onunload和onload:
onunload 应用程序的功能是将数据库或表写到磁带上,该程序以二进制形式,以磁盘页为单位卸下数据,这种方式卸下的数据其效率高于dbexport。
读由onunload创建的磁带使用onload应用程序。接收数据的机器和创建磁带的机器必须具有相同的页面大小。
只有具有数据库DBA特权的用户才能卸下该数据库。只有表的属主或具有该表所在数据库的拥有DBA特权的用户才可以卸下该表。
卸下表时,只有与该表有关的数据页和索引页被卸下。为该表定义的存取权限和与表有关的同义词或视图未被卸到磁带上。
在卸下操作期间,onunload以排他方式封锁新数据库或表。
onunload [-l] [-t <tape device>;] [-b <block size>;] [-s <tape size>;] <database>;[:[<owner>;.]<table>;]
onload [-l] [-t <tape device>;] [-b <block size>;] [-s <tape size>;]
[-d <DBspace>;] <database>;[:[<owner>;.]<table>;]
[{-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>;}]
實例1:將hanner數據庫中的teacher表從一個dbspace移到另一個dbspace上
1> 先卸載unin teacher表,卸載到磁盤時,onunload要求文件存在,第一步建立空文件
# touch teacher.onunload
若是直接卸載到磁帶,該步驟可以跳過
2> 進行卸載
# onunload -t teacher.onunload hanner:teacher
3> 用SQL和dbaceess刪除teacher表
# dbaccess hanner << EOF
> drop table teacher
> EOF
4>將teacher表格重裝到新dbspace中
# onload -t teacher.onunload -d dbs01 hanner:teacher