Tuesday, July 25, 2006

Verifying the logical standby database

I start up the logical standby database by the following steps:
set ORACLE_SID=
sqlplus /nolog
SQL> connect /as sysdba
SQL> startup mount
SQL> alter database guard all
SQL> alter database open
SQL> alter database start logical standby apply;

Verify (http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96653/create_ls.htm#1061182)
Step 1: Verify that the redo logs have been registered
connect to logical standby and qurey:
SQL> alter session set nls_date_format = 'DD-MON-YY HH24:MI:SS';
SQL> select sequence#, first_time, next_time, dict_begin, dict_end
2> from dba_logstdby_log order by sequence#;

SEQUENCE# FIRST_TIME NEXT_TIME DIC DIC
---------- ------------------ ------------------ --- ---
794 23-JUL-06 21:54:09 23-JUL-06 21:54:12 YES NO
795 23-JUL-06 21:54:12 23-JUL-06 21:54:14 NO NO
796 23-JUL-06 21:54:14 23-JUL-06 21:54:16 NO NO
797 23-JUL-06 21:54:16 23-JUL-06 21:54:18 NO NO
798 23-JUL-06 21:54:18 23-JUL-06 21:54:20 NO YES
799 23-JUL-06 21:54:20 23-JUL-06 21:56:59 NO NO
800 23-JUL-06 21:56:59 23-JUL-06 23:20:21 NO NO
801 23-JUL-06 23:20:21 23-JUL-06 23:27:10 NO NO
802 23-JUL-06 23:27:10 24-JUL-06 23:14:50 NO NO
803 24-JUL-06 23:14:50 24-JUL-06 23:21:04 NO NO
804 24-JUL-06 23:21:04 24-JUL-06 23:21:08 NO NO

SEQUENCE# FIRST_TIME NEXT_TIME DIC DIC
---------- ------------------ ------------------ --- ---
805 24-JUL-06 23:21:08 24-JUL-06 23:21:10 NO NO

Step 2 Archive some redo logs
Connect to the primary database and archive some redo logs
SQL> alter system archive log current;
SQL> alter system archive log current;

Step 3 Query the DBA_LOGSTDBY_LOG view again
SEQUENCE# FIRST_TIME NEXT_TIME DIC DIC
---------- ------------------ ------------------ --- ---
794 23-JUL-06 21:54:09 23-JUL-06 21:54:12 YES NO
795 23-JUL-06 21:54:12 23-JUL-06 21:54:14 NO NO
796 23-JUL-06 21:54:14 23-JUL-06 21:54:16 NO NO
797 23-JUL-06 21:54:16 23-JUL-06 21:54:18 NO NO
798 23-JUL-06 21:54:18 23-JUL-06 21:54:20 NO YES
799 23-JUL-06 21:54:20 23-JUL-06 21:56:59 NO NO
800 23-JUL-06 21:56:59 23-JUL-06 23:20:21 NO NO
801 23-JUL-06 23:20:21 23-JUL-06 23:27:10 NO NO
802 23-JUL-06 23:27:10 24-JUL-06 23:14:50 NO NO
803 24-JUL-06 23:14:50 24-JUL-06 23:21:04 NO NO
804 24-JUL-06 23:21:04 24-JUL-06 23:21:08 NO NO

SEQUENCE# FIRST_TIME NEXT_TIME DIC DIC
---------- ------------------ ------------------ --- ---
805 24-JUL-06 23:21:08 24-JUL-06 23:21:10 NO NO
806 24-JUL-06 23:21:10 25-JUL-06 14:15:00 NO NO
807 25-JUL-06 14:15:00 25-JUL-06 14:15:03 NO NO
Step 4 Verify that data from the redo logs is being applied correctly
On the logical standby
SQL> select name, value from v$logstdby_stats where name='coordinator state';
coordinator state
APPLYING

Step 5 View the V$LOGSTDBY view to see current SQL apply activity
SQL> column status format a50
SQL> column type format a12
SQL> select type, high_scn, status from v$logstdby;

Step 6 Check the overall progress of log apply services
SQL> select applied_scn, newest_scn from dba_logstdby_progress;
APPLIED_SCN NEWEST_SCN
----------- ----------
360712 360712
When the numbers in the APPLIED_SCN and NEWEST_SCN columns are equal (as shown in the query example), it means that all of the available data in the redo log was applied. These values can be compared to the values in the FIRST_CHANGE# column in the DBA_LOGSTDBY_LOG view to see how much log information has to be applied and how much remains.

No comments: