Oracle 10g数据库g DataGuard在虚拟机中的配置_Oracle数据库_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

Oracle 10g数据库g DataGuard在虚拟机中的配置

作者:黑客防线网安网站维护基地 来源:黑客防线网安网站维护基地 浏览次数:0

本篇关键词:OracleDataGuard虚拟机
黑客防线网安网讯:在Oracle数据库中,DataGuard最主要的功能就是容灾。它可以分为物理STANDBY和逻辑STANDBY两种。物理STANDBY主要用在主库的归档日志方面;逻辑STANDBY主要应用的是主库的归档日志提取的SQL语句。本文主要论述的是Dat
Oracle数据库中DataGuard最主要的功能就是容灾它可以分为物理STANDBY和逻辑STANDBY两种物理STANDBY主要用在主库的归档日志方面;逻辑STANDBY主要应用的是主库的归档日志提取的SQL语句。本文主要论述的是DataGuard在虚拟机上的配置包括STANDBY参数的文件的相关配置等。

1.环境准备

虚拟机版本:VMware GSX

操作系统 :redhat linux 4

Primary主机

ip:192.168.111.131

db_name:wellcomm

db_unique_name:wellcomm

ip:192.168.111.131

db_name:wellcomm

db_unique_name:wellcommb

2.设置Primary主机为force logging模式


alter database force logging;
3.在Primary 上面创建备用日志(为切换而用)


alter database add standby logfile group 4 ('/u01/oracle/oradata/wellcomm/stdredo01.log') size 50m; 
alter database add standby logfile group 5 ('/u01/oracle/oradata/wellcomm/stdredo02.log') size 50m; 
alter database add standby logfile group 6 ('/u01/oracle/oradata/wellcomm/stdredo03.log') size 50m;
4.修改primary库的参数


alter system set db_unique_name='wellcomm' scope=spfile; 
alter system set log_archive_config='DG_CONFIG=(wellcomm,wellcommb)'; 
alter system set log_archive_dest_1='LOCATION=/u01/oracle/oradata/wellcomm/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=wellcomm'; 
alter system set log_archive_dest_2='SERVICE=wellcommb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=wellcommb'; 
alter system set log_archive_dest_state_1=enable; 
alter system set log_archive_dest_state_2=enable; 
alter system set log_archive_max_processes=10;
5.克隆Primary数据库


shutdown immediate 
startup mount 
backup database;
创建standby的控制文件


alter database create standby controlfile as '/u01/oracle/controlbak.ctl';
创建standby的参数文件并按standby主机的配置修改


create pfile='/u01/oracle/initwellcommb.ora' from spfile;
6.在standby主机上恢复数据库(rman方式);

将5步的文件拷备到对应位置(ftp)

startup mount pfile='';

修改参数文件


db_name='ora10g1'
db_unique_name='ora10g3'
log_archive_config='DG_CONFIG=(wellcomm,wellcommb)'
log_archive_dest_1='LOCATION=/u01/oracle/oradata/wellcommb/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=wellcommb'  log_archive_dest_2='SERVICE=wellcomm LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=wellcomm'
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable
remote_login_passwordfile='EXCLUSIVE'
log_archive_max_processes=10
restore database;
7.监听配置和tns服务配置

(1)primary 主机上配置

listener.ora文件内容如下:


SID_LIST_LISTENER = 
(SID_LIST = 
(SID_DESC = 
(GLOBAL_DBNAME = wellcomm ) 
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1) 
(SID_NAME = wellcomm ) 


LISTENER = 
(DESCRIPTION_LIST = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.111.131)(PORT = 1521)) 

)
tnsnames.ora文件内容如下:


WELLCOMM = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = wangwang)(PORT = 1521)) 
(CONNECT_DATA =   (SERVER = DEDICATED)   (SERVICE_NAME = wellcomm)   )   )   WELLCOMMB =   (DESCRIPTION =   (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.111.132)(PORT = 1521)) 
(CONNECT_DATA = 
(SERVER = DEDICATED) 
(SERVICE_NAME = wellcommb) 

)
(2)在standby主机上配置

listener.ora文件内容如下:


SID_LIST_LISTENER = 
(SID_LIST = 
(SID_DESC = 
(GLOBAL_DBNAME = wellcommb) 
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1) 
(SID_NAME = wellcommb) 


LISTENER = 
(DESCRIPTION_LIST = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = wangkang)(PORT = 1521)) 

)
tnsnames.ora文件内容如下:


WELLCOMM = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.111.131)(PORT = 1521)) 
(CONNECT_DATA = 
(SERVICE = DEDICATED) 
(SERVICE_NAME = wellcomm) 


WELLCOMMB = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.111.132)(PORT = 1521)) 
(CONNECT_DATA = 
(SERVER = DEDICATED ) 
(SERVICE_NAME = wellcommb) 

)
重启监听

lsnrctl stop

lsnrctl start

8.在standby主机上启动应用redo

alter database recover managed standby database disconnect from session;

(取消:alter database recover managed standby database cancel;)

9.确认从Primary到Standby的Redo传输及应用

(1)在Primary主机上执行日志文件切换(最好多次)

alter system switch logfile;

(2)查询Primary的归档日志

select sequence#,applied,first_time,next_time from v$archived_log order by sequence#;

(3)查询Standby的归档日志及其应用

select sequence#,applied,first_time,next_time from v$archived_log order by sequence#;

注意applied字段显示YES则表明该归档日志已被standby数据库应用了。
    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-5029-1.html
网站维护教程更新时间:2011-07-20 21:43:04  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer