在一台新機器上恢複另台機器的全備份
1 要記住原機器的各種目錄結構和DBID
2 在新機器上建立對應的目錄結構 注意使用者權限
/u01/oracle/admin/dbname/pfile bdump udump dpdump cdump
/oradata/dbname/rman_backup flash_recover_sea archivelog
3 把備份組檔案放到新機器原來的備份目錄中
3 Rman 串連到預設處
]$ export ORACLE_SID=surgesms
]$ ./rman target /
connected to target database (not started)
3 startup nomount 啟動預設spfile
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/oracle/product/10.2.0/dbs/initsurgesms.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 1218244 bytes
Variable Size 58722620 bytes
Database Buffers 92274688 bytes
Redo Buffers 7168000 bytes
4 還原spfile 檔案和控制檔案
RMAN> set dbid 4223770157;
RMAN> restore spfile from '/oradata/{DB_NAME}/rman_backup/full.bak';
RMAN> restore controlfile from '/oradata/{DB_NAME}/rman_backup/full.bak';
5退出RMAN 再重進RMAN
RMAN> shutdown
RMAN> EXIT
bin]$ ./rman target /
RMAN> startup mount
6 察看是否使用了控制檔案
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/oradata/{DB_NAME}/rman_backup/full_%d_%s_%T_%t.bak';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/product/10.2.0/dbs/snapcf_{DB_NAME}.f'; # default
7 還原資料庫
RMAN> restore database;
8 恢複資料庫
RMAN> recover database
9 開啟資料庫
alter database open resetlog