ORACLE11gRAC-RACDGDuplicate搭建(⽣产操作⽂档)环境:
rhel 6.7 64位
源库:ORACLE 11204 RAC 未打PSU
备库:ORACLE 11204 RAC PSU 20170718
⼀、停⽌中间件并做全库备份
1、在节点2做全备
2、⾸先要规划主、备库db_unique_name
主库:备库:
============================================================
db_name mgrdb db_name mgrdb
db_unique_name mgrdb db_unique_name mgrdbdg
============================================================
3、vi /etc/hosts 修改主、备共计4个节点
=========================================================
#主库
由于是⽣产系统IP 省略
#备库
由于是⽣产系统IP 省略
============================================================
⼆、源库参数设置
1、检查源库每个节点⾄少3组redo
select group#,thread#,bytes/1024/1024,members,status from v$log;
GROUP# THREAD# BYTES/1024/1024 MEMBERS STATUS
---------- ---------- --------------- ---------- ----------------
5 1 500 2 INACTIVE
6 1 500 2 INACTIVE
7 1 500 2 INACTIVE
8 1 500 2 CURRENT
9 1 500 2 INACTIVE
10 1 500 2 INACTIVE
11 2 500 2 CURRENT
12 2 500 2 INACTIVE
13 2 500 2 INACTIVE
14 2 500 2 INACTIVE
15 2 500 2 INACTIVE
GROUP# THREAD# BYTES/1024/1024 MEMBERS STATUS
---------- ---------- --------------- ---------- ----------------
16 2 500 2 INACTIVE
1节点\2节点
alter database add logfile thread 1 group 5 ('+DATA1') size 500m;
alter database add logfile thread 2 group 6 ('+DATA1') size 500m;
2、添加Standby Redo Log
如果主库是Rac数据库,standby redo log组数=(所有节点中⽇志组数最⼤值+1)*RAC节点数;
>>>>>>>>>>>>>>>>>>>##
-
-1节点
alter database add standby logfile thread 1 group 21('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 1 group 22('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 1 group 23('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 1 group 24('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 1 group 25('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 1 group 26('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 1 group 27('+DATA1','+DATA1') size 500m;
--2节点
alter database add standby logfile thread 2 group 31('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 2 group 32('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 2 group 33('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 2 group 34('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 2 group 35('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 2 group 36('+DATA1','+DATA1') size 500m;
alter database add standby logfile thread 2 group 37('+DATA1','+DATA1') size 500m;
>>>>>>>>>>>>>>>>>>>### select group#,thread#,sequence#,BYTES/1024/1024,archived,used,status from v$standby_log;
GROUP# THREAD# SEQUENCE# BYTES/1024/1024 ARC USED STATUS
---------- ---------- ---------- --------------- --- ---------- ----------
21 1 0 500 YES 0 UNASSIGNED
22 1 0 500 YES 0 UNASSIGNED
23 1 0 500 YES 0 UNASSIGNED
24 1 0 500 YES 0 UNASSIGNED
25 1 0 500 YES 0 UNASSIGNED
26 1 0 500 YES 0 UNASSIGNED
27 1 0 500 YES 0 UNASSIGNED
31 2 0 500 YES 0 UNASSIGNED
32 2 0 500 YES 0 UNASSIGNED
33 2 0 500 YES 0 UNASSIGNED
34 2 0 500 YES 0 UNASSIGNED
GROUP# THREAD# SEQUENCE# BYTES/1024/1024 ARC USED STATUS
---------- ---------- ---------- --------------- --- ---------- ----------
35 2 0 500 YES 0 UNASSIGNED
36 2 0 500 YES 0 UNASSIGNED
37 2 0 500 YES 0 UNASSIGNED
3、判断DG软件是否安装
select * from v$option where parameter = 'Oracle Data Guard';
4、允许Forced Logging
alter database force logging;
select INST_ID,name,force_logging from gv$database;
--备份原始参数⽂件
create pfile='/home/oracle/pfile0908.bak' from spfile;
!ls -ltr /home/oracle
5、设置主库初始化参数
>>>>>>>>>>>>>>>>>>>### select name,db_unique_name from v$database;
--alter system set db_unique_name=mgrdb scope=spfile sid='*';
alter system set log_archive_config='dg_config=(mgrdb,mgrdbdg)' scope=spfile sid='*';
alter system set log_archive_dest_1='LOCATION=+DATA1 valid_for=(ALL_LOGFILES, ALL_ROLES) db_unique_name=mgrdb' scope=spfile sid='*';
alter system set log_archive_dest_2='SERVICE=standby OPTIONAL LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILE, PRIMARY_ROLE) DB_UNIQUE_NAME=mgrdbdg' scope=spfile sid='*';
alter system set log_archive_format = '%t_%s_%r.arc' scope=spfile sid='*';
alter system set log_archive_dest_state_1=enable scope=spfile sid='*';
alter system set log_archive_dest_state_2=enable scope=spfile sid='*';
alter system set remote_login_passwordfile=EXCLUSIVE scope=spfile sid='*';
alter system set log_archive_max_processes = 10 scope=spfile sid='*';
--Primary Database:Standby Role initialization parameters FAL参数定义的数据库名同样取⾃本地a⾥配置的Oracle Net Service Name.
alter system set fal_server=standby scope=spfile sid='*';
alter system set standby_file_management=auto scope=spfile sid='*';
alter system set db_file_name_convert='+DATA1','+DATA1' scope=spfile sid='*'; --备端的磁盘组写前⾯
alter system set log_file_name_convert='+DATA1','+DATA1' scope=spfile sid='*'; --备端的磁盘组写前⾯
>>>>>>>>>>>>>>>>>>>###
#为使修改⽣效,重启Primary Database:
alter system archive log current;
alter system archive log current;
alter system checkpoint;
alter system checkpoint;
ps -ef|grep LOCAL=NO
set pages 999
set lines 200
col machine for a30
select MACHINE,s.USERNAME, SID,s.SERIAL#,p.spid from v$session s,v$process p
where s.paddr = p.addr and s.username is not null
order by spid;
ps -ef|grep LOCAL=NO|grep -v grep|cut -c 9-15|xargs kill -9
#分别关闭2节点
shut immediate;
#srvctl stop database -d mgrdb
#srvctl start database -d mgrdb
#重启完后,可通过下⾯语句查看修改地⽅:
set lines 500 pages 0
col value for a90
col name for a50
select name,value
from v$parameter
where name in('db_name','db_unique_name',
'log_archive_config',
'log_archive_dest_1','log_archive_dest_2',
'log_archive_dest_1',
'log_archive_dest_2',
'remote_login_passwordfile',
'log_archive_format',
'log_archive_max_processes',
'fal_server',
'db_file_name_convert',
'log_file_name_convert',
'standby_file_management')
/
6、将数据库备份、备份控制⽂件、备份参数⽂件
su - oracle
mkdir backup
rman target /
run
{allocate channel c1 type disk;
allocate channel c2 type disk;
backup filesperset 3 database format '/home/oracle/backup/full_%d_%T_%s_%p';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup archivelog from time 'sysdate-1/24' format '/home/oracle/backup/arch_%d_%T_%s_%p';
backup current controlfile for standby format '/home/oracle/backup/ctl_std';
}
7、创建备库的pfile
su - oracle
mkdir backup
sqlplus / as sysdba
CREATE PFILE='/home/oracle/a' FROM SPFILE;
--查看备份出来的参数⽂件
cat /home/oracle/a
>>>>>>>>>>>>>>>>#
mgrdb1.__db_cache_size=14629732352
mgrdb2.__db_cache_size=14361296896
mgrdb1.__java_pool_size=939524096
mgrdb2.__java_pool_size=939524096
mgrdb1.__large_pool_size=134217728
mgrdb2.__large_pool_size=402653184
mgrdb1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
oracle11g 创建数据库mgrdb2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
mgrdb1.__pga_aggregate_target=39996882944
mgrdb2.__pga_aggregate_target=39460012032
mgrdb1.__sga_target=24427626496
mgrdb2.__sga_target=24964497408
mgrdb1.__shared_io_pool_size=0
mgrdb2.__shared_io_pool_size=0
mgrdb1.__shared_pool_size=7784628224
mgrdb2.__shared_pool_size=8321499136
mgrdb1.__streams_pool_size=268435456
mgrdb2.__streams_pool_size=268435456
*.audit_file_dest='/u01/app/oracle/admin/mgrdb/adump'
*.audit_trail='db'
*.cluster_database=true
*patible='11.2.0.4.0'
*.control_files='+DATA1/mgrdb/controlfile/current.260.834178123','+DATA1/mgrdb/controlfile/current.3076.947956273'
*.db_block_size=8192
*.db_create_file_dest='+DATA1'
*.db_domain=''
*.db_file_name_convert='+DATA1','+DATA1'
*.db_name='mgrdb'
*.diagnostic_dest='/u01/app/oracle'
*.fal_server='STANDBY'
mgrdb1.instance_number=1
mgrdb2.instance_number=2
*.job_queue_processes=1000
*.log_archive_config='dg_config=(mgrdb,mgrdbdg)'
*.log_archive_dest_1='LOCATION=+DATA1 valid_for=(ALL_LOGFILES, ALL_ROLES) db_unique_name=mgrdb'
*.log_archive_dest_2='SERVICE=standby OPTIONAL LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILE, PRIMARY_ROLE) DB_UNIQUE_NAME=mgrdbdg'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=10
*.log_buffer=306790400
*.log_file_name_convert='+DATA1','+DATA1'
*.memory_max_target=64424509440
*.memory_target=64424509440
*.open_cursors=300
*.parallel_force_local=FALSE
*.pga_aggregate_target=25769803776
mgrdb2.pga_aggregate_target=0
mgrdb1.pga_aggregate_target=0
*.processes=1000
*.remote_listener='scanip:1521'
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1600
*.sga_max_size=38654705664
mgrdb2.sga_max_size=64424509440
mgrdb1.sga_max_size=64424509440
*.sga_target=38654705664
mgrdb1.sga_target=0
mgrdb2.sga_target=0
*.shared_pool_reserved_size=288568115
mgrdb2.shared_pool_reserved_size=524288000
mgrdb1.shared_pool_reserved_size=524288000
*.shared_pool_size=805306368
mgrdb1.shared_pool_size=0
mgrdb2.shared_pool_size=0
*.standby_file_management='AUTO'
*.streams_pool_size=268435456
mgrdb2.thread=2
mgrdb1.thread=1
*.undo_retention=86400
mgrdb2.undo_tablespace='UNDOTBS2'
mgrdb1.undo_tablespace='UNDOTBS1'
*.undo_tablespace='UNDOTBS2'
>>>>>>>>>>>>>>>># 8、修改主库a 【两个节点都要修改】
#修改1节点:
vi $ORACLE_HOME/network/a
#拷贝到2节点
scp $ORACLE_HOME/network/a HOSTNAME:$ORACLE_HOME/network/admin >>>>>>>>>>>>>>##33 primary
=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = public ip )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mgrdb)
)
)
primary1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vip1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mgrdb)
(SID = mgrdb1)
)
)
primary2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vip2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mgrdb)
(SID = mgrdb2)
)
)
>>>>>>>>>>>>>>##
三、准备备库RAC Database
1、复制参数⽂件
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
Oracle11g设计与开发教程课程设计
« 上一篇
oracle11g dg容灾方案
下一篇 »
推荐文章
热门文章
-
随机森林算法的改进方法
2024-10-02 -
基于随机森林算法的风险预警模型研究
2024-10-02 -
Python中的随机森林算法详解
2024-10-02 -
随机森林发展历史
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(八)
2024-10-02 -
随机森林回归模型原理
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(六)
2024-10-02 -
如何使用随机森林进行时间序列数据预测(四)
2024-10-02 -
如何使用随机森林进行异常检测(六)
2024-10-02 -
随机森林算法和grandientboosting算法 -回复
2024-10-02 -
随机森林方法总结全面
2024-10-02 -
随机森林算法原理和步骤
2024-10-02 -
随机森林的原理
2024-10-02 -
随机森林 重要性
2024-10-02 -
随机森林算法
2024-10-02 -
机器学习中随机森林的原理
2024-10-02 -
随机森林算法原理
2024-10-02 -
使用计算机视觉技术进行动物识别的技巧
2024-10-02 -
基于crf命名实体识别实验总结
2024-10-02 -
transformer预测模型训练方法
2024-10-02
最新文章
-
随机森林算法介绍及R语言实现
2024-10-02 -
基于随机森林优化的神经网络算法在冬小麦产量预测中的应用研究_百度文 ...
2024-10-02 -
基于正则化贪心森林算法的情感分析方法研究
2024-10-02 -
随机森林算法和grandientboosting算法
2024-10-02 -
基于随机森林的图像分类算法研究
2024-10-02 -
随机森林结合直接正交信号校正的模型传递方法
2024-10-02
发表评论