物理DG中主库的LNSn、NSS、NSA进程的比较

0    332    1

Tags:

👉 本文共约20342个字,系统预计阅读时间或需77分钟。

前言部分

导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

① 检查物理DG是否正常的常用SQL

② 日志传输进程LNSn、NSS、NSA的区别

③ 日志传输的2种方式:lgwr和arch,10g和11g有了变化

④ dg的架构图

本文简介

同事说dg不能同步,让我帮忙看看,我用自己写的2个视图查看了下,首先发现主库没有常见的LNSn进程,下意识的认为主库这个进程没有启动,需要切换日志唤醒LNSn进程,事实上也这样做了,(alter system set log_archive_dest_state_2='defer'; alter system switch logfile; alter system set log_archive_dest_state_2='enable'; alter system switch logfile;),切换后发现日志可以正常传输了,但是主库还是看不到LNSn这个进程,于是找找资料,深入的研究了一下这个问题。

在读完整个文章后,大家就会了解我这里碰到的问题,说明配置的时候不是采用的异步方式,而小麦苗后来也的确去查看了下,采用的是LGWR SYNC的方式,在读完这篇文章后大家对这个问题就非常明朗了。

相关知识点扫盲

DG架构图

下图是小麦苗绘制的dg结构图,对于里边的redo buffer到底如何传递到LNSn,众说纷纭,10g和11g也有不同,但这个不是我们今天讨论的内容,详细点的资料可以参考:http://www.itpub.net/thread-1841337-1-1.html,我们讨论并实验LNSn、NSS、NSA进程在10g和11g的中表现形式

DG日志传输

DG架构可以按照功能分成3个部分:

1) 日志发送(Redo Send)

2) 日志接收(Redo Receive)

3) 日志应用(Redo Apply)

我们今天着重来讲讲这里的日志发送的部分。

Primary Database 运行过程中,会源源不断地产生Redo 日志,这些日志需要发送到Standy Database。 这个发送动作可以由Primary Database 的LGWR 或者ARCH进程完成, 不同的归档目的地可以使用不同的方法,但是对于一个目的地,只能选用一种方法。 选择哪个进程对数据保护能力和系统可用性有很大区别。

如果你配置一个目的地来使用 LGWR 进程, 但是由于某些原因 LGWR 进程变得无法归到目的地了,则重做传输将会回复到使用 ARCn 进程来完成归档操作。

alter system set log_archive_dest_2='SERVICE=tns_mydgwl LGWR ASYNC db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)' sid='*';

alter system set log_archive_dest_2='SERVICE=tns_mydgwl db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)' sid='*';

若不写传输进程和模式的话,11g下默认为LGWR ASYNC方式,10g为ARCH SYNC模式。

使用ARCH 进程

1)Primary Database 不断产生Redo Log,这些日志被LGWR进程写到联机日志。

2)当一组联机日志被写满后,会发生日志切换(Log Switch),并且会触发本地归档,本地归档位置是采用 LOG_ARCHIVE_DEST_1='LOCATION=/path' 这种格式定义的。如:alter system set log_archive_dest_1 = 'LOCATION=/u01/arch' scope=both;

3)完成本地归档后,联机日志就可以被覆盖重用。

4)ARCH 进程通过Net 把归档日志发送给Standby Database的RFS(Remote File Server) 进程。

5)Standby Database 端的RFS 进程把接收的日志写入到归档路径中。

6)Standby Database 端的MRP(Managed Recovery Process)进程(Redo Apply)或者LSP 进程(SQL Apply)在Standby Database上应用这些日志,进而同步数据。

说明:

逻辑Standby接收后将其转换成SQL语句,在Standby数据库上LSP进程执行SQL语句实现同步,这种方式叫SQL Apply。

物理Standby接收完Primary数据库生成的REDO数据后,MRP进程以介质恢复的方式实现同步,这种方式也叫Redo Apply。

使用LGWR 进程的SYNC 方式

