Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1127302
  • 博文数量: 276
  • 博客积分: 10077
  • 博客等级: 上将
  • 技术积分: 2513
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-24 20:31
文章分类

全部博文(276)

文章存档

2020年(1)

2015年(5)

2012年(2)

2011年(6)

2010年(7)

2009年(224)

2008年(31)

我的朋友

分类: Oracle

2009-07-03 16:53:44

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) |
给主人留下些什么吧!~~