SinoDB数据库导入导出工具onunload/onload

onunload以二进制形式将数据库或表写到磁带上或磁盘上。当写到磁盘时,以磁盘页为单位卸下数据,这种方式卸下的数据其效率高于dbexport。

1.onunload语法

onunload [-l] [-t <tape_device>] [-b <block size>] [-s <tape size>]
<db_name>[:[<owner>.]<table_name>]
  • tape_device:保存数据的磁带设备。当使用磁盘时,需创建一个空文件并指定该文件。

  • db_name:要导出数据的数据库名称。如果不指定表名称,则导出全库数据。

  • table_name:当需要导出表数据时,指定表名称。

  • 参数b,参数s和参数l主要用于使用磁带设备,当使用磁盘设备时,可以忽略。

示例1:卸载数据库

[informix@vm84145 data] touch testdb1.bin

[informix@vm84145 data]$ onunload -t testdb1.bin testdb1

Please mount tape and press Return to continue ...

Please label this as tape number 1 in the tape sequence.

示例2:卸载表

[informix@vm84145 data] touch mytable.bin

[informix@vm84145 data]$ onunload -t mytable.bin testdb1:t1

Please mount tape and press Return to continue ...

Please label this as tape number 1 in the tape sequence.

[informix@vm84145 data]$

2. onload语法

onload [-l] [-t <tape_device>] [-b <block size>] [-s <tape size>]

[-d <data_dbs>] <db_name>[:[<owner>.]<table_name>]

[{-i <old index name> <new index name>}]

[{-fd old-DBspace-name new-DBspace-name}]

[{-fi index-name old-DBspace-name new-DBspace-name}]

[{-c <old constraint name> <new constraint name>}]
  • tape_device:保存数据的磁带设备或操作系统文件目录。当为操作系统的文件时,需要指定该文件。

  • data_dbs:指定数据导入时,使用的数据库空间。

  • db_name:指定导入的数据库名称。

  • table_name:指定导入的表名称。

示例1:加载数据库

[informix@vm84145 data]$ onload -t testdb1.bin -d datadbs1 testdb1

Please mount tape and press Return to continue ...

The load has successfully completed.

[informix@vm84145 data]$

示例2:加载表

[informix@vm84145 data]$ onload -t mytable.bin -d datadbs1 testdb1:t1

Please mount tape and press Return to continue ...

Error creating table.

Duplicate table name t1.

[informix@vm84145 data]$ onload -t mytable.bin -d datadbs1 testdb1:t2

Please mount tape and press Return to continue ...

The load has successfully completed.

3.onunload/onload操作注意点

  • 导出数据为二进制格式,只能用于兼容硬件上的兼容数据库版本的数据导入。由于该方式使用限制较严格,真实场景中使用较少。

  • onunload卸载的数据由onload应用程序装入。

  • 接收数据的机器和创建磁带的机器必须具有相同的页面大小。

  • 只有具有数据库DBA特权的用户才能卸下该数据库。

  • 只有表的属主或具有该表所在数据库的拥有DBA特权的用户才可以卸下该表。

  • 卸载表时,只有与该表有关的数据页和索引页被卸下。该表定义的存取权限和与表有关的同义词或视图未被卸到磁带上。

  • 在卸下操作期间,onunload以排他方式封锁新数据库或表。

  • 无法处理clob数据

更多信息内容请移步星瑞格官方社区,期待大家加入

Sinoregal Tech ForumAsk questions, share solutions, and get to know the Sinoregal community.https://forum.sinoregal.cn/

相关推荐
向上的车轮36 分钟前
Django学习笔记二:数据库操作详解
数据库·django
编程老船长1 小时前
第26章 Java操作Mongodb实现数据持久化
数据库·后端·mongodb
全栈师1 小时前
SQL Server中关于个性化需求批量删除表的做法
数据库·oracle
Data 3172 小时前
Hive数仓操作(十七)
大数据·数据库·数据仓库·hive·hadoop
BergerLee2 小时前
对不经常变动的数据集合添加Redis缓存
数据库·redis·缓存
gorgor在码农2 小时前
Mysql 索引底层数据结构和算法
数据结构·数据库·mysql
bug菌¹3 小时前
滚雪球学Oracle[6.2讲]:Data Guard与灾难恢复
数据库·oracle·data·灾难恢复·guard
一般路过糸.3 小时前
MySQL数据库——索引
数据库·mysql
Cengineering3 小时前
sqlalchemy 加速数据库操作
数据库
Cikiss4 小时前
微服务实战——平台属性
java·数据库·后端·微服务