oracle ADG for windows install steps

发布时间:2020-05-26 16:26:50 作者:刘枫_Leo
来源:网络 阅读:291

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

1、主库
create pfile='C:\Users\Administrator\Desktop\file\pfile.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:\app\archive 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:\app\datafiles\orcl\','C:\app\datafiles\prod\' scope=spfile sid='
';
alter system set log_file_name_convert='C:\app\datafiles\orcl\','C:\app\datafiles\prod\' scope=spfile sid='*';

SQL> create pfile='C:\Users\Administrator\Desktop\file\pfilebak.ora' from spfile;

2、备库创建目录
归档目录 C:\app\archive
数据文件目录 C:\app\datafiles\prod\
adump目录 C:\app\Administrator\admin\prod\adump

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:\Users\Administrator\Desktop\file\full%U%T' include current controlfile for standby;
backup current controlfile for standby format 'C:\Users\Administrator\Desktop\file\control01.ctl';
backup archivelog all format 'C:\Users\Administrator\Desktop\file\arch
%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:\app\Administrator\admin\prod\adump' 注意路径
log_archive_dest_1='C:\app\archive'
.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:\app\archive 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:\Users\Administrator\Desktop\file\pfilebak.ora';
sql>create spfile from pfile='C:\Users\Administrator\Desktop\file\pfilebak.ora';
若有需求更改数据文件目录可通过
rman target / nocatalog
RMAN> restore standby controlfile from 'C:\Users\Administrator\Desktop\file\control01.ctl';
SQL>alter database mount;
catalog start with 'C:\Users\Administrator\Desktop\file\';

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:\app\datafiles\prod\system01.dbf';
set newname for datafile 2 to 'C:\app\datafiles\prod\sysaux01.dbf';
set newname for datafile 3 to 'C:\app\datafiles\prod\undotbs01.dbf';
set newname for datafile 4 to 'C:\app\datafiles\prod\users01.dbf';
set newname for datafile 5 to 'C:\app\datafiles\prod\example01.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:\app\datafiles\orcl\standby04.log') size 50M;
alter database add standby logfile thread 1 group 5 ('C:\app\datafiles\orcl\standby05.log') size 50M;
alter database add standby logfile thread 1 group 6 ('C:\app\datafiles\orcl\standby06.log') size 50M;
alter database add standby logfile thread 1 group 7 ('C:\app\datafiles\orcl\standby07.log') size 50M;
alter database add standby logfile thread 1 group 8 ('C:\app\datafiles\orcl\standby08.log') size 50M;
备库
alter database add standby logfile thread 1 group 4('C:\app\datafiles\prod\standby04.log') size 50M;
alter database add standby logfile thread 1 group 5 ('C:\app\datafiles\prod\standby05.log') size 50M;
alter database add standby logfile thread 1 group 6 ('C:\app\datafiles\prod\standby06.log') size 50M;
alter database add standby logfile thread 1 group 7 ('C:\app\datafiles\prod\standby07.log') size 50M;
alter database add standby logfile thread 1 group 8 ('C:\app\datafiles\prod\standby08.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

推荐阅读:
  1. Converting to Oracle Real Appl
  2. Installation Oracle11gR2 RAC---自动打GI PSU补丁(11.2.0.4.8)

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

oracle adg windows

上一篇:JVM垃圾回收算法和垃圾回收器是什么?

下一篇:Mysql数据库事务的特性及运用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》