1)Primary Database 产生的Redo日志要同时写到日志文件和网络。也就是说LGWR进程把日志写到本地日志文件的同时还要发送给本地的LNSn进程(Network Server Process),再由LNSn(LGWR Network Server process)进程把日志通过网络发送给远程的目的地,每个远程目的地对应一个LNS进程,多个LNS进程能够并行工作。

2)LGWR 必须等待写入本地日志文件操作和通过LNSn进程的网络传送都成功,Primary Database上的事务才能提交,这也是SYNC的含义所在。

3)Standby Database的RFS进程把接收到的日志写入到Standby Redo Log日志中。

4) Primary Database的日志切换也会触发Standby Database 上的日志切换,即Standby Database 对Standby Redo Log的归档,然后触发Standby Database 的MRP或者LSP进程恢复归档日志。

使用LGWR进程的ASYNC 方式

使用LGWR SYNC方法的可能问题在于,如果日志发送给Standby Database过程失败,LGWR进程就会报错。也就是说Primary Database的LGWR 进程依赖于网络状况,有时这种要求可能过于苛刻,这时就可以使用LGWR ASYNC方式。 它的工作机制如下:

1) Primary Database 一旦产生Redo日志后,LGWR 把日志同时提交给日志文件和本地LNS 进程,但是LGWR进程只需成功写入日志文件就可以,不必等待LNSn进程的网络传送成功。

2) LNSn进程异步地把日志内容发送到Standby Database。多个LNSn进程可以并发发送。

3) Primary Database的Online Redo Log 写满后发生Log Switch,触发归档操作,也触发Standby Database对Standby Redo Log 的归档;然后触发MRP或者LSP 进程恢复归档日志。

进程LNSn:LGWR Network Server process

On the primary database, the LGWR process submits the redo data to one or more network server (LNSn) processes, which then initiate the network I/O in parallel to multiple remote destinations.

[root@rhel6_lhr lhr]# ps -ef|grep ora_ln

oracle 8090 1 0 03:57 ? 00:01:40 ora_lns1_oradg10g

oracle 11862 1 0 05:06 ? 00:01:18 ora_lns2_oradg10g

root 26450 25545 0 09:35 pts/4 00:00:00 grep ora_ln

[root@rhel6_lhr lhr]#

DG可以使用ARCH,LGWR来传送日志,但他们都是把日志发送给本地的LNS(如果有多个目标备库,那会启动相应数量的LNS进程,同时发送数据)进程,然后备库那边的RFS进程接收数据,接收到的数据可以存储在备库的备用重做日志文件中或备库的归档日志中,然后再应用到备库中。

主库切换(alter system switch logfile;)可以启动LNS进程, V$MANAGED_STANDBY视图可以查看LNS进程的具体情况:

col group# format a5

set line 9999 pagesize 9999

SELECT a.PROCESS,a.PID,a.STATUS,a.GROUP#,a.SEQUENCE#, a.DELAY_MINS, a.RESETLOG_ID FROM V$MANAGED_STANDBY a;

如何启动LNS进程?

有3种方法:

  1. alter system switch logfile;
  2. 推荐: 备库启动实时应用后,主库alter system set log_archive_dest_state_2='defer'; alter system switch logfile; alter system set log_archive_dest_state_2='enable'; alter system switch logfile;
  3. 重启备库、主库

LNS进程的后台表现形式

经过小麦苗的研究,日志传输若采用LGWR进程来传输,则在10g dg中是lns的形式,到了11g变为了nsa和nss的形式了,具体可以参考本文实验部分的总结,不管10还是11g我们都可以用命令ps -ef|grep -v grep|grep -E "ora_lns|ora_nsa|ora_nss"来查询后台进程。

[oracle@rhel6_lhr oradgphy]$ ps -ef|grep ora_nsa

oracle 60229 1 0 16:23 ? 00:00:01 ora_nsa2_oradg11g

oracle 60231 1 0 16:23 ? 00:00:01 ora_nsa3_oradg11g

