環境介紹
OS :HP-UX cs1 B.11.31 U ia64
DB :Oracle 10.2.0.5.0
data pump:HP Data Protector A.07.00
生產庫數據在生產測試庫進行恢復測試,確認備份可用性,生產測試庫刪除數據庫,然後進行rman恢復
..省略恢復spfile 和controlfile過程
run{
allocate channel 'dev_0' type 'sbt_tape';
allocate channel 'dev_1' type 'sbt_tape';
allocate channel 'dev_2' type 'sbt_tape';
allocate channel 'dev_3' type 'sbt_tape';
set newname for datafile 'xxx' to 'new_xxx';
set until time "to_date('2019-05-10 12:00:00','YYYY-MM-DD HH24:MI:SS')";
restore database;
switch datafile all;
recover database;
release channel 'dev_0';
release channel 'dev_1';
release channel 'dev_2';
release channel 'dev_3';
}
rman 恢復時報錯
channel dev_0: reading from backup piece D2D_cs1_db_full<orcl_145573:1007445760:1>.dbf
ORA-19870: error reading backup piece D2D_sd1_db_full<orcl_145573:1007445760:1>.dbf
ORA-19504: failed to create file "/dev/vgoradata2/rdate05"
ORA-27041: unable to open file
HPUX-ia64 Error: 6: No such device or address
Additional information: 1
channel dev_0: starting datafile backupset restore
channel dev_0: specifying datafile(s) to restore from backup set
查看該設備
cs1[/]#ll /dev/vgoradata2/date05
brw-rw---- 1 oracle dba 128 0x0020e5 2016年3月17日 /dev/vgoradata2/date05
cs1[/]#ll /dev/vgoradata2/rdate05
-rw-rw---- 1 oracle dba 28456456445 5月13日 17:22 /dev/vgoradata2/rdate05
由於hp_ux中vg劃分出的lv必須爲套接字設備才能給數據庫用,刪除數據庫後發現只有塊設備,並沒有對應的c文件,rman set newname生成了一個文件導致根目錄撐滿
cs1[/]#bdf /
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 5242880 5242880 0 100% /
重新手動生成c文件
mknod rdate05 c 64 0x0020e5
再次查看
$ ll /dev/vgoradata2/*date05
crw-rw---- 1 oracle dba 128 0x0020e5 May 14 13:37 /dev/vgoradata2/rdate05
brw-r----- 1 root sys 128 0x0020e5 May 14 13:37 /dev/vgoradata2/date05
重新恢復該文件
RMAN> run{
2> set newname for datafile '/dev/vgdata1/rdate05' to '/dev/vgoradata2/rdate05';
3> allocate channel 'dev_5' type 'sbt_tape';
4> restore datafile 187;
5> }
released channel: ORA_DISK_1
allocated channel: dev_5
channel dev_5: sid=2188 devtype=SBT_TAPE
channel dev_5: Data Protector A.07.00/72
Starting restore at 14-MAY-19
channel dev_5: starting datafile backupset restore
channel dev_5: specifying datafile(s) to restore from backup set
restoring datafile 00187 to /dev/vgdata1/rdate05
channel dev_5: reading from backup piece D2D_cs1_db_full<orcl_145569:1007428596:1>.dbf
....等待恢復
--end