当前位置:操作系统 > Unix/Linux >>

数据迁移:DataGuard配置

数据迁移:DataGuard配置
 
本次快速搭建单实例物理DataGuard,为解决某些同事担心“那如果我在primary里面使用提交的事务操作时按照rowid去检索数据,到备库执行的和主库操作不一致”
数据库软件安装过程不再赘述。
  www.zzzyk.com  
1: 检查主库否为 force logging .
[sql] 
select inst_id , force_logging from gv$database;  
alter database force logging;  
2:备库创建数据库实例 
oradim -new -sid tjcshow -startmode a
 
3:配置主/备库tnsnames,listener
增加主库TNSNAMES节点:
[sql] 
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拷贝到备库待用
修改监听:
[sql] 
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
[sql] 
---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;
[sql] 
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\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.131)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = tjcsh  
ow)))  
OK (0 msec)  
 
6:RMAN 备份主库
[sql] 
sql 'alter system archive log current' ;  
backup as compressed backupset full format='c:\backupset-%d_%s.bak' database include current controlfile for standby plus archivelog ;  
 
7:拷贝文件,还原备库
[sql] 
Set oracle_sid=tjcshow  
Startup pfile=’c:\standby.ora’ nomount;  
rman target  sys/oracle@tjcshow1  auxiliary sys/oracle@tjcshow2   
duplicate target database for standby dorecover nofilenamecheck;  
 
8:添加Standby redo log 重做日志组配置
( 01) 主库添加Standby Redo Log
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('C:\oracle\product\10.2.0\oradata\tjcsho\redo004') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('C:\oracle\product\10.2.0\oradata\tjcsho\redo005') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('C:\oracle\product\10.2.0\oradata\tjcsho\redo006') SIZE 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('C:\oracle\prod
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,