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/

相关推荐
薛定谔的算法10 小时前
phoneGPT:构建专业领域的检索增强型智能问答系统
前端·数据库·后端
Databend12 小时前
Databend 亮相 RustChinaConf 2025,分享基于 Rust 构建商业化数仓平台的探索
数据库
得物技术13 小时前
破解gh-ost变更导致MySQL表膨胀之谜|得物技术
数据库·后端·mysql
Raymond运维17 小时前
MariaDB源码编译安装(二)
运维·数据库·mariadb
沢田纲吉17 小时前
🗄️ MySQL 表操作全面指南
数据库·后端·mysql
RestCloud1 天前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud1 天前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence1 天前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库
DemonAvenger2 天前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
AAA修煤气灶刘哥2 天前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql