As businesses increasingly rely on their data for critical operations, the importance of protecting.
Command Line tips and tricks for Standby™️
Here at Dbvisit, we are proud to be part of a team that has taken the complexity out of using Disaster Recovery software for Oracle SE. This is by no means an accident. Other than being robust, market-tested, secure, and backed up by our superb support team, it is still important to continue to keep Standby™️ user friendly and simple to use.
We understand the changing landscape of responsibilities of IT engineers and have designed Standby™️ in such a way that even non-Oracle DBAs can use Standby™️ efficiently.
Let me get into some of the Command Line Interface (CLI) commands that are available in the latest version of Standby™️.
Standby™️ Command Line Interface (CLI) Commands
Listed below are our Standby™️ CLI commands. Please review our documentation for reference:
These commands can be very helpful when you have to perform Standby™️ tasks or troubleshoot. I would like to share a few of my favorite ones here.
Creating A Support Package
1. Whenever I encounter an error performing a Dbvisit task, the first thing I do is to create a support package. This contains all the important information required for troubleshooting.
dbvctl -d <ddc> -f support_package -a pid=PID
[oracle@dbv1 standby]$ ./dbvctl -d DEV -f support_package -a pid=2169
Support package /usr/dbvisit/standby/support/2169_DEV_201908282118.tar.gz created.
Pre-checks Before Performing a Graceful Switchover
2. It is essential to do pre checks before performing a Graceful Switchover to avoid unnecessary stress at the time of this operation.
dbvctl -f switchover_precheck -d <ddc>
[oracle@dbv1 standby]$ ./dbvctl -f switchover_precheck -d DEV
Running pre-checks ... done
Upon completion of Graceful Switchover (GS) the new primary database will have tempfiles and redologs as follows:
REDOLOGS
Group 1: /u01/app/oracle/oradata/DEV/redo01.log
Group 2: /u01/app/oracle/oradata/DEV/redo02.log
Group 3: /u01/app/oracle/oradata/DEV/redo03.log
TEMPFILES
Id 1: /u01/app/oracle/oradata/DEV/temp01.dbf
Finding The Location Of The Oracle Alert Log
3. If you encounter an Oracle error and have to look into the alert log for troubleshooting, the below command gives the location of the Oracle alert log:
dbvctl -f alertlog_name -d <ddc>
[oracle@dbv1 standby]$ ./dbvctl -f alertlog_name -d DEV
/u01/app/oracle/diag/rdbms/dev/DEV/trace/alert_DEV.log
The best way to learn is to explore and try it for yourself.
For help use "dbvctl" with the "-h" option or for full detail on functions use "-h -f".
dbvctl -h
dbvctl -h -f
Let's have a look at some more commands.
Starting & Stopping Databases
4. By using the simple command below, you could start and stop databases. The same command starts the database in Read Write mode when run on the Primary and Recovery mode when run on the Standby database.
dbvctl -d <ddc> -o start|stop|restart
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o start
=============================================================
Standby™️ Database Technology (9.0.00_0_g28d7024c) (pid 4312)
dbvctl started on dbv2: Tue Aug 27 00:02:07 2019
=============================================================
Starting instance DEV...
Standby Database DEV started on dbv2.
=============================================================
dbvctl ended on dbv2: Tue Aug 27 00:02:13 2019
=============================================================
Open The Standby Database in Read-Only Mode for Reporting Purposes
5. To open the standby database in Read-only mode for reporting purpose, use the following command:
dbvctl -d <ddc> -o open|read
[oracle@dbv2 standby]$ ./dbvctl -d DEV -o open
=============================================================
Standby™️ Database Technology (9.0.00_0_g28d7024c) (pid 4397)
dbvctl started on dbv2: Tue Aug 27 00:02:52 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: Tue Aug 27 00:02:53 2019
=============================================================
Display The Current License Information
6. To Display the current license information run the next command:
dbvctl -d <ddc> -l
[oracle@dbv1 standby]$ ./dbvctl -d DEV -l
=============================================================
Standby™️ Database Technology (9.0.00_0_g28d7024c) (pid 597)
dbvctl started on dbv1: Thu Aug 29 21:52:49 2019
=============================================================
>>> Standby™️ License
License Key : 4jo70-qwp4l-7gplh-g1ckz-izkq8-0j6ck-5rnl9
customer_number : 0
dbname :
expiry_date : 2019-09-26
os :
sequence : 1
software_features : 00000000
status : VALID
version : 9
=============================================================
dbvctl ended on dbv1: Thu Aug 29 21:52:49 2019
=============================================================
Copy Changes Made To The DDC Parameter on the Primary to the Standby
7. Any changes made to the DDC parameter on the Primary can be copied to the Standby using the command below:
dbvctl -d <ddc> -c
[oracle@dbv1 standby]$ ./dbvctl -d DEV -c
=============================================================
Standby™️ Database Technology (9.0.00_0_g28d7024c) (pid 5325)
dbvctl started on dbv1: Tue Aug 27 00:07:28 2019
=============================================================
>>> Standby™️ configuration copied to dbv2...
=============================================================
dbvctl ended on dbv1: Tue Aug 27 00:07:29 2019
Recreating A Corrupt Standby Control File
8. If the Standby control file is corrupted, you could easily recreate it by running the below command on the Primary database:
dbvctl -f create_standby_ctl -d <ddc>
[oracle@dbv1 standby]$ ./dbvctl -f create_standby_ctl -d DEV
=>Replace current standby control files on dbv2 with new standby control file?
<Yes/No> [No]: Yes
>>> Create standby control file... done
>>> Copy standby control file to dbv2... done
>>> Recreate standby control file... done
>>> Standby controlfile(s) on dbv2 recreated. To complete please run dbvctl on the primary, then on the standby.
Refreshing Corrupted Corrupted Datafiles
dbvctl -f refresh_datafile -d <ddc> -a file_id=<file_id>
[oracle@dbv1 standby]$ ./dbvctl -f refresh_datafile -d DEV -a file_id=3
>>> Back up datafile 3... done
>>> Transfer backup of datafile 3 to standby server... done
>>> Catalog backup... done
>>> Restore datafile 3... done
>>> Datafile 3 refresh complete
From: /u01/app/oracle/oradata/DEV/undotbs01.dbf on dbv1
To: /u01/app/oracle/oradata/DEV/undotbs01.dbf on dbv2
Checking The Disk Space For A Specific Mount Point
10. To check the disk space used for a specific mount point, the following command is very helpful:
dbvctl -f diskfull_percent -a path=<directory>
[oracle@dbv2 standby]$ ./dbvctl -f diskfull_percent -a path=/usr
Directory % full
----------------
/usr : 99%
dbvctl -f find_os_pfile -d <ddc> [oracle@dbv1 standby]$ ./dbvctl -f find_os_pfile -d DEV spfile:/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfileDEV.ora pfile:/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/init.oraListing All The Control Files and Their Locations 12. To list all the control files and their locations, run this command:
dbvctl -f controlfile_list -d <ddc> [oracle@dbv1 standby]$ ./dbvctl -f controlfile_list -d DEV /u01/app/oracle/oradata/DEV/control01.ctl /u01/app/oracle/fast_recovery_area/DEV/control02.ctl
Listing All The Redolog Files and Their Locations 13. To list all redolog files and their locations, run this command:
dbvctl -f redo_list -d <ddc> [oracle@dbv1 standby]$ ./dbvctl -f redo_list -d DEV /u01/app/oracle/oradata/DEV/redo01.log /u01/app/oracle/oradata/DEV/redo02.log /u01/app/oracle/oradata/DEV/redo03.log
Listing All The Datafiles
14. To list all the datafiles, the following command can be used:
dbvctl -f datafile_list -d <ddc>
[oracle@dbv1 standby]$ ./dbvctl -f datafile_list -d DEV
/u01/app/oracle/oradata/DEV/system01.dbf
/u01/app/oracle/oradata/DEV/sysaux01.dbf
/u01/app/oracle/oradata/DEV/undotbs01.dbf
/u01/app/oracle/oradata/DEV/users01.dbf
Performing A Basic Check To See If ASM Is Up & Running
15. Another basic check to see if ASM is up and running can be done by using the following command:
dbvctl -f asm_up -d DEV
[oracle@kiwi701 /usr/dbvisit/standby]$ ./dbvctl -f asm_up -d DEV
Y
I have shown you the commands that I find myself using the most often. I encourage you to try them in your (test) environment. Additionally, you could use the dbvctl -h -f option to display the rest of the CLI commands. I am sure you will add some of these to your cheatsheet to make life even more simple when maintaining your Standby™️ environment.
Subscribe to our monthly blog updates
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of DBVisit's Privacy Policy