本文共 11118 字,大约阅读时间需要 37 分钟。
[20170324]dg相关进程.txt
--//简单测试了解dg相关进程.
RFS:remote file server
On the standby system, the remote file server (RFS) receives redo data over the network from the LGWR process and writes the redo data to the standby redo log files.LNSn:
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.MRP:managed recovery process
The managed recovery process (MRP) applies archived redo log files to the physical standby database, and automatically determines the optimal number of parallel recovery processes at the time it starts. The number of parallel recovery slaves spawned is based on the number of CPUs available on the standby server.1.环境:
SYS@book> @ &r/ver1 PORT_STRING VERSION BANNER ------------------------------ -------------- -------------------------------------------------------------------------------- x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production2.探究:
--//主库(192.168.100.78):
SYS@book> @ &r/dg/dg PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- LNS 10522 WRITING LNS 1 1 698 43 1 0 ARCH 10476 CLOSING ARCH N/A 1 697 1 28 0--//LNS进程对应的PID=10522.
# ps -lef | egrep 'UID|10522'
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 0 S oracle 10522 1 0 80 0 - 68736 semtim 16:43 ? 00:00:00 ora_nsa2_book 0 S root 10592 10535 0 80 0 - 15311 pipe_w 16:46 pts/7 00:00:00 egrep UID|10522# lsof -P -i -n| egrep 'COMMAND|10522'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME oracle 10522 oracle 12u IPv4 25381169 0t0 TCP 192.168.100.78:18727->192.168.100.40:1521 (ESTABLISHED)--//备库(192.168.100.40)::
SYS@bookdg> @ &r/dg/dg PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- RFS 6688 IDLE UNKNOWN N/A 0 0 0 0 0 RFS 6690 IDLE LGWR 1 1 698 324 1 0 ARCH 6675 CLOSING ARCH 4 1 695 1 154 0--//RFS进程对应的PID=6690.CLIENT_P='LGWR'
# ps -lef | egrep 'UID|6690'
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 0 S oracle 6690 1 0 76 0 - 62125 - 16:43 ? 00:00:00 oraclebookdg (LOCAL=NO) 4 S root 6745 6693 0 76 0 - 12777 pipe_w 16:50 pts/6 00:00:00 egrep UID|6690# lsof -P -i -n| egrep 'COMMAND|6690'
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME oracle 6690 oracle 14u IPv6 430263089 TCP 192.168.100.40:1521->192.168.100.78:18727 (ESTABLISHED)--//仔细看端口号(192.168.100.78:18727),可以发现是一样的,也就是主库主动连接备库,主库进程名LNS.备库进程名RFS.
--//也就是采用主动推送在线或者归档日志的方式传递日志.3.启动日志应用看看:
--//备库: SYS@bookdg> alter database recover managed standby database using current logfile disconnect ; Database altered.SYS@bookdg> @ &r/dg/dg
PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- RFS 6688 IDLE UNKNOWN N/A 0 0 0 0 0 RFS 6690 IDLE LGWR 1 1 698 4032 1 0 ARCH 6675 CLOSING ARCH 4 1 695 1 154 0 MRP0 6753 APPLYING_LOG N/A N/A 1 698 4032 102400 0 --//MRP0进程对应的PID=6753.# ps -lef | egrep 'UID|6753'
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 0 S oracle 6753 1 0 75 0 - 57899 - 16:59 ? 00:00:00 ora_mrp0_bookdg 4 S root 6774 6693 0 76 0 - 12777 pipe_w 17:00 pts/6 00:00:00 egrep UID|6753# lsof -P -i -n| egrep 'COMMAND|6753'
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME--//没有连接.从这个链接 :
--//已经发现实际上mrp0进程干的事情很少,主要是dbw进程干活.3.如果停止日志应用以及禁止传输呢?
--//备库执行: SYS@bookdg> alter database recover managed standby database cancel ; Database altered.--//主库执行:
SYS@book> alter system set log_archive_dest_state_2=defer scope=memory ; System altered.SYS@book> @ &r/dg/dg
PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- LNS 10522 WRITING LNS 1 1 698 4619 1 0 ARCH 10476 CLOSING ARCH N/A 1 697 1 28 0--//等几秒...
SYS@book> @ &r/dg/dg PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- LNS 10522 WRITING LNS 1 1 698 4654 1 0 ARCH 10476 CLOSING ARCH N/A 1 697 1 28 0--//可以发现主库还在传,因为网络连接没有断开.
--//备库执行:
SYS@bookdg> @ &r/dg/dg PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- RFS 6688 IDLE UNKNOWN N/A 0 0 0 0 0 RFS 6690 IDLE LGWR 1 1 698 4706 1 0 ARCH 6675 CLOSING ARCH 4 1 695 1 154 0--//等几秒...
SYS@bookdg> @ &r/dg/dg
PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- RFS 6688 IDLE UNKNOWN N/A 0 0 0 0 0 RFS 6690 IDLE LGWR 1 1 698 4709 1 0 ARCH 6675 CLOSING ARCH 4 1 695 1 154 0--//这也就很好理解为什么执行alter system set log_archive_dest_state_2=defer,日志一直在传输.
--//主库执行:
SYS@book> alter system archive log current ; System altered.SYS@book> alter system archive log current ;
System altered.SYS@book> alter system archive log current ;
System altered.SYS@book> @ &r/dg/dg
PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- -------------- ---------- ---------- ---------- ---------- LNS 10522 CLOSING LNS 1 1 698 95965 2046 0 ARCH 10476 CLOSING ARCH 3 1 700 90112 1132 0 --//可以发现主库LNS状态是CLOSING.# ps -ef | grep 10522
oracle 10522 1 0 16:43 ? 00:00:00 ora_nsa2_book root 10732 10535 0 17:14 pts/7 00:00:00 grep 10522# lsof -P -i -n| egrep 'COMMAND|10522'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME--//网络连接已经断开.
--//备库: SYS@bookdg> @ &r/dg/dg PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- RFS 6688 IDLE UNKNOWN N/A 0 0 0 0 0 ARCH 6675 CLOSING ARCH 4 1 698 96256 1755 0 --//进程6690已经消失.# lsof -P -i -n| egrep 'COMMAND|6690'
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME # ps -lef | grep 6690 4 S root 6810 6693 0 76 0 - 12773 pipe_w 17:15 pts/6 00:00:00 grep 66904.出现gap呢?
--//主库执行: $ cd /u01/app/oracle/archivelog/book $ mv 1_707_896605872.dbf 1_707_896605872.dbf_XXX $ mv 1_708_896605872.dbf 1_708_896605872.dbf_xxx --//产生2个间隙.SYS@book> alter system set log_archive_dest_state_2=enable scope=memory ;
System altered.--//可以发现备库没有
$ ls -l /u01/app/oracle/archivelog/book/ total 154556 -rw-r----- 1 oracle oinstall 79360 2017-03-24 16:43:33 1_695_896605872.dbf -rw-r----- 1 oracle oinstall 10252800 2017-03-24 16:43:33 1_696_896605872.dbf -rw-r----- 1 oracle oinstall 14848 2017-03-24 16:43:34 1_697_896605872.dbf -rw-r----- 1 oracle oinstall 50181632 2017-03-24 17:12:09 1_698_896605872.dbf -rw-r----- 1 oracle oinstall 50181632 2017-03-24 17:18:41 1_699_896605872.dbf -rw-r----- 1 oracle oinstall 46716928 2017-03-24 17:18:43 1_700_896605872.dbf -rw-r----- 1 oracle oinstall 72704 2017-03-24 17:18:44 1_701_896605872.dbf -rw-r----- 1 oracle oinstall 69120 2017-03-24 17:18:45 1_702_896605872.dbf -rw-r----- 1 oracle oinstall 2560 2017-03-24 17:18:45 1_703_896605872.dbf -rw-r----- 1 oracle oinstall 272384 2017-03-24 17:18:45 1_704_896605872.dbf -rw-r----- 1 oracle oinstall 137216 2017-03-24 17:23:02 1_705_896605872.dbf -rw-r----- 1 oracle oinstall 4096 2017-03-24 17:25:26 1_706_896605872.dbf -rw-r----- 1 oracle oinstall 55808 2017-03-24 17:25:28 1_709_896605872.dbf--//备库执行:
SYS@bookdg> alter database recover managed standby database using current logfile disconnect ; Database altered.alter database recover managed standby database using current logfile disconnect
Attempt to start background Managed Standby Recovery process (bookdg) Fri Mar 24 17:28:15 2017 MRP0 started with pid=23, OS id=6860 MRP0: Background Managed Standby Recovery process started (bookdg) started logmerger process Fri Mar 24 17:28:20 2017 Managed Standby Recovery starting Real Time Apply Parallel Media Recovery started with 4 slaves Waiting for all non-current ORLs to be archived... All non-current ORLs have been archived. Media Recovery Log /u01/app/oracle/archivelog/book/1_705_896605872.dbf Media Recovery Log /u01/app/oracle/archivelog/book/1_706_896605872.dbf Media Recovery Waiting for thread 1 sequence 707 Fetching gap sequence in thread 1, gap sequence 707-708 Completed: alter database recover managed standby database using current logfile disconnect --//间隙出现.--//主库执行:
$ mv 1_707_896605872.dbf_XXX 1_707_896605872.dbf $ mv 1_708_896605872.dbf_xxx 1_708_896605872.dbf--//备库:
Fri Mar 24 17:29:42 2017 RFS[8]: Assigned to RFS process 6852 RFS[8]: Opened log for thread 1 sequence 707 dbid 1337401710 branch 896605872 Archived Log entry 16 added for thread 1 sequence 707 rlc 896605872 ID 0x4fb7d86e dest 2: Fri Mar 24 17:29:43 2017 Media Recovery Log /u01/app/oracle/archivelog/book/1_707_896605872.dbf Media Recovery Waiting for thread 1 sequence 708 Fetching gap sequence in thread 1, gap sequence 708-708 Fri Mar 24 17:29:53 2017 RFS[8]: Opened log for thread 1 sequence 708 dbid 1337401710 branch 896605872 Archived Log entry 17 added for thread 1 sequence 708 rlc 896605872 ID 0x4fb7d86e dest 2: Fri Mar 24 17:29:54 2017 Media Recovery Log /u01/app/oracle/archivelog/book/1_708_896605872.dbf Media Recovery Log /u01/app/oracle/archivelog/book/1_709_896605872.dbf Media Recovery Waiting for thread 1 sequence 710 (in transit) Recovery of Online Redo Log: Thread 1 Group 5 Seq 710 Reading mem 0 Mem# 0: /mnt/ramdisk/book/redostb02.logSYS@bookdg> @ &r/dg/dg
PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- RFS 6852 IDLE UNKNOWN N/A 0 0 0 0 0 RFS 6849 WRITING LGWR 1 1 710 307 1 0 ARCH 6675 CLOSING ARCH 4 1 709 1 108 0 MRP0 6860 APPLYING_LOG N/A N/A 1 710 306 102400 0--//指派进程6852接收.接收完成变成status=IDEL.
# lsof -P -i -n| egrep 'COMMAND|6852'
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME oracle 6852 oracle 14u IPv6 430265874 TCP 192.168.100.40:1521->192.168.100.78:19255 (ESTABLISHED)--//主库:
SYS@book> @ &r/dg/dg PROCESS PID STATUS CLIENT_P GROUP# THREAD# SEQUENCE# BLOCK# BLOCKS DELAY_MINS --------- ------- ------------ -------- ------ ------- ---------- ---------- ---------- ---------- LNS 10522 WRITING LNS 1 1 710 488 1 0 ARCH 10476 CLOSING ARCH N/A 1 708 1 31 0# lsof -P -i -n| egrep 'COMMAND|19255'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME oracle 10476 oracle 10w IPv4 25402671 0t0 TCP 192.168.100.78:19255->192.168.100.40:1521 (ESTABLISHED)--//可以发现oracle使用 进程号10476来传输.PID=10476进程是arch进程,估计arch进程定时检查gap,传输gap日志到备库.也许还有其他
--//方法,仅仅探究到这里. # ps -lef | egrep 'UID|10476' F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD 0 S oracle 10476 1 0 80 0 - 81160 semtim 16:42 ? 00:00:01 ora_arc0_book 0 S root 10917 10535 0 80 0 - 15311 pipe_w 17:35 pts/7 00:00:00 egrep UID|10476转载地址:http://nibsx.baihongyu.com/