oracle ADG for windows install steps

Environment Introduction:
Windows 2012 R2 * 2 sets of
main libraries: oracle software installation, monitoring, examples of
the standby database: oracle software to install, monitor
database version: 11.2.0.4
main library: orcl
library equipment: prod

1、主库
create pfile='C:\Users\Administrator\Desktop\file\pfile.ora' from spfile;
alter database force logging;

alter system set log_archive_config='DG_CONFIG=(orcl,prod)' scope=spfile;
alter system set log_archive_dest_1='location=C:\app\archive valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl' scope=both sid='';
alter system set log_archive_dest_2='service=prod LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=prod' scope=both sid='
';
alter system set log_archive_dest_state_1='enable' scope=both sid='';
alter system set log_archive_dest_state_2='enable' scope=both sid='
';
alter system set fal_client='orcl' scope=both sid='';
alter system set fal_server='prod' scope=both sid='
';
alter system set standby_file_management='AUTO' scope=both sid='';
alter system set db_file_name_convert='C:\app\datafiles\orcl\','C:\app\datafiles\prod\' scope=spfile sid='
';
alter system set log_file_name_convert='C:\app\datafiles\orcl\','C:\app\datafiles\prod\' scope=spfile sid='*';

SQL> create pfile='C:\Users\Administrator\Desktop\file\pfilebak.ora' from spfile;

2, prepared by the library to create a directory
archive directory C: \ app \ archive
data file directory C: \ App \ the Datafiles \ Prod \
adump directory C: \ app \ Administrator \ admin \ prod \ adump

3、主库备份
rman target /
run{
allocate channel a1 device type disk;
allocate channel a2 device type disk;
allocate channel a3 device type disk;
crosscheck archivelog all;
sql 'alter system archive log current';
sql 'alter system archive log current';
backup full database format='C:\Users\Administrator\Desktop\file\full%U%T' include current controlfile for standby;
backup current controlfile for standby format 'C:\Users\Administrator\Desktop\file\control01.ctl';
backup archivelog all format 'C:\Users\Administrator\Desktop\file\arch
%d%T%U.arc';
release channel a1;
release channel a2;
release channel a3;
}

4, copy files
password file $ ORACLE_HOME / database
password file (need to change sid), pfile, redo, temp , to prepare the library copy corresponding directory.

5, modify the host file
192.168.3.2 WIN-JP7MSEND1SD
192.168.3.3 WIN-KL9BBQ52F5R

6, tnsnames consistent standby database

7, modified by the library file pfile
change pfile file
db_name = 'orcl' should be consistent with the primary database
.db_unique_name = 'Prod'
.audit_file_dest = 'C: \ App \ Administrator \ ADMIN \ Prod \ the adump' note path
log_archive_dest_1 = 'C: \ App \ Archive '
.db_recovery_file_dest
ORACLE_BASE
deleted log_archive_dest_2, log_archive_dest_state_1
modify
FAL_CLIENT =' Prod '
.fal_server =' ORCL '
.log_archive_config =' = the DG_CONFIG (ORCL, Prod) '
.log_archive_dest_1 =' LOCATION = C: \ App \ = Archive VALID_FOR (ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME = prod '

* Check the file path is correct ***

8, prepared by the library to add a service
the oradim -new -sid Auto Prod the -startmode
the SET Prod the ORACLE_SID =

9, recovery backup database
SQL> Startup pfile = nomount 'C: \ the Users \ Administrator \ Desktop \ File \ pfilebak.ora';
SQL> Create pfile = SPFILE from 'C: \ the Users \ Administrator \ Desktop \ File \ pfilebak.ora ';
if demand changes to data files which are available through
RMAN target / nocatalog
RMAN> Restore STANDBY controlfile from' C: \ the Users \ Administrator \ Desktop \ file \ CONTROL01.CTL ';
SQL> the ALTER Database Mount;
Cataog Start with' C: \ Users \ Administrator \ Desktop \ file \ ';

run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
set newname for datafile 1 to 'C:\app\datafiles\prod\system01.dbf';
set newname for datafile 2 to 'C:\app\datafiles\prod\sysaux01.dbf';
set newname for datafile 3 to 'C:\app\datafiles\prod\undotbs01.dbf';
set newname for datafile 4 to 'C:\app\datafiles\prod\users01.dbf';
set newname for datafile 5 to 'C:\app\datafiles\prod\example01.dbf';
restore database;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
recover database;

10、主备库添加standby日志(比online log至少多一个)
主库
alter database add standby logfile thread 1 group 4('C:\app\datafiles\orcl\standby04.log') size 50M;
alter database add standby logfile thread 1 group 5 ('C:\app\datafiles\orcl\standby05.log') size 50M;
alter database add standby logfile thread 1 group 6 ('C:\app\datafiles\orcl\standby06.log') size 50M;
alter database add standby logfile thread 1 group 7 ('C:\app\datafiles\orcl\standby07.log') size 50M;
alter database add standby logfile thread 1 group 8 ('C:\app\datafiles\orcl\standby08.log') size 50M;
备库
alter database add standby logfile thread 1 group 4('C:\app\datafiles\prod\standby04.log') size 50M;
alter database add standby logfile thread 1 group 5 ('C:\app\datafiles\prod\standby05.log') size 50M;
alter database add standby logfile thread 1 group 6 ('C:\app\datafiles\prod\standby06.log') size 50M;
alter database add standby logfile thread 1 group 7 ('C:\app\datafiles\prod\standby07.log') size 50M;
alter database add standby logfile thread 1 group 8 ('C:\app\datafiles\prod\standby08.log') size 50M;

11, the main library DB restart restart to take effect because log_archive_config

启动同步
SQL>alter database recover managed standby database disconnect from session;
SQL> recover managed standby database cancel;
SQL>alter database open read only;
SQL>alter database recover managed standby database using current logfile disconnect from session;

验证
主库 v$archived_log
SQL> select thread#,max(sequence#) from v$archived_log where applied='NO' group by thread#;

备库 v$archived_log
SQL> select thread#,max(sequence#) from v$archived_log where applied='YES' group by thread#;

备库 v$managed_standby;
select process,status,thread#,sequence# from v$managed_standby;
SQL> select process,status,thread#,sequence# from v$managed_standby;

PROCESS STATUS THREAD# SEQUENCE#


ARCH CONNECTED 0 0
ARCH CONNECTED 0 0
ARCH CLOSING 1 10
ARCH CLOSING 1 11
RFS IDLE 0 0
RFS IDLE 0 0
RFS IDLE 0 0
RFS IDLE 1 12
MRP0 APPLYING_LOG 1 12

Guess you like

Origin blog.51cto.com/11298469/2472376