DG學習筆記(4)_建立物理Standby步驟及注意事項

gdutllf2006發表於2010-03-19

DG學習筆記(4)_建立物理Standby步驟及注意事項

目錄

 

1 Turn on force logging

2 Backup the primary database and create Standby Controlfile

3 Copy files to standby site

4 Set parameters on the physical standby database

5 Start the standby database

6 Configure Oracle Net

7 Set parameters on the primary database

8 Start the transport of redo

9 Notes

 

 

 

1 Turn on force logging

 

ALTER DATABASE FORCE LOGGING;

 

Perform. the command in Mount state

 

 

2 Backup the primary database and create Standby Controlfile

 

2.1 Make sure the primary is in archive log mode

 

2.2 Create a backup of the primary database.

 

You can use any backup of the primary database so long as you have archived redo logs completely recover the database. The backup can be old or new, consistent or inconsistent, Hot backups (or open backups) allow you to keep the database open while performing the backup. Nevertheless, you may prefer to make a new closed, consistent backup using the RMAN or OS utility to prevent the application of a large number of archived redo logs.( 能使用任何形式的備份, 只要有完備的歸檔檔案. 最好的形式是一個Closed, Consistent Backup. 即準備, RMAN能做冷備嗎? 不行吧.RMAN要連線資料庫的,資料庫狀態至少為Mount)

 

 

2.3 Create the standby control file

 

ALTER DATABASE CREATE STANDBY CONTROL FILE AS file_name [reuse];

 

The filename for the created standby control file must be different from the filename of the current control file of the primary database. You can also use RMAN to create the standby database control file.(Standby control file name 必須與 Current control file name 不同, CopyStandby端時,可以改回去的.只是生成的時候不同而已.)

 

 

3 Copy files to standby site

 

Datafiles

Backup control file

Parameter file

All available archived redo logs (如果用的是冷備不需要, 複製過去後,是否要Register ?不用,因為Controlfile 中已做了記錄,只需放到相同的目錄下 )

 

Online redo logs. (Recommended for switchover and failover operations)

 

Conversion initialization parameters

DB_FILE_NAME_CONVERT

LOG_FILE_NAME_CONVERT

STANDBY_FILE_MANAGEMENT

These are set in Standby initialization file, and should be in the primary database initialization file as well. (PrimaryStandby都要設這些引數, 不是隻在Standby設嗎?兩邊都設定的原因是方便以後的Switchover)

 

 

4 Set parameters on the physical standby database

 

DB_FILE_NAME_CONVERT

LOG_FILE_NAME_CONVERT

LOG_ARCHIVE_FORMAT

STANDBY_FILE_MANAGEMENT

Maintain consistency when you add or delete a datafile on the primary database

 

= Manual(default) datafiles must be added on the standby database manually

 

= Auto: Add the datafile automatically to the standby database.

(是否需要手動新增,刪除資料檔案,但對資料檔案的renaming還是必須手工做)

 

When you add a log file to the primary and want to add it to the standby as well then you

must:

• Set to MANUAL on the standby

• Redo log files on the primary

• Add them to the standbys

• Reset back to AUTO afterwards on the standby

(logfile不能自動新增,且必須將STANDBY_FILE_MANAGEMENT引數先圍置為manual. )

 

STANDBY_ARCHIVE_DEST

LOG_ARCHIVE_START

REMOTE_ARCHIVE_ENABLE

 

Example: STBY_INIT.ORA

 

compatible='9.2.0'

control_files='D:\USER01\ORADATAB\U01\control01.ctl'

db_file_name_convert=

'D:\USER01\ORADATAA\U01','D:\USER01\ORADATAB\U01',

'D:\USER01\ORADATAA\U02','D:\USER01\ORADATAB\U02'

db_name='TESTA'

lock_name_space='testb'

log_file_name_convert=

'D:\USER01\ORADATAA\U03','D:\USER01\ORADATAB\U03'

remote_archive_enable='TRUE'

remote_login_passwordfile='exclusive'

standby_archive_dest='D:\USER01\ORADATAB\U04'

standby_file_management='auto'

 

5 Start the standby database

 

Bring it to the mount stage

Crate standby redo logs

Start the managed recover process(MRP)

SQL> STARTUP MOUNT PFILE=STBY_INIT.ORA

SQL> ALTER DATABASE ADD STANDBY LOGFILE

 (’/oracle/dbs/log1c.rdo’,’/oracle/dbs/log2c.rdo’) SIZE 500K;

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

 

 

6 Configure Oracle Net

 

7 Set parameters on the primary database

 

LOG_ARCHIVE_DEST

LOG_ARCHIVE_STATE

 

ARCHIVE_LAG_TARGET:Set to the number of seconds after which a log switch must happen even if the log file is not full.(定時強制歸檔,減少Instance恢復時間)

 

LOG_ARCHIVE_TRACE

 

 

Example:

 

archive_lag_target=0

compatible='9.2.0'

db_name='TESTA'

log_archive_dest_1='LOCATION=D:\USER01\ORADATAA\ARCHIVE1'

log_archive_dest_state_1='ENABLE'

log_archive_dest_2='service=TESTB'

log_archive_dest_state_2='ENABLE'

log_archive_format='testa_%s.arc'

log_archive_max_processes=3

log_archive_start=TRUE

log_archive_trace=0

log_parallelism=1

remote_archive_enable='TRUE'

remote_login_passwordfile='exclusive'

standby_archive_dest='D:\USER01\ORADATAA\ARCHIVE2'

standby_file_management='MANUAL'

 

8 Start the transport of redo

 

ALTER SYSTEM ARCHIVE LOG CURRENT;

 

This will cause the archive process to archive the current log file and will start the transport of redo to the physical standby database. On the physical standby database the RFS process will start on reception of the redo.

 

 

9 Notes

 

1 Notes for Standby Database on The Same System

 

Set the LOCK_NAME_SPACE initialization parameter

 

Standby database datafiles must be in a different location

 

The standby database does not protect against disaster

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10248702/viewspace-629921/,如需轉載,請註明出處,否則將追究法律責任。

相關文章