日期:2014-05-16  浏览次数:20441 次

数据迁移:DataGuard配置

本次快速搭建单实例物理DataGuard,为解决某些同事担心“那如果我在primary里面使用提交的事务操作时按照rowid去检索数据,到备库执行的和主库操作不一致”

数据库软件安装过程不再赘述。


1: 检查主库否为 force logging .

select inst_id , force_logging from gv$database;
alter database force logging;

2:备库创建数据库实例 

oradim -new -sid tjcshow -startmode a


3:配置主/备库tnsnames,listener

增加主库TNSNAMES节点:

TJCSHOW1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.111.130)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = tjcshow)
    )
  )


TJCSHOW2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.111.131)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = tjcshow)
    )
  )



将主库listener/SQLNET/TNSNAMES拷贝到备库待用

修改监听:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
    (GLOBAL_DBNAME = tjcshow)
    (ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
    (SID_NAME = tjcshow)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = DKD-O13022802)(PORT = 1521))
    )
  )



4:主库生成pfile,拷贝到备库作为基础参数文件,修改主/备库pfile

---PRIMAY
*.log_archive_config=''
*.log_archive_dest_1='LOCATION=C:\oracle\product\10.2.0\archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tjcshow'
*.log_archive_dest_2='service=tjcshow2 lgwr async  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tjcshow'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.LOG_ARCHIVE_FORMAT='%t_%s_%r.arc'
*.log_archive_max_processes=1
*.fal_client='tjcshow1'
*.fal_server='tjcshow2'
*.DB_FILE_NAME_CONVERT='C:\oracle\product\10.2.0\oradata\tjcshow','C:\oracle\product\10.2.0\oradata\tjcshow' 
*.LOG_FILE_NAME_CONVERT='C:\oracle\product\10.2.0\oradata\tjcshow','C:\oracle\product\10.2.0\oradata\tjcshow'
*.standby_file_management=auto

---STSNDBY

*.log_archive_config=''
*.log_archive_dest_1='LOCATION=C:\oracle\product\10.2.0\archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tjcshow'
*.log_archive_dest_2='service=tjcshow1 lgwr async  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=tjcshow'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.LOG_ARCHIVE_FORMAT='%t_%s_%r.arc'
*.log_archive_max_processes=1
*.fal_client='tjcshow2'
*.fal_server='tjcshow1'
*.DB_FILE_NAME_CONVERT='C:\oracle\product\10.2.0\oradata\tjcshow','C:\oracle\product\10.2.0\oradata\tjcshow' 
*.LOG_FILE_NAME_CONVERT='C:\oracle\product\10.2.0\oradata\tjcshow','C:\oracle\product\10.2.0\oradata\tjcshow'
*.standby_file_management=auto




5:节点联通性测试,节点1 tnsping tjcshow1 tnsping tjcshow2 节点2 tnsping tjcshow1 tnsping tjcshow2

startup nomount pfile=c:\standby.ora;

c:\oracle\product\10.2.0\db_1\BIN>TNSPING.EXE tjcshow1

TNS Ping Utility for 64-bit Windows: Version 10.2.0.4.0 - Production on 13-MAR-2
013 09:23:20

Copyright (c) 1997,  2007, Oracle.  All rights reserved.

Used parameter files:
C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.1
11.130)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = tjcsh
ow)))
OK (0 msec)

c:\oracle\product\10.2.0\db_1\BIN>TNSPING.EXE tjcshow2

TNS Ping Utility for 64-bit Windows: Version 10.2.0.4.0 - Production on 13-MAR-2
013 09:23:21

Copyright (c) 1997,  2007, Oracle.  All rights reserved.

Used parameter files:
C:\oracle\product\10.2.0\d