[I]要准备做logical standby的实验,把physical standby的步骤记一下.
1)Physical Standby: force logging
ALTER DATABASE FORCE LOGGING;
2)Physical Standby:create standby control file
>startup mount;
>alter database create standby controlfile as 'K:\control01.ctl';shutdown immediate;
3)backup & copy
+backup pysical standby database.
+copy pwd file, backup file to standby host.
4)change init file & tnsnames.ora
+standby init file
*.DB_UNIQUE_NAME='standby' *.log_archive_config='DG_CONFIG=(primary,standby)' *.LOG_ARCHIVE_FORMAT=ARC%S_%R.%T *.log_archive_dest_1='location=d:\arc\ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby' *.LOG_ARCHIVE_DEST_2='SERVICE=primary LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary' *.LOG_ARCHIVE_DEST_STATE_1=ENABLE *.LOG_ARCHIVE_DEST_STATE_2=ENABLE *.FAL_SERVER=primary *.FAL_CLIENT=standby *.STANDBY_FILE_MANAGEMENT=AUTO
|
+primary init file
*.DB_UNIQUE_NAME='primary' *.log_archive_config='DG_CONFIG=(primary,standby)' *.LOG_ARCHIVE_FORMAT=ARC%S_%R.%T *.log_archive_dest_1='location=d:\arc\ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary' *.LOG_ARCHIVE_DEST_2='SERVICE=standby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby' *.LOG_ARCHIVE_DEST_STATE_1=ENABLE *.LOG_ARCHIVE_DEST_STATE_2=ENABLE *.FAL_SERVER=standby *.FAL_CLIENT=primary *.STANDBY_FILE_MANAGEMENT=AUTO
|
+tnsname.ora for both
PRIMARY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.128)(PORT = 1521)) ) (CONNECT_DATA = (SID = ORCL) (SERVER = DEDICATED) ) )
STANDBY = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.129)(PORT = 1521)) ) (CONNECT_DATA = (SID = ORCL) (SERVER = DEDICATED) ) )
|
5)start standby database
>startup mount;
>alter database recover managed standby database disconnect from session;
6)open primary
>startup;
[II]switch over
1)primary database to standby database
>ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY with session shutdown;
>SHUTDOWN IMMEDIATE;
>STARTUP MOUNT;
>alter database recover managed standby database disconnect from session;
2)standby database to primary database
>ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
>ALTER DATABASE OPEN;
>ALTER SYSTEM SWITCH LOGFILE;
[III]Failover
1)Identify and resolve any gaps in the archived redo log files.
2)Copy any other missing archived redo log files.
>SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;
>ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1';
3)Initiate a failover on the target physical standby database.
>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH FORCE;
4)Convert the physical standby database to the primary role.
>ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
5)Finish the transition of the standby database to the primary database role.
>ALTER DATABASE OPEN;
影响到standby的primary事件
阅读(922) | 评论(0) | 转发(0) |