Você está na página 1de 7

Physical Standby process 11g new feature

Preparing the Physical standby using


RMAN Image copy. (11g New Feature)
Version: 1

SL
No

Description

Preparing
standby
using Rman
image copy

Versio
n

Date

Changed
By

14/08/2
012

Phanikis
han

Approved
By

Remarks

Preparing the primary.

Create the spfile from pfile.


Add the following datagaurd patameters.
SQL> alter system set log_archive_dest_1="LOCATION=Path of Archives" scope=both;
SQL> alter system set log_archive_dest_2="service=to_standby lgwr sync affirm
scope=both;
SQL> alter system set FAL_SERVER=to_standby scope=both;
SQL> alter system set FAL_client=to_prod scope=both;
SQL>

alter system set standby_file_management=auto scope=both;

create the password file if already they take the backup and create new one
$orapwd file=orapw$ORACLE_SID password=welcome

Preparing the Standby

Install the Database software only at the standby.


Copy the pfile from primary to standby to the $ORACLE_HOME/dbs folder
create a password file with same password as primary in dbs folder
$orapwd file=orapw$ORACLE_SID password=welcome
Change the following parameters according to the standby database directory structure
and create necessary directories for that.
The following parameters have to be added in changed are added in parameter file
log_archive_dest_1='LOCATION=/oracle/database/saistby/app/saistby/archives/'
log_archive_dest_2='service=to_prod lgwr sync affirm'
fal_client='to_standby'
fal_server='to_prod'
standby_file_management='AUTO'
Use the following parameters to convert the paths of the datafiles from primary to
standby
Example:
db_file_name_convert='/1500/sai/app/sai/oradata/prod','/oracle/database/saistby/app/sa
istby/oradata/dev'

log_file_name_convert='/1500/sai/app/sai/oradata/prod','/oracle/database/saistby/app/s
aistby/oradata/dev'
Create the directories according to the parameter file.
Use the following parameter to change the database name from prod to dev keep the
format as
db_name ='prod'
db_unique_name='dev'

CONFIGURING THE PRIMARY AND STANDBY NETWORK

Add the following entries in the listener.ora to configure the listener.

Configure the standby listener.ora


STANDBY SID IS DEV
dev=
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.17.35)(PORT = 3000))
)
)
SID_LIST_dev=
(SID_LIST =
(SID_DESC =
(SID_NAME = dev)
(ORACLE_HOME =/oracle/database/saistby/app/saistby/product/11.2.0/dbhome_1)
)
)

Configure the standby tnsnames.ora


to_prod =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.17.44)(PORT = 2000))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(ORACLE_SID = prod)
)
)

Configure the primary listener.ora

Here in this section we will configure the two listener one is used by the database
and other is used for the RMAN to send the data from Target to the Auxiliary
Main listener for the primary
prod =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.17.44)(PORT = 2000))
)
)
SID_LIST_prod =
(SID_LIST =
(SID_DESC =
(SID_NAME = prod)
(ORACLE_HOME = /1500/sai/app/sai/product/11.2.0/dbhome_1)
)
)

Local listener for the primary

local =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.17.44)(PORT = 2501))
)
)
SID_LIST_local=
(SID_LIST =
(SID_DESC =
(SID_NAME = prod)
(ORACLE_HOME = /1500/sai/app/sai/product/11.2.0/dbhome_1)
)
)

Configure tnsnames for the Primary


Tns entry for the local listener
to_local=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.17.44)(PORT = 2501))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(ORACLE_SID =prod)
)
)

Tns entry for the Standby listener. According to this configure the standby listener.
to_standby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.17.35)(PORT = 3000))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(ORACLE_SID =dev)
)
)

Check Whether the listener and tnsnames pinging correctly are not

At Primary
lsnrctl
lsnrctl
tnsping
tnsping

status prod
status local
to_standby
to_local

At Standby
lsnrctl status dev
tns_ping to_prod

After pinging correctly check whether we are connecting to the database using sys
user both in primary and standby

AT Primary
sqlplus sys/welcome as sysdba
sqlplus sys/welcome@to_standby as sysdba

AT Standby
sqlplus sys/welcome as sysdba
sqlplus sys/welcome@to_prod as sysdba
If Successfully Connected then our Network configured successfully.
Note : Please put the standby database in nomount while restore

Now connect to the Rman via target and Auxiliary to send the data from primary to
standby.
5

rman target sys/welcome@to_local auxiliary sys/welcome@to_standby

RMAN>duplicate target database for standby from active database nofilenamecheck;

FINALLY AT THE STANDBY FINISH TASKS TO SYNC THE ARCHIVES AND TO APPLY
ARCHIVES

Here the database will be in nomount state issue the following commands after
completing the RMAN restore.
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect from session;
The above query will put the data in MRM mode (Managed Recovery Mode)
The archives will sync now.
To Come out of MRM mode use the following query.
SQL>alter database recover managed standby database cancel;
Check the archvies syncing and wheather applied are not using the following queries.
SQL>select name,applied from v$archived_log;
SQL>select process,status,sequence#,block# from vss$managed_standby;
Now check the archive log list in both the databases by connecting to sqlplus and
check the sequence number. It should match.
If it matches it is done
We have prepared the standby database for the primary database.

Suddenly if the Primary database gets crashed do the following tasks to make the
Standby database as Primary.

Firstly check the Archive log sequence of the primary if the server is up and
compare the Archive log sequence of primary with standby if any archives are
missing copy them from primary to standby.
Use the following tables to check the Archive log sequence applied are not.
SQL> select name, applied from v$archived_log;
SQL> select sequence#,process,status,block# from v$managed_standby;
SQL> select database_role from v$database;
IT should be Physical Standby
After doing this confirm the archives are up to date or not and issue the following
commands.
SQL> alter database recovery managed standby database finish;
The above query will make the database to come out of MRM mode.
SQL> alter database active standby database;
SQL> alter database open;
SQL>select database_role from v$database;

Now the standby becomes the primary

Você também pode gostar