您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > Windows环境下配置oracle-11gR2-Data-Guard详细过程
1Windows环境下配置oracle11gR2DataGuard详细过程1服务器环境:两台PC机,操作系统为Windowsserver2008R2数据库准备为oracle11.2.0.3forwin322配置前准备:主库主机名service1,ip配置为192.168.104.11,db_name:orcl,db_unique_name:primary备库主机名service2,ip配置为192.168.104.21.db_name:orcl,db_unique_name:standby在安装oracle时,主库安装数据库,备库只安装软件安装路径在D盘,具体路径为默认D:\app\Administrator\。实例名为orcl数据文件放在E:\oracleDB\orcl文件夹下,归档日志文件放在E:\oracleDB\flash\orcl\ARCHIVELOG文件夹下,联机日志文件默认3正式配置过程:3.1主库配置在主库启动数据库到mount模式,开启归档模式与forceloggingflashback。2ShutdownimmediateStartupmountAlterdatabasearchivelog;Alterdatabaseforcelogging;Alterdatabaseflashbackon;3.2查看当前日志文件组Select*fromv$logfileorderbygroup#;33.3为备用库创建日志文件:这里四组可以简单的理解为在线日志组数+1Alterdatabaseaddstandbylogfilegroup4(‘E:\oracleDB\orcl\redo004.log’)size50m;Alterdatabaseaddstandbylogfilegroup5(‘E:\oracleDB\orcl\redo005.log’)size50m;Alterdatabaseaddstandbylogfilegroup6(‘E:\oracleDB\orcl\redo006.log’)size50m;Alterdatabaseaddstandbylogfilegroup7(‘E:\oracleDB\orcl\redo007.log’)size50m;4再次查询v$logfile已经建好备用日志了。3.4修改系统参数spfile文件(13个参数)1)Altersystemsetdb_unique_name='primary'scope=spfile;2)Altersystemsetlog_archive_config='DG_CONFIG=(primary,standby)'scope=spfile;53)Altersystemsetlog_archive_dest_1='location=E:\oracleDB\flash\orcl\ARCHIVELOG\VALID_FOR=(ALL_LOGFILES,ALL_ROLES)DB_UNIQUE_NAME=primary'scope=spfile;4)Altersystemsetlog_archive_dest_2='SERVICE=standbyLGWRASYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=standby'scope=spfile;5)Altersystemsetlog_archive_dest_state_1='enable'scope=spfile;6)Altersystemsetlog_archive_dest_state_2='enable'scope=spfile;7)Altersystemsetfal_server='standby'scope=spfile;8)Altersystemsetfal_client='primary'scope=spfile;9)Altersystemsetarchive_lag_target=1800scope=spfile;10)Altersystemsetlog_archive_format='%t_%s_%r.arc'scope=spfile;11)Altersystemsetstandby_file_management=autoscope=spfile;12)Altersystemsetdb_file_name_convert='standby','primary'scope=spfile;13)Altersystemsetlog_file_name_convert='standby','primary'scope=spfile;63.5启动数据库Alterdatabaseopen;重启数据库将修改的参数加载;ShutdownimmediateStartup3.6创建pfile参数文件;Createpfilefromspfile;默认路径下D:\app\Administrator\product\11.2.0\dbhome_1\database\INITorcl.ORA。73.7创建密码文件密码文件存放在:D:\app\Administrator\product\11.2.0\dbhome_1\database\文件名为:PWDorcl.ora如果在目录下未能找见,则需要动手创建,创建命令为:Orapwdfile=D:\app\Administrator\product\11.2.0\dbhome_1\database\PWDorcl.orapassword=123entries=58注:在cmd命令下输入orapwd。Orcl为实例名,123为主库sys的密码3.8配置主库网络监听(备用库同理)文件位置在D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\修改listener.ora文件,内容如下:#listener.oraNetworkConfigurationFile:d:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora#GeneratedbyOracleconfigurationtools.SID_LIST_LISTENER=(SID_LIST=(SID_DESC=(SID_NAME=CLRExtProc)(ORACLE_HOME=d:\app\Administrator\product\11.2.0\dbhome_1)(PROGRAM=extproc)(ENVS=EXTPROC_DLLS=ONLY:d:\app\Administrator\product\11.2.0\dbho9me_1\bin\oraclr11.dll))(SID_DESC=(GLOBAL_DBNAME=orcl)(ORACLE_HOME=d:\app\Administrator\product\11.2.0\dbhome_1)(SID_NAME=orcl)))LISTENER=(DESCRIPTION_LIST=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.104.11)(PORT=1521))(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))))ADR_BASE_LISTENER=d:\app\Administrator10红色内容为需要修改成的。修改tnsnames.ora文件,内容如下:#tnsnames.oraNetworkConfigurationFile:d:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora#GeneratedbyOracleconfigurationtools.PRIMARY=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.104.11)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))ORACLR_CONNECTION_DATA=(DESCRIPTION=(ADDRESS_LIST=11(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))(CONNECT_DATA=(SID=CLRExtProc)(PRESENTATION=RO)))STANDBY=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.104.21)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))ORCL=(DESCRIPTION=(ADDRESS_LIST=12(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.104.11)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))红色内容为需要修改成的。3.9测试监听重启监听,用网络名连接测试监听是否正常C:\lsnrctlstopC:\lsnrctlstart重启数据库:shutdownimmediate---startup测试监听C:\tnspingprimaryC:\sqlplussys/syspwd@primaryassysdba13如果不能连接,请检查防火墙。3.10关闭注数据库3.11在备用建立文件夹A.将D:\app\Administrator目录下的admin、cfgtoollogs、diag目录及E:\oracleDB\下的flash目录及密码文件拷贝到备用库相同的路径下。B.将主库的listener.ora和tnsnames.ora拷贝到备库相同路径下。注意修改listener.or中IP地址为备机IPLISTENER=14(DESCRIPTION_LIST=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.104.21)(PORT=1521))(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))))在主备机E盘建立E:\oracleDB\tmp文件夹3.12备机新建实例在备机上注册oracle实例到服务中,命令如下:Oradim-new-sidorcl(实例名)3.13在备库启动监听153.14备库参数文件将刚才主库创建的pfile参数文件initorcl.ora文件拷贝至备库D盘根目录下修改为如下:orcl.__db_cache_size=536870912orcl.__java_pool_size=8388608orcl.__large_pool_size=8388608orcl.__oracle_base='d:\app\Administrator'#ORACLE_BASE16setfromenvironmentorcl.__pga_aggregate_target=520093696orcl.__sga_target=771751936orcl.__shared_io_pool_size=0orcl.__shared_pool_size=209715200orcl.__streams_pool_size=0*.archive_lag_target=1800*.audit_file_dest='d:\app\Administrator\admin\orcl\adump'*.audit_trail='db'*.compatible='11.2.0.0.0'*.control_files='E:\oracleDB\orcl\control01.ctl','E:\oracleDB\flash\orcl\con
本文标题:Windows环境下配置oracle-11gR2-Data-Guard详细过程
链接地址:https://www.777doc.com/doc-4658030 .html