今天检查磁盘空间发现100%爆满,手工释放空间后查看Sequence#有很多没有应用
查看这个归档在不在备库
Crosscheck发现少了
查看gap
SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;
PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
--------- ------------ ---------- ---------- ---------- ----------
ARCH CLOSING 1 17363 292864 1425
ARCH CLOSING 1 17365 157696 1512
ARCH CLOSING 2 12296 1693696 276
ARCH CLOSING 1 17366 198656 1532
RFS IDLE 0 0 0 0
MRP0 WAIT_FOR_GAP 2 12307 0 0
6 rows selected.
SQL>
第一时间去主库看12307是否存在:
SQL> select NAME,THREAD#,SEQUENCE#,APPLIED,DELETED,STATUS from v$archived_log where SEQUENCE#=12307;
NAME
--------------------------------------------------------------------------------
THREAD# SEQUENCE# APPLIED DEL S
---------- ---------- --------- --- -
+RECO_CIS/prod/archivelog/2016_01_01/thread_2_seq_12307.2161.899944423
2 12307 NO NO A
SQL>
去看物理文件:
那么我们直接把主库的归档传到备库(注:这里是asm,如果是文件系统的可以直接cp)(PS:如果主库都没有的话就要去找备份。)
RMAN> copy archivelog '+RECO_CIS/prod/ARCHIVELOG/2016_01_01/thread_2_seq_12307.2161.899944423' to '/home/thread_2_seq_12307.2161.899944423';
Starting backup at 02-JAN-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=2 sequence=12307 RECID=53596 STAMP=899944429
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/02/2016 10:31:44
ORA-19504: failed to create file "/home/thread_2_seq_12307.2161.899944423"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 13: Permission denied
Additional information: 1
RMAN> copy archivelog '+RECO_CIS/prod/ARCHIVELOG/2016_01_01/thread_2_seq_12307.2161.899944423' to '/archivelog/thread_2_seq_12307.2161.899944423';
Starting backup at 02-JAN-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=2 sequence=12307 RECID=53596 STAMP=899944429
output file name=/archivelog/thread_2_seq_12307.2161.899944423 RECID=53805 STAMP=900066828
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:15
Finished backup at 02-JAN-16
这里注意目录oracle要有权限
RMAN> quit
Recovery Manager complete.
[oracle@cisdb01 ~]$ cd /archivelog/
[oracle@cisdb01 archivelog]$ ls
thread_2_seq_12307.2161.899944423
[oracle@cisdb01 archivelog]$
[root@cisdb01 archivelog]# scp thread_2_seq_12307.2161.899944423 root@10.19.2.85:/u01/CCBPROD/oracle/oradata/archive/
root@10.19.2.85's password:
thread_2_seq_12307.2161.899944423 100% 843MB 36.7MB/s 00:23
[root@cisdb01 archivelog]#
然后备库注册下:
SQLplus创建也可以注册:alter database register logfile '/archlog/1_44158_937520954.dbf';
RMAN> catalog archivelog '/u01/CCBPROD/oracle/oradata/archive/thread_2_seq_12307.2161.899944423';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of catalog command on default channel at 01/02/2016 10:51:57
ORA-19625: error identifying file /u01/CCBPROD/oracle/oradata/archive/thread_2_seq_12307.2161.899944423
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
RMAN>
这里也是权限问题 chown一下就好
RMAN> catalog archivelog '/u01/CCBPROD/oracle/oradata/archive/thread_2_seq_12307.2161.899944423';
cataloged archived log
archived log file name=/u01/CCBPROD/oracle/oradata/archive/thread_2_seq_12307.2161.899944423 RECID=9578 STAMP=900068071
RMAN>
再去看后台进程已经ok了
看后台进程
SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;
PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
--------- ------------ ---------- ---------- ---------- ----------
ARCH CLOSING 1 17363 292864 1425
ARCH CLOSING 1 17365 157696 1512
ARCH CLOSING 2 12296 1693696 276
ARCH CLOSING 1 17366 198656 1532
RFS IDLE 0 0 0 0
RFS IDLE 0 0 0 0
RFS IDLE 0 0 0 0
MRP0 APPLYING_LOG 2 12319 231792 1691908
8 rows selected.
SQL>
注意:这个时候crosscheck还是看不到这个归档的,因为你没同步。