DBA Hub

📋Steps in this guide1/4

EMCLI : Manage Databases using Enterprise Manager Command Line Interface (Cloud Control)

This article describes how to manage databases in Enterprise Manager Cloud Control using EMCLI, rather than using the web interface.

oracle miscconfigurationintermediate
by OracleDba
12 views
1

Setup

You can perform these actions from anywhere with an EMCLI client , but for this example we're going to use the EMCLI client on the Cloud Control server. We use the following commands to connect to the OMS and sync the EMCLI client.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
unset SSH_ASKPASS
export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst
alias emcli='${OMS_HOME}/bin/emcli'

emcli login -username=sysman
emcli sync
2

Add Database

The verb is used to add all targets, including databases. The command below includes the monitoring credentials. The verb is used to show the target has been added. After adding the database, you should set the preferred credentials, as described here .

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DB_HOST="my-server.localdomain"
DB_PORT="1521"
DB_NAME="orcl"
DB_USERNAME="DBSNMP"
DB_PASSWORD="MyPassword123"
DB_ORACLE_HOME="/u01/app/oracle/product/18.0.0/dbhome_1"
DB_ROLE="Normal"

emcli add_target \
  -name="${DB_NAME}" \
  -type="oracle_database" \
  -host="${DB_HOST}" \
  -credentials="UserName:${DB_USERNAME};password:\"${DB_PASSWORD}\";Role:${DB_ROLE}" \
  -properties="SID:${DB_NAME};Port:${DB_PORT};OracleHome:${DB_ORACLE_HOME};MachineName:${DB_HOST}"

emcli get_targets -targets="${DB_NAME}:oracle_database"
3

Remove Database

The verb is used to remove all targets, including databases. The verb is used to show the target has been removed.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
DB_NAME="ORCL"

emcli delete_target \
  -name="${DB_NAME}" \
  -type="oracle_database"

emcli get_targets -targets="${DB_NAME}:oracle_database"
4

Help

The usage of the commands referenced in this article can displayed using the following commands. You can also check out all the other database verbs in the Help Command Output . For more information see: - EMCLI : All Articles Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
3
4
5
emcli help add_target
emcli help delete_target
emcli help get_targets

emcli help

Comments (0)

Please to add comments

No comments yet. Be the first to comment!