1)1 Create a Physical Standby Database
2)Stop Redo Apply on the Physical Standby Database
alter database recover managed standby database cancel;
3)Set Parameters in Primary
alter system set log_archive_dest_1='location=d:\arc\ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary';
alter system set log_archive_dest_3='location=d:\stdyarc\ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=primary';
alter system set LOG_ARCHIVE_DEST_STATE_3=ENABLE;
4)Build a Dictionary in the Redo Data on Primary Database
exec dbms_logstdby.build;
5)standby:change db_name
show parameter db_name;
alter database recover to logical standby orcldg; /*NEW_DBNAME:orcldg*/
shutdown immedaite;
/*change pfile parameter db_name=orcldg*/
startup mount;
show parameter db_name;
select database_role from v$database;
6)standby:recreate password file
orapwd file=C:\oracle\product\10.2.0\db_1\database\PWDorcl.ora password=123456
7)standby: change parameter
alter system set log_archive_dest_1='location=d:\arc\ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcldg';
alter system set LOG_ARCHIVE_DEST_2='SERVICE=primary LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary';
alter system set log_archive_dest_3='location=d:\stdyarc\ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=orcldg';
alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE;
alter database add standby logfile group 4 ('d:\orcl\redostby01.log') size 50M;
alter database add standby logfile group 5 ('d:\orcl\redostby02.log') size 50M;
alter database add standby logfile group 6 ('d:\orcl\redostby03.log') size 50M;
7)standby: open database resetlogs, and start apply
alter database open resetlogs;
alter database start logical standby apply immediate;
#alter database stop logical standby apply immediate;
8)Test
in primary:
create table test.test (a int);
insert into test.test values(1);
commit;
in logical standby:
select * from test.test;
<+++++++++++++++++++++logical standby init file for archive destination++++++++++++++++++++++++++++
=======primary
*.log_archive_dest_1='location=d:\arc\ VALID_FOR=(ONLINE_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_3='location=d:\stdyarc\ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=primary'
/*如果此库是primary role时,这个参数可以忽略。如果是logical standby role时,则用来接收primary role的归档.*/
=======standby
*.log_archive_dest_1='location=d:\arc\ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcldg';
*.LOG_ARCHIVE_DEST_2='SERVICE=primary LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary';
/*为primary role时才有效。*/
*.log_archive_dest_3='location=d:\stdyarc\ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=orcldg'
+++++++++++++++++++++++++++++++++++++++++++++++++>
阅读(1141) | 评论(0) | 转发(0) |