Database Reference
In-Depth Information
Listing 3-22. Add the “orcl” single-instance database target
[oracle ~]$ emcli add_target -name='ORCL_DB' \
-type='oracle_database' -host='oradb1.example.com' \
-properties='SID:orcl;Port:1521;OracleHome:/u01/app/oracle/product/12.1.0/dbhome_1;
MachineName:oradb1-vip.example.com' \
-credentials='Role:NORMAL;UserName:DBSNMP;password:<password>'
Target "ORCL_DB:oracle_database" added successfully
If we want to add an RAC database target, the individual instances of the cluster need to be added first, as shown
in Listings 3-23 and 3-24.
Listing 3-23. Add RAC database node one
[oracle ~]$ emcli add_target -name='ORCL1_ORCL_RACCLUSTER'\
-type='oracle_database' -host='oradb1.example.com' \
-properties='SID:orclrac1;Port:1521;OracleHome:/u01/app/oracle/product/12.1.0/dbhome_1;
MachineName:oradb1-vip.example.com' \
-credentials='Role:NORMAL;UserName:DBSNMP;password:<password>'
Target "ORCL1_ORCL_RACCLUSTER:oracle_database" added successfully
Listing 3-24. Add RAC database node two
[oracle ~]$ emcli add_target -name='ORCL2_ORCL_RACCLUSTER'\
-type='oracle_database' -host='oradb2.example.com' \
-properties='SID:orclrac2;Port:1521;OracleHome:/u01/app/oracle/product/12.1.0/dbhome_1;
MachineName:oradb2-vip.example.com' \
-credentials='Role:NORMAL;UserName:DBSNMP;password:<password>'
Target "ORCL2_ORCL_RACCLUSTER:oracle_database" added successfully
Once the instances are added, the database cluster target can be added, specifying the instances as part of the
properties of the EM CLI command. These instances then become associated with the database cluster target.
Because we are adding a cluster target, a Cluster ware target must already exist before adding database
cluster targets, as shown in listing 3-25.
Note
Listing 3-25. Add RAC database cluster, associating the two previous database instances
[oracle ~]$ emcli add_target -name='ORCL_RACCLUSTER' \
-host='oradb1.example.com' -monitor_mode='1' \
-type='rac_database' -properties='ServiceName:orclrac;ClusterName:oradb-cluster' \
-instances='ORCL1_ORCL_RACCLUSTER:oracle_database;ORCL2_ORCL_RACCLUSTER:oracle_database'
Target "ORCL_RACCLUSTER:rac_database" added successfully
One can use EM CLI to add almost any target type. The auto-discovery tool in EM will accurately detect most
targets, making it easy to promote those targets. When an environment has customized configurations that make the
auto-discovery mechanism unreliable, adding targets manually is the only option. In some environments, scripting
the process of adding targets can be used to migrate between versions or to replicate an environment. In these
circumestances, using EM CLI to add targets becomes a necessity.
 
Search WWH ::




Custom Search