Oracle 11g DataGuard 配置详细说明
1.判断DataGuard是否安装
select * from v$option where parameter = 'Oracle Data Guard'; 2. 数据库环境说明
主库配置:IP:192.168.228.133(Oracle11g1),数据库名:db1,监听服务名:db1pri,网络服务名:pri
从库配置:IP:192.168.229.134(Oracle11g2),数据库名:db1,监听服务名:db1dg ,网络服务名:dg
数据库程序安装路径:/oracleapp/oinstall/oracle/product/11.2.0/dbhome_1/dbs 数据库存放路径:/oracledata/db1 3.监听配置
在做oracle dataguard主从库配置时候,一定要配置静态监听,否则可能出现监听服务解析错误,不能连接的问题,监听配置如下: 主库 配置如下:
[oracle@Oracle11g1 admin]$ pwd
/oracleapp/oinstall/oracle/product/11.2.0/dbhome_1/network/admin [oracle@Oracle11g1 admin]$ cat listener.ora
# listener.ora Network Configuration File:
/oracleapp/oinstall/oracle/product/1.2.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. WU =
(DESCRIPTION_LIST = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle11g2)(PORT = 1521)) ) )
SID_LIST_WU = (SID_LIST =
—
(SID_DESC =
(GLOBAL_DBNAME =db1pri)
(ORACLE_HOME = /oracleapp/oinstall/oracle/product/11.2.0/dbhome_1) (SID_NAME = db1) ) )
ADR_BASE_WU = /oracleapp/oinstall/oracle
#注意这里的global_dbname=db1pri,SID_NAME=db1,这个SID_NAME 应与你对外提供服务的 $ORACLE_SID 一致,即数据库:db1 [oracle@Oracle11g1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File:
/oracleapp/oinstall/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. pri =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle11g1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = db1pri) ) ) dg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle11g2)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = db1dg) ) )
#tnsname pri 中的 SERVICE_NAME=db1pri ,这里的服务名为 db1pri而不是通常的 db1,因为在 listener.ora 中已经注册了 db1pri,lsnrctl 启动时会监听 db1pri ,并
欢迎下载
2
—
对应到 SID_NAME=db1 上。此处的pri,dg为数据库参数文件中(initdb1.ora)的
DB_UNIQUE_NAME的名字,即对外提供的服务名。
从库配置如下:
[oracle@Oracle11g2 admin]$ cat listener.ora
# listener.ora Network Configuration File:
/oracleapp/oinstall/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. WU =
(DESCRIPTION_LIST = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle11g2)(PORT = 1521)) ) )
SID_LIST_WU = (SID_LIST = (SID_DESC =
(GLOBAL_DBNAME = db1dg)
(ORACLE_HOME = /oracleapp/oinstall/oracle/product/11.2.0/dbhome_1) (SID_NAME = db1) ) )
ADR_BASE_WU = /oracleapp/oinstall/oracle [oracle@Oracle11g2 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File:
/oracleapp/oinstall/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. pri =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Oracle11g1)(PORT = 1521))
欢迎下载
3