Oracle Data Guard (An
Oracle Enterprise Edition Feature)
Configuring
standby database from primary database (Active Database)
Configure standby parameter file.
Standby
database(stand) Side:-
~]$ cd
$ORACLE_HOME/dbs
dbs]$ cp
initprod.ora initstand.ora
dbs]$ vi initstand.ora (db_name=prod)
:%s/prod/stand/g (change name by this command in parameter file)
db_unique_name=pune
db_file_name_convert='/u01/home/prod','/u01/home/stand'
log_file_name_convert='/u01/home/prod','/u01/home/stand'
log_archive_dest_1='location=/u01/home/stand/arch'
:wq!
~]$ mkdir
stand
~]$ cd stand
stand]$ mkdir
arch diag
stand]$ pwd
Primary database(prod) Side:-
~]$ export ORACLE_SID=prod
~]$
sqlplus / as sysdba
SQL>
startup
SQL>
create pfile from spfile;
SQL> exit
~]$ cd
$ORACLE_HOME/dbs
dbs]$ rm -rvf
spfileprod.ora
dbs]$ vi
initprod.ora (db_name=prod)
standby_file_management=auto
log_archive_dest_2='service=tostand'
log_archive_dest_1='location=/u01/home/prod/arch'
db_unique_name=hyd
:wq! (save & quit)
Configure listener on standby database side:-
stand]$ netmgr(create listener)
stand]$
lsnrctl start list_stand
Primary database(prod) Side:-
Configure TNS on primary database side
dbs]$ netmgr(create TNS)
dbs]$
tnsping tostand
Both side create password file
Primary database(prod) Side:-
prod]$ cd $ORACLE_HOME/dbs
dbs]$ orapwd file=orapwprod password=manager force=y ignorecase=y
Standby database(stand)
stand]$
cd $ORACLE_HOME/dbs
dbs]$ orapwd file=orapwstand password=manager force=y ignorecase=y
start the standby database in nomount state
dbs]$ export ORACLE_SID=stand
dbs]$
sqlplus / as sysdba
SQL>
startup nomount
Primary database(prod) Side:-
dbs]$ export ORACLE_SID=prod
dbs]$
sqlplus / as sysdba
SQL> shut
immediate
SQL>
startup
SQL>
archive log list (Archive Mode= Enabled)
SQL> exit
dbs]$ rman
target / nocatalog auxiliary sys/manager@tostand
RMAN>
duplicate target database for standby from active database;
RMAN> exit
dbs]$ sqlplus
/ as sysdba
SQL>
archive log list (Archive Mode= Enabled)
Standby database(stand) Side:-
SQL>
archive log list (Archive Mode= Enabled)
SQL>
select database_role,open_mode, protection_mode from v$database;
(open_mode=MOUNTED)
SQL> alter
database open; (if have some arror so primary db
shut immediate then stand by alter again)
SQL>
select database_role, open_mode, protection_mode from v$database;
(open_mode=READ ONLY)
Primary database(prod) Side:-
SQL>
select database_role,open_mode,protection_mode from v$database;
(open_mode=READ WRITE)
SQL> alter
system switch logfile; (hit this
command 3 times)
SQL>
archive log list (Archive Mode= Enabled)
Standby database(stand) Side:-
SQL>
archive log list (Archive Mode= Enabled)
starting
mrp (media recovery process) process
SQL>
select SEQUENCE#,applied,archived from v$archived_log; (APPLIED=NO)
SQL> alter
database recover managed standby database disconnect;
SQL>
select SEQUENCE#,applied,archived from v$archived_log; (APPLIED=YES)
SQL> exit
dbs]$ ps -ef
| grep stand | grep mrp (mep=start)
How to stop mrp process
dbs]$
sqlplus / as sysdba
SQL> alter
database recover managed standby database cancel;
SQL> exit
dbs]$ ps -ef
| grep stand | grep mrp (mrp
stop)
Imp views:-
v$archive_dest (To check if any error in
transferring archives)
v$managed_standby (Current status information for oracle
database process)
3 v$archived_log (To check how many archives
are applied at standby database Side)
No comments:
Post a Comment