主库启动instance和lsnr,在备库启动lsnr后,在dg启动的各个阶段,dg都做了什么呢:启动了那些进程?什么时候会传归档?什么时候开始应用归档?
1.备库关闭时。
1.1 检查备库进程:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[oracle@standby1 arch]$ sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.4.0 - Production on Fri Jan 11 23:52:25 2008 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to an idle instance. > > !ps -ef |grep ora_ oracle 3917 3915 0 23:52 pts/1 00:00:00 /bin/bash -c ps -ef |grep ora_ oracle 3919 3917 0 23:52 pts/1 00:00:00 grep ora_ |
1.2 备库arch目录:
1 2 3 4 5 6 |
[oracle@standby1 arch]$ ll total 328 -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000040.arc -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000041.arc -rw-r----- 1 oracle dba 1024 Jan 10 01:04 oradg_0001_0000000042.arc -rw-r----- 1 oracle dba 302080 Jan 10 01:11 oradg_0001_0000000043.arc |
1.3 此时在主库switch logfile,arch不会传到备库,在主库上检查v$archived_log,也发现日志不会applied:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
SQL> select SEQUENCE#,DEST_ID,ARCHIVED,APPLIED,DELETED,STATUS from v$archived_log order by SEQUENCE# 2 / SEQUENCE# DEST_ID ARCHIV APPLIE DELETE ST ---------- ---------- ------ ------ ------ -- 20 2 YES YES NO A 21 2 YES YES NO A 22 2 YES YES NO A 23 2 YES YES NO A 24 2 YES YES NO A 25 2 YES YES NO A 26 2 YES YES NO A 27 2 YES YES NO A 28 0 YES YES NO A 29 0 YES YES NO A 30 0 YES YES NO A 31 0 YES YES NO A 32 0 YES YES NO A 33 0 YES YES NO A 34 0 YES YES NO A 35 0 YES YES NO A 36 0 YES YES NO A 37 0 YES YES NO A 38 0 YES YES NO A 39 0 YES YES NO A 40 0 YES YES NO A 41 2 YES YES NO A 42 2 YES YES NO A 43 2 YES YES NO A 44 1 YES NO NO A 45 1 YES NO NO A 46 1 YES NO NO A 27 rows selected. |
1.4 备库alertlog只有上次的信息:
1 2 3 4 5 6 7 |
…… ARC0: Archival stopped Sat Jan 12 00:39:57 2008 ARCH: Archiving is disabled Shutting down archive processes Archiving is disabled Archive process shutdown avoided: 0 active |
2.备库startup nomount
2.1 检查备库进程:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
> startup nomount; ORACLE instance started. Total System Global Area 370218244 bytes Fixed Size 451844 bytes Variable Size 167772160 bytes Database Buffers 201326592 bytes Redo Buffers 667648 bytes > !ps -ef |grep ora_ oracle 4251 1 1 00:42 ? 00:00:00 ora_pmon_oradg oracle 4253 1 0 00:42 ? 00:00:00 ora_dbw0_oradg oracle 4255 1 0 00:42 ? 00:00:00 ora_lgwr_oradg oracle 4257 1 1 00:42 ? 00:00:00 ora_ckpt_oradg oracle 4259 1 1 00:42 ? 00:00:00 ora_smon_oradg oracle 4261 1 1 00:42 ? 00:00:00 ora_reco_oradg oracle 4263 1 1 00:42 ? 00:00:00 ora_cjq0_oradg oracle 4265 1 0 00:42 ? 00:00:00 ora_qmn0_oradg oracle 4267 1 0 00:42 ? 00:00:00 ora_s000_oradg oracle 4269 1 1 00:42 ? 00:00:00 ora_d000_oradg oracle 4271 1 1 00:42 ? 00:00:00 ora_arc0_oradg oracle 4273 1 0 00:42 ? 00:00:00 ora_arc1_oradg oracle 4275 4245 0 00:42 pts/1 00:00:00 /bin/bash -c ps -ef |grep ora_ |
这些进程的数量和主库一致。
2.2 备库arch目录:
1 2 3 4 5 6 |
[oracle@standby1 arch]$ ll total 328 -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000040.arc -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000041.arc -rw-r----- 1 oracle dba 1024 Jan 10 01:04 oradg_0001_0000000042.arc -rw-r----- 1 oracle dba 302080 Jan 10 01:11 oradg_0001_0000000043.arc |
发现备库的arch没有增加,也就是说,arch没有被传输到备库。
2.3 检查主库上检查v$archived_log,发现还是没有applied日志(连传都没有传过去,当然不会applied):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
SQL> / SEQUENCE# DEST_ID ARCHIV APPLIE DELETE ST ---------- ---------- ------ ------ ------ -- 24 2 YES YES NO A 25 2 YES YES NO A 26 2 YES YES NO A 27 2 YES YES NO A 28 0 YES YES NO A 29 0 YES YES NO A 30 0 YES YES NO A 31 0 YES YES NO A 32 0 YES YES NO A 33 0 YES YES NO A 34 0 YES YES NO A 35 0 YES YES NO A 36 0 YES YES NO A 37 0 YES YES NO A 38 0 YES YES NO A 39 0 YES YES NO A 40 0 YES YES NO A 41 2 YES YES NO A 42 2 YES YES NO A 43 2 YES YES NO A 44 1 YES NO NO A 45 1 YES NO NO A 46 1 YES NO NO A 47 1 YES NO NO A 48 1 YES NO NO A 49 1 YES NO NO A 50 1 YES NO NO A 51 1 YES NO NO A 52 1 YES NO NO A |
2.4 备库alertlog上却出现了报错信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
Sat Jan 12 00:41:43 2008 Starting ORACLE instance (normal) LICENSE_MAX_SESSION = 0 LICENSE_SESSIONS_WARNING = 0 SCN scheme 2 Using log_archive_dest parameter default value LICENSE_MAX_USERS = 0 SYS auditing is disabled Starting up ORACLE RDBMS Version: 9.2.0.4.0. System parameters with non-default values: processes = 150 timed_statistics = TRUE shared_pool_size = 67108864 large_pool_size = 50331648 java_pool_size = 33554432 control_files = /oracle/oradata/oradg/control01.ctl, /oracle/oradata/oradg/control02.ctl, /oracle/oradata/oradg/control03.ctl db_block_size = 8192 db_cache_size = 201326592 compatible = 9.2.0.0.0 log_archive_start = TRUE log_archive_dest_1 = LOCATION=/oracle/arch/ log_archive_dest_2 = SERVICE=standby optional standby_archive_dest = /oracle/arch log_archive_format = oradg_%T_%S.arc db_file_multiblock_read_count= 16 fast_start_mttr_target = 300 undo_management = AUTO undo_tablespace = UNDOTBS1 undo_retention = 10800 remote_login_passwordfile= EXCLUSIVE db_domain = instance_name = oradg dispatchers = (PROTOCOL=TCP) (SERVICE=oradgXDB) job_queue_processes = 10 hash_join_enabled = TRUE background_dump_dest = /oracle/admin/oradg/bdump user_dump_dest = /oracle/admin/oradg/udump core_dump_dest = /oracle/admin/oradg/cdump sort_area_size = 524288 db_name = oradg open_cursors = 300 star_transformation_enabled= FALSE query_rewrite_enabled = FALSE pga_aggregate_target = 82837504 aq_tm_processes = 1 PMON started with pid=2 DBW0 started with pid=3 LGWR started with pid=4 CKPT started with pid=5 SMON started with pid=6 CJQ0 started with pid=8 RECO started with pid=7 Sat Jan 12 00:41:44 2008 starting up 1 shared server(s) ... QMN0 started with pid=9 Sat Jan 12 00:41:44 2008 starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'... ARCH: STARTING ARCH PROCESSES Sat Jan 12 00:42:53 2008 ARCH: STARTING ARCH PROCESSES COMPLETE ARC1 started with pid=13 ARC1: Archival started ARC1: Thread not mounted ARC0 started with pid=12 ARC0: Archival started ARC0: Thread not mounted Sat Jan 12 00:43:41 2008 Restarting dead background process QMN0 QMN0 started with pid=9 destination database instance is 'started' not 'mounted' Sat Jan 12 00:49:08 2008 Restarting dead background process QMN0 QMN0 started with pid=15 Sat Jan 12 00:50:47 2008 RFS: Possible network disconnect with primary database destination database instance is 'started' not 'mounted' Sat Jan 12 00:50:47 2008 destination database instance is 'started' not 'mounted' RFS: Possible network disconnect with primary database Sat Jan 12 00:51:13 2008 RFS: Possible network disconnect with primary database destination database instance is 'started' not 'mounted' Sat Jan 12 00:51:13 2008 destination database instance is 'started' not 'mounted' Sat Jan 12 00:51:13 2008 RFS: Possible network disconnect with primary database Sat Jan 12 00:51:13 2008 RFS: Possible network disconnect with primary database Sat Jan 12 00:51:14 2008 destination database instance is 'started' not 'mounted'-------------注意这里附近 Sat Jan 12 00:51:14 2008 destination database instance is 'started' not 'mounted' RFS: Possible network disconnect with primary database |
这里的destination database是指备机本身,这个报错信息会定时出现,即每当在主库在switch logfile的时候出现。
RFS服务是指Remote File Server服务,负责传输arch日志。此时RFS服务报错,因此arch也无法传输过来。
3.备库到mount状态。
3.1 检查备库进程:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
> alter database mount standby database; Database altered. Elapsed: 00:00:04.23 > !ps -ef |grep ora_ oracle 4251 1 0 00:47 ? 00:00:01 ora_pmon_oradg oracle 4253 1 0 00:47 ? 00:00:00 ora_dbw0_oradg oracle 4255 1 0 00:47 ? 00:00:00 ora_lgwr_oradg oracle 4257 1 0 00:47 ? 00:00:00 ora_ckpt_oradg oracle 4259 1 0 00:47 ? 00:00:00 ora_smon_oradg oracle 4261 1 0 00:47 ? 00:00:00 ora_reco_oradg oracle 4263 1 0 00:47 ? 00:00:00 ora_cjq0_oradg oracle 4267 1 0 00:47 ? 00:00:00 ora_s000_oradg oracle 4269 1 0 00:47 ? 00:00:00 ora_d000_oradg oracle 4271 1 0 00:47 ? 00:00:00 ora_arc0_oradg oracle 4273 1 0 00:47 ? 00:00:00 ora_arc1_oradg oracle 4452 4245 0 01:04 pts/1 00:00:00 /bin/bash -c ps -ef |grep ora_ |
发现进程数还是和原来一样。
3.2 备库arch目录:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[oracle@standby1 arch]$ ll [oracle@standby1 arch]$ ll total 4908 -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000040.arc -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000041.arc -rw-r----- 1 oracle dba 1024 Jan 10 01:04 oradg_0001_0000000042.arc -rw-r----- 1 oracle dba 302080 Jan 10 01:11 oradg_0001_0000000043.arc -rw-r----- 1 oracle dba 889856 Jan 12 00:04 oradg_0001_0000000044.arc -rw-r----- 1 oracle dba 35328 Jan 12 00:04 oradg_0001_0000000045.arc -rw-r----- 1 oracle dba 1536 Jan 12 00:04 oradg_0001_0000000046.arc …… -rw-r----- 1 oracle dba 34816 Jan 12 01:10 oradg_0001_0000000092.arc -rw-r----- 1 oracle dba 1024 Jan 12 01:10 oradg_0001_0000000093.arc -rw-r----- 1 oracle dba 1536 Jan 12 01:10 oradg_0001_0000000094.arc -rw-r----- 1 oracle dba 1024 Jan 12 01:10 oradg_0001_0000000095.arc -rw-r----- 1 oracle dba 1024 Jan 12 01:10 oradg_0001_0000000096.arc |
发现备库的arch已经传输过来。
3.3 检查主库上检查v$archived_log,发现文件虽然已经传到备库,还是没有applied日志(MRP进程没起来):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
SQL> select SEQUENCE#,DEST_ID,ARCHIVED,APPLIED,DELETED,STATUS from v$archived_log order by SEQUENCE# 2 / SEQUENCE# DEST_ID ARCHIV APPLIE DELETE ST ---------- ---------- ------ ------ ------ -- 24 2 YES YES NO A 25 2 YES YES NO A 26 2 YES YES NO A 27 2 YES YES NO A 28 0 YES YES NO A 29 0 YES YES NO A 30 0 YES YES NO A 31 0 YES YES NO A 32 0 YES YES NO A 33 0 YES YES NO A 34 0 YES YES NO A 35 0 YES YES NO A 36 0 YES YES NO A 37 0 YES YES NO A 38 0 YES YES NO A 39 0 YES YES NO A 40 0 YES YES NO A 41 2 YES YES NO A 42 2 YES YES NO A 43 2 YES YES NO A 44 1 YES NO NO A 44 2 YES NO NO A 45 1 YES NO NO A 45 2 YES NO NO A 46 1 YES NO NO A 46 2 YES NO NO A 47 1 YES NO NO A …… 94 2 YES NO NO A 95 1 YES NO NO A 95 2 YES NO NO A 96 1 YES NO NO A 96 2 YES NO NO A |
3.4 备库alertlog的信息:
1 2 3 4 5 6 |
alter database mount standby database Sat Jan 12 01:09:29 2008 Successful mount of redo thread 1, with mount id 2634673925. Sat Jan 12 01:09:29 2008 Standby Database mounted. Completed: alter database mount standby database |
基本就一个启动到mount的信息,没别的。
4. 备库启动到recover managed状态
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
> alter database recover managed standby database disconnect from session; Database altered. Elapsed: 00:00:06.17 > !ps -ef |grep ora_ oracle 4528 1 0 01:11 ? 00:00:00 ora_pmon_oradg oracle 4530 1 0 01:11 ? 00:00:00 ora_dbw0_oradg oracle 4532 1 0 01:11 ? 00:00:00 ora_lgwr_oradg oracle 4534 1 0 01:11 ? 00:00:00 ora_ckpt_oradg oracle 4536 1 0 01:11 ? 00:00:00 ora_smon_oradg oracle 4538 1 0 01:11 ? 00:00:00 ora_reco_oradg oracle 4540 1 0 01:11 ? 00:00:00 ora_cjq0_oradg oracle 4544 1 0 01:11 ? 00:00:00 ora_s000_oradg oracle 4546 1 0 01:11 ? 00:00:00 ora_d000_oradg oracle 4548 1 0 01:11 ? 00:00:00 ora_arc0_oradg oracle 4550 1 0 01:11 ? 00:00:00 ora_arc1_oradg oracle 5064 1 5 01:18 ? 00:00:02 ora_mrp0_oradg<-------注意此处,mrp进程已经起来 oracle 5065 4245 0 01:18 pts/1 00:00:00 /bin/bash -c ps -ef |grep ora_ |
发现mrp进程已经起来。
4.2 备库arch目录:
1 2 3 4 5 6 7 8 9 10 11 12 |
[oracle@standby1 arch]$ ll [oracle@standby1 arch]$ ll total 4908 -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000040.arc -rw-r----- 1 oracle dba 1536 Jan 10 01:04 oradg_0001_0000000041.arc -rw-r----- 1 oracle dba 1024 Jan 10 01:04 oradg_0001_0000000042.arc …… -rw-r----- 1 oracle dba 34816 Jan 12 01:10 oradg_0001_0000000092.arc -rw-r----- 1 oracle dba 1024 Jan 12 01:10 oradg_0001_0000000093.arc -rw-r----- 1 oracle dba 1536 Jan 12 01:10 oradg_0001_0000000094.arc -rw-r----- 1 oracle dba 1024 Jan 12 01:10 oradg_0001_0000000095.arc -rw-r----- 1 oracle dba 1024 Jan 12 01:10 oradg_0001_0000000096.arc |
还是原来的。
4.3 检查主库上检查v$archived_log,发现归档已经applied:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
SQL> / SEQUENCE# DEST_ID ARCHIV APPLIE DELETE ST ---------- ---------- ------ ------ ------ -- 24 2 YES YES NO A 25 2 YES YES NO A 26 2 YES YES NO A 27 2 YES YES NO A 28 0 YES YES NO A 29 0 YES YES NO A 30 0 YES YES NO A 31 0 YES YES NO A 32 0 YES YES NO A 33 0 YES YES NO A 34 0 YES YES NO A 35 0 YES YES NO A 36 0 YES YES NO A 37 0 YES YES NO A 38 0 YES YES NO A …… 92 1 YES NO NO A 92 2 YES NO NO A 93 1 YES NO NO A 93 2 YES NO NO A 94 1 YES NO NO A 94 2 YES NO NO A 95 1 YES NO NO A 95 2 YES NO NO A 96 1 YES NO NO A 96 2 YES YES NO A 126 rows selected. |
4.4 备库alertlog的信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
…… alter database recover managed standby database disconnect from session Sat Jan 12 01:18:09 2008 Attempt to start background Managed Standby Recovery process MRP0 started with pid=16 MRP0: Background Managed Standby Recovery process started Starting datafile 1 recovery in thread 1 sequence 44 Datafile 1: '/oracle/oradata/oradg/system01.dbf' Starting datafile 2 recovery in thread 1 sequence 44 Datafile 2: '/oracle/oradata/oradg/undotbs01.dbf' Starting datafile 3 recovery in thread 1 sequence 44 Datafile 3: '/oracle/oradata/oradg/cwmlite01.dbf' Starting datafile 4 recovery in thread 1 sequence 44 Datafile 4: '/oracle/oradata/oradg/drsys01.dbf' Starting datafile 5 recovery in thread 1 sequence 44 Datafile 5: '/oracle/oradata/oradg/example01.dbf' Starting datafile 6 recovery in thread 1 sequence 44 …… Datafile 9: '/oracle/oradata/oradg/users01.dbf' Starting datafile 10 recovery in thread 1 sequence 44 Datafile 10: '/oracle/oradata/oradg/xdb01.dbf' Starting datafile 11 recovery in thread 1 sequence 44 Datafile 11: '/oracle/oradata/oradg/ts_mssm_01.dbf' Media Recovery Log /oracle/arch/oradg_0001_0000000044.arc Sat Jan 12 01:18:15 2008 Completed: alter database recover managed standby database di Sat Jan 12 01:18:15 2008 Media Recovery Log /oracle/arch/oradg_0001_0000000045.arc Media Recovery Log /oracle/arch/oradg_0001_0000000046.arc …… Media Recovery Log /oracle/arch/oradg_0001_0000000089.arc Media Recovery Log /oracle/arch/oradg_0001_0000000090.arc Media Recovery Log /oracle/arch/oradg_0001_0000000091.arc Media Recovery Log /oracle/arch/oradg_0001_0000000092.arc Media Recovery Log /oracle/arch/oradg_0001_0000000093.arc Media Recovery Log /oracle/arch/oradg_0001_0000000094.arc Media Recovery Log /oracle/arch/oradg_0001_0000000095.arc Media Recovery Log /oracle/arch/oradg_0001_0000000096.arc Media Recovery Waiting for thread 1 seq# 97 Sat Jan 12 01:22:05 2008 |
总结:备库在起来时:
1 2 3 |
1.nomount:rfs服务没有起,因此主库文件不会传到备库;mrp进程没有起,因此也不会做recover,归档不会applied。 2.mount:rfs服务启动,主库的归档能传输到备库(可以在主库switchlogfile几次,会发现归档已经传输过去);mrp进程没有启动,归档不applied。 3.recover managed:rfs在上一步已经启动,归档能传输到备库;且mrp进程已经起来,apply 归档日志! |
一条评论
分析过程层次很清析,很好