We're here to help!

Running CSD in non-interactive mode

Follow
Description

This article explains how to Creating Standby Database in non interactive mode

Solution

Option A:  Create a valid CSD template and use BATCH mode

1Create Standby Database template only in interactive mode

dbvctl -d <DDC> --csd

[oracle@ip-10-0-2-51 standby]$ ./dbvctl -d SRC --csd

>>> Running pre-checks please wait... done
What would you like to do:
1 - Create standby database (and optionally save settings in template)
2 - Create standby database using existing template (previously saved)
3 - Help
4 - Terminate processing
Please enter your choice [1]: 1

-------------------------------------------------------------------------------

=>Do you want to use TRANSPORTABLE MEDIA to transfer the database backup to the
standby server? Transportable media is an external device such as a USB drive
that is first plugged into the primary server and then manually transferred to
the standby site and plugged into the standby server to continue the process.
It can be used for large databases or slow networks.
Specifying No means the network will be used to transfer the database backup.
[N]:
Your input: N

Is this correct? <Yes/No> [Yes]:

-------------------------------------------------------------------------------

=>Do you want to perform backup, transfer and restore operations in parallel
when possible? [Y]:
Your input: Y

Is this correct? <Yes/No> [Yes]:

-------------------------------------------------------------------------------
A temporary location must be specified on tahi where the database will be
backed up to first.
This location must be big enough to hold RMAN backup of the whole database
(2.82GB).

=>Specify the location on this server: [/usr/tmp]:
Your input: /usr/tmp

Is this correct? <Yes/No> [Yes]:

-------------------------------------------------------------------------------
A temporary location must be specified on rua where the database backup will be
copied to before moving to specified locations.

=>Specify location on remote server: [/usr/tmp]:
Your input: /usr/tmp

Is this correct? <Yes/No> [Yes]:

-------------------------------------------------------------------------------

=>Do you want to use an existing standby spfile rather than create a new one
from scratch? [N]:
Your input: N

Is this correct? <Yes/No> [Yes]:

The following oracle database parameters will be set in the standby database pfile or spfile:
-------------------------------------------------------------------------------
SID NAME VALUE

* audit_file_dest /u01/app/oracle/admin/SRC/adump
* compatible 12.1.0.2.0
* control_files /u02/data/SRC/control01.ctl,/u02/data/FRA/SRC/control02.ctl
* db_block_size 8192
* db_domain
* db_name SRC
* db_recovery_file_dest /u02/data/FRA
* db_recovery_file_dest_size 4781506560
* db_unique_name SRC
* diagnostic_dest /u01/app/oracle
* dispatchers (PROTOCOL=TCP) (SERVICE=SRCXDB)
* open_cursors 300
* pga_aggregate_target 293601280
* processes 300
* remote_login_passwordfile EXCLUSIVE
* sga_target 882900992
* spfile OS default
* undo_tablespace UNDOTBS1

-------------------------------------------------------------------------------
What would you like to do:
1 - Proceed with creating the standby database
2 - Edit oracle database parameters for the standby database pfile/spfile
3 - Terminate processing
Please enter your choice [1]:

Validating oracle database parameters... please wait
=>SUCCEEDED

-------------------------------------------------------------------------------

=>Create standby database template for SRC using provided answers? [Y]:
Your input: Y

Is this correct? <Yes/No> [Yes]:

-------------------------------------------------------------------------------

=>Continue with creating a standby database? (If No processing will terminate,
the saved template will be available for future use) [Y]: N
Your input: 0

Is this correct? <Yes/No> [Yes]:

PID:25386
TRACE:25386_dbvctl_csd_SRC_202005011211.trc


 

 2. Run the CSD in Batch mode. The stored template is used to create the standby

./dbvctl -d <DDC> --csd --mode BATCH
[oracle@ip-10-0-2-51 standby]$ ./dbvctl -d SRC --csd --mode BATCH

Creating standby database see trace file /usr/dbvisit/standby/trace/27273_dbvctl_csd_SRC_202005011506.trc

>>> Running pre-checks please wait... done

>>> dbvctl will now run a pre-flight check for standby database creation. An attempt will
be made to create a standby (s)pfile using oracle standby database parameters, followed
by trying to start the standby instance. If this step fails, then please double-check
the following items before re-running dbvctl again:

1) Review the standby database parameters you have supplied and provide valid values
unless a template is used.
2) Recreate the template to provide valid values for standby database parameters if a
template is used.

>>> Running pre-flight check for standby creation, please wait... done

>>> Creating standby control file... done

WARNING: FORCE_LOGGING is disabled in the primary database!

>>> Total database size for SRC is 2.82GB

>>> Backing up primary database...
....
....
....

>>> Completing standby database creation... done

>>> Standby database created.

>>> Performing checkpoint and archiving logs... done

>>> Synchronising standby... done

PID:27273
TRACE:27273_dbvctl_csd_SRC_202005011506.trc

  

3. You could also run CSD Batch mode in background using nohup 

