Oracle数据库DG单实例双备机.pdf
《Oracle数据库DG单实例双备机.pdf》由会员分享,可在线阅读,更多相关《Oracle数据库DG单实例双备机.pdf(27页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Oracle数据库DG单实例双备机部署记录2020-03目录环境介绍.3建立测试主库:.5修改 oracle 用户 profile:.5设置主库监听.5启动监听后,创建测试主库:.6查看控制文件:.6查看数据文件:.7查看归档文件:.7查看 db_unique_name:.7主库开启强制同步:.7环境介绍本次测试在一台物理主机下新建3台虚拟机进行测试,主库用1521端口做业务服务,用1522端口做DGO d g l模拟大带宽备机使用dumplicate复制,dg2模拟窄带宽备机使用rman备份,各项配置计划如下:主库备 库 1备库2主机名primarysecondthirdIP地址规划192.
2、168.0.20192.168.0.21192.168.0.22ORACLE_SIDdccbdbdccbdgldccbdg2TNSNAMEdccbdbdccbdgldccbdg2数据文件路径/oradata/dccbdb/oradata/dccbdgl/oradata/dccbdg2归档文件路径/archivelog/dccbdb/archivelog/dccbdgl/archivelog/dccbdg2db_unique_namedccbdbdccbdgldccbdg2log_archvie_configdccbdb,dccbdgl,dccbdg2dccbdb,dccbdgl,dccbdg2
3、dccbdb,dccbdgl,dccbdg2fal_serverdccbdgl,dccbdg2dccbdb,dccbdg2dccbdb,dccbdglfal_clientdccbdbdccbdgldccbdg2db_file_name_convert/oradata/dccbdgl,/oradata/dccbdb/oradata/dccbdb,/oradata/dccbdgl,/oradata/dccbdb,/oradata/dccbdg2log_file_name_convert/oradata/dccbdgl,/oradata/dccbdb/oradata/dccbdb,/oradata/
4、dccbdgl,/oradata/dccbdb,/oradata/dccbdg2more/etc/hosts192.168.0.20 primary192.168.0.21 second192.168.0.22 third建立测试主库:修改 oracle 用户 profile:oracleprimary$more-/.bash_profile#.bash_profile#Get the aliases and functionsif -f-/.bashrc;then./.bashrcfi#User specific environment and startup programsPATH=$P
5、ATH:$HOME/.local/bin:$HOME/binexport PATH#Add for Oracleumask 022export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_l/export PATH=$PATH:/usr/sbin:$ORACLE_HOME/binexport ORACLE_SID=dccbdbexport ORACLE_TERM=xtermexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
6、CLASSPATH=$ORACLE_HOME/jdk/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlibif$USER=oracle;thenif SSHELL=7bin/ksh;thenulimit-p 16384ulimit-n 65536elseulimit-u 16384-n 65536fifi设置主库监听在监听中添加了 1522端口做为D G的监听端口。oracleprimary admin$more listener.ora#listener.ora Network Configuration File:/u01/app/oracle/pro
7、duct/12.2.0/dbhome_l/network/admin/listener.ora#Generated by Oracle configuration tools.SID_LIST_LISTENER=(SID_LIST 二(SID_DESC=(GLOBAL_DBNAME=dccbdb)(ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_l)(SID.NAME 二 dccbdb)LISTENER 二(DESCRIPTION=(ADDRESS 二(PROTOCOL=TCP)(HOST=192.168.0.20)(PORT=1521)LI
8、STENER_DG 二(DESCRIPTION 二(ADDRESS 二(PROTOCOL=TCP)(HOST 二 192.168.0.20)(PORT=1522)SID_LIST_LISTENER_DG 二(SID_LIST=(SID_DESC=(GLOBAL.DBNAME=dccbdb)(ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_l)(SID_NAME=dccbdb)ADR_BASE_LISTENER=/uOl/app/oracle启动监听后,创建测试主库:oracleprimary dbs$Isnrctl start listene
9、roracleprimary dbs$Isnrctl start listener_dg查看控制文件:SQL select name from v$controlfile;/uOl/app/oracle/oradata/dccbdb/controlOl.ctl/u01/app/oracle/fast_recovery_area/dccbdb/control02.ctl查看数据文件:SQLselect name from v$datafile;/oradata/dccbdb/systemOl.dbf/oradata/dccbdb/sysauxOl.dbf/oradata/dccbdb/undot
10、bsOl.dbf/oradata/dccbdb/usersOl.dbf查看归档文件:确认主库是否处于归档模式,若为非归档模式,需要修改为归档模式。此处我们已经开启归档。SQL show parameter db_recovery_fiIe_dest;NAME TYPE VALUEd b_recovery_f i I e_dest string/archivelog/dccbdbdb_recovery_file_dest_size big integer 8016M查看 db_unique_name:SQL show parameter db_unique_name;NAME TYPE VALU
11、Edb_unique_name string dccbdb主库开启强制同步:SQL show user;USER is SYSSQL alter database force logging;Database altered.验证是否同步:SQL select force_logging from v$database;FORCE_LOGGINGYES主库添加standby redostandby redo比联机日志多一个:首先确认联机日志的路径和大小:SQL select group#,thread#,bytes/1024/1024 MB from v$log;GROUP#THREAD#MB
12、1 12 13 1200200200SQL select member from vSlogfile;MEMBER/oradata/dccbdb/redo03.log/oradata/dccbdb/redo02 og/oradata/dccbdb/redoOl.log或:SQL select a.group#,a.thread#,a.bytes/1024/1024 Mb.b.member from v$log a,v$logfile bwhere a.group#=b.group#;GROUP#THREAD#MB MEMBER3 12 11 1200/oradata/dccbdb/redo03
13、.log200/oradata/dccbdb/redo02.log200/oradata/dccbdb/redoOl.log添 力 口 standby redolog 文 件:SQL alter database add standby logfile thread 1 group 4 7oradata/dccbdb/stdredo04.log size200M;Database altered.SQL alter database add standby logfile thread 1 group 5 7oradata/dccbdb/stdredo05.log size200M;Datab
14、ase altered.SQL alter database add standby logfile thread 1 group 6 7oradata/dccbdb/stdredo06.log size200M;Database altered.SQL alter database add standby logfile thread 1 group 7 7oradata/dccbdb/stdredo07.log size200M;Database altered.添 力 口 standby redolog 后查看:SQL select type,member from vSlogfile;
15、TYPE MEMBERONLINE/oradata/dccbdb/redo03.logONLINE/oradata/dccbdb/redo02.logONLINE/oradata/dccbdb/redoOl.logSTANDBY/oradata/dccbdb/stdredo04.logSTANDBY/oradata/dccbdb/stdredo05.logSTANDBY/oradata/dccbdb/std redo06.logSTANDBY/oradata/dccbdb/stdredo07.log查看监听文件:oracleprimary admin$more listener.ora#lis
16、tener.ora Network Configuration File:/u01/app/oracle/product/12.2.0/dbhome_l/network/admin/listener.oraSID_LIST_LISTENER 二(SID.LIST 二(SID_DESC=(GLOBAL.DBNAME 二 dccbdb)(ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_l)(SID_NAME=dccbdb)LISTENER 二(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.2
17、0)(PORT=1521)ADR_BASE_LISTENER=/uOl/app/oracle启动监听:oracleprimary admin$Isnrctl start LISTENER编辑tnsnames文件:oracleprimary admin$vi tnsnames.ora#tnsnames.ora Network Configuration File:/u01/app/oracle/product/12.2.0/dbhome_l/network/admin/tnsnames.ora#Generated by Oracle configuration tools.DCCBDB二(DES
18、CRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.20)(PORT=1522)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=dccbdb)DCCBDG1二(DESCRIPTION=(ADDRESS 二(PROTOCOL=TCP)(HOST=192.168.0,21)(PORT=1522)(CONNECT.DATA=(SERVER=DEDICATED)(SERVICE_NAME=dccbdgl)DCCBDG2=(DESCRIPTION 二(ADDRESS=(PROTOCOL=TCP)(HOST=192.1
19、68.0.22)(PORT=1522)(CONNECT_DATA 二(SERVER=DEDICATED)(SERVICE_NAME=dccbdg2)LISTENER_DCCBDB 二(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.20)(PORT=1521)修改主库DG参数:先对参数文件进行一个备份:oracleprimary admin$export ORACLE_SID=dccbdboracleprimary admin$sqlplus/as sysdbaSQL create pfile=7u01/app/oracle/product/12.2.0/dbhom
20、e_l/dbs/initdccbdb.ora,from spfile;一可将initdccbdb.ora文件再拷贝一个备份。SQL alter system set log_archive_config=dg_config=(dccbdbIdccbdgl1dccbdg2)scope二both;SQL alter system set log_archive_dest_l=location=/archivelog/dccbdb/valid_for=(all_logfiles,all_roles)db_unique_name=dccbdb scope=both;SQL alter system s
21、et log_archive_dest_2=service=dccbdgl Igwr async compression=enabIe valid_for=(online_logfiles,primary_role)db_unique_name=dccbdgl scope=both;SQL alter system set Iog_archive_dest_3=service=dccbdg2 Igwr async compression=enabIe valid_for=(online_logfiles,primary_role)db_unique_name=dccbdg2 scope=bot
22、h;SQL alter system set log_archive_dest_state_l=enable scope=both;SQL alter system set Iog_archive_dest_state_2=defer scope=both;SQL alter system set Iog_archive_dest_state_3=defer scope=both;SQL alter system set fal_=,dccbdgl,dccbdg2,scope=both;SQL alter system set fal_client=dccbdb scope=both;SQL
23、alter system set standby_file_management=auto scope=both;SQL alter system set dbjile.name.convert=/oradata/dccbdgl./oradata/dccbdb scope=spfile;SQL alter system set log_file_name_convert=7archivelog/dccbdgl,7archivelog/dccbdb scope=spfile;修改数据后重启数据库,然后再次生成一个参数文件,可以和之前生产的参数文件作对照。SQL shutdown immediat
24、e;SQL startup;SQL create pfile=7u01/app/oracle/product/12.2.0/dbhome_l/dbs/initdccb_new.ora fromspfile;对比前后的参数文件(红色为修改过的部分,绿色为新增部分):(oracleprlmary dbs)$cat lnltdccbdb.ora.bakdccMb.data t ransfer cache slze0dccbdb.db cache size1828716544dcctxJb.inmemory ext roarea*6dccbdb.i nmemo ry二 ex t rwa rdeebdb
25、.二Java_pooT_slie-16777216deebdb.large poolslze-33554432dccMb.oracle base*/u81/app/oracle,ORACIE BASE set from environmentdcc6Jb._ pga aggregate targct-83886e860deebdb.sga tarQet-25i6582496deebdb.shared lo pool slze117449512deebdb.shared pool slzcs5e331648ddccWb.$trns pool.a u d it f ile d e s t-/uei
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Oracle 数据库 DG 实例 双备机
限制150内