DUL 恢復簡單表測試

--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過程:

  1. UNLOAD TABLE owner.table ; 

    1. This will unload the one table definition and the table's data. 

  2. UNLOAD USER user name ; 

    1. This unloads all tables and data for the specified user. 

  3. UNLOAD DATABASE ; 

    1. This unloads all of the database tables available. (except the user SYS). 


DUL>
 
unload table ducw.test_dul;



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章