--1. 构造测试数据
SQL> alter database datafile '/oracle/app/oracle/oradata/test/users01.dbf' resize 100m;
SQL> create table ducw.test_dul tablespace users
2 as
3 select * from dba_objects;
SQL> select count(1) from ducw.test_dul;
SQL> exit;
--2. 构造DUL使用的控制文件
在control.dul中必须包含SYSTEM表空间的文件信息,以及想UNLOAD的表的表空间文件信息。
SQL> select ts# || ' '|| rfile# || ' '|| name || ' block_size '|| block_size
2 from v$datafile
3 /
TS#||''||RFILE#||''||NAME||'BLOCK_SIZE'||BLOCK_SIZE
--------------------------------------------------------------------------------
0 1 /oracle/app/oracle/oradata/test/system01.dbf block_size 8192
1 2 /oracle/app/oracle/oradata/test/sysaux01.dbf block_size 8192
2 3 /oracle/app/oracle/oradata/test/undotbs01.dbf block_size 8192
4 4 /oracle/app/oracle/oradata/test/users01.dbf block_size 8192
4 5 /oracle/app/oracle/oradata/test/users02.dbf block_size 8192
--2.1 DUL控制文件
(python3venv) [oracle@sqlaudit ~]$ cat control.dul
0 1 /oracle/app/oracle/oradata/test/system01.dbf block_size 8192
1 2 /oracle/app/oracle/oradata/test/sysaux01.dbf block_size 8192
2 3 /oracle/app/oracle/oradata/test/undotbs01.dbf block_size 8192
4 4 /oracle/app/oracle/oradata/test/users01.dbf block_size 8192
4 5 /oracle/app/oracle/oradata/test/users02.dbf block_size 8192
--2.2 DUL参数文件
(python3venv) [oracle@sqlaudit ~]$ cat init.dul
#Platform specific parameter
OSD_BIG_ENDIAN_FLAG=FALSE
OSD_DBA_FILE_BITS=10
OSD_C_STRUCT_ALIGNMENT=32
OSD_FILE_LEADER_SIZE=1
OSD_WORD_SIZE=32
# Size of dul dictionary caches. If one of these is too low startup will fail.
DC_COLUMNS=200000
DC_TABLES=100000
DC_OBJECTS=100000
DC_USERS=100
DC_SEGMENTS=100000
# Location and filename ofthe control file
CONTROL_FILE=/home/oracle/control.dul
# Database blocksize
DB_BLOCK_SIZE=8192
# Using Import to restore the data retrieved
EXPORT_MODE=TRUE
# Using SQL*Loader to restore the data retrieved
#EXPORT_MODE=FALSE
# Compatible parameter
COMPATIBLE=10
FILE_SIZE_IN_MB=1000
BUFFER=200000000
--3. 运行DUL
rm *.ctl
rm *.dat
rm *.log
rm *.ddl
rm *.out
--3.1 在DUL运行环境下执行BOOTSTRAP命令,生成字典信息,为UNLOAD做必要的准备。
(python3venv) [oracle@sqlaudit ~]$ ./dul
DUL> bootstrap;
--3.2 在DUL运行环境下执行UNLOAD过程:
UNLOAD TABLE owner.table ;
This will unload the one table definition and the table's data.
UNLOAD USER user name ;
This unloads all tables and data for the specified user.
UNLOAD DATABASE ;
This unloads all of the database tables available. (except the user SYS).
DUL>
unload table ducw.test_dul;