[20170324]dg相關程式.txt
[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 Production
2.探究:
--//主庫(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
--//沒有連線.從這個連結 :http://blog.itpub.net/267265/viewspace-2135449/
--//已經發現實際上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 6690
4.出現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.log
SYS@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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2136038/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DG相關指令碼指令碼
- 【DG】搭建(二)及相關測試
- [20230306]學習UNIFIED audit--dg相關問題.txtNifi
- DG學習筆記(12)_相關檢視筆記
- 與oracle10g data guard(dg)緊密關聯的相關檢視Oracle
- [20170315]簡單探究dg的mrp程式.txt
- [20200422]瞭解相關程式的環境變數.txt變數
- [Linux]——程式管理相關Linux
- 【DG】物理DG中LNSn、NSS、NSA程式
- [20180413]熱備模式相關問題.txt模式
- [20161008]修改dg模式.txt模式
- Windows API 程式相關筆記WindowsAPI筆記
- HTTP相關的應用程式HTTP
- 程式和執行緒相關執行緒
- 與browser相關的程式碼
- ORB 相關的次程式碼ORB
- Springboot小程式相關Spring Boot
- [20170324]cpu 100%,latch free等待分析
- [20180413]熱備模式相關問題2.txt模式
- jQuery陣列相關操作程式碼jQuery陣列
- [20190328]簡單探究sql語句相關mutexes.txtSQLMutex
- [20160815]查詢相關表的sql語句.txtSQL
- [20191220]關於共享記憶體段相關問題.txt記憶體
- NNLM初認識以及相關程式碼
- java基礎部分程式碼相關題Java
- [20190929]bash使用bc計算的相關問題.txt
- [20190329]探究sql語句相關mutexes補充2.txtSQLMutex
- [20170203]dg磁碟空間不足的處理.txt
- [20170803]如何檢視dg的redo應用率.txt
- [20191223]關於共享記憶體段相關問題3.txt記憶體
- 程式設計師的相關笑話(一)程式設計師
- Android技能樹 — 多程式相關小結Android
- C#並行程式設計-相關概念C#並行行程程式設計
- javascript物件導向相關程式碼例項JavaScript物件
- Linux下程式相關:fork(),wait(),exec()LinuxAI
- Linux 程式和網路埠相關命令Linux
- 一些程式設計相關的分享程式設計
- 記錄shell指令碼程式設計相關指令碼程式設計