配置standby
--创建standby logfile
[Oracle@dgstb ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Feb 13 23:37:19 2014
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select status from v$instance;
STATUS
------------------------
MOUNTED
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/standby/standby01.log') size 50M;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/standby/standby02.log') size 50M;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/standby/standby03.log') size 50M;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/standby/standby04.log') size 50M;
Database altered.
--打开standby apply log,这里我创建了standby redo logfile,所以可以使用using current logfile来实时应用
--可以在standby db使用alter database recover managed standby database cancel命令停止apply日志来测试DG同步效果,之后再alter database recover managed standby database using current logfile disconnect from session应用日志
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
SQL> select sequence#,applied from v$archived_log;
SEQUENCE# APP
---------- ---
19 YES
20 YES
18 YES
21 YES
17 YES
22 YES
23 YES
24 YES
8 rows selected.
SQL> select sequence#,applied from v$archived_log where applied='YES';
SEQUENCE# APP
---------- ---
19 YES
20 YES
18 YES
21 YES
17 YES
22 YES
23 YES
24 YES
8 rows selected.
#至此物理DataGuard搭建完成
*********************************************
--primary状态
SQL> select database_role,protection_mode,switchover_status,name from v$database;
DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS NAME
---------------- -------------------- -------------------- ---------
PRIMARY MAXIMUM PERFORMANCE TO STANDBY DBSERVER
*********************************************
--standby状态
SQL> select database_role,protection_mode,switchover_status,name from v$database;
DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS NAME
---------------- -------------------- -------------------- ---------
PHYSICAL STANDBY MAXIMUM PERFORMANCE SESSIONS ACTIVE DBSERVER
*********************************************
--primary alert.log
[oracle@vzwc bdump]$ tail -f alert_ORCL.log
Thu Feb 13 23:42:25 2014
Thread 1 advanced to log sequence 24 (LGWR switch)
Current log# 1 seq# 24 mem# 0: /u01/app/oracle/oradata/dbserver/redo01.log
Thu Feb 13 23:42:25 2014
LNS: Standby redo logfile selected for thread 1 sequence 24 for destination LOG_ARCHIVE_DEST_2
Thu Feb 13 23:46:44 2014
Thread 1 advanced to log sequence 25 (LGWR switch)
Current log# 3 seq# 25 mem# 0: /u01/app/oracle/oradata/dbserver/redo03.log
Thu Feb 13 23:46:44 2014
LNS: Standby redo logfile selected for thread 1 sequence 25 for destination LOG_ARCHIVE_DEST_2
Thu Feb 13 23:57:59 2014
Thread 1 advanced to log sequence 26 (LGWR switch)
Current log# 2 seq# 26 mem# 0: /u01/app/oracle/oradata/dbserver/redo02.log
Thu Feb 13 23:57:59 2014
LNS: Standby redo logfile selected for thread 1 sequence 26 for destination LOG_ARCHIVE_DEST_2
Thu Feb 13 23:58:00 2014
Thread 1 advanced to log sequence 27 (LGWR switch)
Current log# 1 seq# 27 mem# 0: /u01/app/oracle/oradata/dbserver/redo01.log
Thu Feb 13 23:58:00 2014
LNS: Standby redo logfile selected for thread 1 sequence 27 for destination LOG_ARCHIVE_DEST_2
Thu Feb 13 23:58:00 2014
Thread 1 cannot allocate new log, sequence 28
Checkpoint not complete
Current log# 1 seq# 27 mem# 0: /u01/app/oracle/oradata/dbserver/redo01.log
Thu Feb 13 23:58:05 2014
Thread 1 advanced to log sequence 28 (LGWR switch)
Current log# 3 seq# 28 mem# 0: /u01/app/oracle/oradata/dbserver/redo03.log
Thu Feb 13 23:58:05 2014
LNS: Standby redo logfile selected for thread 1 sequence 28 for destination LOG_ARCHIVE_DEST_2
*********************************************
--standby alert.log
[oracle@dgstb bdump]$ tail -f alert_standby.log
Mem# 0: /u01/app/oracle/oradata/standby/standby01.log
Thu Feb 13 23:58:05 2014
Primary database is in MAXIMUM PERFORMANCE mode
RFS[7]: Successfully opened standby log 4: '/u01/app/oracle/oradata/standby/standby01.log'
Thu Feb 13 23:58:06 2014
Media Recovery Log /arch/ARC0000000027_0839199018.0001
Media Recovery Waiting for thread 1 sequence 28 (in transit)
Thu Feb 13 23:58:06 2014
Recovery of Online Redo Log: Thread 1 Group 4 Seq 28 Reading mem 0
Mem# 0: /u01/app/oracle/oradata/standby/standby01.log
