Overview
1. Overview___________________________________________________________ 1
2. Configuration_______________________________________________________ 2
2.1. Listener.ora ___________________________________________________________ 2
2.2. tnsnames.ora __________________________________________________________ 2
2.3. Pfile __________________________________________________________________ 3
2.4. Directory Structure _____________________________________________________ 4
3. Setting It Up ________________________________________________________ 5
3.1. Archive Files___________________________________________________________ 5
3.2. Query V$MANAGED_STANDBY ________________________________________ 6
3.3. Log files to check on both systems_________________________________________ 7
3.4. Post Set-up ____________________________________________________________ 7
4. Database Maintenance _______________________________________________ 8
4.1. Cancel/Stop Managed Standby Recovery___________________________________ 8
4.2. Activating a Standby Database ___________________________________________ 8
4.3. Database Switchover ____________________________________________________ 8
4.4. Database Fail over ______________________________________________________ 9
4.5. Automatic Archive Gap Detection_________________________________________ 9
4.6. Delayed Redo Application ______________________________________________ 10
1
2. Configuration
2.1. Listener.ora
2.1.1. listener.ora entry on nodeA
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = DWH0P01))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = nodeA.ldn.eu.wm.ubs.com)(PORT = 1521))
)
)
)
2.2. tnsnames.ora
2.2.1. tnsnames.ora entry on nodeA and nodeB
# TNSNAMES.ORA Network Configuration File:
/var/db/oracle/product/9.2.0/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
prod1.db.eu.wm.ubs.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = nodeA.ldn.eu.wm.ubs.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = prod1.db.eu.wm.ubs.com)
)
)
stby1.db.eu.wm.ubs.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = nodeB.fft.eu.wm.ubs.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = stby1.db.eu.wm.ubs.com)
)
)
2
2.3. Pfile
2.3.1. pfile for DWH0P01 on nodeA
#include the common include file BEFORE the other parameters so that "common" parameters can
be overridden
ifile = /var/db/oracle/product/9.2.0/dbs/common_ifile.ora
audit_trail = OS
control_files = ("/var/db/oracle/admin/DWH0P01/data/DWH0P01_cntrl_01.ctl",
"/var/db/oracle/admin/DWH0P01/data/DWH0P01_cntrl_02.ctl")
db_name = DWH0P01
background_dump_dest = /var/db/oracle/admin/DWH0P01/bdump
user_dump_dest = /var/db/oracle/admin/DWH0P01/udump
core_dump_dest = /var/db/oracle/admin/DWH0P01/cdump
db_block_buffers = 6400
open_links = 255
processes = 85
shared_pool_size = 50M
undo_management = AUTO
undo_tablespace = UNDO
undo_retention = 7200
SERVICE_NAMES = prod1
LOG_ARCHIVE_FORMAT = DWH0P01_%S.arc
LOG_ARCHIVE_DEST_1 = 'LOCATION=/var/db/oracle/admin/DWH0P01/archive MANDATORY
REOPEN=30'
LOG_ARCHIVE_DEST_2 = 'SERVICE=stby1 LGWR SYNC AFFIRM'
LOG_ARCHIVE_DEST_STATE_1= enable
LOG_ARCHIVE_DEST_STATE_2= enable
REMOTE_ARCHIVE_ENABLE = true
FAL_SERVER = prod1
FAL_CLIENT = stby1
STANDBY_ARCHIVE_DEST = /var/db/oracle/admin/DWH0P01/standby
The LGWR SYNC AFFIRM keywords indicate that the Logwriter should synchronously
write updates to the online redo logs to this location and wait for confirmation of
the write before proceeding, if in maximum protection mode. The remote site will
process and archive these standby redo logs to keep the databases synchronized.
This whole process can impact performance greatly but provides maximum data
security. However if communications are halted between sites, the Primary
Database will continue and the Standby Database will re-sync when
communications are re-established. If in maximum protection mode, the Primary
database will halt. An easy test for this is to stop the listeners.
REMOTE_ARCHIVE_ENABLE = true
SERVICE_NAMES = stby1
LOCK_NAME_SPACE = stby1
INSTANCE_NAME = stby1
FAL_SERVER = prod1
3
FAL_CLIENT = stby1
STANDBY_ARCHIVE_DEST = /var/db/oracle/admin/DWH0P01/standby
LOG_ARCHIVE_TRACE = 127
LOG_ARCHIVE_FORMAT = DWH0P01_%S.arc
STANDBY_FILE_MANAGEMENT = auto
REMOTE_ARCHIVE_ENABLE = true
If maximum protection is not required, then removing “LGWR SYNC AFFIRM” and
changing it to say “REOPEN=60” in both of the pfiles’ will then just enable the standby
database to receive and apply archive files when they are produced on the primary database.
4
3. Setting It Up
That’s it
5
3.2. Query V$MANAGED_STANDBY
Query the physical standby database to monitor log apply and log transport
services activity at the standby site.
nodeB(oracle):/var/db/oracle/admin/DWH0P01/standby$ sqlplus
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Dec 30 21:30:47 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Enter user-name: / as sysdba
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;
From the query on the primary database, we see the current sequence being
written to in the redo log area is 4205, and on the standby database we also see
the current archive log being applied is for sequence 4205. In the directory that
receives archive files on the standby database, the file DWH0P01_0000004205.arc
will exist and will be the same size as the redo log on the primary database.
However the primary database will not have DWH0P01_0000004205.arc as a file in
the archive area, as a log switch will not have occurred yet, but both databases
are synchronized at the same sequence and block number, 14947.
The other RFS entries for the standby database are from a previous attempt and
can be ignored.
6
Up-to-date details can be found at
http://foglight.appl.eu.wm.ubs.com/DBCentral/html/standby_db_status.html
For more information on monitoring, check the Oracle site
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96653/log_apply.htm#SBYDB0055
7
4. Database Maintenance
Since the standby database is now the primary database it should be backed up
immediately. The previous primary database can then be configured as a
standby.
1. Backup Standby Database
Backups of the standby database can only be performed if the database is shut
down or in read only mode. Read only mode is best for managed recovery
systems, as archive logs will still be transferred during the backup process, thus
preventing gap sequences. Once the server is in the desired mode simply copy the
appropriate database files.
8
1. CONNECT / AS SYSDBA
2. ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;
3. SHUTDOWN IMMEDIATE;
4. STARTUP NOMOUNT
5. ALTER DATABASE MOUNT STANDBY DATABASE;
6. RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Now the original Primary database is in Standby mode and waiting for the new
Primary database to activate, which is done while connected to the standby
database (not the original primary)
1. CONNECT / AS SYSDBA
2. ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
3. SHUTDOWN IMMEDIATE;
4. STARTUP
This process has no affect on alternative standby locations. The process of
converting the instances back to their original roles is known as a Switchback. The
switchback is accomplished by performing another switchover.
This process will recovery all or some of the application data using the standby
redo logs, therefore avoiding reinstantiation of other standby databases. If
completed successfully, only the primary database will need to be reinstatiated as
a standby database.
Forced Database Failover changes one standby database to a primary database.
Application data may be lost necessitating the reinstantiation of the primary and
all standby databases.
The FAL server is normally the primary database, but can be another standby
database. Once the standby database is placed in managed recovery mode it
will automatically check for gap sequences. If it finds any it will request the
appropriate files from the primary database via the FAL server. If the gap
sequences cannot be resolved the files have to be recovered manually. This can
be done by retrieving missing archive files to the archive directory on the Primary
server.
9
4.6. Delayed Redo Application
Application of the archived redo logs to the standby database can be delayed
using the DELAY keyword. If a rogue statement significantly damages the primary
database the DBA can choose to switch to the standby database, which will be in
the correct state prior to the problem on the primary database.
On the primary database, issue the following commands: -
• Delay application of archived redo logs by 30 minutes.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DELAY 30;
• Return to no delay (Default).
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE NODELAY;
10