DBA Hub

📋Steps in this guide1/12

EMCLI COMMAND DBACLASS

EMCLI useful commands. Enteprise manager command line interface. Oem 12c cloud control.

oracle monitoringintermediate
by OracleDba
14 views
1

1. Login to syman

Code/Command (click line numbers to comment):

1
./emcli login -username=SYSMAN
2

2. SYNC OMS REPOSITORY:

Code/Command (click line numbers to comment):

1
2
./emcli login -username=SYSMAN
./emcli sync
3

3. Get THE LIST OF TARGETS

For listing only the oracle_database

Code/Command (click line numbers to comment):

1
2
3
./emcli get_targets

./emcli get_targets -targets="oracle_database"
4

4. Delete a target from OEM cloud control:

Code/Command (click line numbers to comment):

1
2
./emcli delete_target -name="B2BOMT2" -type="oracle_database"
Target "B2BOMT2:oracle_database" deleted successfully
5

5. Run autodiscovery on a target host

You can configure autodiscover from GUI also, after a target host is added. Below is for doing using EMCLI Create a property file: Update the property file:( It will look as below) Create a job: Get the job status: Alternatively we can see the execution detail as :

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
./emcli describe_job_type -job_type=RunAutoDiscovery > inputs.prop

# Description: (Optional) The user specified name of the job
name=AUTO_DISC

# Description: (Optional) The job type for this job
type=RunAutoDiscovery

# Description: (Optional) The user specified description of the job
description=

# Description: The job owner. The job owner is the user who creates the job.
# Default: the logged in user
# The job owner information displayed here is for documentation only and user is not expected to change it.
owner=

# Description: (Optional) The kind of job
# Legal Values: active, library
kind=


# Fill in the target list before submitting.
# For Example:
#     target_list=MyTarget:cluster
target_list=172.20.294.137:host


# Description: The type of targets to use for this job
targetType=host


# Description: (Optional) Notify the job owner when a selected state occurs
# Allowed Values:  SCHEDULED, RUNNING, ACTION_REQUIRED, SUSPENDED, SUCCEEDED, PROBLEMS
notification=

# Description: (Optional) The run time properties for the job
properties=

./emcli create_job -input_file=property_file:inputs.prop

Creation of job "AUTO_DISC" was successful.
The following properties were not set to any value and were ignored: description, owner, kind, notification, properties

emcli get_jobs -name=AUTO_DISC

Name       Type              Job ID                            Execution ID                      Scheduled            Completed  TZ Offset  Status   Status ID  Owner   Target Type  Target Name
AUTO_DISC  RunAutoDiscovery  4A115DB150B74968E0540010E01F328C  4A115DB150BA4968E0540010E01F328C  2017-03-06 17:03:55  none       GMT+03:00  Running  2          SYSMAN  host         172.20.294.137

./emcli get_job_execution_detail -execution=4A115DB150BA4968E0540010E01F328C -xml -showOutput

emcli get_jobs -name=AUTO_DISC
Name       Type              Job ID                            Execution ID                      Scheduled            Completed            TZ Offset  Status     Status ID  Owner   Target Type  Target Name
AUTO_DISC  RunAutoDiscovery  4A115DB150B74968E0540010E01F328C  4A115DB150BA4968E0540010E01F328C  2017-03-06 17:03:55  2017-03-06 17:05:22  GMT+03:00  Succeeded  5          SYSMAN  host         172.20.204.137
6

6 . Add target database to OEM cloud:

SYNTAX: EXAMPLE:

Code/Command (click line numbers to comment):

1
2
3
4
5
./emcli add_target -name=”ORACLE_SID” -type=”oracle_database” -host=”$oemhost” -credentials=”UserName:dbsnmp;password:dbsnmp_password;Role:Normal” -properties=”SID:ORACLE_SID;Port:1521;OracleHome:;MachineName:\”

./emcli add_target -name="CRMB2RT" -type="oracle_database" -host="172.29.284.137" -credentials="UserName:dbsnmp;password:oracle4u;Role:Normal" -properties="SID:CRMB2RT;Port:1543;OracleHome:/oracle/app/oracle/product/12.1.0.2_B2R/dbhome_1;MachineName:dbac61-1"

Target "CRMB2RT:oracle_database" added successfully
7

7. Get list of plugins installed on OMS server:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
./emcli list_plugins_on_server

OMS name is dbadev64.dba.com.sa:4889_Management_Service
Plug-in Name                                 Plugin-id                     Version [revision]

