RMAN备份恢复 控制文件和归档日志丢失情况

RMAN> backup current controlfile tag=‘bak_ctlfile‘ format=‘/home/oracle/backup/bak_ctl_%U_%T‘;

alter system switch logfile;

alter system switch logfile;

alter system switch logfile;

多切换几次,切出几个archivelog文件,删除其中的一个

rm o1_mf_1_3_cpk5wloy_.arc

然后删除控制文件

rm /u01/app/oracle/oradata/orcl/control01.ctl

rm /u01/app/oracle/flash_recovery_area/orcl/control02.ctl

shutdown abort;

rman startup nomount方式启动

RMAN> restore controlfile from ‘/home/oracle/backup/bak_ctl_12r8mgn0_1_1_20160621‘;

Starting restore at 21-JUN-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/orcl/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 21-JUN-16

RMAN> mount database;

database mounted
released channel: ORA_DISK_1

recover数据库报找不到3号归档日志文件.
RMAN> recover database;

Starting recover at 21-JUN-16
Starting implicit crosscheck backup at 21-JUN-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
Crosschecked 10 objects
Finished implicit crosscheck backup at 21-JUN-16

Starting implicit crosscheck copy at 21-JUN-16
using channel ORA_DISK_1
Finished implicit crosscheck copy at 21-JUN-16

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_5_cpk5wplw_.arc

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 4 is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log
archived log for thread 1 with sequence 5 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_5_cpk5wplw_.arc
archived log for thread 1 with sequence 6 is already on disk as file /u01/app/oracle/oradata/orcl/redo03.log
unable to find archived log
archived log thread=1 sequence=3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/21/2016 09:31:51
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3 and starting SCN of 1112349

需要将control file重建饶开sequence 3

SQL> alter database backup controlfile to trace;

Database altered.

