11gr2 adg 主备库切换后,归档日志不能自动传送到备库分析


主备库切换后,归档日志不能自动传送分析

在备库上运行:
show parameter log_archive_config
--alter system set log_archive_config='DG_CONFIG=(sg02,sg01)' scope=spfile;
SQL>  SELECT MESSAGE FROM V$DATAGUARD_STATUS;

MESSAGE
--------------------------------------------------------------------------------
ARC0: Archival started
ARC1: Archival started
ARC2: Archival started
ARC1: Becoming the 'no FAL' ARCH
ARC1: Becoming the 'no SRL' ARCH
ARC2: Becoming the heartbeat ARCH
ARC2: Becoming the active heartbeat ARCH
ARC3: Archival started
Attempt to start background Managed Standby Recovery process
MRP0: Background Managed Standby Recovery process started
Managed Standby Recovery not using Real Time Apply

MESSAGE
--------------------------------------------------------------------------------
Media Recovery Waiting for thread 1 sequence 55
MRP0: Background Media Recovery cancelled with status 16037
MRP0: Background Media Recovery process shutdown
Managed Standby Recovery Canceled
Attempt to start background Managed Standby Recovery process
MRP0: Background Managed Standby Recovery process started
Managed Standby Recovery not using Real Time Apply
Media Recovery Waiting for thread 1 sequence 55
Media Recovery Log /oraarch/ARC_ERP5_55_809346321_1.log
Media Recovery Waiting for thread 1 sequence 56
Media Recovery Log /oraarch/ARC_ERP5_56_809346321_1.log

MESSAGE
--------------------------------------------------------------------------------
Media Recovery Waiting for thread 1 sequence 57

23 rows selected.

SQL>


在主库上执行:
show parameter log_archive_config
--alter system set log_archive_config='DG_CONFIG=(sg02,sg01)' scope=spfile;

SQL> SELECT NAME ,VALUE FROM v$parameter WHERE name='log_archive_dest_state_2';

NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
log_archive_dest_state_2
enable
SQL> select status,error from v$archive_dest where dest_id=2;

STATUS    ERROR
--------- -----------------------------------------------------------------
ERROR     ORA-12154: TNS:could not resolve the connect identifier specified

SQL>
已经找到原因了,下面解决:
pc02:/home/oracle>sqlplus system/sgtest@sg01

SQL*Plus: Release 11.2.0.3.0 Production on Fri Mar 8 21:35:13 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied

已经很明显了是tnsnames.ora配的有问题
pc02:/home/oracle>cd /u01/app/oracle/product/11.2.0/db_1/network/admin
pc02:/u01/app/oracle/product/11.2.0/db_1/network/admin>ll
total 8
drwxr-xr-x 2 oracle oinstall 4096 Mar  6 10:17 samples
-rw-r--r-- 1 oracle oinstall  205 May 11  2011 shrept.lst
pc02:/u01/app/oracle/product/11.2.0/db_1/network/admin>
pc02:/u01/app/oracle/product/11.2.0/db_1/network/admin>vi tnsnames.ora

SGERP5 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = pc02)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sgerp5)
    )
  )

SG01=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=129.100.253.62)
      (PORT=1521)
    )
    (CONNECT_DATA=
      (SERVICE_NAME=sg01)
    )
  )

SG02=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=129.100.253.91)
      (PORT=1521)
    )
    (CONNECT_DATA=
      (SERVICE_NAME=sg02)
    )
  )
