Creating a Physical Standby Database
一、在備機上建立備庫
透過冷備份資料庫檔案複製的方式,在備機上建立一個與原庫資料庫結構一致的資料庫,具體方法如下:
將資料庫所必需的檔案,如資料檔案、初始化引數檔案、redo日誌檔案、密碼檔案等複製到備庫相應的目錄中,目錄需要和初始化引數檔案中指定的路徑保持一致。其中控制檔案需要使用standby控制檔案,生成命令如下:
> alter database create standby controlfile as '/tmp/controlfile.standby';
將此控制檔案複製到初始化引數檔案指定目錄中,並替換掉之前的控制檔案。
至此,資料庫備庫建立完畢。
二、修改主備庫的監聽檔案,確保二者的資料庫能夠互相訪問以獲取對方的日誌檔案
修改主備庫的listener.ora檔案和tnsnames.ora檔案,保證listener.ora同時監聽本機的庫和備機的庫。
具體事例如下(僅供參考):
主(備)庫lintener.ora檔案:
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.97)(PORT=1521))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=standby)
(ORACLE_HOME=/apps/oracle/product/10.2.0/)
(SID_NAME=credit))
(SID_DESC=
(GLOBAL_DBNAME=primary)
(ORACLE_HOME=/apps/oracle/product/10.2.0/)
(SID_NAME=credit))
)
主(備)庫tnsnames.ora檔案:
credit_52 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.52)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = standby)
(SERVER=dedicated)
)
)
credit_97 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.97)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = primary)
(SERVER=dedicated)
)
)
三、修改初始化引數檔案,這裡採用修改pfile的方式
修改主備庫的初始化引數檔案,主要增加如下幾個引數:
DB_UNIQUE_NAME
LOG_ARCHIVE_CONFIG
LOG_ARCHIVE_DEST_1
LOG_ARCHIVE_DEST_2
FAL_SERVER
FAL_CLIENT
DB_FILE_NAME_CONVERT
LOG_FILE_NAME_CONVERT
STANDBY_FILE_MANAGEMENT
參考事例:
主庫
DB_UNIQUE_NAME=primary
LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary,standby)'
log_archive_dest_1='LOCATION=/data/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary'
log_archive_dest_2='SERVICE=credit_52 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
FAL_SERVER=standby
FAL_CLIENT=primary
STANDBY_FILE_MANAGEMENT=AUTO
備庫
DB_UNIQUE_NAME=standby
LOG_ARCHIVE_CONFIG='DG_CONFIG=(standby,primary)'
log_archive_dest_1='LOCATION=/data/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
log_archive_dest_2='SERVICE=credit_97 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary'
FAL_SERVER=primary
FAL_CLIENT=standby
STANDBY_FILE_MANAGEMENT=AUTO
db_file_name_convert='/data/oradata/credit','/data/oradata/credit'
log_file_name_convert='/data/oradata/credit','/data/oradata/credit'
四、在主、備庫上增加standby redo log file
在主備庫上增加比原redo日誌數量增加一個的standby redo日誌檔案,具體命令如下:
>alter database add standby logfile group 4 '/u01/app/oracle/oradata/stand/redo04.log' size 50m;
注意group#不要與之前的衝突
五、開庫驗證DG
以上配置完成之後,對DG進行驗證:
首先將主庫啟動到open狀態,主庫需要開啟force logging狀態,備庫啟動到mount狀態,在主庫執行
> alter system switch logfile;
並開啟備庫的告警日誌檔案,檢視是否傳輸過去,如下即為搭建成功:
Fri Aug 29 18:53:51 CST 2014
Primary database is in MAXIMUM PERFORMANCE mode
RFS[2]: Successfully opened standby log 4: '/data/oradata/credit/redo04.log'
Fri Aug 29 18:53:52 CST 2014
Media Recovery Log /data/archivelog/1_14_856871410.dbf
Media Recovery Waiting for thread 1 sequence 15 (in transit)
由於此DG採用了最大可用模式,因此如果需要實時在備庫上應用日誌,則需要執行以下命令:
> alter database recover managed standby database disconnect from session;
PS: upgrading the protection mode,
Step 1 If you are upgrading the protection mode, perform this step.
Perform this step only if you are upgrading the protection mode (for example, from maximum performance to maximum availability mode). Otherwise, go to Step 3.
Assume this example is upgrading the Data Guard configuration from the maximum performance mode to the maximum availability mode. Shut down the primary database and restart it in mounted mode:
SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT;
For a Real Application Clusters database, shut down all of the primary instances but start and mount only one primary instance.
Step 2 Set the data protection mode.
To specify a data protection mode, issue the SQL ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE {PROTECTION | AVAILABILITY | PERFORMANCE} statement on the primary database. For example, the following statement specifies the maximum availability mode:
SQL> ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;
Step 3 Open the primary database.
If you performed Step 1 to upgrade the protection mode, open the database:
SQL> ALTER DATABASE OPEN;
If you are downgrading the protection mode, the database will already be open.
Step 4 Configure the LOG_ARCHIVE_DEST_n parameters on standby databases.
On the standby databases, configure the LOG_ARCHIVE_DEST_n parameter attributes so the configuration can continue to operate in the new protection mode after a switchover.
For example:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=boston 2> OPTIONAL LGWR SYNC AFFIRM 3> VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) 4> DB_UNIQUE_NAME=boston';
Step 5 Confirm the configuration is operating in the new protection mode.
Query the V$DATABASE view to confirm the Data Guard configuration is operating in the new protection mode. For example:
SQL> SELECT PROTECTION_MODE, PROTECTION_LEVEL FROM V$DATABASE; PROTECTION_MODE PROTECTION_LEVEL --------------------- --------------------- MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29802484/viewspace-1261133/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Creating a Physical Standby using RMAN DUPLICATE FROM ACTIVE DATABASEDatabase
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- Creating a physical standby from ASM primaryASM
- Physical Standby Database 切換到 Snapshot Standby DatabaseDatabase
- Oracle DG建立Physical Standby DatabaseOracleDatabase
- Creating a 10gr2 Data Guard Physical Standby database with Real-Time applyDatabaseAPP
- Performing a Failover to a Physical Standby DatabaseORMAIDatabase
- Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE WithoutGUIIDEDatabase
- Creating a physical standby from ASM primary [ID 787793.1]ASM
- Oracle10G Physical Standby Database setupOracleDatabase
- Performing a Switchover to a Physical Standby Database and failoverORMDatabaseAI
- ORACLE10g DataGuard 配置Physical Standby DatabaseOracleDatabase
- oracle 10g physical standby database creationOracle 10gDatabase
- Recover physical standby database after loss of archive log(2)DatabaseHive
- 【RAC,DATAGUARD】Creating a physical standby from ASM (RAC ) primary之四ASM
- 【RAC】Creating a filesystem physical standby from ASM (RAC ) primary之三ASM
- 【RAC】Creating a filesystem physical standby from ASM (RAC ) primary 之二ASM
- 【RAC】Creating a filesystem physical standby from ASM (RAC ) primary之一ASM
- 同事總結的 : 用RMAN建立Physical Standby DatabaseDatabase
- oracle 9i physical standby database狀態查詢OracleDatabase
- Using RMAN Incremental Backups to Roll Forward a Physical Standby DatabaseREMForwardDatabase
- Physical Standby上開啟flashback database實驗日誌Database
- Brief description of Oracle physical standby database configuration and managementOracleDatabase
- Brief description of Oracle physical standby database configuration and managemeOracleDatabase
- Recover physical standby database after loss of archive log – roll forward(轉)DatabaseHiveForward
- Oracle physical standbyOracle
- Creating Physical Standby using RMAN Duplicate Without Shutting Primary_789370.1
- ORACLE10G DG配置下Physical Standby Database的管理OracleDatabase
- 4 Creating a Logical Standby Database 建立邏輯備庫Database
- oracle 9i physical standby database 中v$database switchover_status的含義OracleDatabase
- Creating Physical Standby using RMAN Duplicate Without Shutting down The Primary [ID 789370.1]
- Step By Step Guide On Creating Physical Standby Using RMAN Duplicate In ASM Filesystem For ASM PrimaGUIIDEASM
- oracle 9i physical standby database 上的v$archived_logOracleDatabaseHive
- Step By Step Guide To Create Physical Standby Database Using RMAN [ID 469493.1]GUIIDEDatabase
- DataGuard:Physical Standby Switchover
- Physical Database LimitsDatabaseMIT
- 【DataGuarad】ORA-1153 trying to turn on Flashback for Physical Standby DatabaseDatabase
- Creating a Standby Database using RMAN (Recovery Manager) [ID 118409.1]Database