After completing this lesson, you should be able to use
SQL commands to create a logical standby database.
8-2 Copyright 2006, Oracle. All rights reserved.
Preparing to Create a Logical Standby Database
As preparation for creating a logical standby database,
perform the following steps on the primary database: Check for unsupported data types. Be aware of unsupported DDL commands. Ensure row uniqueness. Verify that the primary database is configured for ARCHIVELOG mode. Enable supplemental logging. Check the values of the initialization parameters.
8-3 Copyright 2006, Oracle. All rights reserved.
Creating a Logical Standby Database
To create a logical standby database by using SQL
commands: 1. Create a physical standby database. 2. Stop Redo Apply on the physical standby database. 3. Prepare the primary database to support a logical standby database. 4. Build a LogMiner Dictionary in the redo data. 5. Convert to a logical standby database. 6. Open the logical standby database. 7. Verify that the logical standby database is performing properly.
8-4 Copyright 2006, Oracle. All rights reserved.
Step 1: Create a Physical Standby Database
a. Create a physical standby database.
b. Ensure that the physical standby database is caught up to the primary database.
8-5 Copyright 2006, Oracle. All rights reserved.
Step 2: Stop Redo Apply on the Physical Standby Database
Before converting the physical standby database to a
logical standby database, stop Redo Apply. Required to avoid applying changes past the redo that contains the LogMiner dictionary.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY
2 DATABASE CANCEL;
8-6 Copyright 2006, Oracle. All rights reserved.
Step 3: Prepare the Primary Database to Support a Logical Standby Database
a. Prepare the primary database for role transitions by
setting LOG_ARCHIVE_DEST_n parameters appropriately. b. Set the LOG_ARCHIVE_DEST_3 initialization parameter for transitioning to a logical standby role. LOG_ARCHIVE_DEST_3= 'LOCATION=/arch/chicago/ VALID_FOR=(STANDBY_LOGFILES, STANDBY_ROLE) DB_UNIQUE_NAME=chicago' LOG_ARCHIVE_DEST_STATE_3=enable
c. Set the value of UNDO_RETENTION to 3600.
8-7 Copyright 2006, Oracle. All rights reserved.
Step 4: Build a LogMiner Dictionary in the Redo Data
Build a LogMiner dictionary in the redo data so that
SQL Apply can properly interpret changes in the redo. Supplemental logging is automatically enabled.
SQL> EXECUTE DBMS_LOGSTDBY.BUILD;
8-8 Copyright 2006, Oracle. All rights reserved.
Step 5: Transition to a Logical Standby Database
a. Convert to a logical standby database.
SQL> ALTER DATABASE RECOVER TO
2 LOGICAL STANDBY db_name;
b. Create a new password file.
c. Shut down the instance and restart it in MOUNT mode. d. Adjust initialization parameters: LOG_ARCHIVE_DEST_n
8-9 Copyright 2006, Oracle. All rights reserved.
Step 6: Open the Logical Standby Database
a. Open the new logical standby database with the
RESETLOGS option:
SQL> ALTER DATABASE OPEN RESETLOGS;
b. Start the application of redo data to the logical standby
database:
SQL> ALTER DATABASE START LOGICAL STANDBY
2 APPLY IMMEDIATE;
8 - 10 Copyright 2006, Oracle. All rights reserved.
Step 7: Verify That the Logical Standby Database Is Performing Properly
a. Verify that the archived redo log files were registered:
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME, 2 DICT_BEGIN, DICT_END 3 FROM DBA_LOGSTDBY_LOG ORDER BY SEQUENCE#;
b. Begin sending redo data to the standby database:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
c. Query the DBA_LOGSTDBY_LOG view to verify that the
archived redo log files were registered.
8 - 11 Copyright 2006, Oracle. All rights reserved.
Step 7: Verify That the Logical Standby Database Is Performing Properly
d. Verify that redo data is being applied correctly:
SQL> SELECT NAME, VALUE FROM V$LOGSTDBY_STATS 2 WHERE NAME = 'coordinator state';
e. View the V$LOGSTDBY view to see current
SQL Apply activity: SQL> SELECT TYPE, HIGH_SCN, STATUS 2 FROM V$LOGSTDBY;
f. Check the overall progress of SQL Apply:
SQL> SELECT APPLIED_SCN, LATEST_SCN 2 FROM V$LOGSTDBY_PROGRESS;
8 - 12 Copyright 2006, Oracle. All rights reserved.
Additional Configuration Tasks
Perform the following tasks as appropriate for your
configuration: Configure standby redo logs. Enable Flashback Database. Upgrade the data protection mode.
8 - 13 Copyright 2006, Oracle. All rights reserved.
Summary
In this lesson, you should have learned how to use SQL
commands to create a logical standby database.
8 - 14 Copyright 2006, Oracle. All rights reserved.