rman restore spfile from backup

Posted hftian

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rman restore spfile from backup相关的知识,希望对你有一定的参考价值。

 

spfile一般在$ORACLE_HOME/dbs(linux)目录,如果你丢失了spfile并不会引起实例立刻停掉,你的实例可以继续操作,尽管当你restore spfile的时候需要关闭重启实例,那么可以通过多种方式进行恢复

1).通过alert_sid.log,alert里面包含你修改过的所有参数,可以根据alert日志重新创建pfile,再创建spfile恢复

2).如果pfile还存在

shutdown immediate;

create spfile from pfile;

创建spfile

3).如果存在之前的spfile的备份,可以在rman 里面配置控制文件自动备份,spfile随着控制文件一起备份

 

CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/home/oracle/rmanback/control_%F‘;

 

注意事项:

  • 如果实例已经用spfile启动,那么你不能覆盖存在的spfile;

  • 当有recovery catalog 的时候能简化你的恢复过程,因为你不需要设置dbid

 

rman演示存在spfile备份的恢复(不连接catalog)

1、删除spfile,pfile

 rm -rf spfiletest.ora inittest.ora

2、关闭实例

shutdown immediate;

3.启动实例到nomount 状态,当spfile不可用时,rman用虚拟的参数文件启动实例

RMAN> startup force nomount;


startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/home/u01/app/oracle/product/11.2.0/db_1/dbs/inittest.ora‘


starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started


Total System Global Area     158662656 bytes


Fixed Size                     2226456 bytes
Variable Size                130025192 bytes
Database Buffers              20971520 bytes
Redo Buffers                   5439488 bytes

 

4.restore spfile from spfile autobackup

如果你想要restore spfile从自动备份,你必须要设置dbid,然后restore spfile from autobackup;

restore spfile from ‘/home/oracle/rmanback/control_c-2171455666-20150309-02‘ --手动指定路径

 

RMAN> SET DBID 320066378;
RMAN> RUN {
    SET CONTROLFILE AUTOBACKUP FORMAT 
          FOR DEVICE TYPE DISK TO ‘/home/oracle/rmanback/control_%F‘;
    RESTORE SPFILE FROM AUTOBACKUP;
    }

 



RMAN> set dbid 2171455666;


executing command: SET DBID

RMAN> set  CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/home/oracle/rmanback/control_%F‘;


executing command: SET CONTROLFILE AUTOBACKUP FORMAT



RMAN> restore spfile from autobackup;


Starting restore at 2015-03-09 18:52:31
using channel ORA_DISK_1


channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150309
channel ORA_DISK_1: AUTOBACKUP found: /home/oracle/rmanback/control_c-2171455666-20150309-02
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/rmanback/control_c-2171455666-20150309-02
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 2015-03-09 18:52:33

5.启动实例



RMAN> startup force;


Oracle instance started
database mounted
database opened


Total System Global Area    1068937216 bytes


Fixed Size                     2235208 bytes
Variable Size                700449976 bytes
Database Buffers             360710144 bytes
Redo Buffers                   5541888 bytes

 

以上是关于rman restore spfile from backup的主要内容,如果未能解决你的问题,请参考以下文章

RMAN-06555: datafile 1 must be restored from backup created before ***

RMAN-06555: datafile 1 must be restored from backup created before ***

How to restore and recover a database from an RMAN backup. (Doc ID 881395.1)

5. RAMN备份与恢复

利用rman自己主动备份转储spfile

转 RMAN: RAC Backup, Restore and Recovery using RMAN