Oracle Audit Vault                           oracle.em.soav                12.1.0.4.0
Oracle GoldenGate                            oracle.fmw.gg                 13.1.1.0.0
Oracle Cloud Framework                       oracle.sysman.cfw             13.2.1.0.0
Oracle Database                              oracle.sysman.db              13.2.1.0.0
Oracle Fusion Middleware                     oracle.sysman.emas            13.2.1.0.0
Oracle Fusion Applications                   oracle.sysman.emfa            13.2.1.0.0
Oracle Siebel                                oracle.sysman.empa            13.1.1.0.0
Oracle ORAchk Healthchecks                   oracle.sysman.orhc            13.1.1.0.0
Systems Infrastructure                       oracle.sysman.si              13.2.1.0.0
Oracle Exadata                               oracle.sysman.xa              13.2.1.0.0
8

8 . Get list of plugins installed on a Management Agent:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
./emcli list_plugins_on_agent -agent_names="172.25.224.2:3872"
The Agent URL is https://172.20.204.2:3872/emd/main/ -
Plug-in Name                                 Plugin-id                     Version [revision]

Oracle Home                                  oracle.sysman.oh              13.2.0.0.0
Oracle Database                              oracle.sysman.db              13.2.1.0.0
9

9 . Create BLACKOUT:

Creating blackout for single database DBNAME – DBATEST BLACKOUT DUATION – 30 MIN SCHEDULE- START IMMEDIATELY For multiple databases: DB NAME – DBATEST1,DBATEST2 Create blackout for a host(target agent) and all this services/database runnin on that server TARGET AGENT HOST – localhost.dbaclass.com DURATIO – 30 MIN START IMMEDIATELY Create blackout for RAC database: Get status of a blackout: SYNTAX EXAMPLE: Stop a BLACKOUT: Delete a blackout:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
./emcli create_blackout -name="db_blackout_phase1" -reason="patching" -add_targets="DBATEST:oracle_database" -schedule="duration:30"
Blackout "db_blackout_phase1" created successfully

emcli create_blackout -name="DBACLASS_MULTDB_BLACKOUT" -reason="psu patchcing" -add_targets="DBATEST1:oracle_database;DBATEST2:oracle_database" -schedule="duration:30"

./emcli create_blackout -name="DBACLASS_HOST_BLACKOUT" -reason="OS PATCHING OUTAGE" -add_targets="localhost.dbaclass.com:host" -schedule="duration:60" -propagate_targets
Blackout "DBACLASS_HOST_BLACKOUT" created successfully

emcli create_blackout -name="DBACLASS_RAC_BLACKOUT" -reason="Mainteneance" -add_targets="instance_name:oracle_database;cluster_name:rac_database" -schedule="duration:60"

./emcli get_blackout_details  -name="BLACK_OUT_NAME"

./emcli get_blackout_details  -name="db_blackout_phase1"

./emcli stop_blackout -name="db_blackout_phase1"
Blackout "db_blackout_phase1" stopped successfully

./emcli delete_blackout -name="db_blackout_phase1"
Blackout "db_blackout_phase1" deleted successfully
10

10 . Decommission an agent and delete the respective targets:

Code/Command (click line numbers to comment):

1
2
3
./emcli delete_target -name="dbahost-local:3872"  -type="oracle_emd" -delete_monitored_targets

Target "dbahost-local:3872:oracle_emd" deleted successfully
11

11. Stop and start an agent from OMS server

STOP AN AGENT: START AN AGENT:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/data/app/oracle/oms13c/bin$ ./emcli stop_agent -agent_name="dbahost-local:3872" -host_username=oracle
Host User password:
The Shut Down operation is in progress for the Agent: dbahost-local:3872
The Agent "dbahost-local:3872" has been stopped successfully.
---------------------
Operation Output
---------------------
Oracle Enterprise Manager Cloud Control 13c Release 2
Copyright (c) 1996, 2016 Oracle Corporation.  All rights reserved.Stopping agent ... stopped.

./emcli start_agent -agent_name="dbahost-local:3872" -host_username=oracle
Host User password:
The Start Up operation is in progress for the Agent: dbahost-local:3872
The Agent "dbahost-local:3872" has been started successfully.
---------------------
Operation Output
---------------------
Oracle Enterprise Manager Cloud Control 13c Release 2
Copyright (c) 1996, 2016 Oracle Corporation.  All rights reserved.Starting agent ..................................... started.
12

12. Change password for dbsnmp user of target database

This will prompt for old password and new password.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
./emcli update_db_password -target_name="B2CCRMT2" -target_type="oracle_database" -user_name="dbsnmp" -change_at_target=yes

Enter value for old_password :
Enter value for new_password :
Enter value for retype_new_password :
Successfully submitted a job to change the password in Enterprise Manager and on the target database: "B2CCRMT2"
Execute "emcli get_jobs -job_id=50A66C2EF0EB6E7AE0540010E01F328C" to check the status of the job.
Search for job name "CHANGE_PWD_JOB_1496046676449" on the Jobs home page to check job execution details.

Comments (0)

Please to add comments

No comments yet. Be the first to comment!