discover_db
Discovers and adds or promotes single instance, Real Application Cluster (RAC), Clusterware, and pluggable databases along with their associated targets, such as High Availability Service, listener, and SCAN listener, according to the preferences provided in the input file.
Format
Standard Mode
emcli discover_db -input_file="db_discovery_file:/path/db_discovery_file" [-debug] [-promote] [-add_missing_cluster] [-check]
Interactive or Script Mode
discover_db( ddb_discovery_file="db_discovery_file" [,debug=True/False] [,promote=True/False] [,add_missing_cluster=True/False] [,check=True/False] ) [ ] indicates that the parameter is optional.
Options
-
db_discovery_file
This file contains the preferences required to add a database. The file must organized into blocks, with each block specific to a particular host or cluster. Each input block includes lines for a host or cluster name, database credentials, and the target type. Optionally, each input block can include discovery hints such as discovery time-out and database status.
Input blocks are separated by an empty line.
Database credentials are given as database name/credentials (user name, password, role) pairs.
If you want to specify common database credentials for all of the databases on a given host, then '*' can be specified instead of the database name.
Specify the database target type as follows:
-
rac_database
in case of a RAC database -
oracle_database
in case of a single instance database.
Specify ASM credentials as follows:
asm_creds=Username,Password,Role
To add targets to groups, specify the group names separated by commas as follows:
group_names=Group Name 1,Group Name 2,Group Name 3
The names of targets to be added or promoted can include a prefix or a suffix, as follows:
db_name_prefix=Prefix pattern
db_name_suffix=Suffix pattern
The target properties (global or user added properties) can be saved by specifying the input as follows:
global_props=Property 1 Name: Property 1 Value, Property 2 Name: Property 2 Value
user_added_props=Property 1 Name: Property 1 Value, Property 2 Name: Property 2 Value
The structure of the input file when the host name is provided is as follows:
<host_name=Host Machine Name> <db_creds=Target Name:Username,Password,Role> <target_type=Target Type -optional> <discovery_hints - optional> <asm_creds=Username,Password,Role -optional> <group_names=Group Name 1,Group Name 2,Group Name 3 -optional> <db_name_prefix=Prefix pattern -optional> <db_name_suffix=Suffix pattern -optional> <global_props=Property 1 Name: Property 1 Value -optional> <user_added_props=Property 1 Name: Property 1 Value -optional>
The structure of the Input file when the cluster name is provided is as follows:
<cluster_name=Name of the Cluster> <db_creds=Target Name:Username,Password,Role> <target_type=Target Type -optional> <discovery_hints - optional> <asm_creds=Username,Password,Role -optional> <group_names=Group Name 1,Group Name 2,Group Name 3 -optional> <db_name_prefix=Prefix pattern -optional> <db_name_suffix=Suffix pattern -optional> <global_props=Property 1 Name: Property 1 Value -optional> <user_added_props=Property 1 Name: Property 1 Value -optional> ----------------- cluster_name=slc00dsno-cls db_creds=db1:sys,oracle,SYSDBA db_creds=db2:sys,welcome,SYSDBA target_type=oracle_database asm_creds=sys,oracle,SYSDBA group_names=group1,group2 cluster_name=slc00dtfg-r db_creds=*:sys,oracle,SYSDBA target_type=rac_database db_status=up db_name_prefix=prefix_ db_name_suffix=_suffix global_props=Comment:Test,Contact:4444,Cost Center:CC
For example, the contents of the file can be (2 blocks of input in the file):
----------------- host_name=slc00dsn.mycompany.com db_creds=db1:sys,oracle,SYSDBA db_creds=db2:sys,welcome,SYSDBA target_type=oracle_database asm_creds=sys,oracle,SYSDBA group_names=group1,group2 host_name=slc00dtf.mycompany.com db_creds=*:sys,oracle,SYSDBA target_type=rac_database db_status=up db_name_prefix=prefix_ db_name_suffix=_suffix global_props=Comment:Test,Contact:4444,Cost Center:CC
-
-
debug
Specifies if debug is on or off.
-
promote
Promotes targets obtained from auto discovery.
-
add_missing_cluster
Adds the cluster in case the mentioned host is valid and the corresponding cluster is not added.
-
check
Runs discovery and shows the results. It does not add the targets.
Exit Codes
0 if successful. A non-zero value indicates that verb processing was unsuccessful.
Example
The following example discovers a database target and promotes it:
emcli discover_db -input_file=db_discovery_file:/emcli/test.txt <-debug> <-promote> <-add_missing_cluster> <-check>