x
rman 下
connect target /
这里要记住你的dbid
RMAN> show all
2> ;
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION OFF;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE ENCRYPTION FOR DATABASE OFF;
CONFIGURE ENCRYPTION ALGORITHM 'AES128';
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f';
第二步先进行一次备份 backup format '/uo1/app/oracle/rmanbak/full_%T_%u.bak' database plus archivelog;
备份完之后记住spfile 的位置 '/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_04_28/o1_mf_s_878224692_bmyf1o7h_.bkp'
为了确保安全 我们不采用rm将spfie删除 而是采用 mv spfileORCL.ora sfiel.ora; 这只是将spfile改了名字;
在rman下
RMAN> shutdown immediate;
using target database control file instead of recovery catalog
Oracle instance shut down
startup nomount;
connected to target database (not started)
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 281019272 bytes
Database Buffers 780140544 bytes
Redo Buffers 5517312 byt
这里会报错 LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'找不到spfile
设置dbid:
RMAN> set dbid 1403717444
executing command: SET DBID
RMAN> restore spfile from autobackup;
Starting restore at 28-APR-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=111 device type=DISK
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150428
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150427
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150426
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150425
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150424
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150423
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150422
channel ORA_DISK_1: no AUTOBACKUP in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/28/2015 15:38:55
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece
RMAN> restore spfile from '/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_04_28/o1_mf_s_878224692_bmyf1o7h_.bkp';
Starting restore at 28-APR-15
using channel ORA_DISK_1
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_04_28/o1_mf_s_878224692_bmyf1o7h_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 28-APR-15
在dbs里就能看到你的控制文件spfileORCL.ora
测试
rman下shutdown 数据库
之后startup 如果不能启动 在设置一下你的dbid 就可以了
数据库重新启动完成!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30163683/viewspace-1609007/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30163683/viewspace-1609007/