oracle ADG for windows install steps

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle ADG for windows install steps相关的知识,希望对你有一定的参考价值。

环境介绍:
windows 2012 R2*2台
主库:安装oracle软件、监听、实例
备库:安装oracle软件、监听
数据库版本:11.2.0.4
主库:orcl
备库:prod

1、主库
create pfile=‘C:UsersAdministratorDesktopfilepfile.ora‘ from spfile;
alter database force logging;

alter system set log_archive_config=‘DG_CONFIG=(orcl,prod)‘ scope=spfile;
alter system set log_archive_dest_1=‘location=C:apparchive valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl‘ scope=both sid=‘‘;
alter system set log_archive_dest_2=‘service=prod LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=prod‘ scope=both sid=‘
‘;
alter system set log_archive_dest_state_1=‘enable‘ scope=both sid=‘‘;
alter system set log_archive_dest_state_2=‘enable‘ scope=both sid=‘
‘;
alter system set fal_client=‘orcl‘ scope=both sid=‘‘;
alter system set fal_server=‘prod‘ scope=both sid=‘
‘;
alter system set standby_file_management=‘AUTO‘ scope=both sid=‘‘;
alter system set db_file_name_convert=‘C:appdatafilesorcl‘,‘C:appdatafilesprod‘ scope=spfile sid=‘
‘;
alter system set log_file_name_convert=‘C:appdatafilesorcl‘,‘C:appdatafilesprod‘ scope=spfile sid=‘*‘;

SQL> create pfile=‘C:UsersAdministratorDesktopfilepfilebak.ora‘ from spfile;

2、备库创建目录
归档目录 C:apparchive
数据文件目录 C:appdatafilesprod
adump目录 C:appAdministratoradminprodadump

3、主库备份
rman target /
run{
allocate channel a1 device type disk;
allocate channel a2 device type disk;
allocate channel a3 device type disk;
crosscheck archivelog all;
sql ‘alter system archive log current‘;
sql ‘alter system archive log current‘;
backup full database format=‘C:UsersAdministratorDesktopfilefull%U%T‘ include current controlfile for standby;
backup current controlfile for standby format ‘C:UsersAdministratorDesktopfilecontrol01.ctl‘;
backup archivelog all format ‘C:UsersAdministratorDesktopfilearch
%d%T%U.arc‘;
release channel a1;
release channel a2;
release channel a3;
}

4、拷贝文件
密码文件在$ORACLE_HOME/database
将密码文件(需要改sid)、pfile、redo、temp、拷贝到备库相应目录。

5、修改host文件
192.168.3.2 WIN-JP7MSEND1SD
192.168.3.3 WIN-KL9BBQ52F5R

6、主备库tnsnames一致

7、修改备库pfile文件
更改pfile文件
db_name=‘orcl‘应与主库一致
.db_unique_name=‘prod‘
.audit_file_dest=‘C:appAdministratoradminprodadump‘ 注意路径
log_archive_dest_1=‘C:apparchive‘
.db_recovery_file_dest
oracle_base
删除log_archive_dest_2、log_archive_dest_state_1
修改
fal_client=‘prod‘
.fal_server=‘orcl‘
.log_archive_config=‘DG_CONFIG=(orcl,prod)‘
.log_archive_dest_1=‘location=C:apparchive valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prod‘

*检查文件中的路径是否正确***

8、备库添加服务
oradim -new -sid prod -startmode auto
set ORACLE_SID=prod

9、恢复备库
sql>startup nomount pfile=‘C:UsersAdministratorDesktopfilepfilebak.ora‘;
sql>create spfile from pfile=‘C:UsersAdministratorDesktopfilepfilebak.ora‘;
若有需求更改数据文件目录可通过
rman target / nocatalog
RMAN> restore standby controlfile from ‘C:UsersAdministratorDesktopfilecontrol01.ctl‘;
SQL>alter database mount;
catalog start with ‘C:UsersAdministratorDesktopfile‘;

run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
set newname for datafile 1 to ‘C:appdatafilesprodsystem01.dbf‘;
set newname for datafile 2 to ‘C:appdatafilesprodsysaux01.dbf‘;
set newname for datafile 3 to ‘C:appdatafilesprodundotbs01.dbf‘;
set newname for datafile 4 to ‘C:appdatafilesprodusers01.dbf‘;
set newname for datafile 5 to ‘C:appdatafilesprodexample01.dbf‘;
restore database;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
recover database;

10、主备库添加standby日志(比online log至少多一个)
主库
alter database add standby logfile thread 1 group 4(‘C:appdatafilesorclstandby04.log‘) size 50M;
alter database add standby logfile thread 1 group 5 (‘C:appdatafilesorclstandby05.log‘) size 50M;
alter database add standby logfile thread 1 group 6 (‘C:appdatafilesorclstandby06.log‘) size 50M;
alter database add standby logfile thread 1 group 7 (‘C:appdatafilesorclstandby07.log‘) size 50M;
alter database add standby logfile thread 1 group 8 (‘C:appdatafilesorclstandby08.log‘) size 50M;
备库
alter database add standby logfile thread 1 group 4(‘C:appdatafilesprodstandby04.log‘) size 50M;
alter database add standby logfile thread 1 group 5 (‘C:appdatafilesprodstandby05.log‘) size 50M;
alter database add standby logfile thread 1 group 6 (‘C:appdatafilesprodstandby06.log‘) size 50M;
alter database add standby logfile thread 1 group 7 (‘C:appdatafilesprodstandby07.log‘) size 50M;
alter database add standby logfile thread 1 group 8 (‘C:appdatafilesprodstandby08.log‘) size 50M;

11、主库重启DB 因为log_archive_config重启生效

启动同步
SQL>alter database recover managed standby database disconnect from session;
SQL> recover managed standby database cancel;
SQL>alter database open read only;
SQL>alter database recover managed standby database using current logfile disconnect from session;

验证
主库 v$archived_log
SQL> select thread#,max(sequence#) from v$archived_log where applied=‘NO‘ group by thread#;

备库 v$archived_log
SQL> select thread#,max(sequence#) from v$archived_log where applied=‘YES‘ group by thread#;

备库 v$managed_standby;
select process,status,thread#,sequence# from v$managed_standby;
SQL> select process,status,thread#,sequence# from v$managed_standby;

PROCESS STATUS THREAD# SEQUENCE#


ARCH CONNECTED 0 0
ARCH CONNECTED 0 0
ARCH CLOSING 1 10
ARCH CLOSING 1 11
RFS IDLE 0 0
RFS IDLE 0 0
RFS IDLE 0 0
RFS IDLE 1 12
MRP0 APPLYING_LOG 1 12

以上是关于oracle ADG for windows install steps的主要内容,如果未能解决你的问题,请参考以下文章

Oracle -- 记一次ADG库迁移过程小结 -- 上篇(ADG建库)

ORACLE 12C ADG 之十一 (ADG环境主机重启步骤)

Oracle11g ADG 搭建

Oracle ADG数据库切换

oracle ogg ADG和DG的区别

Oracle 物理 DG 转 ADG 步骤