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 [email protected] as sysdba
输入口令:
已连接到空闲例程。
SQL> startup nomount pfile=‘d:\pfileBRS.ora‘
ORACLE 例程已经启动。startup nomount pfile= ‘
>>>use recovery catalog to duplicate database
rman target sys/[email protected] auxiliary sys/[email protected] catalog rman/[email protected]
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行。