您好,登錄后才能下訂單哦!
手工熱備份步驟:
開庫備份只用于歸檔模式,而且熱備之前先執(zhí)行命令:
熱備步驟:
alter database/tablespace XXX begin backup 這句話會導(dǎo)致鎖塊頭,scn號不會變化。
cp files
alter database/tablespace XXX end backup
實驗備份users表空間,并測試刪除文件并恢復(fù):
1、首先開始備份users表空間
sys@TEST0910> alter tablespace users begin backup;
Tablespace altered.
2、操作系統(tǒng)命令拷貝文件:
[oracle@rtest ~]$ cd /u01/app/oracle
[oracle@rtest oracle]$ mkdir hot_dir
[oracle@rtest oracle]$ cp /u01/app/oracle/oradata/test0910/users01.dbf /u01/app/oracle/hot_dir/users01.dbf
3、結(jié)束users表空間的備份:
sys@TEST0910> alter tablespace users end backup;
Tablespace altered.
4、此時刪除users01.dbf文件
[oracle@rtest oracle]$ ls /u01/app/oracle/oradata/test0910/users01.dbf
ls: /u01/app/oracle/oradata/test0910/users01.dbf: No such file or directory
5、關(guān)庫,再啟庫,報錯:
sys@TEST0910> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@TEST0910> startup
ORACLE instance started.
Total System Global Area 2505338880 bytes
Fixed Size 2230952 bytes
Variable Size 587203928 bytes
Database Buffers 1895825408 bytes
Redo Buffers 20078592 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/u01/app/oracle/oradata/test0910/users01.dbf'
6、通過操作系統(tǒng)拷貝到正確的位置,(也可以通過rman恢復(fù),這里用拷貝方式)
[oracle@rtest oracle]$ cp /u01/app/oracle/hot_dir/users01.dbf /u01/app/oracle/oradata/test0910/users01.dbf
[oracle@rtest oracle]$ ls /u01/app/oracle/oradata/test0910/users01.dbf
/u01/app/oracle/oradata/test0910/users01.dbf
7、再開庫,報錯,需要介質(zhì)恢復(fù):
sys@TEST0910> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/u01/app/oracle/oradata/test0910/users01.dbf'
8、介質(zhì)恢復(fù):
sys@TEST0910> recover datafile 4;
Media recovery complete.
9、再開庫,成功:
sys@TEST0910> alter database open;
Database altered.
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。