Professional Documents
Culture Documents
DBVisit As-Built
Page | 1
Document Change History
Document Authorization
Name/Title Signature Date
Prepared by: Divanshu Chopra 16th February 2015
Modified by:
Jaivardhan Singh
Reviewed by: 4th January 2018
Bairaria
Accepted by:
Version History
Version Author Issue Purpose Date
0.1 Raymond Allo Initial Draft 20/08/2013
0.2 Hong Tran Reviewed and 19/09/2013
formatted
1.0 Raymond Allo Updated with 7/10/2013
customer feedback
2.0 Hong Tran Released 7/10/2013
2.3 Raymond Allo Added DBVisit and 16/10/2013
RMAN sections
3.0 Hong Tran Released 18/10/2013
3.1 Divanshu Chopra Added Standby Sync 05/12/2016
Procedure through DB
Visit
3.2 Jaivardhan Singh Reviewed ,no updates 04/01/2018
Bairaria required
Peer Reviewers
Title Name Date Review Outcome
DBA Taranjit Singh Boonga 31st July 2017 Reviewed
Reviewed, no
DBA Jaivardhan Singh Bairaria 4th January 2018
updates required.
Page | 2
Glossary
S.No Abbreviation Description
1 SMTP Simple Mail Transfer Protocol
2 DNS Domain Naming System
3 DC Domain Controller
4 SQL Structured Query Language
5 MS-SQL Microsoft SQL Server
6 RDBMS Relational Database Management System
7 BKUP Back Up (or Backup)
8 FSD File System Device
9 VM Virtual Machine
10 VCB VMware Consolidated Backup
11 SAN Storage Area Network
12 WAN Wide Area Network
13 LAN Local Area Network
14 NIC Network Interface Card
15 RPO Recovery Point Objective
16 RTO Recovery Time Objective
17 VM Virtual Machine
18 VC/VCS VMware vCenter Server
19 vSwitch VMware Virtual Switch
20 ESXi VMware ESXi Server
21 NIC Network Interface Card
Page | 3
Table of Contents
SMART GRID INFRASTRUCTURE: ORACLE & DBVISIT AS-BUILT ............................................................................. 1
1 INTRODUCTION .............................................................................................................................. 5
1.1 Overview......................................................................................................................... 5
1.2 Purposes/Requirement .................................................................................................... 5
1.3 Scope.............................................................................................................................. 5
1.4 Achievements after the Task ............................................................................................. 5
2 ORACLE CONFIGURATION ........................................................................................................... 6
2.1 Oracle Hardware Details ................................................................................................... 6
2.2 Oracle Software and Patch Level Details ............................................................................ 6
2.3 DBVisit Software and Patch Level Details ........................................................................... 6
3 ORACLE - DBVISIT CONFIGURATION ......................................................................................... 8
3.1 Database Server Setup ..................................................................................................... 8
3.2 Configured Database Instance Details ................................................................................ 8
3.3 Init<xxxx>.ora Database Instance Configuration.................................................................. 8
3.4 Username Password ...................................................................................................... 10
3.5 DBVisit configuration ..................................................................................................... 10
4 BOOT AND STANDBY MANAGEMENT ...................................................................................... 12
4.1 Boot ............................................................................................................................. 12
4.2 Oratab .......................................................................................................................... 12
4.3 Standby database management ...................................................................................... 12
4.4 Archive log management ................................................................................................ 13
5 USING DBVISIT ............................................................................................................................. 14
5.1 Resending archive logs ................................................................................................... 14
5.2 Archivelog mode switched off ......................................................................................... 14
5.3 Graceful Switchover (role reversal) .................................................................................. 15
5.4 Failover ......................................................................................................................... 17
5.5 DBVisit Housekeeping .................................................................................................... 17
6 USING DB VISIT TO SYNC STANDBY DATABASE USING INCREMENTAL BACKUP .......... 19
APPENDIX A – SCRIPTS ........................................................................................................................ 25
APPENDIX B – TECHNICAL REQUIREMENTS .................................................................................... 28
Page | 4
1 Introduction
1.1 Overview
This document contains information about Smart Grid Infrastructure in EE environment.
It presents details about hardware, software, and installation of Oracle and DBVisit in
Smart Grid Infrastructure.
1.2 Purposes/Requirement
The purpose of this document is to present the as-built documentation for the Oracle
consisting of:
• Oracle installation,
• Oracle configuration,
• DBVisit installation,
• DBVisit configuration
This will also help the DBA to work on tasks related to DB Visit like DR recovery &
restoration.
1.3 Scope
The scope of this document is limited to the Smart Grid Oracle Infrastructure and
availability architecture. The following list details items that are included in this
document;
Oracle setup
DBVisit setup
Failover and failback
Page | 5
2 Oracle Configuration
2.1 Oracle Hardware Details
Description Value
Number of 2
Servers
RAM 128GB
Oracle 11.2.0.3
11R2
Oracle /opt/oracle
base
director
y
Oracle /opt/oracle/product/11.2.0/dbhome_1
home
Table 2 - Oracle Software and Patch level
Page | 6
Description Value
Page | 7
3 Oracle - DBVisit configuration
The following details pertain to the Oracle database instance setup for the primary
and standby database.
SGPRD1 sgporaa1
SGPRD2 sgporab1
SGDEV1 sgporaa1
SGDEV2 sgporab1
Page | 8
*.log_archive_format='sgprd1_%t_%s_%r.dbf'
*.memory_target=4294967296
*.open_cursors=500
*.processes=550
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=610
*.undo_tablespace='UNDOTBS1'
SGPRD2
*.audit_file_dest='/opt/oracle/admin/SGPRD2/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/oradata/SGPRD2/sgprd2_control01.ctl',
'/opt/oracle/fast_recovery_area/SGPRD2/sgprd2_control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='SGPRD2'
*.db_recovery_file_dest='/opt/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4322230272
*.diagnostic_dest='/opt/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=SGPRD2XDB)'
*.log_archive_dest_1='LOCATION=/oracle/archive/SGPRD2'
*.log_archive_format='sgprd2_%t_%s_%r.dbf'
*.memory_target=4294967296
*.open_cursors=500
*.processes=550
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=610
*.undo_tablespace='UNDOTBS1'
SGDEV1
*.audit_file_dest='/opt/oracle/admin/SGDEV1/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/oradata/SGDEV1/sgdev1_control01.ctl',
'/opt/oracle/fast_recovery_area/SGDEV1/sgdev1_control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='SGDEV1'
*.db_recovery_file_dest='/opt/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4322230272
*.diagnostic_dest='/opt/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=SGDEV1XDB)'
*.log_archive_dest_1='LOCATION=/oracle/archive/SGDEV1'
*.log_archive_format='sgdev1_%t_%s_%r.dbf'
*.memory_target=4294967296
*.open_cursors=500
*.processes=550
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=610
*.undo_tablespace='UNDOTBS1'
SGDEV2
*.audit_file_dest='/opt/oracle/admin/SGDEV2/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/oradata/SGDEV2/sgdev2_control01.ctl',
'/opt/oracle/fast_recovery_area/SGDEV2/sgdev2_control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='SGDEV2'
*.db_recovery_file_dest='/opt/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4322230272
*.diagnostic_dest='/opt/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=SGDEV2XDB)'
*.log_archive_dest_1='LOCATION=/oracle/archive/SGDEV2'
*.log_archive_format='sgDEV2_%t_%s_%r.dbf'
*.memory_target=4294967296
*.open_cursors=500
*.processes=550
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=610
Page | 9
*.undo_tablespace='UNDOTBS1'
3.4Username Password
Description Value
3.5DBVisit configuration
Please note that all databases have the same configuration.
[10 Generic Settings]
ORACLE_SID = SGPRD1
ORACLE_HOME = /opt/oracle/product/11.2.0/dbhome_1
OWNER = oracle
ORATAB = /etc/oratab
CP = /usr/bin/scp
RSH = /usr/bin/ssh
COMPRESS = dbvisit
UNCOMPRESS = dbvisit
ZIP_EXTENSION = .gz
SEND_HEARTBEAT_TIME24 = 0700
TMP = /usr/tmp
PATH = /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/sbin:/sbin
Page | 10
ORACLE_BASE_DR = /opt/oracle
BINDIR_DR = /opt/dbvisit/standby
LOGDIR_DR = /opt/oracle/admin/SGPRD1/dbvisit
ARCHDEST = /oracle/archive/SGPRD1
MAX_TIMES_TRIED = 4
LEAVE_COMPRESS_DEST = Yes
ORACLE_SID_ASM_DEST = +ASM
[40 Mail Settings]
MAILCFG_MAIL_CLIENT = sendmail
SUCCESSMAIL = Yes
SUCCESSMAIL_DR = Yes
ADMINS = oracle@sgporaa1
MAILCFG_FROM = oracle@sgporaa1.com
MAILCFG_FROM_DR = oracle@sgporab1.com
MAILCFG_SMTP_SERVER =
MAILCFG_SMTP_SERVER_DR =
[50 Primary Archive Log Management Settings]
ARCHSOURCE_MANAGEMENT = No
DAYS_TO_KEEP_ARCHSOURCE =
NUM_ARCHSOURCE_TO_KEEP =
ARCHSOURCE_BACKUP_COUNT =
THRESHOLD_ARCHSOURCE =
FRA_THRESHOLD_ARCHSOURCE =
DELETE_ARCHSOURCE =
[60 Standby Archive Log Management Settings]
ARCHDEST_MANAGEMENT = Yes
DAYS_TO_KEEP_ARCHDEST = 4
NUM_ARCHDEST_TO_KEEP = 0
THRESHOLD_ARCHDEST = 80
DELETE_ARCHDEST = No
[90 Advanced Settings]
# ALL DEFAULTS
Page | 11
4 Boot and Standby management
/etc/init.d
OraStartStop: used to let dbvisit manage stopping and starting the databases in the
correct mode. Linked to
oracle : only used to stop and start the listener
Natively within the vCenter, alarm metrics can be set to alert when performance
thresholds are met and or exceeded. These alerts can be used to monitor
performance based metrics such as:
CPU ready time
Disk queue length
Balloon Memory Driver Activations
4.1 Boot
At (re)boot time only the Oracle component need to be started. When DBVisit is
used the startup of the databases is managed by DBVisit instead of using the
standard Oracle startup scripts, which rely on the /etc/oratab file. Standby databases
require a special startup command set. There are two scripts in the /etc/init.d
directory:
- oracle
- OraStartStop
4.2 Oratab
SGPRD1:/opt/oracle/product/11.2.0/dbhome_1:N
SGDEV1:/opt/oracle/product/11.2.0/dbhome_1:N
SGPRD2:/opt/oracle/product/11.2.0/dbhome_1:N
SGDEV2:/opt/oracle/product/11.2.0/dbhome_1:N
Page | 12
current configured retention period after applying is 4 days. After 4 days DBVisit will
delete the archive log file on the standby server side.
The current frequency is set to 10 min intervals. It is recommended to not set it
lower than 5 minutes. There is no point setting it to lower than 10 min as generally
the recommended log switch on the primary database is around 10 min.
Crontab configuration
#
# Primary database dbvisit execution
00,10,20,30,40,50 * * * * /opt/dbvisit/standby/dbvisit SGPRD1
00,10,20,30,40,50 * * * * /opt/dbvisit/standby/dbvisit SGDEV1
#
# Standby database dbvisit apply log files
00,10,20,30,40,50 * * * * /opt/dbvisit/standby/dbvisit SGPRD2
00,10,20,30,40,50 * * * * /opt/dbvisit/standby/dbvisit SGDEV2
Page | 13
5 Using DBVisit
5.1 Resending archive logs
If for any reason the specific log files from the primary database have to be resent to
the standby database the following command can be used.
On the primary database server:
dbvisit -r <sequence_number> <DDC>
Where DDC is the name of the DB visit Database Configuration. In most cases this is
the same as the database name. The DDC refers to the DDC file name which is in the
form: dbv_DDC.env and contains the Dbvisit Standby settings for a particular primary
and standby configuration.
Where sequence_number is the log sequence number from which you want to start
sending.
For example:
dbvisit -r 229 SGPRD1
======================================================
Dbvisit Standby Database technology
dbvisit started on dbvisit11
======================================================
======================================================
dbvisit ended on dbvisit11
======================================================
Where dbvisitp is the name of the database, and 229 is the starting
log sequence number to resend.
Page | 14
This can be done in a number of ways, but the easiest way is in the following steps
- On the standby server shutdown the database and remove database files,
controlfiles and archive log files. For example for SGDEV1 the files can be found
in the following directories
/oracle/oradata/SGDEV1
/opt/oracle/fast_recovery_area/SGDEV1
/oracle/archive/SGDEV1
- Copy the standby control file and database file to the standby server
scp ‘/tmp/sgdev1_control01.ctl’ oracle@sgporab:/oracle/oradata/SGDEV1
scp ‘/tmp/sgdev1_control01.ctl’
oracle@sgporab:/opt/oracle/fast_recovery_area/SGDEV1/sgdev1_control02.ctl
scp /oracle/oradata/SGDEV1/*.dbf oracle@sgporab:/oracle/oradata/SGDEV1
- Make sure that dbvisit cronjob is enabled on both primary and standby server
Page | 15
4. Standby database is shutdown during transition.
5. Main primary database transitions to standby database on primary server in
matter of minutes*.
6. Standby database transitions to primary database on standby server in matter of
minutes*.
7. Users can re-connect to primary database on standby server and continue
working, with no data loss.
8. Maintenance can proceed on primary server.
9. Optionally Dbvisit Standby can keep the standby database on the primary server
up to date during the scheduled maintenance outage.
10. At the end of the scheduled maintenance the databases are transitioned back to
their original state in matter of minutes*.
Prerequisites
1. Ensure Dbvisit Standby is no longer scheduled on the primary and standby
servers.
2. Ensure there is enough space on the standby server to receive the primary redo
logs, and any new archive logs created.
3. Ensure that the standby database is in archive log mode.
4. Ensure there is sufficient space on the primary server for complete backups of
the redo logs. Required space will be double the current redo log space
requirements.
5. The standby database must be up to date before starting the switchover
process. Dbvisit Standby will check if this is the case and will not initiate the
switchover if the standby database is not up to date.
7. The standby database must be available. Dbvisit Standby will check if this is the
case and will not initiate the switchover if the standby database is not available.
Switchover
1. On the primary server start the Graceful Switchover procedure.
dbv_oraStartStop switchover SGPRD1
Where dbvisitp is the name of the database
3. Enter a unique key on the primary server. This unique key can be any number that
has not previously been used for Graceful Switchover. Dbvisit Standby will notify if a
previously used key is used.
4. Enter the same unique key on the standby server. This ensures that both
processes are linked to each other.
Page | 16
5. At the end of the switchover, the primary database has transitioned to a standby
database and the standby database has transitioned to a primary database.
5.4 Failover
When disaster strikes and the primary database is no longer available the standby
database must be activated to become the new primary database to continue
operation.
This is also called failover to the standby database.
The steps to activate the standby database are:
- Stop the scheduling of Dbvisit Standby.
- Change the network configuration (or DNS) so that users will connect to the
standby database (or server) instead of the primary database (or server).
- Activate and open the standby database for normal operation as per instructions
below. As soon as the standby database is activated and becomes the new active
primary database, the link to the original primary database is lost and it is no
longer possible to apply new logs to the original primary database.
To activate and open the standby database for continued operation in the event of a
disaster the following procedure must be used:
On the standby server
- Manually run Dbvisit Standby to ensure all log files have been applied.
dbvisit SGPRD1
- Activate the standby database. A prompt will be displayed to ask for confirmation:
dbv_oraStartStop activate SGPRD1
- As soon as possible, back up your new production database. At this point, the
former standby database is now your production database. This task, while not
required, is a recommended safety measure because you cannot recover changes
made after activation without a backup.
DAYS_TO_KEEP_TRACE
= The number of days to keep the trace files after which trace files are deleted.
Default settings are:
Page | 17
Least restrictive setting applies between DAYS_TO_KEEP_TRACE and
NUM_TRACE_TO_KEEP.
To turn off, set to 0.
Prior to version 5.1.19 Dbvisit
Standby trace files are not removed.
The Dbvisit Standby log file (dbvisit.hist) and the Dbvisit Standby archive
management module log file (<DDC>_arch_management.log) will automatically be
kept at a specific size based on the following settings:
LOG_FILE_ROTATE_MAX
LOG_FILE_SIZE_MAX_MB
LOG_FILE_ROTATE_MAX indicates how many backups are made of the log files
before it is overwritten.
The first backup will be: dbvisit_hist.log.1
The second backup will be: dbvisit_hist.log.2
etc.
LOG_FILE_SIZE_MAX_MB indicates the size of the log file before the log file is
rotated as above.
Example:
LOG_FILE_ROTATE_MAX = 5
LOG_FILE_SIZE_MAX_MB = 5
This setting ensures the maximum size of the Dbvisit Standby log file will be 5MB. If
the log file is greater than 5MB, it will be copied to a backup log file.
This setting
ensures there will be 5 backup versions of the Dbvisit Standby log file before backup
versions of the log file will be overwritten.
The TMP directory location can be found in the DDC file for the database.
Page | 18
6 Using DB Visit to Sync Standby Database
using Incremental Backup
STEP 1:- Create Directory on primary & standby server to take incremental backup.
STEP 2:- On the Primary Node ( Primary Server) execute the “dbvsit_setup” command
Cd /opt/dbvisit/standby/
STEP 3:- Once the setup is executed. It will ask you for a confirmation
Select Yes, as this can be executed only from primary Node. I have captured the
screenshot from Stack B just for the reference
Page | 19
Select Option 8 to synchronise standby database
STEP 5:- Select the database
Page | 20
Enter yes as choice
STEP 7:- Process will Query both Primary and standby database and
show the lag results and ask for confirmation to proceed
STEP 8:- Specify the location on Primary and Standby server where
RMAN can take the backups. This was the first step, which we did in this
process.
Page | 21
STEP 9:- DB Visit will now automatically perform the database sync and
update DB Visit Catalog.
Page | 22
STEP 10:- Stop the standby database using DB Visit on stack b.
Page | 23
STEP 11:- Start the standby database using DB Visit on stack b.
Page | 24
Appendix A – Scripts
oracle
#!/bin/sh
#
# /etc/rc.d/init.d/oracle
# Description: Starts and stops the Oracle database, listeners and Enterprise
Manager
# See how we were called.
case "$1" in
start)
echo "Starting Oracle" >> /var/log/oracle
echo "................." >> /var/log/oracle
date " %T %a %D : Starting Databases as part of system up." >> /var/log/oracle
echo "................." >> /var/log/oracle
#
# Oracle start and stop done via OraStartStop to handle standby databases
correctly
# echo -n "Starting Oracle Databases: "
# su - oracle -c dbstart >> /var/log/oracle
#echo "Done."
echo -n "Starting Oracle Listeners: "
su - oracle -c "lsnrctl start" >> /var/log/oracle
echo "Done."
#echo -n "Starting Oracle Enterprise Manager: "
#su - oracle -c "emctl start dbconsole" >> /var/log/oracle
#echo "Done."
echo ""
echo ".................-" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo ".................-" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
stop)
echo "Shutting Down Oracle"
echo ".................-" >> /var/log/oracle
date +"! %T %a %D : Shutting Down Oracle Databases as part of system down." >>
/var/log/oracle
echo ".................-" >> /var/log/oracle
#echo -n "Shutting Down Oracle Enterprise Manager: "
#su - oracle -c "emctl stop dbconsole" >> /var/log/oracle
#echo "Done."
echo -n "Shutting Down Oracle Listeners: "
su - oracle -c "lsnrctl stop" >> /var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
#echo -n "Shutting Down Oracle Databases: "
#su - oracle -c dbshut >> /var/log/oracle
#echo "Done."
echo ""
echo ".................-" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo ".................-" >> /var/log/oracle
;;
restart)
echo "Restarting Oracle"
echo ".................-" >> /var/log/oracle
date +"! %T %a %D : Restarting Oracle Databases as part of system up." >>
/var/log/oracle
echo ".................-" >> /var/log/oracle
#echo -n "Restarting Oracle Databases: "
#su - oracle -c dbshut >> /var/log/oracle
#su - oracle -c dbstart >> /var/log/oracle
#echo "Done."
echo -n "Restarting Oracle Listeners: "
su - oracle -c "lsnrctl stop" >> /var/log/oracle
su - oracle -c "lsnrctl start" >> /var/log/oracle
echo "Done."
#echo -n "Restarting Oracle Enterprise Manager: "
#su - oracle -c "emctl stop dbconsole" >> /var/log/oracle
#su - oracle -c "emctl start dbconsole" >> /var/log/oracle
#echo "Done."
echo ""
echo ".................-" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo ".................-" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
*)
Page | 25
echo "Usage: oracle {start|stop|restart}"
exit 1
esac
Page | 26
OraStartStop
#!/bin/sh
#
# description: w120n database is started and stopped using dbvisit
#
prog=dbv_oraStartStop
start () {
echo -n $"Starting $prog: "
su - oracle -c "/opt/dbvisit/standby/$prog start SGPRD1"
su - oracle -c "/opt/dbvisit/standby/$prog start SGPRD2"
su - oracle -c "/opt/dbvisit/standby/$prog start SGDEV1"
su - oracle -c "/opt/dbvisit/standby/$prog start SGDEV2"
}
stop () {
echo -n $"Stopping $prog: "
su - oracle -c "/opt/dbvisit/standby/$prog stop SGPRD1"
su - oracle -c "/opt/dbvisit/standby/$prog stop SGPRD2"
su - oracle -c "/opt/dbvisit/standby/$prog stop SGDEV1"
su - oracle -c "/opt/dbvisit/standby/$prog stop SGDEV2"
}
restart () {
echo -n $"Restarting $prog: "
su - oracle -c "/opt/dbvisit/standby/$prog restart SGPRD1"
su - oracle -c "/opt/dbvisit/standby/$prog restart SGPRD2"
su - oracle -c "/opt/dbvisit/standby/$prog restart SGDEV1"
su - oracle -c "/opt/dbvisit/standby/$prog restart SGDEV2"
}
status () {
echo -n $"Status $prog: "
su - oracle -c "/opt/dbvisit/standby/$prog status SGPRD1"
su - oracle -c "/opt/dbvisit/standby/$prog status SGPRD2"
su - oracle -c "/opt/dbvisit/standby/$prog status SGDEV1"
su - oracle -c "/opt/dbvisit/standby/$prog status SGDEV2"
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo $"Usage: $prog {start|stop|restart|status}"
exit 3
esac
Page | 27
Appendix B – Technical Requirements
The virtualisation detailed design document is in line with the below mentioned
design principals specified by Endeavour Energy as business objectives.
Business Objectives Technical Requirement
Page | 28
Business Objectives Technical Requirement
Page | 29