dataguard却少日志文件的处理过程

1、环境

主从oracle数据库运行在最高可用模式

数据一致

 

2、从库上,关闭数据库,使主库归档不能传送到备库

SQL> shutdown immediate
ORA-01109: database not open

 3、主库上创建新表、切换日志

SQL> insert into test0008 select * from dba_objects;                                                                      

49942 rows created.

SQL> commit;                                                                                                              

Commit complete.

SQL> alter system switch logfile;                                                                                         

System altered.

SQL> create table test0009 as select * from test0008;                                                                                                                 

Table created.

SQL> alter system switch logfile;                                                                                                                                     

System altered.

SQL> create table test0010 as select * from test0008;                                                                                                                 

Table created.

SQL> alter system switch logfile;                                                                                                                                     

System altered.

SQL> create table test0011 as select * from test0008;                                                                                                                 

Table created.

SQL> alter system switch logfile;                                                                                                                                     

System altered.

SQL> create table test0012 as select * from test0008;                                                                                                                 

Table created.

SQL> alter system switch logfile;                                                                                                                                     

System altered.

SQL> create table test0013 as select * from test0008;                                                                                                                 

Table created.

SQL> alter system switch logfile;                                                                                                                                     

System altered.

SQL> create table test0014 as select * from test0008;                                                                                                                 

Table created.

SQL> alter system switch logfile;    

                                                                                                                                 

-------------产生的新日志--------------------------------

-rw-r----- 1 oracle oinstall  2427904 11-29 14:58 1_326_777229099.dbf
-rw-r----- 1 oracle oinstall  5924864 11-29 14:58 1_327_777229099.dbf
-rw-r----- 1 oracle oinstall  5926912 11-29 14:59 1_328_777229099.dbf
-rw-r----- 1 oracle oinstall  5922816 11-29 14:59 1_329_777229099.dbf
-rw-r----- 1 oracle oinstall  5970944 11-29 14:59 1_330_777229099.dbf
-rw-r----- 1 oracle oinstall  5923328 11-29 14:59 1_331_777229099.dbf

 

--为避免备库启动数据库后同步日志,进行更名操作

[oracle@dd duxiulog]$ mv 1_326_777229099.dbf 1_326_777229099.dbf.bk
[oracle@dd duxiulog]$ mv 1_327_777229099.dbf 1_327_777229099.dbf.bk
[oracle@dd duxiulog]$ mv 1_328_777229099.dbf 1_328_777229099.dbf.bk
[oracle@dd duxiulog]$ mv 1_329_777229099.dbf 1_329_777229099.dbf.bk
[oracle@dd duxiulog]$ mv 1_330_777229099.dbf 1_330_777229099.dbf.bk
[oracle@dd duxiulog]$ mv 1_331_777229099.dbf 1_331_777229099.dbf.bk

 

4、备库启动到mount状态,开启接收日志

SQL> startup mount
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              92276304 bytes
Database Buffers          188743680 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

跟踪后台alert文件

tailf alert_duxiu.log

MRP0: Background Managed Standby Recovery process started (duxiu)
Managed Standby Recovery starting Real Time Apply
Media Recovery Waiting for thread 1 sequence 326
Fetching gap sequence in thread 1, gap sequence 326-331
FAL[client]: Error fetching gap sequence, no FAL server specified
Thu Nov 29 15:11:39 2012
Completed: alter database recover managed standby database using current logfile disconnect from session
Thu Nov 29 15:12:08 2012
FAL[client]: Failed to request gap sequence
 GAP - thread 1 sequence 326-331
 DBID 1418004073 branch 777229099
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.

查看数据库V$ARCHIVE_GAP视图

SQL>  SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

   THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
         1           326            331

5、将缺失日志拷贝到备库(现实环境中可以rman恢复日志,拷贝到备库)