[oracle@dbv1 standby]$ nohup ./dbvctl -d DEV --csd --mode BATCH --noprompt &
[1] 297
[oracle@dbv1 standby]$ nohup: ignoring input and appending output to `nohup.out'

 

[oracle@dbv1 standby]$ tail -f nohup.out
=============================================================
dbvctl started in BATCH mode at 20200527 11:51
dbvctl -d DEV --csd
=============================================================
Creating standby database see trace file /usr/dbvisit/standby/trace/297_dbvctl_csd_DEV_202005271151.trc

>>> Running pre-checks please wait... done

>>> dbvctl will now run a pre-flight check for standby database creation. An attempt will
    be made to create a standby (s)pfile using oracle standby database parameters, followed
    by trying to start the standby instance. If this step fails, then please double-check
    the following items before re-running dbvctl again:

    1) Review the standby database parameters you have supplied and provide valid values
    unless a template is used.
    2) Recreate the template to provide valid values for standby database parameters if a
    template is used.

>>> Running pre-flight check for standby creation, please wait... done

WARNING: FORCE_LOGGING is disabled in the primary database!

>>> Total database size for DEV is 1.40GB

>>> Backing up primary database...

    Backing up datafile 1... done
    Backing up datafile 2... done
    Backing up datafile 3... done
    Backing up datafile 4... done

>>> Creating standby control file... done

>>> Transferring backup from dbv1 to dbv2...

    Transferring /usr/tmp/dbv_DEV_csd_dbf_1_01v189ui_1_1.rman... done
    Transferring /usr/tmp/dbv_DEV_csd_dbf_1_02v189vl_1_1.rman... done
    Transferring /usr/tmp/dbv_DEV_csd_dbf_2_03v189vo_1_1.rman... done
    Transferring /usr/tmp/dbv_DEV_csd_dbf_3_04v18a0i_1_1.rman... done
    Transferring /usr/tmp/dbv_DEV_csd_dbf_4_05v18a12_1_1.rman... done

>>> Restoring standby control files... done

>>> Starting standby database DEV on dbv2 mount... done

>>> Restoring datafiles on dbv2...

    Restoring datafile 1... done
    Restoring datafile 2... done
    Restoring datafile 3... done
    Restoring datafile 4... done

>>> Renaming standby redo logs and tempfiles on dbv2... done

>>> Completing standby database creation... done

>>> Standby database created.


>>> Performing checkpoint and archiving logs... done

>>> Synchronising standby... done
=============================================================
dbvctl completed in BATCH mode at 20200527 11:55
=============================================================

PID:297
TRACE:297_dbvctl_csd_DEV_202005271151.trc

^C
[1]+  Done         nohup ./dbvctl -d DEV --csd --mode BATCH --noprompt

 

Option B: Use -j option to provide a JSON response file

1. Create CSD with template only option

CSD_Template_Only.png

 

2. Create a valid JSON file. The easiest way to do so initially is to utilise option "dump_template" on a primary database that has a valid stored template:

./dbvctl -d <DDC> --csd --dump_template /tmp/t1.json
[oracle@ip-10-0-2-51 standby]$ ./dbvctl -d SRC --csd --dump_template /tmp/t1.json

Dump template file /tmp/t1.json created.

PID:27848
TRACE:27848_dbvctl_csd_SRC_202005011528.trc

 

3. File t1.json can be edited to adjust the values. All sections (like "template") apart from "Inits" and "Input" can be removed, or left as they will be ignored.  Alternatively, the JSON file can be created manually, as far as it has a correct structure.

[oracle@ip-10-0-2-51 tmp]$ ls -lrt /tmp/t1.json
-rw-r--r-- 1 oracle oinstall 9515 May 1 15:28 /tmp/t1.json

3. Run CSD using option -j to Create the Standby Database

 

dbvctl -d <DDC> --csd -j  <.json file>
[oracle@ip-10-0-2-51 standby]$ ./dbvctl -d SRC --csd -j /tmp/t1.json
*** Dbvisit Standby license will expire in 5 days. Please contact Dbvisit Standby
(www.dbvisit.com) to obtain license.

>>> Running pre-checks please wait... done

>>> dbvctl will now run a pre-flight check for standby database creation. An attempt will
be made to create a standby (s)pfile using oracle standby database parameters, followed
by trying to start the standby instance. If this step fails, then please double-check
the following items before re-running dbvctl again:

1) Review the standby database parameters you have supplied and provide valid values
unless a template is used.
2) Recreate the template to provide valid values for standby database parameters if a
template is used.

>>> Running pre-flight check for standby creation, please wait... done

>>> Creating standby control file... done

WARNING: FORCE_LOGGING is disabled in the primary database!

>>> Total database size for SRC is

>>> Backing up primary database...

...
...
...

>>> Standby database created.

>>> Performing checkpoint and archiving logs... done

>>> Synchronising standby... done

PID:28095

 

 

 

 

 

Have more questions? Submit a request

Comments