1. 模拟由于网络,监听器的原因导致归档无法传到standby上的情形,分别从相应的主备数据库的视图和alert文件定位故障的原因;当故障排除后,看Oracle是否能自动恢复归档的传递,
1.1 DG1上查看归档日志情况
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 26 52428800 1 YES INACTIVE
629616 10-AUG-13
2 1 27 52428800 1 YES INACTIVE
629737 10-AUG-13
3 1 28 52428800 1 NO CURRENT
631131 10-AUG-13
1.2DG2上查看归档日志应用情况,并退出SQLPLUS
SQL> Select sequence#,standby_dest,archived,applied from v$archived_log order by 1 desc;
SEQUENCE# STA ARC APP
---------- --- --- ---
27 NO YES YES
26 NO YES YES
25 NO YES YES
24 NO YES YES
23 NO YES YES
22 NO YES YES
21 NO YES YES
20 NO YES YES
19 NO YES YES
18 NO YES YES
17 NO YES YES
SEQUENCE# STA ARC APP
---------- --- --- ---
16 NO YES YES
15 NO YES YES
14 NO YES YES
13 NO YES YES
12 NO YES YES
11 NO YES YES
10 NO YES YES
9 NO YES YES
8 NO YES YES
7 NO YES YES
6 NO YES YES
SEQUENCE# STA ARC APP
---------- --- --- ---
5 NO YES YES
4 NO YES YES
24 rows selected.
SQL>exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
1.2模拟监听器故障并查看日志
[oracle@dg2 ~]$ lsnrctl stop;
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 10-AUG-2013 04:09:21
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg2)(PORT=1521)))
The command completed successfully
[oracle@dg2 ~]$
查看DG1 alert日志发现监听器故障问题:
DG1:
SQL> alter system switch logfile;
查看DG1 alert日志
Sat Aug 10 04:11:14 2013
Error 12541 received logging on to the standby
Check whether the listener is up and running.
Sat Aug 10 04:11:14 2013
Errors in file /u01/oracle/admin/ORCLDB/bdump/wending_lns1_10859.trc:
ORA-12541: TNS:no listener
LGWR: Error 12541 creating archivelog file 'db_phystdby'
LNS: Failed to archive log 1 thread 1 sequence 29 (12541)
System altered.
在DG2上开启监听器,并在主库DG1上强制归档,观察日志和视图;监听恢复后DG会自动恢复归档日志传递。
[oracle@dg2 ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 10-AUG-2013 04:12:57
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/oracle/product/10.2.0//bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/oracle/product/10.2.0/network/admin/listener.ora
Log messages written to /u01/oracle/product/10.2.0/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg2)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 10-AUG-2013 04:12:57
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
DG1:
SQL> alter system switch logfile;
System altered.
DG1上日志:
Thread 1 advanced to log sequence 28
Current log# 3 seq# 28 mem# 0: /u01/oracle/oradata/ORCLDB/redo03.log
Sat Aug 10 04:05:51 2013
Expanded controlfile section 11 from 28 to 56 records
Requested to grow by 28 records; added 1 blocks of records
LNS1 started with pid=23, OS id=10859
Sat Aug 10 04:11:13 2013
Thread 1 advanced to log sequence 29
Current log# 1 seq# 29 mem# 0: /u01/oracle/oradata/ORCLDB/redo01.log
Sat Aug 10 04:11:14 2013
Error 12541 received logging on to the standby
Check whether the listener is up and running.
Sat Aug 10 04:11:14 2013
Errors in file /u01/oracle/admin/ORCLDB/bdump/wending_lns1_10859.trc:
ORA-12541: TNS:no listener
LGWR: Error 12541 creating archivelog file 'db_phystdby'
LNS: Failed to archive log 1 thread 1 sequence 29 (12541)
Sat Aug 10 04:13:46 2013
Thread 1 advanced to log sequence 30
Current log# 2 seq# 30 mem# 0: /u01/oracle/oradata/ORCLDB/redo02.log
DG2上日志:
Media Recovery Waiting for thread 1 sequence 28
Sat Aug 10 04:11:13 2013
RFS[2]: No standby redo logfiles created
RFS[2]: Archived Log: '/u01/oracle/arch1/1_28_795970778.dbf'
Sat Aug 10 04:11:14 2013
Media Recovery Log /u01/oracle/arch1/1_28_795970778.dbf
Media Recovery Waiting for thread 1 sequence 29
Sat Aug 10 04:16:43 2013
db_recovery_file_dest_size of 2048 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Sat Aug 10 04:16:50 2013
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[5]: Assigned to RFS process 30887
RFS[5]: Identified database type as 'physical standby'
RFS[5]: Archived Log: '/u01/oracle/arch1/1_29_795970778.dbf'
Sat Aug 10 04:16:55 2013
Media Recovery Log /u01/oracle/arch1/1_29_795970778.dbf
Media Recovery Waiting for thread 1 sequence 30
DG1上日志情况:
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 29 52428800 1 YES ACTIVE
631330 10-AUG-13
2 1 30 52428800 1 NO CURRENT
631616 10-AUG-13
3 1 28 52428800 1 YES ACTIVE
631131 10-AUG-13
DG2上归档应用情况:
SQL> Select sequence#,standby_dest,archived,applied from v$archived_log order by 1 desc;
SEQUENCE# STA ARC APP
---------- --- --- ---
29 NO YES YES
28 NO YES YES
27 NO YES YES
26 NO YES YES
25 NO YES YES
24 NO YES YES
23 NO YES YES
22 NO YES YES
21 NO YES YES
20 NO YES YES
19 NO YES YES
SEQUENCE# STA ARC APP
---------- --- --- ---
18 NO YES YES
17 NO YES YES
16 NO YES YES
15 NO YES YES
14 NO YES YES
13 NO YES YES
12 NO YES YES
11 NO YES YES
10 NO YES YES
9 NO YES YES
8 NO YES YES
SEQUENCE# STA ARC APP
---------- --- --- ---
7 NO YES YES
6 NO YES YES
5 NO YES YES
4 NO YES YES
26 rows selected.
2.模拟物理standby产生GAP的情形,并加以解决。
2.1将备库的网卡停掉
[root@dg2 ~]# ifconfig eth1 down
2.2在主库上切换日志
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> select process,status,thread#,sequence#,block#,blocks from v$managed_standby;
PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS
--------- ------------ ---------- ---------- ---------- ----------
ARCH CLOSING 1 30 1 158
ARCH CLOSING 1 31 1 259
ARCH CLOSING 1 32 1 1
ARCH OPENING 1 32 0 0
ARCH CONNECTED 0 0 0 0
ARCH CONNECTED 0 0 0 0
LNS WRITING 1 31 253 7
7 rows selected.
其中redo日志sequence 31、32的归档日志没有正常上传到备库。
2.3对部分归档日志修改文件
对31、32归档日志修改文件名:
[oracle@dg1 WENDING]$ mv 1_31_795970778.dbf 1_31_795970778.dbf_bak
[oracle@dg1 WENDING]$ mv 1_32_795970778.dbf 1_32_795970778.dbf_bak
2.4启动备库网卡
[root@dg2 ~]# ifconfig eth1 up
[root@dg2 ~]#
[root@dg2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:95:DE:4B
inet addr:192.168.1.249 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe95:de4b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1192 errors:0 dropped:0 overruns:0 frame:0
TX packets:530 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:130001 (126.9 KiB) TX bytes:73261 (71.5 KiB)
eth1 Link encap:Ethernet HWaddr 00:0C:29:95:DE:41
inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe95:de41/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:533 errors:0 dropped:0 overruns:0 frame:0
TX packets:175 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:268262 (261.9 KiB) TX bytes:20858 (20.3 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2342 errors:0 dropped:0 overruns:0 frame:0
TX packets:2342 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2398177 (2.2 MiB) TX bytes:2398177 (2.2 MiB)
查看备库alert日志:
Sat Aug 10 20:47:49 2013
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[4]: Assigned to RFS process 30381
RFS[4]: Identified database type as 'physical standby'
Sat Aug 10 20:47:50 2013
Fetching gap sequence in thread 1, gap sequence 31-31
Sat Aug 10 20:48:20 2013
FAL[client]: Failed to request gap sequence
GAP - thread 1 sequence 31-31
DBID 2231924310 branch 795970778
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.
-------------------------------------------------------------
SQL> select * from v$archive_gap;
THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
1 31 32
主库alert日志:
Sat Aug 10 20:47:50 2013
FAL[server]: Fail to queue the whole FAL gap
GAP - thread 1 sequence 31-31
DBID 2231924310 branch 795970778
2.5把归档日志文件名改回来
[oracle@dg1 WENDING]$ ls
1_10_795970778.dbf 1_16_795970778.dbf 1_22_795970778.dbf 1_28_795970778.dbf 1_4_795970778.dbf
1_11_795970778.dbf 1_17_795970778.dbf 1_23_795970778.dbf 1_29_795970778.dbf 1_5_795970778.dbf
1_12_795970778.dbf 1_18_795970778.dbf 1_24_795970778.dbf 1_30_795970778.dbf 1_6_795970778.dbf
1_13_795970778.dbf 1_19_795970778.dbf 1_25_795970778.dbf 1_31_795970778.dbf_bak 1_7_795970778.dbf
1_14_795970778.dbf 1_20_795970778.dbf 1_26_795970778.dbf 1_32_795970778.dbf_bak 1_8_795970778.dbf
1_15_795970778.dbf 1_21_795970778.dbf 1_27_795970778.dbf 1_3_795970778.dbf 1_9_795970778.dbf
[oracle@dg1 WENDING]$ mv 1_31_795970778.dbf_bak 1_31_795970778.dbf
[oracle@dg1 WENDING]$ mv 1_32_795970778.dbf_bak 1_32_795970778.dbf
备库alert日志:
-- Connected User is Valid
RFS[6]: Assigned to RFS process 30630
RFS[6]: Identified database type as 'physical standby'
RFS[6]: Archived Log: '/u01/oracle/arch1/1_32_795970778.dbf'
-- Connected User is Valid
RFS[6]: Assigned to RFS process 30631
RFS[6]: Identified database type as 'physical standby'
RFS[6]: Archived Log: '/u01/oracle/arch1/1_32_795970778.dbf'
SQL> select * from v$archive_gap;
no rows selected