Having the primary and standby on the same host is not recommended for production. This article is provided for testing or training/educational purposes only. When running Dbvisit Standby in a production environment is is required that the primary and standby be located on different servers.
Below are some steps that can assist in running Dbvisit Standby version 7 (latest version recommended), with the primary and standby databases on the same server. This is for educational/testing purpose only and not recommended for production.
Prerequisite: you should have already Oracle RDBMS installation in place with one instance running. In this example SID: DBVONE.
1) Configure virtual adapters to host 2 databases
In order to be able to use dbvnet & dbvserver on sigle host you have to create virtual adapters on existing physical interface for each dbvisit base.
$ ifconfig enp3s0:1 192.168.2.98
$ ifconfig enp3s0:2 192.168.2.99
status will show (physical host IP: 192.168.2.103, hostname: physicalhost)
$ ifconfig -a
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.103 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::12bf:48ff:fe77:84c2 prefixlen 64 scopeid 0x20<link>
ether 10:bf:48:77:84:c2 txqueuelen 1000 (Ethernet)
RX packets 13704821 bytes 17711032363 (16.4 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15279671 bytes 13261528278 (12.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp3s0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.98 netmask 255.255.255.0 broadcast 192.168.2.255
ether 10:bf:48:77:84:c2 txqueuelen 1000 (Ethernet)
enp3s0:2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.99 netmask 255.255.255.0 broadcast 192.168.2.255
ether 10:bf:48:77:84:c2 txqueuelen 1000 (Ethernet)
2) Configure /etc/hosts
$ vi /etc/hosts
File should contain entries for physical host + 2 virtual hosts
192.168.2.103 physicalhost
192.168.2.98 dbvone
192.168.2.99 dbvtwo
3) Configure listener.ora and tnsnames.ora in $ORACLE_HOME/network/admin and /etc/oratab
Each database will have its listener to be as close as possible to real environment.
listener.ora:
DBVONE=
(ADDRESS=(PROTOCOL=TCP)(HOST=dbvone)(PORT=1521)) DBVTWO=
(ADDRESS=(PROTOCOL=TCP)(HOST=dbvtwo)(PORT=1521))
tnsnames.ora:
LISTENER_DBVONE=
(ADDRESS=(PROTOCOL=TCP)(HOST=dbvone)(PORT=1521)) LISTENER_DBVTWO=
(ADDRESS=(PROTOCOL=TCP)(HOST=dbvtwo(PORT=1521))
DBVONE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = dbvone)(Port = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DBVONE)
)
) DBVTWO =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = dbvtwo)(Port = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DBVTWO)
)
)
oratab:
DBVONE:/u01/app/oracle/product/11.2.0.4/dbhome_1:N
DBVTWO:/u01/app/oracle/product/11.2.0.4/dbhome_1:N
4) Create directories for dbvisit installations
$ mkdir /usr/dbvisit1 /usr/dbvisit2
$ chown oracle:oinstall /usr/dbvisit* $ mkdir -p /u01/app/dbvisit_archdest/DBVTWO /u01/app/dbvisit_archdest/DBVONE
5) Configure user environment
add following to ~/.bash_profile:
echo
export ORAENV_ASK=NO if [ ! -z "$ORACLE_SID" ] then
. oraenv
else
export ORACLE_SID=DBVONE
. oraenv
fi unset ORAENV_ASK
export PATH=~:$PATH
export ORACLE_SID
echo ORACLE_SID is set to $ORACLE_SID
echo
umask 022
$ vi ~/1 export ORACLE_SID=DBVONE
. ~/.bash_profile
export PATH=/usr/dbvisit1/standby:/usr/dbvisit1/dbvnet:/usr/dbvisit1/dbvserver:$PATH
cd /usr/dbvisit1/standby
$ vi ~/2 export ORACLE_SID=DBVTWO
. ~/.bash_profile
export PATH=/usr/dbvisit2/standby:/usr/dbvisit2/dbvnet:/usr/dbvisit2/dbvserver:$PATH
cd /usr/dbvisit2/standby
Now you can switch easily between dbvisit1, dbvisit2 and respectively primary (DBVONE) and standby (DBVTWO) instances by running . 1 or . 2 in cmd line
6) Unzip dbvisit installation file and run installer for /usr/dbvisit1
Run the dbvisit installer. Make you you select that dbvnet & dbvserver will NOT start-up after installation is finished:
$ <path to unzipped standby installation>/dbvisit/installer/install-dbvisit
change following options:
>>> INSTALLATION DIRECTORY Please specify the Dbvisit main installation directory. The default directory is "/usr/dbvisit". Note: the various Dbvisit products and components - such as Standby,
Replicate, Dbvnet, and Dbvserver - will be installed in the appropriate
subdirectories of this path. Enter a custom value or press ENTER to accept default [/usr/dbvisit]:
> /usr/dbvisit1
>>> DBVNET START AFTER INSTALLATION Please specify whether or not Dbvnet should be started when the
installer has finished. The default setting is "yes". Custom value or ENTER for default [yes]:
> No
>>> DBVSERVER START AFTER INSTALLATION Please specify whether or not Dbvserver should be started when the
installer has finished.< The default setting is "yes". Custom value or ENTER for default [yes]:
> No
7) Unzip dbvisit installation file and run installer for /usr/dbvisit2:
Run the dbvisit installer. Make you you select that dbvnet & dbvserver will NOT start-up after installation is finished:
$ <path to unzipped standby installation>/dbvisit/installer/install-dbvisit
change following options:
>>> INSTALLATION DIRECTORY Please specify the Dbvisit main installation directory. The default directory is "/usr/dbvisit". Note: the various Dbvisit products and components - such as Standby,
Replicate, Dbvnet, and Dbvserver - will be installed in the appropriate
subdirectories of this path. Enter a custom value or press ENTER to accept default [/usr/dbvisit]:
> /usr/dbvisit2
>>> DBVNET START AFTER INSTALLATION Please specify whether or not Dbvnet should be started when the
installer has finished. The default setting is "yes". Custom value or ENTER for default [yes]:
> No
>>> DBVSERVER START AFTER INSTALLATION Please specify whether or not Dbvserver should be started when the
installer has finished.< The default setting is "yes". Custom value or ENTER for default [yes]:
> No
8) Edit dbvnet and dbvserv config files
Now we will edit the config files, so as we will use the virtual IPs we specified earlier. In this example is IP for dbvisit1=192.168.2.98 and IP for dbvisit2=192.168.2.99
vi /usr/dbvisit*/dbvnet/conf/dbvnet.conf dbvisit1:
bind_ip = 192.168.2.98 dbvisit2:
bind_ip = 192.168.2.99 vi /usr/dbvisit*/dbvserver/conf/dbvserver.conf dbvisit1:
bind_ip = 192.168.2.98 dbvisit2:
bind_ip = 192.168.2.99
9) Start dbvnet and dbvserver from both dbvisit1 and dbvisit2
$ . 1
$ dbvnetd
$ dbvserver $ . 2
$ dbvnetd
$ dbvserver
10) Setup dbvisit from dbvisit1 base
Now we are ready to run the setup. Optionally, you can pre-create custom tablespace for your dbvisit repository in your database
$ . 1 $ dbvisit_setup
in the menu choose "1" - New Dbvisit Database setup (combines options 2,3,4)
Oratab file is [/etc/oratab]:
=>Oratab will be: /etc/oratab Is this correct? <Yes/No> [Yes]:
The following Oracle database(s) have been found on this server: select primary database: SID ORACLE_HOME
=== ===========
1) DBVONE /u01/app/oracle/product/11.2.0.4/dbhome_1
2) DBVTWO /u01/app/oracle/product/11.2.0.4/dbhome_1
3) Enter own ORACLE_SID and ORACLE_HOME Please enter choice : 1 chnage primary server:
=>SOURCE
Please enter primary server [physicalhost] Primary server is [physicalhost]: dbvone
=>Primary server will be: dbvone Is this correct? <Yes/No> [Yes]: =>DESTINATION
Please enter the name of the standby server (or standby database server).
(Primary server is dbvone) Standby server is []: dbvtwo
=>Standby server will be: dbvtwo Is this correct? <Yes/No> [Yes]: change ORACLE_SID for standby database:
=>ORACLE_SID_DEST
If the ORACLE_SID on the standby server dbvtwo is different than the ORACLE_SID on the primary server, then it can be specified here.
Default is the same as ORACLE_SID: [DBVONE] Please enter database on standby server dbvtwo. Oracle database on standby server is [DBVONE]: DBVTWO
=>Oracle database on standby server will be: DBVTWO Is this correct? <Yes/No> [Yes]:
=>DBVISIT_BASE_DR
Please enter DBVISIT_BASE directory for the standby server dbvtwo.
DBVISIT_BASE is the Dbvisit installation directory on the standby server dbvtwo. DBVISIT_BASE for standby server is [/usr/dbvisit1]: /usr/dbvisit2
=>DBVISIT_BASE_DR for standby server will be: /usr/dbvisit2 Is this correct? <Yes/No> [Yes]:
=>ARCHDEST
Please enter the directory where Dbvisit will transfer the (archive) log files to on standby server dbvtwo.
This directory will ONLY contain (archive) log files related to this database. It should not contain any other (non archive log) files.
Please ensure that this directory exists on dbvtwo as this cannot be verified.
This directory is specific to Dbvisit Standby and is NOT the same as the database archive log directory and should NOT be set to the same
value as your database archive log or recovery area location. It is advisable to also create this directory on the primary server physicalhost for graceful switchover to work. Archive log dir on the standby server is [/oracle/dbvisit_archdest/DBVONE]: /u01/app/dbvisit_archdest/DBVTWO
=>Archive log dir on the standby server will be: /u01/app/dbvisit_archdest/DBVTWO Is this correct? <Yes/No> [Yes]:
=>ARCHSOURCE_MANAGEMENT
Do you want to setup (archive) log file management on the primary server?
This is used to manage the Oracle logs on the primary server.
- Alerts when certain thresholds have been reached.
- Can delete Oracle archives logs after a set number of days.
- Can keep a constant number of Oracle archive logs on the system. Values are Yes or No
Yes = Setup and use AMM on primary server.
No = do not use AMM on primary server. If you are unsure, set to Yes. Should Dbvisit Archive Log Management Module be used on primary server? [Y]: N
=>Dbvisit Archive Log Management Module on primary server will used: N Is this correct? <Yes/No> [Yes]:
=>ARCHDEST_MANAGEMENT
Do you want to setup (archive) log file management on the standby server?
This is used to manage the Oracle logs on the standby server.
- Alerts when certain thresholds have been reached.
- Can delete Oracle archives logs after a set number of days.
- Can keep a constant number of Oracle archive logs on the system. Values are Yes or no
Yes = Setup and use AMM on standby server.
No = do not use AMM on standby server. If you are unsure, set to Yes. Should Dbvisit Archive Log Management Module be used on standby server? [Y]: N
=>Dbvisit Archive Log Management Module on standby server will used: N Is this correct? <Yes/No> [Yes]:
=>DDC File
Please specify the name of the Dbvisit Database Configuration (DDC) file.
The DDC file contains all the Dbvisit Standby settings.
The DDC file is a plain text file and can be edited manually or through this setup. Dbvisit Database Configuration (DDC) file is [DBVONE]: DBVONETWO
=>Dbvisit Database Configuration (DDC) file will be: DBVONETWO Please select the default tablespace to install the Dbvisit Database repository (DDR). The following tablespaces are available:
Tablespace
===========
1) USERS
2) DBVISIT
3) Refresh list Please enter choice : 2
The default tablespace will be: DBVISIT Is this correct? <Yes/No> [Yes]: ------------------------------------------------------------------------------
Please select the temp tablespace to install the Dbvisit Database repository (DDR). The following tablespaces are available:
Tablespace
===========
1) TEMP
2) DBVISIT
3) USERS
4) Refresh list Please enter choice : 1
The temp tablespace will be: TEMP after setup is finished, exit
11) Modify DDC file with required options for single host setup and copy DDC file to /usr/dbvisit2/standby/conf
[20 Primary Server Settings]
SOURCE = dbvone
DBVISIT_BASE = /usr/dbvisit1
DBUSER = dbvisit7
DBPASSWD = ENCRYPT53616c7465645f5feef85da60cff8c62353b64020ba10fff37d11f60ff8a5ccc
ENCRYPT_PASSWDS = Y
LEAVE_COMPRESS_SOURCE = N SYNCH_DBVISIT_INSTALL = N SYNCH_ENV_FILE_ONLY = N LOGSWITCH = N
ORACLE_SID_ASM = +ASM
$ cp /usr/dbvisit1/standby/conf/dbv_DBVONETWO.env /usr/dbvisit2/standby/conf
12) Create custom files for hostnames and modify DDC files to use them
$ echo "#\!/bin/bash
echo dbvone" > /usr/dbvisit1/standby/host_dbvone.sh; chmod +x /usr/dbvisit1/standby/host_dbvone.sh
$ echo "#\!/bin/bash
echo dbvtwo" > /usr/dbvisit2/standby/host_dbvtwo.sh; chmod +x /usr/dbvisit2/standby/host_dbvtwo.sh
vi /usr/dbvisit*/standby/conf/dbv_DBVONETWO.env
base dbvisit1:
HOSTNAME_CMD = /usr/dbvisit1/standby/host_dbvone.sh
base dbvisit2:
HOSTNAME_CMD = /usr/dbvisit2/standby/host_dbvtwo.sh
13) Create standby database
When creating standby database, db_name init parameter must be the same for both instances. In order to run two instances with same db_name parameter, following has to be set (Do not do it now, will be done during the dbvisit setup):
DBVONE(primary):
db_unique_name=DBVONE
instance_name=DBVONE
db_name=DBVONE
DBVTWO(standby):
db_unique_name=DBVTWO
instance_name=DBVTWO
db_name=DBVONE
lock_name_space=DBVTWO
$ mkdir /u01/app/oracle/fast_recovery_area/DBVTWO
$ mkdir /u01/app/oracle/oradata/DBVTWO
choose option "1" Create standby database (and optionally save settings in template)
Do you want to copy database files directly to the standby server? [No]: Yes
Database files will be copied directly to the standby server: Y
Is this correct? <Yes/No> [Yes]:
Dbvisit Standby provides functionality to create missing filesystem directories
on the standby server automatically.
Do you want Dbvisit Standby to create missing filesystem directories on the
standby server automatically? [Yes]: No
Dbvisit Standby will create missing filesystem directories automatically: N
Is this correct? <Yes/No> [Yes]:
Add parameters:
db_unique_name = DBVTWO
instance_name = DBVTWO
lock_name_space = DBVTWO
Proceed, next change all locations to:
-------------------------------------------------------------------------------
Primary ===> Standby
-------------------------------------------------------------------------------
/u01/app/oracle/oradata/DBVONE ===> /u01/app/oracle/oradata/DBVTWO
14) Run dbvisit on primary and standby "server"
Now the standby database should be created. First you need to provide valid license key to dbvisit via -lic switch
$ dbvisit DBVONETWO -l <key>
Now we try to run dbvisit:
$ . 1
$ dbvisit DBVONETWO
$ . 2
$ dbvisit DBVONETWO
15) Startup listeners DBVONE DBVTWO and configure respective instances to use them
$ lsnrctl start DBVONE
$ lsnrctl start DBVTWO
$ . 1
$ sqlplus "/as sysdba"$ sqlplus "/as sysdba" SQL> alter system set local_listener='DBVTWO';
16) All Done!
Comments