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/

相关推荐
Paraverse_徐志斌1 小时前
MySQL 线上大表 DDL 如何避免锁表(pt-online-schema-change)
数据库·mysql·ddl·mysql锁·锁表·pt-osc
哈哈幸运2 小时前
MySQL运维三部曲初级篇:从零开始打造稳定高效的数据库环境
linux·运维·数据库·mysql·性能优化
愚公搬代码2 小时前
【愚公系列】《Python网络爬虫从入门到精通》055-Scrapy_Redis分布式爬虫(安装Redis数据库)
数据库·爬虫·python
pwzs2 小时前
深入浅出 MVCC:MySQL 并发背后的多版本世界
数据库·后端·mysql
大熊猫今天吃什么2 小时前
【一天一坑】空数组,使用 allMatch 默认返回true
前端·数据库
双叶8363 小时前
(51单片机)LCD显示数据存储(DS1302时钟模块教学)(LCD1602教程)(独立按键教程)(延时函数教程)(I2C总线认识)(AT24C02认识)
c语言·数据库·单片机·嵌入式硬件·mongodb·51单片机·nosql
XY.散人3 小时前
初识Redis · C++客户端list和hash
数据库·redis·缓存
码上飞扬3 小时前
深入 MySQL 高级查询:JOIN、子查询与窗口函数的实用指南
数据库·mysql
海洋与大气科学4 小时前
【matlab】地图上的小图
开发语言·数据库·matlab
Geek__19925 小时前
Sqlite3交叉编译全过程
jvm·数据库·sqlite