[Oracle]Data Guard之-创建物理Standby
[Oracle]Data Guard之-创建物理Standby实验环境Primary:主机: jabdw1241SID: O01DMS0DB_UNIQUE_NAME: O01DMS0Standby:主机: jabdw1242SID: O01DMS0DB_UNIQUE_NAME: O01DMS0DR1. Primary的配置和操作1) 确认primary处于归档模式PRIMARY>archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination H:\INTEL_ARCH\O01DMS0Oldest online log sequence 468Next log sequence to archive 470Current log sequence 4702) 确认primary处于force logging模式PRIMARY>select force_logging from v$database;FOR---NO结果为NO,通过下面语句把primary设为force logging:PRIMARY>alter database force logging;Database altered.3) 配置primary的参数增加以下必须参数:*.db_unique_name=O01DMS0*.log_archive_config='DG_CONFIG=(O01DMS0,O01DMS0DR)'*.log_archive_dest_2='service=O01DMS0DR ARCH VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=O01DMS0DR'*.log_archive_dest_state_2=defer以下参数虽然不是必须的,但在角色切换中有用,建议配置:*.fal_server=O01DMS0DR*.fal_client=O01DMS0*.standby_file_management=auto重建spfile启动primary:PRIMARY>shutdown immediate;PRIMARY>create spfile from pfile;File created.PRIMARY>startup4) 创建standby的控制文件PRIMARY>alter database create standby controlfile as 'H:\CONTROL01.O01DMS0';Database altered.5) 创建password fileC:\Documents and Settings\a105024>orapwd file=G:\Oracle\Ora102\database\PWDO01DMS0.ora password=oracle entries=306) 复制数据文件到standby服务器查出primary端的所有数据文件:PRIMARY>select name from v$datafile;NAME-----------------------------------------------I:\INTEL_DATA\O01DMS0\SYSTEM01.O01DMS0I:\INTEL_DATA\O01DMS0\UNDOTBS01.O01DMS0I:\INTEL_DATA\O01DMS0\USERS01.O01DMS0I:\INTEL_DATA\O01DMS0\SECURITY_D.O01DMS0K:\INTEL_INDEX\O01DMS0\SECURITY_I.O01DMS0I:\INTEL_DATA\O01DMS0\SYSAUX01.O01DMS0I:\INTEL_DATA\O01DMS0\STREAMS_TBS.DBFI:\INTEL_DATA\O01DMS0\DMS01.O01DMS0I:\INTEL_DATA\O01DMS0\UNDOTBS02.O01DMS0关闭数据库:PRIMARY>shutdown immediate;把上面的所有数据文件拷贝到standby服务器对应的目录下。再把刚生成的控制文件拷贝到standby服务器对应的目录下,注意控制文件要复制三份,且要修改文件名。最后再把pfile和password file拷贝到standby服务器对应的目录下。注意:online 和 archived redo log不需要复制。启动数据库:PRIMARY>startup2. Standby的配置和操作1) 创建OracleServiceC:\Documents and Settings\a105024>oradim -new -sid O01DMS0Instance created.2) 修改standby参数打开刚刚从primary复制过来的pfile,修改以下参数:*.db_unique_name=O01DMS0DR*.log_archive_dest_2='service=O01DMS0 ARCH VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=O01DMS0'*.log_archive_dest_state_2=enable*.fal_server=O01DMS0*.fal_client=O01DMS0DR创建spfile:STANDBY> create spfile from pfile;File created.3) 启动数据库至mount状态注意:在启动至mount之前,一定要仔细检查参数文件和控制文件中指定的目录和文件都已在standby服务器存在。STANDBY>startup mount;ORACLE instance started.Total System Global Area 629145600 bytesFixed Size 1296652 bytesVariable Size 339740404 bytesDatabase Buffers 251658240 bytesRedo Buffers 36450304 bytesDatabase mounted.3. 配置primary和standby的通讯1) standby listener 的配置DRO01DMS0 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = JABDW1242)(PORT = 1521)))SID_LIST_DRO01DMS0 =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = O01DMS0)(ORACLE_HOME = G:\Oracle\ora102)(SID_NAME = O01DMS0)))通过lsnrctl启动listener2) primary tnsnames 的配置O01DMS0DR =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = jabdw1242)(PORT = 1521)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = O01DMS0)))测试primary是否能连standby:C:\Documents and Settings\a105024>tnsping O01DMS0DRTNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 18-OCT-2011 02:49:47Copyright (c) 1997, 2007, Oracle. All rights reserved.Used parameter files:G:\Oracle\Ora102\network\admin\sqlnet.oraUsed TNSNAMES adapter to resolve the aliasAttempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = jabdw1242)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = O01DMS0)))OK (40 msec)3) standby tnsnames 配置O01DMS0 =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = jabdw1241)(PORT = 1521)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = O01DMS0)))测试standby是否能连primary:C:\Documents and Settings\a105024>tnsping O01DMS0TNS Ping Utility for 32-bit Windows: Version 10.2.0.4.0 - Production on 18-OCT-2011 02:54:32Copyright (c) 1997, 2007, Oracle. All rights reserved.Used parameter files:G:\oracle\ora102\network\admin\sqlnet.oraUsed TNSNAMES adapter to resolve the aliasAttempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = jabdw1241)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = O01DMS0)))OK (50 msec)上一个:oracle error:Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...解决
下一个:[Oracle]Data Guard之-三种保护模式
- 更多Oracle疑问解答:
- 运行exp备份oracle数据库提示oracle-12154错误
- 有没有,生产Oracle Rman 备份脚本的工具啊!
- 初学orcle,希望有大大帮忙解说一下详细步骤,从登录oracle到创建表的过程
- oracle语句问题:一张user表,三个字段,id,name,time,插入记录比如:张三2007,李四2008,张三2011
- 如何写一个ORACLE触发器同步两个表中的数据?
- oracle 如何查看一个服务器上有多少个数据库.
- oracle 创建包的时候错误 求解
- oracle 重复列的问题
- oracle 中如何查处2星期前的数据
- 请教oracle数据库安装中的问题
- 请问谁能提供给我标准的oracle ERP的数据库表结构并详细说明各表主要的作用?
- 安装oracle遇到的问题 invalid entry CRC (expected 0x3e12e795 but got 0x9db0e9fd)
- 我的是ORACLE 10G,在RMAN中如何按指定的时间恢复数据文件啊?
- oracle为什么没有自动增长列
- oracle快捷键都有哪些啊?