[oracle@dd duxiulog]$ scp *.bk 192.168.90.119:/media/duxiustandbylog/
oracle@192.168.90.119's password:
1_326_777229099.dbf.bk                                                                                                               100% 2371KB   2.3MB/s   00:00   
1_327_777229099.dbf.bk                                                                                                               100% 5786KB   5.7MB/s   00:00   
1_328_777229099.dbf.bk                                                                                                               100% 5788KB   5.7MB/s   00:01   
1_329_777229099.dbf.bk                                                                                                               100% 5784KB   5.7MB/s   00:00   
1_330_777229099.dbf.bk                                                                                                               100% 5831KB   5.7MB/s   00:00   
1_331_777229099.dbf.bk                                                                                                               100% 5785KB   5.7MB/s   00:00   

6、在备库上注册归档日志

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_326_777229099.dbf';

Database altered.

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_327_777229099.dbf';

Database altered.

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_328_777229099.dbf';

Database altered.

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_329_777229099.dbf';

Database altered.

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_330_777229099.dbf';

Database altered.

SQL> ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_331_777229099.dbf';

Database altered.

7、跟踪后台alert文件

ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_326_777229099.dbf'
Thu Nov 29 15:13:34 2012
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_326_777229099.dbf'
Thu Nov 29 15:13:38 2012
Media Recovery Log /media/duxiustandbylog/1_326_777229099.dbf
Media Recovery Waiting for thread 1 sequence 327
Fetching gap sequence in thread 1, gap sequence 327-331
FAL[client]: Error fetching gap sequence, no FAL server specified
Thu Nov 29 15:13:56 2012
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_327_777229099.dbf'
Thu Nov 29 15:13:56 2012
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_327_777229099.dbf'
Thu Nov 29 15:14:01 2012
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_328_777229099.dbf'
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_328_777229099.dbf'
Thu Nov 29 15:14:06 2012
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_329_777229099.dbf'
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_329_777229099.dbf'
Thu Nov 29 15:14:08 2012
Media Recovery Log /media/duxiustandbylog/1_327_777229099.dbf
Media Recovery Log /media/duxiustandbylog/1_328_777229099.dbf
Media Recovery Log /media/duxiustandbylog/1_329_777229099.dbf
Media Recovery Waiting for thread 1 sequence 330
Fetching gap sequence in thread 1, gap sequence 330-331
FAL[client]: Error fetching gap sequence, no FAL server specified
Thu Nov 29 15:14:20 2012
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_330_777229099.dbf'
Thu Nov 29 15:14:20 2012
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_330_777229099.dbf'
Thu Nov 29 15:14:24 2012
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_331_777229099.dbf'
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: ALTER DATABASE REGISTER PHYSICAL LOGFILE '/media/duxiustandbylog/1_331_777229099.dbf'
Thu Nov 29 15:14:39 2012
Media Recovery Log /media/duxiustandbylog/1_330_777229099.dbf
Media Recovery Log /media/duxiustandbylog/1_331_777229099.dbf
Media Recovery Log /media/standby_redo/1_332_777229099.dbf
Media Recovery Waiting for thread 1 sequence 333 (in transit)
Thu Nov 29 15:14:40 2012
Recovery of Online Redo Log: Thread 1 Group 4 Seq 333 Reading mem 0
  Mem# 0 errs 0: /opt/oracle/oradata/duxiu/redostandby01.log
Thu Nov 29 15:15:18 2012
Primary database is in MAXIMUM AVAILABILITY mode
Changing standby controlfile to MAXIMUM AVAILABILITY level
RFS[2]: Successfully opened standby log 5: '/opt/oracle/oradata/duxiu/redostandby02.log'
Thu Nov 29 15:15:19 2012
Media Recovery Waiting for thread 1 sequence 334 (in transit)
Thu Nov 29 15:15:19 2012
Recovery of Online Redo Log: Thread 1 Group 5 Seq 334 Reading mem 0
  Mem# 0 errs 0: /opt/oracle/oradata/duxiu/redostandby02.log

已经运行在最高可用模式了

8、

查看数据库V$ARCHIVE_GAP视图

SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

no rows selected

SQL>

9、切换到只读状态核实数据是否一致


SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database open read only;

Database altered.

SQL> select count(*) from test0014;

  COUNT(*)
----------
     49942

SQL>

主库上同样查看:

SQL> select count(*) from test0014;                                                                                                                                   

  COUNT(*)
----------
     49942

SQL>

10、将备库切换到恢复日志状态

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SQL>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值