oracle 62421 1 0 16:47 ? 00:00:00 ora_nsa2_oradglg

oracle 62423 1 0 16:47 ? 00:00:00 ora_nsa3_oradglg

oracle 64923 59476 0 17:32 pts/3 00:00:00 grep ora_nsa

oracle@ZT4FLMSDB1:/oracle$ ps -ef|grep -v grep|grep -E "ora_lns|ora_nsa|ora_nss"

oracle 35258592 1 0 08:07:58 - 0:00 ora_nss2_oraFLMS1

NSAnRedo Transport NSA1 ProcessShips redo from current online redo logs to remote standby destinations configured for ASYNC transportNSAn can run as multiple processes, where n is 1-9 or A-V.
See Also: Oracle Data Guard Concepts and Administration
NSSnRedo Transport NSS1 ProcessActs as a slave for LGWR when SYNC transport is configured for a remote standby destinationNSSn can run as multiple processes, where n is 1-9 or A-V.
See Also: Oracle Data Guard Concepts and Administration
NSVnData Guard Broker NetSlave ProcessPerforms broker network communications between databases in a Data Guard environmentNSVn is created when a Data Guard broker configuration is enabled. There can be as many NSVn processes (where n is 0- 9 and A-U) created as there are databases in the Data Guard broker configuration.

实验部分

实验目标

若采用lgwr进程传输日志的话,分别找到10g和11g中,后台进程的表现形式、切换日志时后台的告警日志及V$MANAGED_STANDBY视图展现的内容有何不同。

实验过程

以下所有试验过程均在主库操作。

10g

实验环境如下:

项目primary db
db 类型单机
db version10.2.0.5.0
db 存储ASM
platform_nameAIX-Based Systems (64-bit)

LGWR SYNC(lgwr 同步)

-----LGWR SYNC

alter system set log_archive_dest_2='SERVICE=tns_mydgwl LGWR SYNC db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)';

SQL> set line 9999

SQL> col DEST_NAME format a20

SQL> col DESTINATION format a15

SQL> col GAP_STATUS format a10

SQL> col DB_UNIQUE_NAME format a15

SQL> col error format a10

col APPLIED_SCN for 999999999999999

SQL> SQL> SELECT al.thread#,

2 ads.dest_id,

3 ads.DEST_NAME,

4 (SELECT ads.TYPE || ' ' || ad.TARGET

5 FROM v$archive_dest AD

6 WHERE AD.DEST_ID = ADS.DEST_ID) TARGET,

7 ADS.DATABASE_MODE,

8 ads.STATUS,

9 ads.error,

10 ads.RECOVERY_MODE,

11 ads.DB_UNIQUE_NAME,

12 ads.DESTINATION,