pc02:/oraarch>ll
total 4891768
-rw-r----- 1 oracle oinstall   23451648 Mar  7 13:15 ARC_ERP5_42_809346321_1.log
-rw-r----- 1 oracle oinstall    1059840 Mar  7 13:16 ARC_ERP5_43_809346321_1.log
-rw-r----- 1 oracle oinstall   11354624 Mar  7 15:46 ARC_ERP5_44_809346321_1.log
-rw-r----- 1 oracle oinstall      28672 Mar  7 15:51 ARC_ERP5_45_809346321_1.log
-rw-r----- 1 oracle oinstall 2072098816 Mar  7 16:07 ARC_ERP5_46_809346321_1.log
-rw-r----- 1 oracle oinstall 1954824704 Mar  7 16:09 ARC_ERP5_47_809346321_1.log
-rw-r----- 1 oracle oinstall  844691456 Mar  7 18:26 ARC_ERP5_48_809346321_1.log
-rw-r----- 1 oracle oinstall   65515520 Mar  8 11:24 ARC_ERP5_49_809346321_1.log
-rw-r----- 1 oracle oinstall    7843328 Mar  8 15:46 ARC_ERP5_50_809346321_1.log
-rw-r----- 1 oracle oinstall    3877376 Mar  8 16:36 ARC_ERP5_51_809346321_1.log
-rw-r----- 1 oracle oinstall       3584 Mar  8 16:39 ARC_ERP5_52_809346321_1.log
-rw-r----- 1 oracle oinstall       2048 Mar  8 16:40 ARC_ERP5_53_809346321_1.log
-rw-r----- 1 oracle oinstall       1024 Mar  8 16:40 ARC_ERP5_54_809346321_1.log
-rw-r----- 1 oracle oinstall      77824 Mar  8 16:49 ARC_ERP5_55_809346321_1.log
-rw-r----- 1 oracle oinstall    4265472 Mar  8 16:53 ARC_ERP5_56_809346321_1.log
-rw-r----- 1 oracle oinstall   15095296 Mar  8 21:18 ARC_ERP5_57_809346321_1.log
pc02:/oraarch>
pc02:/oraarch>ll
total 4908496
-rw-r----- 1 oracle oinstall   23451648 Mar  7 13:15 ARC_ERP5_42_809346321_1.log
-rw-r----- 1 oracle oinstall    1059840 Mar  7 13:16 ARC_ERP5_43_809346321_1.log
-rw-r----- 1 oracle oinstall   11354624 Mar  7 15:46 ARC_ERP5_44_809346321_1.log
-rw-r----- 1 oracle oinstall      28672 Mar  7 15:51 ARC_ERP5_45_809346321_1.log
-rw-r----- 1 oracle oinstall 2072098816 Mar  7 16:07 ARC_ERP5_46_809346321_1.log
-rw-r----- 1 oracle oinstall 1954824704 Mar  7 16:09 ARC_ERP5_47_809346321_1.log
-rw-r----- 1 oracle oinstall  844691456 Mar  7 18:26 ARC_ERP5_48_809346321_1.log
-rw-r----- 1 oracle oinstall   65515520 Mar  8 11:24 ARC_ERP5_49_809346321_1.log
-rw-r----- 1 oracle oinstall    7843328 Mar  8 15:46 ARC_ERP5_50_809346321_1.log
-rw-r----- 1 oracle oinstall    3877376 Mar  8 16:36 ARC_ERP5_51_809346321_1.log
-rw-r----- 1 oracle oinstall       3584 Mar  8 16:39 ARC_ERP5_52_809346321_1.log
-rw-r----- 1 oracle oinstall       2048 Mar  8 16:40 ARC_ERP5_53_809346321_1.log
-rw-r----- 1 oracle oinstall       1024 Mar  8 16:40 ARC_ERP5_54_809346321_1.log
-rw-r----- 1 oracle oinstall      77824 Mar  8 16:49 ARC_ERP5_55_809346321_1.log
-rw-r----- 1 oracle oinstall    4265472 Mar  8 16:53 ARC_ERP5_56_809346321_1.log
-rw-r----- 1 oracle oinstall   15095296 Mar  8 21:18 ARC_ERP5_57_809346321_1.log
-rw-r----- 1 oracle oinstall   17104384 Mar  8 21:46 ARC_ERP5_58_809346321_1.log
pc02:/oraarch>
产生一个新的归档,查看以前没有同步的归档是否能同步过去,在备库上查询还是没有同步过来。
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size                  2228784 bytes
Variable Size             889195984 bytes
Database Buffers          704643072 bytes
Redo Buffers                7344128 bytes
Database mounted.
Database opened.
SQL>
SQL> select status,error from v$archive_dest where dest_id=2;

