R12 standby server create with RMAN hot backup
My Environment
Primary server ofdev.xxxxx.xx 192.168.100.77 TESTC
Standby server ofteststab.xxxxxx.xx 192.168.100.249
TESTCDR
1 Force logging Enable Primary Database
1 su oracle
2 Run environment variables for DB
tire
3 sqlplus / as sysdba
4 SQL> ALTER DATABASE FORCE
LOGGING
2. Primary instance Create Database Password Files
1 su oracle
2 Run environment variable for DB
tire
3 cd $ORACLE_HOME/dbs
4 orapwd file=orapwTESTC password=sys ignorecase=y
Note: - password
should be not a simple one
Test the created password whether
work or not
1 su oracle
2 Run environment variables for DB
tire
3 sqlplus sys/sys@TESTC as sysdba
Above command should be connect to
primary database
3 Listener configurations for primary
su oracle
cd /u01/finsys/db/tech_st/11.1.0/network/admin/TESTC_ofdev
vi tnsnames.ora
TESTCDR=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)
(HOST=192.168.100.249)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=TESTC)
(INSTANCE_NAME=TESTC)
)
4 Enable archive log mode and change archive log file
location
1 su oracle
2 run environment variable for db
tire
3 sqlplus / as sysdba
4 shutdown immediate
5startup mount
6 sql> alter database
archivelog;
7 sql> alter system set
log_archive_dest_1='location=/u01/finsys/db/tech_st/flash_recovery_area/prod/archivelog’;
8 sql> alter database open;
5 Check archive log status of the database
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination
/u01/finsys/db/tech_st/flash_recovery_area/PROD/archivelog
Oldest online log sequence 165
Next log sequence to archive 167
Current log sequence 167
6 Create standby redo log
Assume, we have 2 online logs in PRIMARY, then we need
to add 3 standby log files
1 su oracle
2 Run environment variable for DB
tire
3 sqlplus / as sysdba
4
alter database add standby logfile
group 3 ('/u01/finsys/db/apps_st/data1/log03a.dbf','/u01/finsys/db/apps_st/data1/log03b.dbf')
size 1000M ;
alter database add standby logfile
group 4
('/u01/finsys/db/apps_st/data1/log04a.dbf','/u01/finsys/db/apps_st/data1/log04b.dbf')
size 1000M ;
alter database add standby logfile
group 5 ('/u01/finsys/db/apps_st/data1/log05a.dbf','/u01/finsys/db/apps_st/data1/log05b.dbf')
size 1000M ;
Verifying
standby redo logs
select MEMBER from
V$LOGFILE;
select TYPE from V$LOGFILE;
7 Primary pfile parameters
(initTESTC.ora)
*.DB_UNIQUE_NAME='TESTC'
*.INSTANCE_NAME='TESTC'
*.SERVICE_NAMES='TESTC'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(TESTC,TESTCDR)'
*.LOG_ARCHIVE_DEST_2='SERVICE=TESTCDR
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=TESTCDR'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.LOG_FILE_NAME_CONVERT='TESTCDR','TESTC'
*.DB_FILE_NAME_CONVERT='TESTCDR','TESTC'*.INSTANCE_NAME='TESTC'
*.REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
*.STANDBY_FILE_MANAGEMENT='AUTO'*.FAL_CLIENT='TESTC'
*.FAL_SERVER='TESTCDR'
*.FAL_CLIENT='TESTC'
Confirm the parameters on primary
show parameter db_unique_name
show parameter log_archive_dest_1
show parameter log_archive_dest_2
show parameter log_archive_config
show parameter
log_archive_dest_state_2
show parameter
log_archive_dest_state_1
show parameter
standby_file_management
show parameter Remote_login_passwordfile
show parameter fal
8 Prepare source Database Tier Pre Clone
1 su oracle
2 Run environment variables for DB
tire
3 cd ORACLE_HOME/appsutil/scripts/
4 perl adpreclone.pl dbTier
9 Create folders create on standby server
mkdir -p /u01/finsys/db/apps_st/data (for data node location )
mkdir -p /u01/finsys/db/apps_st/apptmt/ (for databases backup temp location )
mkdir -p
/u01/backup/Database_Backup (for databases
backup location )
Set permission to created
directories
chown -R oracle:dba /u01/
10 Copy db tire to
standby same as that primary server
rsync –avp
/u01/finsys/db/tech_st
root@192.168.100.249: /u01/finsys/db/
11 Take Backup of Primary Database hot RMAN
1 su oracle
2 Run environment variables for DB
tire
3
rman target /
4
RMAN> run
{
allocate
channel c1 type disk;
allocate
channel c2 type disk;
allocate
channel c3 type disk;
backup
database plus archivelog;
}
12 Copy backup rman hot backup pieces to standby server
same as primary location
su root
rsync –avp /u01/backup/Database_Backup/* root@192.168.100.249:/u01/backup/Database_Backup/
13 Clone the Standby Database Tier using Rapid Clone
su oracle
cd /u01/finsys/db/tech_st/11.1.0/appsutil/clone/bin
perl adcfgclone.pl dbTechStack
Provide the values required for
creation of the new Database Context file.
Target System Hostname (virtual or
normal) [proddr] :
Target Instance is RAC (y/n) [n] :
n
Target System Database SID : PROD
Target System Base Directory :
/u01/finsys
Target System utl_file_dir
Directory List : /u01/finsys/db/apps_st/apptmt
Number of DATA_TOP's on the Target
System [1] :
Target System DATA_TOP Directory 1
[/u01/finsys/db/apps_st/data] :
Target System RDBMS ORACLE_HOME
Directory [/u01/finsys/db/tech_st/11.1.0] :
Do you want to preserve the Display
[null] (y/n) ? : n
Target System Display [proddr:0.0]
: proddr:0.0
Do you want the the target system
to have the same port values as the source system (y/n) [y
] ? :
Note:- instance name should be same of the primary
14 Listener configurations on standby server
Edit Tnsname file or you can do
this process on gui mode also
cd
/u01/finsys/db/tech_st/11.1.0/network/admin/TESTCDR_oftdev
add following lines on tnsmanes.ora
file
TESTC= (DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=ofdev)(PORT=1521))
(CONNECT_DATA=(SID=TESTC))
)
Or you can do above step using GUI tool call netmgr
set
display variable
su oracle
export
display=192.168.100.161:0.0
netmgr
15 log in to standby SERVER
sqlplus / as sysdba
SQL> create spfile from pfile;
SQL> create pfile from spfile;
16 Add following entries for the standby SERVER (created
pfile)
*.DB_NAME='TESTC'
*.DB_UNIQUE_NAME='TESTDR'
*.SERVICE_NAMES='TESTCDR'
*.INSTANCE_NAME='TESTCDR'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(TESTC,TESTCDR)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/finsys/db/tech_st/flash_recovery_area/PROD/archivelog’
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.DB_FILE_NAME_CONVERT='TESTC','TESTCDR'
*.LOG_FILE_NAME_CONVERT='TESTC','TESTCDR'
*.REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.FAL_CLIENT='TESTCDR'
*.FAL_SERVER='TESTC'
17 Take database to nomount mode with created pfile
1 su oracle
2 Run environment variables for DB
tire
3 sqllplus / as sysdba
4 startup nomount pfile='/u01/finsys/db/tech_st/11.1.0/dbs/initTESTC.ora'
5 create
spfile from pfile;
Testing connectivity form standby
to primary
1 su oracle
2 Run environment variables for DB
tire
3 sqlplus sys/system@TESTC as
sysdba
4 SQL> select name from
v$database;
5 SQL> select status from
v$instance;
18 begging to rman
duplicate command
1 su oracle
2 Run environment variables for DB
tire
3
rman target sys/sys@TESTC auxiliary /
Out put
Copyright (c) 1982, 2005,
Oracle. All rights reserved.
Connected to target database: PRIM
(DBID=3603807872)
Connected to auxiliary database:
PRIM (not mounted)
RMAN>duplicate target database
for standby nofilenamecheck;
Note :- It will be take some time
it will depend on your database capacity
In my case my db is 380GB it was
taken more than 5 hours
19 Check the status of the standby database
1 su oracle
2 Run environment variables for DB
tire
3 sqllplus / as sysdba
4 select
NAME,OPEN_MODE,FORCE_LOGGING,DB_UNIQUE_NAME,CONTROLFILE_TYPE,DATABASE_ROLE from
v$database ;
Output
NAME OPEN_MODE
FOR DB_UNIQUE_NAME
CONTROL DATABASE_ROLE
--------- ---------- ---
------------------------------ ------- ----------------
PROD MOUNTED
YES PRODDR
STANDBY PHYSICAL STANDBY
20 Log in to PROD Server
and do below command (Important)
SQL
>alter system set
log_archive_dest_state_2 = 'enable' scope=both;SQL
>alter system set
log_archive_dest_state_2 = 'defer'
scope=both;
Check
the status of remote archive destination from primary
1 su oracle
2 run environment variables for db
tire
3
SQL> select
destination, status, error from v$archive_dest where dest_id=2;
Output should be if work
DESTINATION
STATUS ERROR
-------------------- --------- ----------------------------------------
TESTCDR VALID
-------------------- --------- ----------------------------------------
TESTCDR VALID
21 Start the redo apply form standby
1 su oracle
2 Run environment variables for DB
tire
3 SQL>
alter database recover managed standby database disconnect from session; #start
4 SQL>recover managed standby
database cancel; #stop
22 Monitoring data guard redo log transferring
and applying
SQL
>
select al.thrd
"Thread", almax "Last Seq Received", lhmax "Last Seq
Applied"
from (select thread#
thrd, max(sequence#) almax
from v$archived_log
where
resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) al,
(select thread# thrd,
max(sequence#) lhmax
from v$log_history
where
first_time=(select max(first_time) from v$log_history)
group by thread#) lh
where al.thrd = lh.thrd;
23
LAST APPLIED archive log (on standby)
1 su oracle
2 Run environment variables for DB
tire
3 sqllplus / as sysdba
4 SQL
>SELECT
SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG;
Output
SEQUENCE#
APPLIED
----------
---------
318 YES
319 YES
320 IN-MEMORY
74 rows selected.
24 Data gaud status monitoring
1 su oracle
2 Run environment variables for DB
tire
3 sqllplus / as sysdba
4 SQL>
select MESSAGE from v$dataguard_status;
MESSAGE
--------------------------------------------------------------------------------
ARC0: Completed
archiving thread 1 sequence 439 (0-0)
RFS[3]: Successfully
opened standby log 4: '/u01/finsys/db/apps_st/data/log04a.d
bf'
Media Recovery Log
/u01/finsys/db/tech_st/flash_recovery_area/PROD/archivelog/1_
439_796402345.dbf
Protection Mode
SELECT protection_mode FROM v$database;
PROTECTION_MODE
--------------------
MAXIMUM PERFORMANCE
25
Switch the standby database into read-only mode
1 su oracle
2 Run environment variables for DB
tire
3 sqllplus / as sysdba
4
SQL>
ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE CANCEL; #stop redo log receiving
from primary
SQL>SHUTDOWN
IMMEDIATE;
SQL>STARTUP
MOUNT;
SQL>ALTER
DATABASE OPEN READ ONLY;
SQL>ALTER DATABASE RECOVER MANAGED
STANDBY DATABASE DISCONNECT FROM SESSION;
26 Preparing the standby application
Su oracle
Run environment variable
autoconfig for dbTire
cd /u01/finsys/apps/apps_st/comn/clone/bin
perl adcfgclone.pl appsTier
Note :- this time the cloning process will
be complete with waning
27 Fail over the standby server
SQL>alter database recover managed
standby database cancel;
SQL>alter database recover managed
standby database finish;
SQL>alter database commit to switchover
to primary;
SQL>alter database open;
SQL>shutdown immediate;
SQL>startup;
28 Complete the database configuration on
sqlplus apps/apps
SQL>select node_name
From FND_NODES;
The above command will give the old instance name and in this case you must
follow the following steps to complete it.
SQL> EXEC FND_CONC_CLONE.SETUP_CLEAN;
SQL> commit;
Run auto config for DBtire
Run auto config for appsTire
Start the application
No comments:
Post a Comment