ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Logical Standby实验

Logical Standby实验

原创 Linux操作系统 作者:tolywang 时间:2009-07-22 18:17:49 0 删除 编辑


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'
+++++++++++++++++++++++++++++++++++++++++++++++++> 

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-609937/,如需转载,请注明出处,否则将追究法律责任。

下一篇: [草稿]data guard
请登录后发表评论 登录
全部评论
Oracle , MySQL, SAP IQ, SAP HANA, PostgreSQL, Tableau 技术讨论,希望在这里一起分享知识,讨论技术,畅谈人生 。

注册时间:2007-12-10

  • 博文量
    5595
  • 访问量
    13207514