Step by Step Guide on How to Create Logical Standby [ID 738643.1]
Goal
Step by Step Guide on How to Create Logical StandbySolution
Prerequisite1 : Before setting up a logical standby database, ensure the logical standby database can maintain the data types and tables in your primary database. See Appendix C of the dataguard documentation for a complete list of data type and storage type considerations.
2 : Ensure Table Rows in the Primary Database Can Be Uniquely Identified.
2.1 : Find Tables Without Unique Logical Identifier in the Primary Database.
Use following query to display a list of tables that SQL Apply may not be able to uniquely identify:
SQL> SELECT OWNER, TABLE_NAME FROM DBA_LOGSTDBY_NOT_UNIQUE WHERE (OWNER, TABLE_NAME) NOT IN (SELECT DISTINCT OWNER, TABLE_NAME FROM DBA_LOGSTDBY_UNSUPPORTED) AND BAD_COLUMN = 'Y'
2.2 : If your application ensures the rows in a table are unique, you can create a disabled primary key RELY constraint on the table. Use ALTER TABLE command to add a disabled primary-key RELY constraint.
The following example creates a disabled RELY constraint on a table named mytab, for which rows can be uniquely identified using the id and name columns:
SQL> ALTER TABLE mytab ADD PRIMARY KEY (id, name) RELY DISABLE;
Creating a Logical Standby Database:
Step 1 Create a Physical Standby Database Create a Physical Standby Database and make sure that there is no error in remote archiving to Standby from Primary Database.
Please refer following documentations for creating physical standby database:
For 10.2:
Oracle® Data Guard Concepts and Administration 10g Release 2 (10.2)
For 11.1:
Oracle® Data Guard Concepts and Administration 11g Release 1 (11.1)
Step 2 Make Sure that Physical Standby is in Sync with Primary Database
Use following query on Standby to check:
SQL>SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied"
FROM
(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,
(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
WHERE
ARCH.THREAD# = APPL.THREAD#
ORDER BY 1;
There should not be any difference in Last Seq Received and Last Seq Applied on Physical Standby.
Step 3 Stop Redo Apply on the Physical Standby Database
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Step 4 Set Parameters for Logical Standby in Primary
4.1. Change VALID_FOR in LOG_ARCHIVE_DEST_1 on Primary to (ONLINE_LOGFILES,ALL_ROLES)
LOG_ARCHIVE_DEST_1= 'LOCATION=/u01/arch/online/ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prim1'
4.2. Set LOG_ARCHIVE_DEST_3 for logs which will received on Standby from Primary
LOG_ARCHIVE_DEST_3= 'LOCATION=/u01/arch/standby/ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=prim1'
LOG_ARCHIVE_DEST_STATE_3=ENABLE
Note: LOG_ARCHIVE_DEST_3 only takes effect when the primary database is transitioned to the logical standby role.
Step 5 Build a Dictionary in the Redo Data on Primary Database
SQL> EXECUTE DBMS_LOGSTDBY.BUILD;
The DBMS_LOGSTDBY.BUILD procedure waits for all existing transactions to complete. Long-running transactions executed on the primary database will affect the timeliness of this command.
Step 6 Convert to a Logical Standby Database
SQL> ALTER DATABASE RECOVER TO LOGICAL STANDBY ;
For db_name, specify a database name to identify the new logical standby database. If you are using a spfile for standby, then command will update the db_name parameter otherwise it will issues a message reminding you to set the name of the DB_NAME parameter after shutting down the database.
Step 7 Create a New Password File for Logical Standby Database
$ORAPWD FILE= PASSWORD= ENTRIES=
This step is required in 10.2 only and should not be performed in 11g.
Step 8 Shutdown and Startup Logical Standby Database in Mount Stage
SQL> SHUTDOWN;
SQL> STARTUP MOUNT;
Step 9 Adjust Initialization Parameter on Logical Standby Database
LOG_ARCHIVE_DEST_1= 'LOCATION=/u01/arch/online/ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=logstd1'
LOG_ARCHIVE_DEST_2= 'SERVICE=prim1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=prim1'
LOG_ARCHIVE_DEST_3= 'LOCATION=/u01/arch/standby/ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=logstd1'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
LOG_ARCHIVE_DEST_STATE_3=ENABLE
Step 10 Open the Logical Standby Database
SQL> ALTER DATABASE OPEN RESETLOGS;
Step 11 Start Logical Apply on Standby
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/1933/viewspace-1049313/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Step By Step Guide To Create Physical Standby Database Using RMAN [ID 469493.1]GUIIDEDatabase
- Step-By-Step Guide To Create Physical Standby On Normal File System For ASM Primary using RMANGUIIDEORMASM
- Step By Step Guide On Creating Physical Standby Using RMAN Duplicate In ASM Filesystem For ASM PrimaGUIIDEASM
- Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE WithoutGUIIDEDatabase
- Step by Step Guide on converting a database from Windows to AIX-1373780.1GUIIDEDatabaseWindowsAI
- BAPI Step by step GuidanceAPIGUI
- Step by Step Troubleshooting Guide for TDE Error ORA-28374 (Doc ID 1541818.1)GUIIDEError
- oracle Physical Standby failover stepOracleAI
- Linux Software RAID step by stepLinuxAI
- Step 3: Create the Initialization Parameter File (61)
- Step 7: Issue the CREATE DATABASE Statement (65)Database
- Step 8: Create Additional Tablespaces (66)
- TIDB DM資料同步step by stepTiDB
- React Step by StepReact
- Create Logical Standby For Oracle 10GOracle 10g
- Command 模式 Step by Step模式
- Step by Step TimesTen --- ttIsqlSQL
- Step 5: Create a Server Parameter File (Recommended) (63)Server
- Promise的實現(step by step)Promise
- Learn c++ step by step (轉)C++
- Sitecore10 Demo演示環境Azure一鍵部署(Step By Step Guide to installing Sitecore10 in Azure Paas)GUIIDE
- Git Step by Step (3):Git物件模型Git物件模型
- Oracle高階複製Step by StepOracle
- 安裝linux(step by step)(轉)Linux
- Learn C++ step by step(2) (轉)C++
- How to Create or Remove Restore Point on Standby database (文件 ID 1672977.1)REMRESTDatabase
- 單步除錯 step into/step out/step over 區別詳解除錯
- Step By Step Configure DataGuard (10g) Physical Standby Database On Linux X86_64(2/2)DatabaseLinux
- ABP應用開發(Step by Step)-下篇
- ABP應用開發(Step by Step)-上篇
- Git Step by Step (4):探索.git目錄Git
- ClearCase使用入門--step by step(序) (轉)
- 實時 Linux 抖動分析 Step by stepLinux
- Git Step by Step (6):Git遠端倉庫Git
- STEP BY STEP INSTALL SSH ON AIX5.3(6.1)AI
- install 11G ASM on RedHat step by stepASMRedhat
- oracle10g simpe AQ step by step(二)Oracle
- oracle10g simpe AQ step by step(一)Oracle