码迷,mamicode.com
首页 > 数据库 > 详细

Oracle 11gR2 Duplicate target database for standby

时间:2014-08-31 15:48:51      阅读:382      评论:0      收藏:0      [点我收藏+]

标签:des   os   io   ar   for   art   cti   log   sp   

1. copy standby control file from primary db to standby db and rename the file name and location in stdby db same as the primary db

2. copy password file from primary db to the standby db (keep both of them same )

3. use the pfile to startup the standby database using  >>>>>>>>>>

SQL> conn sys@brsstby as sysdba
输入口令:
已连接到空闲例程。
SQL> startup nomount pfile=‘d:\pfileBRS.ora‘
ORACLE 例程已经启动。startup nomount  pfile= ‘

 >>>use recovery catalog to duplicate database

rman target  sys/oracle@BRS  auxiliary sys/oracle@BRSSTBY catalog rman/rman001@RMANDB

run
{
allocate channel disk1 device type disk;
allocate channel disk2 device type disk ;
allocate channel disk3 device type disk ;
allocate channel disk4 device type disk ;
allocate auxiliary channel aux1 device type disk ;
allocate auxiliary channel aux2 device type disk ;
allocate auxiliary channel aux3 device type disk ;
allocate auxiliary channel aux4 device type disk ;
DUPLICATE TARGET DATABASE
  FOR STANDBY
  FROM ACTIVE DATABASE
  DORECOVER
  PASSWORD FILE
  SPFILE
    SET db_unique_name=‘BRSSTBY‘ COMMENT ‘Is standby‘
    SET LOG_ARCHIVE_DEST_2=‘SERVICE=BRS ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=BRS‘
    SET FAL_SERVER=‘BRS‘ COMMENT ‘Is primary‘
  NOFILENAMECHECK;
}

SQL> shutdown immediate;
ORA-01109: database not open
SQL> startup mount;

SQL> alter database recover managed standby database disconnect from session;

Start the apply process on standby server.

# Foreground redo apply. Session never returns until cancel.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;

# Background redo apply. Control is returned to the session once the apply process is started.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

If you need to cancel the apply process, issue the following command.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

On Primary:

SQL> archive log list
SQL> alter system switch logfile;


On Standby:

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# APPLIED
———- —————————
31 YES
32 YES
33 YES
34 YES
35 IN-MEMORY

 

SQL> ALTER DATABASE REGISTER LOGFILE ‘<archive destination with archive file>‘;


on prod DB
SQL> SELECT STATUS,PROCESS FROM V$MANAGED_STANDBY;

STATUS PROCESS
------------ ---------
CLOSING ARCH
CLOSING ARCH
CLOSING ARCH
WRITING LNS

on standby

SQL> SELECT STATUS,PROCESS FROM V$MANAGED_STANDBY;

 

SQL> select database_role from v$database;

DATABASE_ROLE
————————————————
PHYSICAL STANDBY


注意Data Guard 启动顺序:
启动顺序:先standby ,后primary;
关闭顺序:先primary 后standby;


SQL> select member from v$logfile;

MEMBER
-----------------------------------------------
G:\ORACLE_DATA\BRS\REDO41.LOG
D:\ORACLE_DATA\BRS\REDO42.LOG
F:\ORACLE_DATA\BRS\REDO31.LOG
G:\ORACLE_DATA\BRS\REDO32.LOG
E:\ORACLE_DATA\BRS\REDO21.LOG
F:\ORACLE_DATA\BRS\REDO22.LOG
D:\ORACLE_DATA\BRS\REDO11.LOG
E:\ORACLE_DATA\BRS\REDO12.LOG
E:\ORACLE_DATA\STANDBYBRS\STDY_REDO51.LOG
D:\ORACLE_DATA\STANDBYBRS\STDY_REDO52.LOG
F:\ORACLE_DATA\STANDBYBRS\STDY_REDO61.LOG

MEMBER
-----------------------------------------------
G:\ORACLE_DATA\STANDBYBRS\STDY_REDO62.LOG
E:\ORACLE_DATA\STANDBYBRS\STDY_REDO71.LOG
F:\ORACLE_DATA\STANDBYBRS\STDY_REDO72.LOG
D:\ORACLE_DATA\STANDBYBRS\STDY_REDO81.LOG
E:\ORACLE_DATA\STANDBYBRS\STDY_REDO82.LOG

已选择16行。

Oracle 11gR2 Duplicate target database for standby

标签:des   os   io   ar   for   art   cti   log   sp   

原文地址:http://www.cnblogs.com/jefflu2012/p/3947719.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!