Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
com
standby db name =PROD Unique name = standby Host name=appsdr72.com
production side =
-----------------------------------
SQL> ALTER DATABASE FORCE LOGGING;
sql>show parameter db_unique_name=prod
SQL> alter system set log_archive_config='DG_CONFIG=(PROD,STANDBY)';
SQL> alter system set log_archive_dest_1='LOCATION=/u01/database/PROD/arch MANDA
TORY';
SQL> alter system set log_archive_dest_2='SERVICE=STANDBY LGWR ASYNC VALID_FOR=(
ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STANDBY' scope=spfile;
SQL> show parameter log_archive_min_succeed_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_min_succeed_dest integer 1
SQL> alter system set standby_file_management='AUTO';
SQL> alter system set fal_server=STANDBY;
SQL> alter system set fal_client=PROD;
SQL> alter system set log_archive_dest_state_2=DEFER;
SQL> alter system set db_file_name_convert='/u01/database/STANDBY/db/apps_st/dat
a','/u01/database/PROD/db/apps_st/data' scope=spfile;
SQL> alter system set log_file_name_convert='/u01/database/STANDBY/db/apps_st/da
ta','/u01/database/PROD/db/apps_st/data' scope=spfile;
SQL> alter system set standby_archive_dest='/u01/database/PROD/arch';
sql>show parameter db_recovery_file_dest='/u01/database/PROD/flashback'
sql> show paramerter db_recovery_file_dest_size = 500G
SQL> alter database add standby logfile group 4 ('/u01/database/PROD/db/apps_st/
data/redo04.dbf','/u01/database/PROD/db/apps_st/data/redo05.log') size 1000m;
sql>alter database add standby logfile group 5 ('/u01/database/PROD/db/apps_st/d
ata/redo06.dbf','/u01/database/PROD/db/apps_st/data/redo07.log') size 1000m;
sql>alter database add standby logfile group 6 ('/u01/database/PROD/db/apps_st/d
ata/redo08.dbf','/u01/database/PROD/db/apps_st/data/redo09.log') size 1000m;
$ tnsnames.ora
IFILE=/u01/database/PROD/db/tech_st/11.1.0/network/admin/PROD_appsdemo/PROD_apps
demo_ifile.ora
cat /db/oracle/10R2/network/admin/PROD_bcpdb/PROD_bcpdb_ifile.ora
[oracle@appsdemo PROD_appsdemo]$ cat PROD_appsdemo_ifile.ora
PRODDB = (DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=appsdemo.com)(PORT=1521))
(CONNECT_DATA=(SID=PROD))
)
STANDBY = (DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=appsdr72.com)(PORT=1521))
(CONNECT_DATA=(SID=PROD))
)
[oracle@appsdemo PROD]$ pwd
/u01/database/PROD
[oracle@appsdemo PROD]$ mkdir arch flashback
[oracle@appsdemo dbs]$ orapwd file=orapwPROD password=manager entries=5 ignoreca
se=y
SQL> shut immediate;
sql>startup;
[oracle@appsdemo 11.1.0]$ cd /u01/database/
[oracle@appsdemo ~]$ mkdir backup
RMAN method
--------------------------------
[oracle@appsdemo ~]$ rman target / nocatalog
rman>run
{
BACKUP AS COMPRESSED BACKUPSET database FORMAT '/u01/database/backup/database__%
d_%u_%s_%T';
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT '/u01/database/backup/archi
velogs_%d_%u_%s_%T';
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FOR STANDBY FORMAT '/u01/dat
abase/backup/controlfile_standby_%d_%u_%s_%T';
}
USERMANAGED cold backup --
--------------------------------
sql>shut immediate;
sql>shut immediate;
sql>shut immediate;
sql>shut immediate;
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/u01/standby.ctl';
sql>shut immmediate;
(copy rman backup / oracle home to standby side)
(copy datafiles / redolog file / standby controlfile / oracle home to standby si
de)
STANDBY SIDE=
-----------------------------------
[oracle@appsdemo PROD_appsdemo]$ perl adpreclone.pl dbTier
[applmgr@appsdemo scripts]$ perl adpreclone.pl appsTier
[oracle@appsdr72 bin]$ pwd
/u01/database/PROD/db/tech_st/11.1.0/appsutil/clone/bin
[oracle@appsdr72 bin]$ perl adcfgclone.pl dbTechStack
Target System Hostname (virtual or normal) [appsdr72] :
Target Instance is RAC (y/n) [n] :
Target System Database SID : PROD
Target System Base Directory : /u01/database/PROD
Target System utl_file_dir Directory List : /usr/tmp
Number of DATA_TOP's on the Target System [1] :
Target System DATA_TOP Directory 1 [/u01/database/PROD/db/apps_st/data] :
Target System RDBMS ORACLE_HOME Directory [/u01/database/PROD/db/tech_st/11.1.0]
:
Do you want to preserve the Display [null] (y/n) ? : n
Target System Display [appsdr72:0.0] :
Do you want the the target system to have the same port values as the source sys
tem (y/n) [y] ? : y
$ tnsnames.ora
IFILE=/u01/database/PROD/db/tech_st/11.1.0/network/admin/PROD_appsdemo/PROD_apps
demo_ifile.ora
STANDBY = (DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=appsdr72.com)(PORT=1521))
(CONNECT_DATA=(SID=PROD))
)
The DR database will gte into sycn overtime..once all the archives are applied-
--------------------------------------------------------------------------------
In case you want to open DR database in read only
=============================================
on production
---------------
sql>alter system set log_Archive_dest_state_2=defer;
On DR side =
------------
sql>recover managed standby database cancel;
sql>alter database open read only;
Once you want to remove DR db from read only mode
===============================================
on DR side
sql>shutdown immediate
sql>startup nomount
sql>ALTER DATABASE MOUNT STANDBY DATABASE;
sql>alter database recover managed standby database disconnect from session;
on production Side=
-----------------
sql>alter system set log_Archive_dest_state_2=enable;
On linux =
----------------
[applmgr@appsdemo ~]$ crontab -l
30 * * * * /bin/sh /u01/application/rsynclog.sh
30 * * * * /bin/sh /u01/application/rsyncout.sh
[applmgr@appsdemo ~]$ cat /u01/application/rsynclog.sh
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
rsync -arvh /u01/application/PROD/inst/apps/PROD_appsdemo/logs/appl/conc/log app
lmgr@192.168.1.172:/u01/application/PROD/inst/apps/PROD_appsdr72/logs/appl/conc/
> /u01/application/resynclog.log
#SWITCHOVER STEPS:-
ON?PRIMARY PROD
1.1.1 Preparing for switchover to standby server
1. Verify the primary database instance is open and standby database instance is
mounted.
2. Verify there are no active users connected to the database. Shut down all the
sessions in
the primary database.
3. Ensure that the last redo data transmitted from the primary database was appl
ied on the
standby database. Issue the following SQL command on the primary and standby
databases to find out. If necessary, perform a logfile switch before the first c
ommand
ON Standby
-----------------------
check for the sync
SQL> SELECT MAX(SEQUENCE#) FROM V$ARCHIVED_LOG WHERE APPLIED='YES';
SQL> archive log list
SQL> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL
.SEQUENCE# "Last Sequence Applied",
(ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM (SELECT THREAD# ,SEQUENCE# F
ROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME )
IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,
(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY
WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTO
RY GROUP BY THREAD#)) APPL
WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;
Sql>show parameter LOG_ARCHIVE_DEST_STATE_2= defer ;
ON Primary
---------------------------
perform a logfile switch before the first command
SQL>alter system switch logfile;
SQL>select sequence#,applied from v$archived_log;
SQL>select switchover_status from v$database;
SQL>connect / as sysdba;
SQL>alter database commit to switchover to physical standby with session shutdow
n;
SQL> Alter system set LOG_ARCHIVE_DEST_STATE_2= DEFER ;
LOG_ARCHIVE_DEST_STATE_2 to enable
SQL> Alter system set LOG_ARCHIVE_DEST_STATE_2= ENABLE ;
To complete the transition, the database must be shut down and re-started:
SQL>shutdown immediate
SQL>startup pfile=$ORACLE_HOME/dbs/init<SID>.ora | spfile
If you do not synchronize your concurrent manager log and out directories, blank
out the host name in the fnd_concurrent_requests table to avoid network timeout
errors:
SQL>update apps.fnd_concurrent_requests
set logfile_node_name = null,
outfile_node_name = null;
SQL>update apps.fnd_conc_req_outputs set file_node_name=' ';
SQL> update apps.fnd_conc_req_outputs set file_node_name='APPSDR72' where file_
node_name = 'APPSDEMO';
SQL> update apps.fnd_concurrent_queues set node_name = 'APPSDR72' where node_nam
e = 'APPSDEMO';
#SWITCHOVER STEPS:-
ON?PRIMARY PROD
1.1.1 Preparing for switchover to standby server
1. Verify the primary database instance is open and standby database instance is
mounted.
2. Verify there are no active users connected to the database. Shut down all the
sessions in
the primary database.
3. Ensure that the last redo data transmitted from the primary database was appl
ied on the
standby database. Issue the following SQL command on the primary and standby
databases to find out. If necessary, perform a logfile switch before the first c
ommand
If you run the latter update, you must execute it before starting the concurrent
managers on the
system. If you do not execute it before starting the managers, you must add a wh
ere clause to
limit the rows updated to those pointing to the old host names. This does not ne
ed to complete
before you run the next step. However, if you let users on to the system before
it is committed,
they will get errors if they try to access a report's log or out file that was g
enerated on the old
primary system.
6.2.3 Perform the cloning finishing tasks
Perform the Finishing Tasks outlined in My Oracle Support Knowledge Document 406
982.1,
Cloning Oracle Applications Release R12 with Rapid Clone.
Instance specific profile options at other than site level (Rapid Clone updates
the site level
instance specific profile options)
Printer settings as necessary
Workflow configuration settings
APPLCSF variable if necessary
6.2.4 Direct users to the new system
The standby system should be available to your users as your new primary system.
Direct your
users to the new URL.
6.2.5 Establish a new standby system
Perform this step if you have performed a failover. Failing over to the standby
database (versus
switching over) separates it from the old primary. You must create a new standby
environment
from this new system to again provide disaster recovery protection.
6.2.6 Re-point your CM log and out and native PL/SQL object directory rsync scri
pts
(optional)
If you are keeping your concurrent manager log and out directories synchronized
across the
environments, set up your rsync scripts to move the files from the new primary s
erver to the new
standby server.