主库归档被意外删除,备库复制出现问题,alter日志如下:
Wed Apr 01 10:16:15 2015
Media Recovery Log /tol/archivelog/1_587399_798641496.arc
Error opening /tol/archivelog/1_587399_798641496.arc
Attempting refetch
Media Recovery Waiting for thread 1 sequence 587399
Fetching gap sequence in thread 1, gap sequence 587399-587399
Wed Apr 01 10:16:25 2015
FAL[client]: Failed to request gap sequence
GAP - thread 1 sequence 587399-587399
DBID 484391126 branch 798641496
FAL[client]: All defined FAL servers have been attempted.
-------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that is sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
-------------------------------------------------------------
Wed Apr 01 10:19:16 2015
Standby crash recovery need archive log for thread 1 sequence 587399 to continue.
Please verify that primary database is transporting redo logs to the standby database.
Wait timeout: thread 1 sequence 587399
Standby crash recovery aborted due to error 16016.
Errors in file /opt/app/oracle/diag/rdbms/dg_136/db26/trace/db26_ora_9667.trc:
ORA-16016: archived log for thread 1 sequence# 587399 unavailable
Recovery interrupted!
Some recovered datafiles maybe left media fuzzy
Media recovery may continue but open resetlogs may fail
Completed standby crash recovery.
Errors in file /opt/app/oracle/diag/rdbms/dg_136/db26/trace/db26_ora_9667.trc:
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/tol/oradata/db26/system01.dbf'
ORA-10458 signalled during: ALTER DATABASE OPEN...
解决:
一、备库
查看当前的SCN号:
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
1.1217E+10
SQL> set numw 15
SQL> select current_scn from v$database;
CURRENT_SCN
---------------
11217220915
二、主库
进行RMAN增量备库:
[oracle@dg_135 ~]$ ls /tol/rmanbak/db26/
[oracle@dg_135 ~]$
[oracle@dg_135 ~]$
[oracle@dg_135 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Apr 1 10:33:03 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DB26 (DBID=484391126)
RMAN> backup as compressed backupset incremental from SCN 11217220915 database format '/tol/rmanbak/db26/standby_%d_%T_%U.bak'incRMAN>
RMAN> backup as compressed backupset incremental from SCN 11217220915 database format '/tol/rmanbak/db26/standby_%d_%T_%U.bak'include current controlfile for standby filesperset=5tag 'FOR STANDBY';
Starting backup at 2015-04-01 10:33:07
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=767 device type=DISK
backup will be obsolete on date 2015-04-08 10:33:12
archived logs will not be kept or backed up
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/tol/oradata/db26/sysaux01.dbf
input datafile file number=00516 name=/tol/oradata/db26/monitor01.dbf
input datafile file number=00525 name=/tol/oradata/db26/dbmonitor01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-04-01 10:33:12
channel ORA_DISK_1: finished piece 1 at 2015-04-01 10:45:18
piece handle=/tol/rmanbak/db26/standby_DB26_20150401_3hq39if8_1_1.bak tag=FOR STANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:12:06
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00515 name=/tol/oradata/db26/undotbs01.dbf
input datafile file number=00498 name=/tol/oradata/db26/pkunewlib_index02.dbf
input datafile file number=00508 name=/tol/oradata/db26/voicedemo_index01.dbf
input datafile file number=00513 name=/tol/oradata/db26/ent2_index01.dbf
input datafile file number=00514 name=/tol/oradata/db26/ent2_index02.dbf
channel ORA_DISK_1: starting piece 1 at 2015-04-01 10:45:18
channel ORA_DISK_1: finished piece 1 at 2015-04-01 11:03:44
.....
.....
.....
using channel ORA_DISK_1
backup will be obsolete on date 2015-04-08 14:29:31
archived logs will not be kept or backed up
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 2015-04-01 14:29:32
channel ORA_DISK_1: finished piece 1 at 2015-04-01 14:29:35
piece handle=/tol/rmanbak/db26/standby_DB26_20150401_71q3a0ab_1_1.bak tag=FOR STANDBY comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2015-04-01 14:29:35
RMAN> exit
Recovery Manager complete.
三、备库
进行恢复数据,恢复控制文件:
1、把增量备份SCP到备库上
[oracle@dg_135 ~]$ cd /tol/rmanbak/db26/
[oracle@dg_135 db26]$ scp * 192.168.100.136:/tol/rmanbak/db26/
standby_DB26_20150401_3hq39if8_1_1.bak 100% 1350MB 32.9MB/s 00:41
standby_DB26_20150401_3iq39j5u_1_1.bak 100% 5160MB 35.3MB/s 02:26
standby_DB26_20150401_3jq39k8g_1_1.bak 100% 296KB 296.0KB/s 00:00
standby_DB26_20150401_3kq39kah_1_1.bak 100% 72KB 72.0KB/s 00:00
standby_DB26_20150401_3lq39kcj_1_1.bak 100% 72KB 72.0KB/s 00:00
standby_DB26_20150401_3mq39kf9_1_1.bak 100% 72KB 72.0KB/s 00:00
standby_DB26_20150401_3nq39kh0_1_1.bak 100% 72KB 72.0KB/s 00:00
standby_DB26_20150401_3oq39kj2_1_1.bak 100% 128MB 25.6MB/s 00:05
standby_DB26_20150401_3pq39kle_1_1.bak 100% 98MB 32.6MB/s 00:03
standby_DB26_20150401_3qq39kng_1_1.bak 100% 92MB 30.8MB/s 00:03
standby_DB26_20150401_3rq39kp8_1_1.bak 100% 102MB 50.8MB/s 00:02
standby_DB26_20150401_3sq39kr9_1_1.bak 100% 113MB 28.3MB/s 00:04
standby_DB26_20150401_3tq39ktb_1_1.bak 100% 96MB 48.0MB/s 00:02
standby_DB26_20150401_3uq39kvd_1_1.bak 100% 94MB 31.3MB/s 00:03
standby_DB26_20150401_3vq39l1f_1_1.bak 100% 109MB 27.2MB/s 00:04
standby_DB26_20150401_40q39l3g_1_1.bak 100% 94MB 31.5MB/s 00:03
standby_DB26_20150401_41q39l5i_1_1.bak 100% 102MB 51.2MB/s 00:02
....
....
....
CATALOG注册。
[oracle@dg_136 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Apr 1 14:55:42 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DB26 (DBID=484391126, not open)
RMAN> CATALOG START WITH '/tol/rmanbak/db26';
using target database control file instead of recovery catalog
searching for all files that match the pattern /tol/rmanbak/db26
List of Files Unknown to the Database
=====================================
File Name: /tol/rmanbak/db26/standby_DB26_20150401_6vq3a07p_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_4qq39oj7_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_49q39me1_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_6nq39vg7_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_5vq39sv4_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_66q39tms_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_5uq39sse_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_69q39u1n_1_1.bak
File Name: /tol/rmanbak/db26/standby_DB26_20150401_3oq39kj2_1_1.bak
.....
.....
.....
2、然后进行恢复。
SQL> Alter database recover managed standby database disconnect from session;
Database altered.
SQL> Alter database recover managed standby database cancel;
Database altered.
SQL> shut immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 1.6034E+10 bytes
Fixed Size 2219552 bytes
Variable Size 1409286624 bytes
Database Buffers 1.4563E+10 bytes
Redo Buffers 60084224 bytes
Database mounted.
[oracle@dg_136 ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Apr 1 14:59:18 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DB26 (DBID=484391126, not open)
RMAN> run {
2> allocate channel dsk0 type disk;
3> allocate channel dsk1 type disk;
4> allocate channel dsk2 type disk;
5> restore standby controlfile to '/tol/rmanbak/db26/control01.ctl';
6> recover database noredo;}
using target database control file instead of recovery catalog
allocated channel: dsk0
channel dsk0: SID=512 device type=DISK
allocated channel: dsk1
channel dsk1: SID=638 device type=DISK
allocated channel: dsk2
channel dsk2: SID=764 device type=DISK
Starting restore at 2015-04-01 14:59:23
channel dsk0: starting datafile backup set restore
channel dsk0: restoring control file
output file name=/tol/rmanbak/db26/control01.ctl
channel dsk0: reading from backup piece /tol/rmanbak/db26/standby_DB26_20150401_71q3a0ab_1_1.bak
channel dsk0: piece handle=/tol/rmanbak/db26/standby_DB26_20150401_71q3a0ab_1_1.bak tag=FOR STANDBY
channel dsk0: restored backup piece 1
channel dsk0: restore complete, elapsed time: 00:00:03
Finished restore at 2015-04-01 14:59:26
Starting recover at 2015-04-01 14:59:27
。。。
。。。
。。。
channel dsk1: restore complete, elapsed time: 00:42:14
channel dsk1: starting incremental datafile backup set restore
channel dsk1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00178: /tol/oradata/db26/lenovo04.dbf
destination for restore of datafile 00386: /tol/oradata/db26/newlib208.dbf
destination for restore of datafile 00404: /tol/oradata/db26/faq208.dbf
destination for restore of datafile 00499: /tol/oradata/db26/t_lib01.dbf
destination for restore of datafile 00547: /tol/oradata/db26/sso11.dbf
channel dsk1: reading from backup piece /tol/rmanbak/db26/standby_DB26_20150401_5bq39qht_1_1.bak
channel dsk0: piece handle=/tol/rmanbak/db26/standby_DB26_20150401_51q39pjd_1_1.bak tag=FOR STANDBY
channel dsk0: restored backup piece 1
channel dsk0: restore complete, elapsed time: 00:02:52
channel dsk1: piece handle=/tol/rmanbak/db26/standby_DB26_20150401_5bq39qht_1_1.bak tag=FOR STANDBY
channel dsk1: restored backup piece 1
channel dsk1: restore complete, elapsed time: 00:00:15
channel dsk2: piece handle=/tol/rmanbak/db26/standby_DB26_20150401_4oq39o5n_1_1.bak tag=FOR STANDBY
channel dsk2: restored backup piece 1
channel dsk2: restore complete, elapsed time: 00:17:16
Finished recover at 2015-04-01 17:42:08
released channel: dsk0
released channel: dsk1
released channel: dsk2
然后shut immediate把控制文件覆盖原控制文件
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/tol/oradata/db26/control01.ctl
/tol/oradata/db26/control02.ctl
/tol/oradata/db26/control03.ctl
SQL> shut immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@dg_136 trace]$ cp /tol/rmanbak/db26/control01.ctl /tol/oradata/db26/control01.ctl
[oracle@dg_136 trace]$ cp /tol/rmanbak/db26/control01.ctl /tol/oradata/db26/control02.ctl
[oracle@dg_136 trace]$ cp /tol/rmanbak/db26/control01.ctl /tol/oradata/db26/control03.ctl
然后startup mount
SQL> startup mount;
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 1.6034E+10 bytes
Fixed Size 2219552 bytes
Variable Size 1409286624 bytes
Database Buffers 1.4563E+10 bytes
Redo Buffers 60084224 bytes
Database mounted.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
四、主库
切换即可,然后查看备库的归档应用状态。
SQL> alter system switch logfile;
System altered.
SQL> Select sequence#,applied from v$archived_log;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23249684/viewspace-1482012/,如需转载,请注明出处,否则将追究法律责任。