数据库备份恢复--参数文件恢复,数据库关闭,控制文件自动备份,使用FRA
注意事项:
1.控制文件自动备份的目录 在 快速恢复区/sid/autobackup/date/
2.将参数文件还原到不同的目录
restore spfile to '/tmp/spfiecopy' from autobackup ;
现象:
1.数据库关闭无法启动到nomount状态
准备:
1.明确数据库的名称
2.RMAN备份文件所在的位置
3.控制文件自动备份
现象
SYS@ocp> startup
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'
检查控制文件是否自动备份
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name DUMMY are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; #
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 MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
恢复步骤
1.设定实例名
[oracle@bonda1 ~]$ export oracle_sid=ocp
2.启动rman,启动到nomount模式
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> restore spfile from autobackup recovery area='/u01/FRA' db_name='OCP';
Starting restore at 09-SEP-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK
recovery area destination: /u01/FRA
database name (or database unique name) used for search: OCP
channel ORA_DISK_1: AUTOBACKUP /u01/FRA/OCP/autobackup/2018_09_09/o1_mf_s_986364643_fs9wf4b8_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/FRA/OCP/autobackup/2018_09_09/o1_mf_s_986364643_fs9wf4b8_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 09-SEP-18
4.打开数据库
RMAN> startup force
Oracle instance started
database mounted
database opened