STATUS    ERROR
--------- -----------------------------------------------------------------
VALID

SQL>
重启数据库后,查看备库的归档可以同步过来:
[root@pc01 oraarch]# ll
total 4940908
-rw-r----- 1 oracle asmadmin   31847424 Mar  6 22:38 ARC_ERP5_37_809346321_1.log
-rw-r----- 1 oracle asmadmin    1264640 Mar  6 22:47 ARC_ERP5_38_809346321_1.log
-rw-r----- 1 oracle asmadmin      20992 Mar  6 22:53 ARC_ERP5_39_809346321_1.log
-rw-r----- 1 oracle asmadmin       4096 Mar  6 22:53 ARC_ERP5_40_809346321_1.log
-rw-r----- 1 oracle asmadmin       1024 Mar  6 22:54 ARC_ERP5_41_809346321_1.log
-rw-r----- 1 oracle asmadmin   23451648 Mar  7 13:14 ARC_ERP5_42_809346321_1.log
-rw-r----- 1 oracle asmadmin    1059840 Mar  7 13:15 ARC_ERP5_43_809346321_1.log
-rw-r----- 1 oracle asmadmin   11354624 Mar  7 15:45 ARC_ERP5_44_809346321_1.log
-rw-r----- 1 oracle asmadmin      28672 Mar  7 15:50 ARC_ERP5_45_809346321_1.log
-rw-r----- 1 oracle asmadmin 2072098816 Mar  7 16:02 ARC_ERP5_46_809346321_1.log
-rw-r----- 1 oracle asmadmin 1954824704 Mar  7 16:04 ARC_ERP5_47_809346321_1.log
-rw-r----- 1 oracle asmadmin  844691456 Mar  7 18:24 ARC_ERP5_48_809346321_1.log
-rw-r----- 1 oracle asmadmin   65515520 Mar  8 11:23 ARC_ERP5_49_809346321_1.log
-rw-r----- 1 oracle asmadmin    7843328 Mar  8 15:45 ARC_ERP5_50_809346321_1.log
-rw-r----- 1 oracle asmadmin    3877376 Mar  8 16:35 ARC_ERP5_51_809346321_1.log
-rw-r----- 1 oracle asmadmin       3584 Mar  8 16:38 ARC_ERP5_52_809346321_1.log
-rw-r----- 1 oracle asmadmin       2048 Mar  8 16:39 ARC_ERP5_53_809346321_1.log
-rw-r----- 1 oracle asmadmin       1024 Mar  8 16:39 ARC_ERP5_54_809346321_1.log
-rw-r--r-- 1 oracle asmadmin      77824 Mar  8 21:07 ARC_ERP5_55_809346321_1.log
-rw-r--r-- 1 oracle asmadmin    4265472 Mar  8 21:07 ARC_ERP5_56_809346321_1.log
-rw-r----- 1 oracle asmadmin   15095296 Mar  8 21:47 ARC_ERP5_57_809346321_1.log
-rw-r----- 1 oracle asmadmin   17104384 Mar  8 21:47 ARC_ERP5_58_809346321_1.log

查看数据也能正确同步过来。

补充归档的方法:
先ftp传送没有传过的归档
pc01:/oraarch>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Mar 8 21:08:06 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL>
SQL> ALTER DATABASE REGISTER LOGFILE '/oraarch/ARC_ERP5_55_809346321_1.log';

Database altered.

SQL> ALTER DATABASE REGISTER LOGFILE '/oraarch/ARC_ERP5_56_809346321_1.log';

Database altered.

SQL>

你可能感兴趣的:(11gr2 adg 主备库切换后,归档日志不能自动传送到备库分析)