Pythian Blog: Technical Track

EM 12c, EM 13c: delete agent and targets using emcli

It's feasible to delete agents and targets using GUI but can take a lot of work depending on configuration and security. Some of the complexities involve port forwarding and access to web browser which is not always available or simple for Linux, for example. Using command line interface (emcli) is much easier and a demo is shown below. The host being monitored is myhost1. Oracle Management Server (OMS) is omshost. The demo has only two monitored targets (oracle_dbsys, oracle_database) and there may be more depending on environments.
### Source OMS environment
 oracle@omshost[emrep]$ . oraenv <<< oms
 ORACLE_SID = [emrep] ? The Oracle base for ORACLE_HOME=/u01/app/product/em12.1.0.3_middleware/oms is /home/oracle/app/oracle
 
 ### Login to OMS as sysman user
 oracle@omshost[oms]$ emcli login -username=sysman
 Enter password : 
 
 Login successful
 
 ### Sync OMS
 oracle@omshost[oms]$ emcli sync
 Synchronized successfully
 
 ### Find monitored targets for host (myhost1)
 oracle@omshost[oms]$ emcli get_targets -format=name:csv|grep myhost1
 5,Under Blackout,oracle_database,myhost1
 6,Status Pending,oracle_dbsys,myhost1_sys
 
 ### Delete monitored target: oracle_database
 oracle@omshost[oms]$ emcli delete_target -name="myhost1" -type="oracle_database" -delete_monitored_targets -async
 Target "myhost1:oracle_database" deleted successfully
 
 ### Delete monitored target: oracle_dbsys
 oracle@omshost[oms]$ emcli delete_target -name="myhost1_sys" -type="oracle_dbsys" -delete_monitored_targets -async
 Target "myhost1_sys:oracle_dbsys" deleted successfully
 
 ### Verify monitored targets have been deleted.
 oracle@omshost[oms]$ emcli get_targets -format=name:csv|grep myhost
 

No Comments Yet

Let us know what you think

Subscribe by email