SQL> SELECT d.VALUE || ‘/‘ || LOWER(RTRIM(i.INSTANCE, CHR(0))) || ‘_ora_‘ || p.spid || ‘.trc‘ trace_file_name FROM (SELECT p.spid FROM v$mystat m, v$session s, v$process p WHERE m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p, (SELECT t.INSTANCE FROM v$thread t, v$parameter v WHERE v.NAME = ‘thread‘ AND (v.VALUE = 0 OR t.thread# = TO_NUMBER(v.VALUE))) i, (SELECT VALUE FROM v$parameter WHERE NAME = ‘user_dump_dest‘) d;

TRACE_FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_4016.trc

打开trace文件,然后按照reset log方式恢复

SQL> startup force nomount;
ORACLE instance started.

Total System Global Area 835104768 bytes
Fixed Size 2217952 bytes
Variable Size 520095776 bytes
Database Buffers 310378496 bytes
Redo Buffers 2412544 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 ‘/u01/app/oracle/oradata/orcl/redo01.log‘ SIZE 50M BLOCKSIZE 512,
9 GROUP 2 ‘/u01/app/oracle/oradata/orcl/redo02.log‘ SIZE 50M BLOCKSIZE 512,
10 GROUP 3 ‘/u01/app/oracle/oradata/orcl/redo03.log‘ SIZE 50M BLOCKSIZE 512
11 -- STANDBY LOGFILE
12 DATAFILE
13 ‘/u01/app/oracle/oradata/orcl/system01.dbf‘,
14 ‘/u01/app/oracle/oradata/orcl/sysaux01.dbf‘,
15 ‘/u01/app/oracle/oradata/orcl/undotbs01.dbf‘,
16 ‘/u01/app/oracle/oradata/orcl/users01.dbf‘,
17 ‘/u01/app/oracle/oradata/orcl/example01.dbf‘,
18 ‘/u01/app/oracle/oradata/orcl/test01.dbf‘
19 CHARACTER SET AL32UTF8
20 ;

Control file created.

SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

SQL> recover database using backup controlfile
ORA-00279: change 1132418 generated at 06/21/2016 09:46:44 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_7_%u_.arc
ORA-00280: change 1132418 for thread 1 is in sequence #7

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/orcl/redo01.log
Log applied.
Media recovery complete.

继续执行后续语句,但不要recover

SQL> VARIABLE RECNO NUMBER;
SQL> EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG(‘RETENTION POLICY‘,‘TO REDUNDANCY 1‘);
-- Commands to re-create incarnation table

PL/SQL procedure successfully completed.

SQL> SQL> -- Below log names MUST be changed to existing filenames on
SQL> -- disk. Any one log file from each branch can be used to
SQL> -- re-create incarnation records.
SQL> -- ALTER DATABASE REGISTER LOGFILE ‘/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_1_%u_.arc‘;
SQL> -- ALTER DATABASE REGISTER LOGFILE ‘/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_1_%u_.arc‘;
SQL> -- ALTER DATABASE REGISTER LOGFILE ‘/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_1_%u_.arc‘;
SQL> -- ALTER DATABASE REGISTER LOGFILE ‘/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_1_%u_.arc‘;
SQL> -- ALTER DATABASE REGISTER LOGFILE ‘/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2016_06_21/o1_mf_1_1_%u_.arc‘;

SQL> ALTER DATABASE OPEN RESETLOGS;

Database altered.

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE ‘/u01/app/oracle/oradata/orcl/temp01.dbf‘ REUSE;

Tablespace altered.

时间: 2024-11-08 20:56:05

RMAN备份恢复 控制文件和归档日志丢失情况的相关文章

使用RMAN备份时应如何处置归档日志文件

昨天去某客户部署RMAN备份,在跑shell脚本的时候,提示找不到归档日志,因为客户那里之前只对数据库做EXPDP逻辑导出备份,并且每天都自动删除前一天的归档,每个归档的生成量大概在200M左右,因为考虑磁盘空间比较紧张,不得已而为之. 在我的脚本中,是采用backup database format 'xxx' plus archivelog format 'xxx'的方式进行备份的,在执行RMAN脚本时,由于是先对归档日志进行备份,再对数据库进行备份的,在脚本的输出日志中,提示找不到35xx

通过RMAN联机全库备份,包括控制文件,归档日志文件,备份成功后,删除已备份的归档日志。

RMAN> backup as backupset full database format '/u01/app/backup/db_%U.rmn' include current controlfile plus archivelog delete all input; Starting backup at 10-OCT-16 current log archived using target database control file instead of recovery catalog

RMAN备份各种物理文件

RMAN运行脚本的方式:RMAN TARGET / @backup_db.rmanRMAN TARGET / cmdfile=backup_db.rman在RMAN中执行操作系统中保存的脚本:RMAN> @backup_db.rman运行存储在catalog中的脚本(需要首先为RMAN创建恢复目录)RMAN> RUN{EXCUTE SCRIPT backup_file_whole_db} 只要数据库处于加载状态,无论数据库能否打开工,都可以在RMAN中对表空间进行备份.=========RMA

Oracle RMAN 备份控制文件/恢复控制文件

--备份控制文件 rman target / RMAN> startup RMAN> configure controlfile autobackup on; --启动自动备份 RMAN> show CONTROLFILE AUTOBACKUP;  --显示是否自动备份控制文件 RMAN> configure controlfile autobackup format for device type disk to '/backup/%F'; --设置控制文件备份路径 RMAN&g

ORACLE11g 没有控制文件如何通过rman备份恢复数据的详细实战过程

1.副总裁需要裸恢复的严峻现实 集团总部的信息部负责人给我打电话说为了找一年前的记录,所以需要对一年前2015年5月1日的数据进行恢复.而2016年初因为进行迁移,所以有些文件可能丢失,手上只有rman全备文件,希望在一天之内找回,集团一个副总裁在等着这个数据有急用. 我在电话里面说马上去做,接完电话,想到只有rman备份文件,而且是备份的数据文件,没有控制文件没有参数文件的备份,所以普通的 (1)      先恢复控制文件restore controlfile from '-bak'; (2)

RMAN 备份恢复 删除表空间后控制文件丢失

先备份一个控制文件 RMAN> backup current controlfile tag='bak_ctlfile' format='/home/oracle/backup/bak_ctl_%U_%T'; drop一个表空间 SQL> drop tablespace xds including contents and datafiles; Tablespace dropped. 删除控制文件 rm /u01/app/oracle/oradata/orcl/control01.ctl rm

RMAN数据库恢复之控制文件和参数文件恢复

一.控制文件的恢复1.查询控制文件的路径 SQL> SELECT * FROM V$CONTROLFILE; STATUS NAME IS_RECOVERY_DEST_FILE BLOCK_SIZE FILE_SIZE_BLKS ------- -------------------------------------------------------------- --------------------- ---------- -------------- D:\APP\ADMINISTR

oracle 使用备份的控制文件恢复,并且之后新建了表空间的恢复

1.备份的控制文件之后创建表空间,控制文件全部丢失,使用备份控制文件如何恢复 步骤如下: 1.备份数据库 rman target / catalog RC_ADMIN/[email protected] backup database plus archivelog delete all input; 2.创建表空间 [email protected]>create tablespace indx 2  datafile '/u01/app/oracle/oradata/PROD2/indx01

RMAN恢复控制文件

查看目前的控制文件位置 SQL> select name from v$controlfile; NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/orcl/control01.ctl/u01/app/oracle/flash_recovery_area/orcl/control02.ctl 先备份一个控制文件 RMAN> bac