注意:
1.由于rman设置了控制文件自动备份的位置,必须指定F%
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/test%F';
2.%F中记录DBID
/u01/testc-2866727024-20180909-01
3.如果目录中存在多个dbid的自动备份,通过strings命令查找dbname
[oracle@bonda1 dbs]$ strings /u01/testc-2866727024-20180909-01 |grep db_name
*.db_name='ocp'
准备:
1.需要知道DBID
2.设置控制文件的自动备份的位置
恢复操作
1.指定oracle_sid
[oracle@bonda1 dbs]$ export ORACLE_SID=ocp
2.启动到nomount状态
[oracle@bonda1 dbs]$ rman target /
connected to target database (not started)
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initocp.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 bytes
3.rman设定dbid
RMAN> set dbid=2866727024;
executing command: SET DBID
4.controlfile自动备份的位置,恢复参数文件
RMAN> run
2> {
3> set controlfile autobackup format for device type disk to '/u01/test%F';
4> allocate channel c1 device type disk;
5> restore spfile from autobackup;
6> }
executing command: SET CONTROLFILE AUTOBACKUP FORMAT
allocated channel: c1
channel c1: SID=171 device type=DISK
Starting restore at 09-SEP-18
channel c1: looking for AUTOBACKUP on day: 20180909
channel c1: AUTOBACKUP found: /u01/testc-2866727024-20180909-01
channel c1: restoring spfile from AUTOBACKUP /u01/testc-2866727024-20180909-01
channel c1: SPFILE restore from AUTOBACKUP complete
Finished restore at 09-SEP-18
released channel: c1
5.打开数据库
RMAN> startup force
Oracle instance started
database mounted
database opened
Total System Global Area 1603411968 bytes
Fixed Size 2253664 bytes
Variable Size 1409289376 bytes
Database Buffers 184549376 bytes
Redo Buffers 7319552 bytes