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

Posted in: Technical Track

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
[email protected][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
[email protected][oms]$ emcli login -username=sysman
Enter password : 

Login successful

### Sync OMS
[email protected][oms]$ emcli sync
Synchronized successfully

### Find monitored targets for host (myhost1)
[email protected][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
[email protected][oms]$ emcli delete_target -name="myhost1" -type="oracle_database" -delete_monitored_targets -async
Target "myhost1:oracle_database" deleted successfully

### Delete monitored target: oracle_dbsys
[email protected][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.
[email protected][oms]$ emcli get_targets -format=name:csv|grep myhost


Want to talk with an expert? Schedule a call with our team to get the conversation started.

2 Comments. Leave new

May 30, 2020 9:16 am

HI Micheal,
Good post,Could you please let us know useful emcli commands


emcli get_blackout_details -name=”consistent_name”
emcli get_blackout_targets -name=”consistent_name”
emcli delete_blackout -name=”consistent_name”
emcli list_plugins_on_server
emcli list_plugins_on_agent
emcli setup
emcli create_group -name=”db_group” -add_targets=”emrep.local:oracle_database”
emcli get_group_members -name=”db_group”
emcli get_group_members -name=db_group -depth=-1
emcli modify_group -name=”db_group” -delete_targets=”emrep.local:oracle_database”
emcli get_targets -target=”oracle_dbsys”
emcli get_targets -target=”host”
emcli show_credential_type_info -target_type=oracle_database
emcli list_active_sessions -details -table -script


Leave a Reply

Your email address will not be published. Required fields are marked *