How to set the database in standby server ?

A primary database can have more than 10 standby server.

First Set The Primary Database in archive log
Second Enable Database for force logging
create standby controlfiles
create parameter pfile from spifle
edit init.ora (primary ) inits.ora(standby)
Shutdown the database
Copy the datafiles and logfile to stby folder
use oradmin to create stby service
configure listener . tnsnames
Start primary with the new init.ora and create spfile from init.ora
Start standby
Start Managed recovery Mode
Open the database in read only mode.

 

First set the Primary database in archive Log mode
Startup Mount
Alter database archive log
Second Enable database force logging
Alter database force logging
create standby controlfile
Alter database create standby controlfile as 'c:\oracle\stand.ctl';
Alter database open;

create the parameter file from spifle for primary
create pfile=c:oracle\init.ora from spifle;
edit the following in primary database init.ora file
log_archive_config='DG_CONFIG=(orcl,stby)'
/*primary database archive location and also connect string */
log_archive_Dest_1='LOCATION=c:\oracle\orcl\arch valid_for=
(ALL_LOGFILES,ALL_roles) DB_UNIQUE_NAME=orcl'
/* service name fror standby service */
log_archive_dest_2='SERVICE=stby LGWR ASYNC
valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stby'
log_archive_Dest_state_1=ENABLE
log_archive_Dest_state_2=ENABLE
remote_login_passwordfile=exclusive
fal_server=stby
fal_Client=orcl
standby_file_management=auto
db_file_name_convert='C:\oracle\product\10.2.0\oradata\stby',
'C:\oracle\product\10.2.0\oradata\orcl'
/* First location of standby should be specified
and then primary be specified */


Create the parameter file for standby database
db_name=orcl
db_unique_name=stby
log_archive_config='DG_CONFIG=(orcl,stby)'
*.db_recovery_file_dest='C:\oracle\stby'
log_archive_Dest_1='LOCATION=c:\oracle\stby\arch
valid_for=(ALL_LOGFILES,ALL_roles) DB_UNIQUE_NAME=stby'
log_archive_dest_2='SERVICE=orcl LGWR ASYNC
valid_for=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
log_archive_Dest_state_1=ENABLE
log_archive_Dest_state_2=ENABLE
remote_login_passwordfile=exclusive
fal_server=orcl
fal_Client=stby
standby_file_management=auto
db_file_name_convert='C:\oracle\product\10.2.0\oradata\orcl',
'C:\oracle\product\10.2.0\oradata\stby'
/*Note in standby server the fal_server=orcl and
db_file_name_convert =here first primary folder is put and
then standby server folder.
also note db_reoverty_File_Dest location is different from standby */

Shutdown the database
create a secondary folder for standby
copy the datafiles ,logfiles from primary to secondary Folder

use oradim to create a service for
standby in admin/service section

oradim -new -sid stby -intpwd oracle -startmode manual
also give the password

configure the listener
Use netmanager to add database service for both primary and standy in listener
configure tnsnames.ora
Use netmanager to add service for both primary and standby

start primary database
startup pfile=c:\oracle\init.ora

create spfile from the pfile through which primary was opend
create spfile from pfile=c:\oralce\init.ora;

start the standby
startup nomount pfile=c:\oracle\inits.ora
alter datbaase mount standby datbase;
start managed recovery for standby
alter database recover managed standby database disconnect from session;

To open the database in read only.
alter database recover managed standby database cancel;
alter database open read only;