13 (SELECT MAX(sequence#) FROM v$log na WHERE na.thread# = al.thread#) Current_Seq#,

14 MAX(sequence#) Last_Archived,

15 max(CASE

16 WHEN al.APPLIED = 'YES' AND ads.TYPE \<> 'LOCAL' THEN

17 al.sequence#

18 end) APPLIED_SEQ#

19 FROM (SELECT *

20 FROM v$archived_log V

21 WHERE V.resetlogs_change# =

22 (SELECT d.RESETLOGS_CHANGE# FROM v$database d)) al,

23 v$archive_dest_status ads

24 WHERE al.dest_id(+) = ads.dest_id

25 AND ads.STATUS != 'INACTIVE'

26 GROUP BY al.thread#,

27 ads.dest_id,

28 ads.DEST_NAME,

29 ads.STATUS,

30 ads.error,

31 ads.TYPE,

32 ADS.DATABASE_MODE,

33 ads.RECOVERY_MODE,

34 ads.DB_UNIQUE_NAME,

35 ads.DESTINATION

36 ORDER BY al.thread#, ads.dest_id;

THREAD# DEST_ID DEST_NAME TARGET DATABASE_MODE STATUS ERROR RECOVERY_MODE DB_UNIQUE_NAME DESTINATION CURRENT_SEQ# LAST_ARCHIVED APPLIED_SEQ#

---------- ---------- -------------------- ---------------------- --------------- --------- ---------- ----------------------- --------------- --------------- ------------ ------------- ------------

1 1 LOG_ARCHIVE_DEST_1 LOCAL PRIMARY OPEN VALID IDLE mydg 39 38

1 2 LOG_ARCHIVE_DEST_2 PHYSICAL STANDBY MOUNTED-STANDBY VALID MANAGED REAL TIME APPLY mydgwl tns_mydgwl 39 38 38

====》说明备库处于mount状态且是实时应用的

SQL> alter system set log_archive_dest_2='SERVICE=tns_mydgwl LGWR SYNC db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)';

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area 1342177280 bytes

Fixed Size 2096224 bytes

Variable Size 335545248 bytes

Database Buffers 989855744 bytes

Redo Buffers 14680064 bytes

Database mounted.

Database opened.

SQL>

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> col group_# format a5

SQL> col PROCESS format a8

SQL> col CLIENT_PID format a8

SQL> set line 9999 pagesize 9999

SQL> SELECT a.INST_ID,

2 a.PROCESS,

3 a.client_process,

4 a.client_pid,

5 a.STATUS,

6 a.GROUP# group_#,

7 a.thread#,

8 a.SEQUENCE#,

9 a.DELAY_MINS,

10 a.RESETLOG_ID,

11 c.SID,

12 c.SERIAL#,

13 a.PID spid

14 FROM gV$MANAGED_STANDBY a, gv$process b, gv$session c

15 WHERE a.PID = b.SPID

16 and b.ADDR = c.PADDR

17 and a.INST_ID = b.INST_ID

18 and b.INST_ID = c.INST_ID

19 order by a.INST_ID;

INST_ID PROCESS CLIENT_P CLIENT_P STATUS GROUP THREAD# SEQUENCE# DELAY_MINS RESETLOG_ID SID SERIAL# SPID

---------- -------- -------- -------- ------------ ----- ---------- ---------- ---------- ----------- ---------- ---------- ----------

1 LGWR LGWR 1712328 WRITING 2 1 17 0 1043078511 166 1 1712328

1 ARCH ARCH 1163504 CONNECTED N/A 0 0 0 0 152 3 1163504

1 ARCH ARCH 909430 CLOSING 1 1 16 0 1043078511 155 3 909430

1 ARCH ARCH 311344 CLOSING 3 1 15 0 1043078511 153 3 311344

1 ARCH ARCH 1933380 CLOSING 2 1 14 0 1043078511 150 3 1933380

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@ZT2CDS1:/cds/oradata]$ ps -ef|grep -v grep|grep -E "ora_lns|ora_nsa|ora_nss"

oracle 712726 1 0 18:03:24 - 0:00 ora_lnsb_mydg

说明LGWR同步方式,后台进程表现为lns,且视图V$MANAGED_STANDBY中表现为LGWR。

告警日志:

Sun Jun 14 18:45:58 BEIST 2020

Thread 1 cannot allocate new log, sequence 31

Checkpoint not complete

Current log# 3 seq# 30 mem# 0: /cds/oradata/mydg/redo03.log

Sun Jun 14 18:46:03 BEIST 2020

Thread 1 advanced to log sequence 31 (LGWR switch)

Current log# 1 seq# 31 mem# 0: /cds/oradata/mydg/redo01.log

LGWR ASYNC(lgwr 异步)

SQL> alter system set log_archive_dest_2='SERVICE=tns_mydgwl LGWR ASYNC db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)';

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area 1342177280 bytes

Fixed Size 2096224 bytes

Variable Size 335545248 bytes

Database Buffers 989855744 bytes

Redo Buffers 14680064 bytes

Database mounted.

Database opened.

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> col group_# format a5

SQL> col PROCESS format a8

SQL> col CLIENT_PID format a8

SQL> set line 9999 pagesize 9999

SQL> SELECT a.INST_ID,

2 a.PROCESS,

3 a.client_process,

4 a.client_pid,

5 a.STATUS,

6 a.GROUP# group_#,

7 a.thread#,

8 a.SEQUENCE#,

9 a.DELAY_MINS,

10 a.RESETLOG_ID,

11 c.SID,

12 c.SERIAL#,

13 a.PID spid

14 FROM gV$MANAGED_STANDBY a, gv$process b, gv$session c

15 WHERE a.PID = b.SPID

16 and b.ADDR = c.PADDR

17 and a.INST_ID = b.INST_ID

18 and b.INST_ID = c.INST_ID

19 order by a.INST_ID;

INST_ID PROCESS CLIENT_P CLIENT_P STATUS GROUP THREAD# SEQUENCE# DELAY_MINS RESETLOG_ID SID SERIAL# SPID

---------- -------- -------- -------- ------------ ----- ---------- ---------- ---------- ----------- ---------- ---------- ----------

1 ARCH ARCH 1802334 CONNECTED N/A 0 0 0 0 155 3 1802334

1 ARCH ARCH 1683676 CLOSING N/A 1 27 0 1043078511 150 3 1683676

1 LNS LNS 1454138 WRITING 3 1 30 0 1043078511 154 3 1454138

1 ARCH ARCH 909490 CLOSING 2 1 29 0 1043078511 152 3 909490

1 ARCH ARCH 1364102 CLOSING 1 1 28 0 1043078511 153 3 1364102

SQL>

[oracle@ZT2CDS1:/cds/oradata]$ ps -ef|grep -v grep|grep -E "ora_lns|ora_nsa|ora_nss"

oracle 1454138 1 2 18:44:21 - 0:00 ora_lns1_mydg

说明LGWR异步方式,后台进程表现为lns,且视图V$MANAGED_STANDBY中表现为LNS。

告警日志:

Sun Jun 14 18:45:58 BEIST 2020

Thread 1 cannot allocate new log, sequence 31

Checkpoint not complete

Current log# 3 seq# 30 mem# 0: /cds/oradata/mydg/redo03.log

Sun Jun 14 18:46:03 BEIST 2020

Thread 1 advanced to log sequence 31 (LGWR switch)

Current log# 1 seq# 31 mem# 0: /cds/oradata/mydg/redo01.log

ARCH(归档传输)

SQL> alter system set log_archive_dest_2='SERVICE=tns_mydgwl ARCH ASYNC db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)';

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area 1342177280 bytes

Fixed Size 2096224 bytes

Variable Size 335545248 bytes

Database Buffers 989855744 bytes

Redo Buffers 14680064 bytes

Database mounted.

Database opened.

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> col group_# format a5

SQL> col PROCESS format a8

SQL> col CLIENT_PID format a8

SQL> set line 9999 pagesize 9999

SQL> SELECT a.INST_ID,

2 a.PROCESS,

3 a.client_process,

4 a.client_pid,

5 a.STATUS,

6 a.GROUP# group_#,

7 a.thread#,

8 a.SEQUENCE#,

9 a.DELAY_MINS,

10 a.RESETLOG_ID,

11 c.SID,

12 c.SERIAL#,

13 a.PID spid

14 FROM gV$MANAGED_STANDBY a, gv$process b, gv$session c

15 WHERE a.PID = b.SPID

16 and b.ADDR = c.PADDR

17 and a.INST_ID = b.INST_ID

18 and b.INST_ID = c.INST_ID

19 order by a.INST_ID;

INST_ID PROCESS CLIENT_P CLIENT_P STATUS GROUP THREAD# SEQUENCE# DELAY_MINS RESETLOG_ID SID SERIAL# SPID

---------- -------- -------- -------- ------------ ----- ---------- ---------- ---------- ----------- ---------- ---------- ----------

1 ARCH ARCH 1933434 CLOSING 3 1 21 0 1043078511 155 3 1933434

1 ARCH ARCH 1290450 CLOSING 1 1 22 0 1043078511 154 3 1290450

1 ARCH ARCH 487436 CLOSING N/A 1 21 0 1043078511 152 3 487436

1 ARCH ARCH 311350 CLOSING N/A 1 22 0 1043078511 150 3 311350

[oracle@ZT2CDS1:/cds/oradata]$ ps -ef|grep -v grep|grep -E "ora_lns|ora_nsa|ora_arc"

oracle 311350 1 0 18:15:20 - 0:00 ora_arc1_mydg

oracle 487436 1 0 18:15:20 - 0:00 ora_arc2_mydg

oracle 1290450 1 0 18:15:20 - 0:00 ora_arc3_mydg

oracle 1933434 1 0 18:15:20 - 0:00 ora_arc0_mydg

说明arch进程传输日志,后台进程表现为arc,且视图V$MANAGED_STANDBY中表现为ARCH。

告警日志输出:

Sun Jun 14 18:15:44 BEIST 2020

Thread 1 advanced to log sequence 23 (LGWR switch)

Current log# 2 seq# 23 mem# 0: /cds/oradata/mydg/redo02.log

Sun Jun 14 18:15:44 BEIST 2020

Shutting down archive processes

Sun Jun 14 18:15:49 BEIST 2020

ARCH shutting down

ARC4: Archival stopped

默认传输模式测试

SQL> SELECT a.VALUE FROM v$parameter a WHERE a.NAME='log_archive_dest_2';

VALUE

--------------------------------------------------------------------------------------------------

SERVICE=tns_mydgwl LGWR ASYNC db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)

SQL> SELECT a.PROCESS,a.TRANSMIT_MODE FROM V$ARCHIVE_DEST a WHERE a.DEST_NAME='LOG_ARCHIVE_DEST_2';

PROCESS TRANSMIT_MOD

-------- ------------

LGWR ASYNCHRONOUS

SQL> alter system set log_archive_dest_2='SERVICE=tns_mydgwl db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)' sid='*';

System altered.

SQL> SELECT a.VALUE FROM v$parameter a WHERE a.NAME='log_archive_dest_2';

VALUE

------------------------------------------------------------------------------------------

SERVICE=tns_mydgwl db_unique_name=mydgwl valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)

SQL> SELECT a.PROCESS,a.TRANSMIT_MODE FROM V$ARCHIVE_DEST a WHERE a.DEST_NAME='LOG_ARCHIVE_DEST_2';

PROCESS TRANSMIT_MOD

-------- ------------

ARCH SYNCHRONOUS

SQL>

可以看出10g中,默认情况下为ARCH的同步模式。

11g

实验环境如下:

项目primary db
db 类型rac
db version11.2.0.4.0
db 存储ASM
platform_nameAIX-Based Systems (64-bit)

LGWR SYNC(lgwr 同步)

SYS@oraDESDB1> set line 9999

SYS@oraDESDB1> col DEST_NAME format a20

SYS@oraDESDB1> col DESTINATION format a15

SYS@oraDESDB1> col GAP_STATUS format a10

SYS@oraDESDB1> col DB_UNIQUE_NAME format a15

SYS@oraDESDB1> col error format a10

SYS@oraDESDB1> col APPLIED_SCN for 999999999999999

SYS@oraDESDB1> SELECT al.thread#,

2 ads.dest_id,

3 ads.DEST_NAME,

4 (SELECT ads.TYPE || ' ' || ad.TARGET

5 FROM v$archive_dest AD

6 WHERE AD.DEST_ID = ADS.DEST_ID) TARGET,

7 ADS.DATABASE_MODE,

8 ads.STATUS,

9 ads.error,

10 ads.RECOVERY_MODE,

11 ads.DB_UNIQUE_NAME,

12 ads.DESTINATION,

13 ads.GAP_STATUS,

14 (SELECT MAX(sequence#) FROM v$log na WHERE na.thread# = al.thread#) Current_Seq#,

15 MAX(sequence#) Last_Archived,

16 max(CASE

17 WHEN al.APPLIED = 'YES' AND ads.TYPE \<> 'LOCAL' THEN

18 al.sequence#

19 end) APPLIED_SEQ#,

20 (SELECT ad.applied_scn

21 FROM v$archive_dest AD

22 WHERE AD.DEST_ID = ADS.DEST_ID) applied_scn

23 FROM (SELECT *

24 FROM v$archived_log V

25 WHERE V.resetlogs_change# =

26 (SELECT d.RESETLOGS_CHANGE# FROM v$database d)) al,

27 v$archive_dest_status ads

28 WHERE al.dest_id(+) = ads.dest_id

29 AND ads.STATUS != 'INACTIVE'

30 GROUP BY al.thread#,

31 ads.dest_id,

32 ads.DEST_NAME,

33 ads.STATUS,

34 ads.error,

35 ads.TYPE,

36 ADS.DATABASE_MODE,

37 ads.RECOVERY_MODE,

38 ads.DB_UNIQUE_NAME,

39 ads.DESTINATION,

40 ads.GAP_STATUS

41 ORDER BY al.thread#, ads.dest_id;

THREAD# DEST_ID DEST_NAME TARGET DATABASE_MODE STATUS ERROR RECOVERY_MODE DB_UNIQUE_NAME DESTINATION GAP_STATUS CURRENT_SEQ# LAST_ARCHIVED APPLIED_SEQ# APPLIED_SCN

---------- ---------- -------------------- ---------------------- --------------- --------- ---------- ----------------------- --------------- --------------- ---------- ------------ ------------- ------------ ----------------

1 1 LOG_ARCHIVE_DEST_1 LOCAL PRIMARY OPEN VALID IDLE oraDESDB /arch 117 116 0

1 2 LOG_ARCHIVE_DEST_2 PHYSICAL STANDBY OPEN_READ-ONLY VALID MANAGED REAL TIME APPLY oraESKDB oraESKDB NO GAP 117 116 115 5673508

2 1 LOG_ARCHIVE_DEST_1 LOCAL PRIMARY OPEN VALID IDLE oraDESDB /arch 93 92 0

2 2 LOG_ARCHIVE_DEST_2 PHYSICAL STANDBY OPEN_READ-ONLY VALID MANAGED REAL TIME APPLY oraESKDB oraESKDB NO GAP 93 92 92 5673508

3 LOG_ARCHIVE_DEST_3 LOCAL PRIMARY OPEN VALID IDLE oraDESDB /arch/arch2 0

====》说明备库处于open状态且是实时应用的

SYS@oraDESDB1> alter system set log_archive_dest_2='SERVICE=oraESKDB LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=oraESKDB' sid='*';

System altered.

ZFZHLHRDB3:oracle:/oracle>srvctl stop db -d oradesdb -o ABORT

ZFZHLHRDB3:oracle:/oracle>srvctl start db -d oradesdb

ZFZHLHRDB3:oracle:/oracle>ps -ef|grep -v grep|grep -E "ora_lns|ora_nsa|ora_nss"

oracle 19988486 1 0 11:15:48 - 0:00 ora_nss2_oraDESDB1 ====》表现为nss

ZFZHLHRDB3:oracle:/oracle>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 6 11:16:57 2016

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SYS@oraDESDB1> col group_# format a5

SYS@oraDESDB1> col PROCESS format a8

SYS@oraDESDB1> col CLIENT_PID format a8

SYS@oraDESDB1> set line 9999 pagesize 9999

SYS@oraDESDB1> SELECT a.INST_ID,

2 a.PROCESS,

3 a.client_process,

4 a.client_pid,

5 a.STATUS,

6 a.GROUP# group_#,

7 a.thread#,

8 a.SEQUENCE#,

9 a.DELAY_MINS,

10 a.RESETLOG_ID,

11 c.SID,

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
验证码:
获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复