Dbvisit Standby Command Line Interface (CLI)
1. Introduction
This section will provide you with more information on using the Dbvisit Standby version 9 command line interface.
2. "dbvctl" Help
The first command you need to be familiar with is the "dbvctl -h" command which will display the syntax and usage options for the Dbvisit Standby command line interface.
You might find it strange that this is the first option to discuss, but it is actually one of the most important. It is a quick and easy way for you to find out the correct command syntax before executing it.
There are a number of help options available to you:
HELP
- dbvctl -f # display system info
- dbvctl -h # display full help
- dbvctl -h -f # display functions list
- dbvctl -h -f <function> # display help on <function>
- dbvctl -h --csd # display help on CSD
- dbvctl -h --sync # display help on SYNC
- dbvctl -h -o # display help on -o options
- dbvctl -h -L # display license agreement
- dbvctl -V # display Dbvisit version
On this page:
2.1. The Quick (short) help
The short or quick help option can be obtained by executing the "dbvctl" command without any arguments.
Example:
[oracle@dbv1 standby]$ ./dbvctl Dbvisit Standby Version 9.0.0_1275 USAGE: dbvctl -d <ddc> [--suppress] [-v] dbvctl -d <ddc> -i [--silent] dbvctl -d <ddc> -l [<new_license_key>] [--force] dbvctl -d <ddc> -R dbvctl -d <ddc> -r sequence# -t thread# dbvctl -d <ddc> -c dbvctl -d <ddc> -C dbvctl -d <ddc> -o status dbvctl -d <ddc> -o start|stop|restart [--database] dbvctl -d <ddc> -o open|read [--database] dbvctl -d <ddc> -o ro_test dbvctl -d <ddc> -o activate [--force] [--noprompt] dbvctl -d <ddc> -o dr_test [--backup --backup_type image|backupset --backup_location bck_dir] [--noprompt] dbvctl -d <ddc> -o reinstate [--switch] [--noprompt] dbvctl -d <ddc> -o switchover [--logswitch] dbvctl -d <ddc> -o update_ddc_file|update_dbenv_file dbvctl -d <ddc> -o upgrade [--noprompt] [--force] dbvctl [-d <ddc>] -o setup [--mode CLI|GUI] [--nolic] [--noprompt] [--action new|install|uninstall] [-j json_file] dbvctl -d <ddc> --csd [--mode CLI|BATCH|GUI] [--restart] [--noprompt] [-j json_file] [--dump_template] dbvctl -d <ddc> --sync [--mode CLI|BATCH|GUI] [--tmp_dir <tmp_dir>] [--tmp_dir_dest <tmp_dir_dest>] [--sync_lag] [--sync_nologging] [-j json_file] dbvctl -d <ddc> -D start|stop|status dbvctl [-d <ddc>] -f <function> [-a <key=value>]...[-a <key=value>] [-j <json_file_name>] dbvctl -d <ddc> -f support_package [-a pid=<pid>] HELP dbvctl -f # display system info dbvctl -h # display full help dbvctl -h -f # display functions list dbvctl -h -f <function> # display help on <function> dbvctl -h --csd # display help on CSD dbvctl -h --sync # display help on SYNC dbvctl -h -o # display help on -o options dbvctl -h -L # display license agreement dbvctl -V # display Dbvisit version
2.2. Listing the installed Dbvctl version
There are two ways to list the installed version of the Dbvisit Standby command line interface "dbvctl". The two options are:
- dbvctl -V (short version)
- dbvctl -f (detailed version)
Example:
[oracle@dbv1 standby]$ ./dbvctl -V 9.0.0_1275_g4206adfb [oracle@dbv1 standby]$ ./dbvctl -f ============================================================= Dbvisit Standby Database Technology (www.dbvisit.com) dbvctl: 9.0.0_1275_g4206adfb Dbvisit Standby time is: 201904261652 (YYYYMMDDHH24MI) Current user is: oracle Server name is: dbv1 Linux 4.9.125-linuxkit CPU count: 3 2491 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz ============================================================= dbvctl ended on dbv1: Fri Apr 26 16:52:01 2019 =============================================================
2.3. Creating a Support Package
There are multiple options to create a support package:
- Creating a general support package
- Creating a support package for a specific process (PID) - which is for a task that was already executed.
The command to execute the support package is:
dbvctl -d <ddc> -f support_package [-a pid=<pid>]
Once the support package is created, it will be located in the DBVISIT_BASE/standby/support directory.
Example:
[oracle@dbv1 standby]$ ./dbvctl -d DEV -f support_package -a pid=280 Support package /usr/dbvisit/standby/support/280_DEV_201904291112.tar.gz created. [oracle@dbv1 standby]$ ls -lrt /usr/dbvisit/standby/support/280_DEV_201904291112.tar.gz -rw-r--r-- 1 oracle oinstall 546248 Apr 29 11:12 /usr/dbvisit/standby/support/280_DEV_201904291112.tar.gz
3. Sending and Applying Logs
3.1. Sending Logs
Sending archive logs to the standby database can be done by running the following command: ./dbvctl -d <DDC>
3.1.1. Example 1: Single Instance Environment
[oracle@dbv1 standby]$ ./dbvctl -d DEV ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2846) dbvctl started on dbv1: Mon Apr 29 11:23:45 2019 ============================================================= >>> Obtaining information from standby database (RUN_INSPECT=Y)... done Thread: 1 Archive log gap: 3. Transfer log gap: 3 Note FORCE_LOGGING is disabled in the primary database. >>> Sending heartbeat message... skipped >>> Transferring Log file(s) from DEV on dbv1 to dbv2: thread 1 sequence 11 (o1_mf_1_11_gd8hzo3m_.arc)... done thread 1 sequence 12 (o1_mf_1_12_gd9jrgrf_.arc)... done thread 1 sequence 13 (o1_mf_1_13_gdczsbvr_.arc)... done ============================================================= dbvctl ended on dbv1: Mon Apr 29 11:23:52 2019 =============================================================
3.1.1. Example 2: Oracle RAC Primary Environment
When running Dbvisit Standby on an Oracle RAC primary Dbvisit Standby will send logs for all Oracle RAC threads to the standby site. From Dbvisit Standby version 8, it is recommended to make use of shared storage and run Dbvisit Standby off only one of the Oracle RAC nodes.
In the example below, all Dbvisit Standby processes are running on node 1 in the cluster:
oracle@kiwi81[/acfs/dbvisit/standby]: ./dbvctl -d MYDEV ============================================================= Dbvisit Standby Database Technology (9.0.0_1383_g276092d5) (pid 26189) dbvctl started on kiwi812-vip: Fri May 24 13:10:56 2019 ============================================================= >>> Obtaining information from standby database (RUN_INSPECT=Y)... done Thread: 1 Archive log gap: 0. Transfer log gap: 0 Thread: 2 Archive log gap: 1. Transfer log gap: 0 Note FORCE_LOGGING is disabled in the primary database. >>> Performing a log switch... done >>> Transferring Log file(s) from MYDEV1 on kiwi812-vip to kiwi912-vip: thread 1 sequence 12 (thread_1_seq_12.511.1009113175)... done thread 2 sequence 4 (thread_2_seq_4.513.1009113173)... done ============================================================= dbvctl ended on kiwi812-vip: Fri May 24 13:13:31 2019 =============================================================
3.2. Applying Logs
Applying archive logs on the standby database run the following command: ./dbvctl -d <DDC>
Example:
[oracle@dbv2 standby]$ ./dbvctl -d DEV ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2166) dbvctl started on dbv2: Mon Apr 29 11:27:42 2019 ============================================================= >>> Sending heartbeat message... skipped >>> Applying Log file(s) from dbv1 to DEV on dbv2: thread 1 sequence 11 (1_11_1004372670.arc)... done thread 1 sequence 12 (1_12_1004372670.arc)... done thread 1 sequence 13 (1_13_1004372670.arc)... done Last applied log(s): thread 1 sequence 13 Next SCN required for recovery 1160518 generated at 2019-04-29:07:29:46 +12:00. Next required log thread 1 sequence 14 ============================================================= dbvctl ended on dbv2: Mon Apr 29 11:27:50 2019 =============================================================
IMPORTANT: Regarding Scheduling or running the Dbvisit Standby version 9 Daemon (Background process) please see Dbvisit Standby Scheduling#4.RunningDbvisitStandbyintheBackground
4. The log gap report
To ensure the primary and standby databases are up to date, you can run the Log Gap Report using the following command from the primary database server:./dbvctl -d <DDC> -i
4.1. Single Instance Environment
Below is an example of running a Log Gap report in a Single Instance Primary environment. In Dbvisit Standby Version 9 the log gap report has details like source/target SCN and timestamp specified in tabular format.
Information for only one thread will be shown.
[oracle@dbv1 standby]$ ./dbvctl -d DEV -i ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2913) dbvctl started on dbv1: Mon Apr 29 11:28:23 2019 ============================================================= Dbvisit Standby log gap report for DEV at 201904291128: ------------------------------------------------------------- Description | SCN | Timestamp ------------------------------------------------------------- Source 1162306 2019-04-29:11:28:22 +12:00 Destination 1160518 2019-04-29:07:29:46 +12:00 Standby database time lag (DAYS-HH:MI:SS): +03:58:36 Report for Thread 1 ------------------- SOURCE Current Sequence 14 Last Archived Sequence 13 Last Transferred Sequence 13 Last Transferred Timestamp 2019-04-29 11:23:52 DESTINATION Recovery Sequence 14 Transfer Log Gap 0 Apply Log Gap 0 ============================================================= dbvctl ended on dbv1: Mon Apr 29 11:28:26 2019 =============================================================
4.2. Oracle RAC Primary Environment
Running the log gap report in an Oracle RAC environment will list information about all the threads in the Oracle RAC cluster.
The command to be executed is the same, but the result as you can see below will include information for all threads.
oracle@kiwi81[/acfs/dbvisit/standby]: ./dbvctl -d MYDEV -i ============================================================= Dbvisit Standby Database Technology (9.0.0_1383_g276092d5) (pid 27344) dbvctl started on kiwi812-vip: Fri May 24 13:15:58 2019 ============================================================= Dbvisit Standby log gap report for MYDEV at 201905241315: ------------------------------------------------------------- Description | SCN | Timestamp ------------------------------------------------------------- Source 1115263 2019-05-24:13:16:50 +12:00 Destination 1115055 2019-05-24:13:12:50 +12:00 Standby database time lag (DAYS-HH:MI:SS): +00:04:00 Report for Thread 1 ------------------- SOURCE Current Sequence 13 Last Archived Sequence 12 Last Transferred Sequence 12 Last Transferred Timestamp 2019-05-24 13:13:16 DESTINATION Recovery Sequence 12 Transfer Log Gap 0 Apply Log Gap 1 Report for Thread 2 ------------------- SOURCE Current Sequence 5 Last Archived Sequence 4 Last Transferred Sequence 4 Last Transferred Timestamp 2019-05-24 13:13:30 DESTINATION Recovery Sequence 5 Transfer Log Gap 0 Apply Log Gap 0 ============================================================= dbvctl ended on kiwi812-vip: Fri May 24 13:17:24 2019 =============================================================
5. Start a Database
5.1. Start a Primary Database
To start the Primary Database in read-write mode run the command "dbvctl -d <DDC> -o start". Dbvisit uses RMAN to start a database. Example:
[oracle@dbv1 standby]$ ./dbvctl -d DEV -o start ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2970) dbvctl started on dbv1: Mon Apr 29 11:37:00 2019 ============================================================= Starting instance DEV... Primary Database DEV started on dbv1. ============================================================= dbvctl ended on dbv1: Mon Apr 29 11:37:08 2019 =============================================================
5.2. Start a Standby Database
To start a standby database, run the command "dbvctl -d <DDC> -o start". Dbvisit uses RMAN to start a database. The standby database will be started in a mounted state, ready for recovery, for example:
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o start ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2314) dbvctl started on dbv2: Mon Apr 29 11:37:56 2019 ============================================================= Starting instance DEV... Standby Database DEV started on dbv2. ============================================================= dbvctl ended on dbv2: Mon Apr 29 11:38:03 2019 =============================================================
5.3. Start an Oracle RAC database
To start an Oracle RAC database run the command "dbvctl -d <DDC> -o start --database". Dbvisit uses SRVCTL utility to start an Oracle RAC database.
To start a local RAC database instance run the command "dbvctl -d <DDC> -o start".
You can also use the SRVCTL utility, for example: "srvctl start database -d DEV".
For more detail on the SRVCTL utility, please see the Oracle Documentation or the command line help of the utility by running: "srvctl start database -h"
When starting a standby Oracle RAC database using SRVCTL utility, you must specify the "-o mount" option to start the standby database in a mounted state, where it will be ready for recovery.
6. Restart a Database
6.1. Restart a Primary Database
The primary database can be restarted using the command "dbvctl -d <DDC> -o restart". Dbvisit Standby will detect based on the DDC file if the database is to be started as a primary or standby based on the SOURCE and DESTINATION values and taking into account on which system the command is being executed. This command will restart the primary database into a read/write open state.
Example:
[oracle@dbv1 standby]$ ./dbvctl -d DEV -o restart ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 3078) dbvctl started on dbv1: Mon Apr 29 11:38:54 2019 ============================================================= Stopping instance DEV... Primary Database DEV shutdown successfully on dbv1. Starting instance DEV... Primary Database DEV started on dbv1. ============================================================= dbvctl ended on dbv1: Mon Apr 29 11:39:12 2019 =============================================================
6.2. Restart a Standby Database
To restart the standby database, use the following command: "dbvctl -d <DDC> -o restart". Dbvisit Standby will detect based on the DDC file if the database is to be started as a primary or standby based on the SOURCE and DESTINATION values and taking into account on which system the command is being executed. The standby database will be restarted into a mounted state, ready for recovery. Example:
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o restart ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2400) dbvctl started on dbv2: Mon Apr 29 11:39:21 2019 ============================================================= Stopping instance DEV... Standby Database DEV shutdown successfully on dbv2. Starting instance DEV... Standby Database DEV started on dbv2. ============================================================= dbvctl ended on dbv2: Mon Apr 29 11:39:29 2019 =============================================================
7. Stop a Database
7.1. Stop a Primary Database
To stop the primary database, execute the command: "dbvctl -d <DDC> -o stop". A shutdown immediate command will be used to stop the database. Example:
[oracle@dbv1 standby]$ ./dbvctl -d DEV -o stop ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 3192) dbvctl started on dbv1: Mon Apr 29 11:40:40 2019 ============================================================= Stopping instance DEV... Primary Database DEV shutdown successfully on dbv1. ============================================================= dbvctl ended on dbv1: Mon Apr 29 11:40:48 2019 =============================================================
7.2. Stop a Standby Database
To stop the standby database, execute the command: "dbvctl -d <DDC> -o stop". A shutdown abort command will be used to stop the database. Example:
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o stop ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2287) dbvctl started on dbv2: Mon Apr 29 11:37:51 2019 ============================================================= Stopping instance DEV... Standby Database DEV shutdown successfully on dbv2. ============================================================= dbvctl ended on dbv2: Mon Apr 29 11:37:52 2019 =============================================================
7.3. Stop an Oracle RAC database
To stop an Oracle RAC database run the command "dbvctl -d <DDC> -o stop -database". Dbvisit uses SRVCTL utility to stop an Oracle RAC database.
To stop a local RAC database instance run the command "dbvctl -d <DDC> -o stop".
oracle@kiwi81[/usr/dbvisit/standby]: ./dbvctl -d MYDEV -o stop --database ============================================================= Dbvisit Standby Database Technology (9.0.0_1383_g276092d5) (pid 3006) dbvctl started on kiwi812-vip: Tue May 28 12:29:33 2019 ============================================================= Stopping database MYDEV... Primary Database MYDEV shutdown successfully on kiwi812-vip. ============================================================= dbvctl ended on kiwi812-vip: Tue May 28 12:31:43 2019 ============================================================= oracle@kiwi81[/usr/dbvisit/standby]: ./dbvctl -d MYDEV -o start --database ============================================================= Dbvisit Standby Database Technology (9.0.0_1383_g276092d5) (pid 3843) dbvctl started on kiwi812-vip: Tue May 28 12:32:25 2019 ============================================================= Starting database MYDEV... Primary Database MYDEV started on kiwi812-vip. ============================================================= dbvctl ended on kiwi812-vip: Tue May 28 12:39:03 2019 ============================================================= oracle@kiwi81[/usr/dbvisit/standby]: ./dbvctl -d MYDEV -o status ============================================================= Dbvisit Standby Database Technology (9.0.0_1383_g276092d5) (pid 5782) dbvctl started on kiwi812-vip: Tue May 28 12:40:48 2019 ============================================================= Instance MYDEV1 is running on node kiwi81. Instance status: Open. Instance MYDEV2 is running on node kiwi82. Instance status: Open. Database Instance MYDEV1 on kiwi812-vip status: Regular database open in read write mode ============================================================= dbvctl ended on kiwi812-vip: Tue May 28 12:42:21 2019 ============================================================= oracle@kiwi81[/usr/dbvisit/dbvnet]: srvctl status database -d MYDEV -v Instance MYDEV1 is running on node kiwi81. Instance status: Open. Instance MYDEV2 is running on node kiwi82. Instance status: Open. oracle@kiwi81[/usr/dbvisit/dbvnet]:
You can also use the SRVCTL utility, for example: "srvctl stop database -d DEV".
For more detail on the SRVCTL utility, please see the Oracle Documentation or the command line help of the utility by running: "srvctl start database -h"
8. Open Standby Database Read-only
If a standby database is in a consistent state, you should be able to open the standby database into a read-only state.
The examples below show the attempt to enable read-only when the standby database is down. This checks the database is down and bring the database up in READ-ONLY mode.
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o stop ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2614) dbvctl started on dbv2: Mon Apr 29 11:44:28 2019 ============================================================= Stopping instance DEV... Standby Database DEV shutdown successfully on dbv2. ============================================================= dbvctl ended on dbv2: Mon Apr 29 11:44:30 2019 ============================================================= [oracle@dbv2 standby]$ ps -ef |grep pmon [oracle@dbv2 standby]$ ./dbvctl -d DEV -o open ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2643) dbvctl started on dbv2: Mon Apr 29 11:44:39 2019 ============================================================= >>> Running pre-checks please wait... done Open Standby instance DEV in READ ONLY mode... Standby instance DEV on dbv2 opened in READ ONLY mode. Log files cannot be applied to Database while in READ ONLY mode. Database tempfile(s) may need to be added to this database. ============================================================= dbvctl ended on dbv2: Mon Apr 29 11:44:46 2019 =============================================================
8.1. Open Read-only for Multitenant Database
The following only applies to Oracle 12.1.0.2 or newer.
When opening the multitenant standby database Dbvisit Standby doesn't interfere with PDBs, but respects the user's settings from the primary database.
Generally, when opening CDB, Oracle uses PDB's SAVE STATE option to determine the required open mode for each and every PDB. By default SAVE STATE option is not set for PDBs, hence PDBs are opened in MOUNT state. Run the following query to determine primary database settings:
SQL> select a.con_id,a.name,a.open_mode,a.restricted,b.state as saved_state from v$pdbs a, cdb_pdb_saved_states b where a.con_id=b.con_id(+); CON_ID NAME OPEN_MODE RES SAVED_STATE ---------- -------------------- ---------- --- -------------- 2 PDB$SEED READ ONLY NO 3 PDBX MOUNTED
If you require "dbvctl -d <DDC> -o open" to open certain PDB in READ ONLY you need to instruct the standby database to do so:
On primary open the PDB in READ ONLY and then run:
SQL> alter pluggable database <pdb_name> save state; SQL> select a.con_id,a.name,a.open_mode,a.restricted,b.state as saved_state from v$pdbs a, cdb_pdb_saved_states b where a.con_id=b.con_id(+); CON_ID NAME OPEN_MODE RES SAVED_STATE ---------- -------------------- ---------- --- -------------- 3 PDBX READ ONLY NO OPEN READ ONLY 2 PDB$SEED READ ONLY NO
Dbvisit Standby will apply these settings to the standby database. Next time you open the standby database using "dbvctl -d <DDC> -o open" the standby PDB will be opened in READ ONLY mode.
9. Database Status Check
There are various options to review the status of the databases. The Dbvisit Standby version 8 command is: "dbvctl -d <DDC> -o status"
9.1. Status Check Example - Primary
[oracle@dbv1 standby]$ ./dbvctl -d DEV -o status ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 3386) dbvctl started on dbv1: Mon Apr 29 12:10:41 2019 ============================================================= Database Instance DEV on dbv1 status: Regular database open in read write mode ============================================================= dbvctl ended on dbv1: Mon Apr 29 12:10:41 2019 =============================================================
9.2. Status Check Example - Standby
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o status ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 2888) dbvctl started on dbv2: Mon Apr 29 12:10:29 2019 ============================================================= Database Instance DEV on dbv2 status: Standby Database in recovery mode ============================================================= dbvctl ended on dbv2: Mon Apr 29 12:10:29 2019 =============================================================
9.3. Status Checks in an Oracle RAC configuration
Check the status of the local database instance using dbvctl:
oracle@kiwi81[/acfs/dbvisit/standby]: ./dbvctl -d MYDEV -o status ============================================================= Dbvisit Standby Database Technology (9.0.0_1383_g276092d5) (pid 28043) dbvctl started on kiwi812-vip: Fri May 24 13:19:01 2019 ============================================================= Instance MYDEV1 is running on node kiwi81. Instance status: Open. Instance MYDEV2 is running on node kiwi82. Instance status: Open. Database Instance MYDEV1 on kiwi812-vip status: Regular database open in read write mode ============================================================= dbvctl ended on kiwi812-vip: Fri May 24 13:19:28 2019 =============================================================
Check the status of all database instances using SRVCTL:
Example to check the status for a Primary Oracle RAC cluster database:
oracle@kiwi81[/acfs/dbvisit/standby]: srvctl status database -d MYDEV -v Instance MYDEV1 is running on node kiwi81. Instance status: Open. Instance MYDEV2 is running on node kiwi82. Instance status: Open.
Example to check the status for a Standby Oracle RAC cluster database:
oracle@kiwi92[/acfs/dbvisit/standby]: srvctl status database -d MYDEV -v Instance MYDEV1 is running on node kiwi91. Instance status: Mounted (Closed). Instance MYDEV2 is running on node kiwi92. Instance status: Mounted (Closed).
9.2.4. Status Check for Multitenant Database
When running a status check on a 12c Multitenant database you will see a status update for the pluggable databases listed as well.
The example below is from a 12c Database running on a Linux-based system.
[oracle@kiwi701 /usr/dbvisit/standby]$ ./dbvctl -d DEV1 -o status ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 3040) dbvctl started on kiwi701: Mon Apr 29 12:07:16 2019 ============================================================= Database DEV is running. Instance status: Open. Database Instance DEV on kiwi701 status: Regular database open in read write mode CON_ID NAME OPEN_MODE 1 CDB$ROOT READ WRITE 2 PDB$SEED READ ONLY 3 DEVPDB1 READ WRITE ============================================================= dbvctl ended on kiwi701: Mon Apr 29 12:07:19 2019 =============================================================
10. Activate a Standby Database (Failover)
Activating a standby database is also known as performing a failover. This is totally different than performing a Graceful Switchover.
During Activation an "open resetlogs" is performed on the standby database while an attempt is made to open the standby database read-write.
If the database is in a consistent state, activation should be possible. A quick way to test the state is by opening the standby database read-only. If that is possible, you will be able to activate the standby database.
The command to activate the standby database is: "dbvctl -d <DDC> -o activate"
Check the Activate (Failover) as Standby Database page for the latest options for performing DR Test and also Read-Only Test
Activating a standby database will result in it becoming a primary database. If the original primary database is still fully functional and you are only performing a DR test, it is recommended to back up the standby database prior to the activation. Once the standby database is activated, you must either restore from a backup on the standby database, or you have to recreate the standby database.
Data loss is possible when performing an activation if you have not been able to apply all redo from the primary to the standby database.
Dbvisit Standby cannot operate in Zero Dataloss mode.
The command to Activate a Standby database is:
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o activate ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 3199) dbvctl started on dbv2: Mon Apr 29 12:25:23 2019 ============================================================= >>> Running pre-checks please wait... done ------------------------------------------------------------------------------- Next required SCN 1164358 generated at 2019-04-29:12:23:17 +12:00 ------------------------------------------------------------------------------- =>Do you want to proceed with activating the standby database? [no]: yes Your input: 1 Is this correct? <Yes/No> [Yes]: yes >>> Activating now... >>> Activation complete. Please ensure a backup of this Database is made >>> Old archives from before the activation should be removed to avoid mix-up between new and old archive logs >>> Process complete ============================================================= dbvctl ended on dbv2: Mon Apr 29 12:25:45 2019 =============================================================
11. Copy DDC file to the standby
If changes were made to the DDC file, you can run the following command on the primary system to copy the DDC file to the standby server. Remember the DDC file on the primary server is considered the "master copy" : "dbvctl -d <DDC> -c"
Example:
[oracle@dbv1 standby]$ ./dbvctl -d DEV -c ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 3409) dbvctl started on dbv1: Mon Apr 29 12:14:06 2019 ============================================================= >>> Dbvisit Standby configuration copied to dbv2... ============================================================= dbvctl ended on dbv1: Mon Apr 29 12:14:07 2019 =============================================================
12. Refresh a Standby datafile from the Primary
It is possible to refresh one specific datafile on the standby database server from the primary. The command to do this is: "dbvctl -f refresh_datafile -d DEV -a file_id=<file_id>"
[oracle@dbv1 standby]$ ./dbvctl -d DEV -f refresh_datafile -h FUNCTION refresh_datafile Refresh a standby datafile from primary dbvctl -f refresh_datafile -d <ddc> -a file_id=<file_id> [-a tmp_dir=<tmp_dir> -a tmp_dir_dr=<tmp_dir_dr>]
Example:
[oracle@dbv1 standby]$ ./dbvctl -d DEV -f refresh_datafile -a file_id=2 >>> Back up datafile 2... done >>> Transfer backup of datafile 2 to standby server... done >>> Catalog backup... done >>> Restore datafile 2... done >>> Datafile 2 refresh complete From: /u01/app/oracle/oradata/DEV/sysaux01.dbf on dbv1 To : /u01/app/oracle/oradata/DEV/sysaux01.dbf on dbv2
13. Cleanup repository
A new function is added starting from version 8.0.14 to clean up Dbvisit Standby repository tables DBV_TRANSFER_LOG and DBV_SEQUENCE_LOG. Below are the new global variables introduced and the default values set.
REPO_MAINTAIN_DAYS = 1 (default value)
REPO_KEEP_DAYS = 30 (default value)
The cleanup function is called during the first run of the day on the primary server. If any records have been deleted, it will attempt to copy the repository to the standby server. If the copy fails, processing still continues.
A new repository table DBV_MAINTAIN_REPO is introduced as well which logs the information of the cleanup function.
To run the repo maintenance function manually, use below syntax:
dbvctl -d <DDC> -f repo_maintain [-a days2keep=N]
Example:
oracle@dbvlab01[/usr/dbvisit/standby]: ./dbvctl -d DEV -f repo_maintain -a days2keep=1
14. Export DBV_TRANSFER_LOG into JSON
In Dbvisit Standby version 8.0.14 a new function was introduced to export the DBV_TRANSFER_LOG table into JSON output.
The command is:
dbvctl -d <DDC> -f repo_export_table -a table=DBV_TRANSFER_LOG -a out=json
Example:
[oracle@dbv1 standby]$ ./dbvctl -d DEV -f repo_export_table -a table=DBV_TRANSFER_LOG -a out=json { "DBV_TRANSFER_LOG" : [ { "end_timestamp" : "2019-04-29 11:23:50", "checksum" : "0", "start_timestamp" : "2019-04-29 11:23:49", "log_id" : 1004372670, "size_in_bytes" : 38986240, "archive_name" : "/u01/app/oracle/fast_recovery_area/DEV/archivelog/2019_04_27/o1_mf_1_11_gd8hzo3m_.arc", "process_completed" : "Y", "source_host" : "DBV1", "id" : 2, "process" : "TRANSFER", "sequence" : 11, "thread_num" : 1, "process_id" : 2846, "destination_host" : "DBV2", "db_unique_name_dr" : "DEV", "db_unique_name" : "DEV", "oracle_sid" : "DEV", "start_epoch" : 1556493829 }, { "process_completed" : "Y", "archive_name" : "/u01/app/oracle/fast_recovery_area/DEV/archivelog/2019_04_28/o1_mf_1_12_gd9jrgrf_.arc", "end_timestamp" : "2019-04-29 11:23:51", "checksum" : "0", "start_timestamp" : "2019-04-29 11:23:50", "log_id" : 1004372670, "size_in_bytes" : 39268864, "db_unique_name_dr" : "DEV", "destination_host" : "DBV2", "db_unique_name" : "DEV", "start_epoch" : 1556493830, "oracle_sid" : "DEV", "source_host" : "DBV1", "process" : "TRANSFER", "sequence" : 12, "id" : 3, "process_id" : 2846, "thread_num" : 1 }, { "process_completed" : "Y", "archive_name" : "/u01/app/oracle/fast_recovery_area/DEV/archivelog/2019_04_29/o1_mf_1_13_gdczsbvr_.arc", "start_timestamp" : "2019-04-29 11:23:51", "log_id" : 1004372670, "size_in_bytes" : 38872064, "end_timestamp" : "2019-04-29 11:23:52", "checksum" : "0", "db_unique_name" : "DEV", "oracle_sid" : "DEV", "start_epoch" : 1556493831, "db_unique_name_dr" : "DEV", "destination_host" : "DBV2", "process_id" : 2846, "thread_num" : 1, "process" : "TRANSFER", "source_host" : "DBV1", "id" : 4, "sequence" : 13 } ] }
15. Videos on how to use some of the Command Line Interface commands
Part 1
Part 2
Part 3