oracle primary rac dataguard single database

主库地址:192.168.1.111(DBP1)  192.168.1.112 (DBP2)

备库地址:192.168.1.17 (DBSTD)


1、主库修改参数:

ALTER DATABASE FORCE LOGGING;
*.fal_server='sgoastd'
SGOADBP1.fal_client='DBP1'
SGOADBP2.fal_client='DBP2'
*.log_archive_dest_2='SERVICE=DBSTD ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DBSTD'


2、备库主要参数设置:

 *.instance_number=1
FAL_SERVER='dbp1'
FAL_SERVER='DBP2'
FAL_CLIENT='DBSTD'
DB_FILE_NAME_CONVERT='+DATA','/u01/dbstd'
LOG_FILE_NAME_CONVERT='+DATA','/u01/dbstd'
db_recovery_file_dest=/u01/dbstd
*.service_names='dbp'
*.cluster_database=false
*.db_unique_name=DBSTD
*.instance_name=DBSTD
*.thread=1
*.standby_file_management=auto
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'


3、备库创建密码文件,一定要和主库密码一致:

orapwd file=orapwdbstd password=oracle123 entries=5


4、主库和备库修改tnsnames.ora文件:

DBP1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.111)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dbp)
      (INSTANCE_NAME = dbp1)
    )
  )

DBP2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.112)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dbp)
      (INSTANCE_NAME = dbp2)
    )
  )


DBSTD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.17)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dbp)
    )
  )

5、启动备库到nomount状态(提前创建adump及存放数据目录)

6、执行rman,创建standby库


run {
   allocate channel prmy1 type disk connect 'sys/oracle@dbp1';
   allocate channel prmy2 type disk connect 'sys/oracle@dbp2'; 
   allocate auxiliary channel stby type disk;
   duplicate target database for standby from active database;
}

7、激活数据同步

STARTUP MOUNT FORCE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

8、以读写方式打开数据库
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
drop RESTORE POINT before_upgrade;
CREATE RESTORE POINT before_upgrade GUARANTEE FLASHBACK DATABASE;
ALTER DATABASE ACTIVATE STANDBY DATABASE;
STARTUP MOUNT FORCE;
ALTER DATABASE OPEN;

9、恢复数据库,重新与主库同步数据
STARTUP MOUNT FORCE;
FLASHBACK DATABASE TO RESTORE POINT before_upgrade;
ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
STARTUP MOUNT FORCE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25702/viewspace-2132011/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25702/viewspace-2132011/

你可能感兴趣的:(数据库,网络)