Oracle Enterprise Manager 12c Cloud Control Command Line İnterface “CLI”

oracle-cloud-control

Oracle Enterprise Manager 12c is one of the Cloud Control Database management tools. It is a database management tool developed by Oracle for managing databases and operating systems independently from one place. Enterprise Manager Grid Control, which was previously called Enterprise Manager 12c & 13C Cloud Control is the new name of the management tool.

The EM CLI command line is the traditional and most direct way to call the EM CLI verb. I will mention the basic syntax from the system prompt below.

  • Log in to Syman

./emcli login-username = SYSMAN

  • REPUBLIC OF SYNC OMS:

./emcli login-username = SYSMAN
./emcli synchronization

  • Get Target Lıst

./emcli get_targets

To list only oracle_database

./emcli get_targets -targets = “oracle_database”

  • Delete a target from the OEM cloud control:

./emcli delete_target -name = “OLDTARGET” -type = “oracle_database”
Target “OLDTARGET: oracle_database” deleted successfully

  • Run autodiscover on a destination host
    Once a destination host is added, you can also configure auto-discovery from the GUI. Using EMCLI to do below
  • Create a property file:

./emcli describe_job_type -job_type=RunAutoDiscovery > inputs.prop

Update the property file

// Description: (Optional) User-specified name of the job
name = AUTO_DISC

// Description: (Optional) Job type for this job
= RunAutoDiscovery type

// Description: (Optional) User has defined job description
Description =

// Description: Business owner. The job owner is the user who created the job.

// Default: logged in user

// The owner information displayed here is for documents only, and the user is not expected to change it.
owner =

// Description: (Optional) Type of job
// Legal Values: active, library
type =

// Fill in the destination list before sending.
// For example:
// target_list = MyTarget: set
target_list = 192.168.20.20 : host

// Description: Target type to use for this job
TARGETTYPE = host

// Description: (Optional) Notify the business owner when a selected status occurs
// Allowed Values: PROGRAMMING, RUN, ACTION_REQUIRED, SUSPENDED, SUCCEED, PROBLEMS
notification =

// Description: (Optional) Run-time properties of the job
Features =

Create a job:

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

The creation of the “AUTO_DISC” job succeeded.
The following properties are not set to any value and are ignored: description, owner, type, declaration, properties

Get job status:

emcli get_jobs -name = AUTO_DISC

Name Type Job ID Execution ID Scheduled Complete TZ Offset Status Status ID Identity Owner Target Type Target Name
AUTO_DISC RunAutoDiscovery 9A215DB150B74968E0540010E01F328C 9A215DB150BA4968E0540010E01F328C 2017-03-06 17:03:55 none GMT + 03: 00 2 Operating the SYSMAN server 192.168.20.20

Alternatively, we can see the execution detail as follows:

./emcli get_job_execution_detail -execution = 9A215DB150BA4968E0540010E01F328C -xml -showOutput

emcli get_jobs -name = AUTO_DISC


Name Type Job ID Execution ID Scheduled Complete TZ Offset Status Status ID Identity Owner Target Type Target Name
AUTO_DISC RunAutoDiscovery 9A215DB150B74968E0540010E01F328C 9A215DB150BA4968E0540010E01F328C was successful

Add the target database to the OEM cloud:
SYNTAX:

./emcli add_target -name = ”ORACLE_SID” -type = ”oracle_database” -host = ”$ oemhost” -credentials = ”UserName: cozum; password: cozum_password; Role: Normal ”-properties =” SID: ORACLE_SID; ; OracleHome :; MachineName: \ ”

SAMPLE:

./emcli add_target -name = “NEWTARGET” -type = “oracle_database” -host = “10.0.204.39” -credentials = “UserName: cozum; password: 123456; Role: Normal” -properties = “SID: NEWTARGET; Port : Normal 1543; OracleHome: /oracle/app/oracle/product/12.1.0.2_B2R/dbhome_1; MachineName: dbac61-1 “

Target “NEWTARGET : oracle_database” added successfully

  • Get the list of plug-ins installed on the OMS server:

./emcli list_plugins_on_server

OMS name: dba.localdomain.sa:4889_Management_Service
Plugin Name Plugin Name Version [revision]

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

Get Install add-ons list
./emcli list_plugins_on_agent -agent_names = “10.0.0.10:3872”

 Create BLACKOUT:

Creating blackout for single database
DBNAME – TESTINSTANCE
BLACKOUT DUATION – 30 MIN
SCHEDULE- START IMMEDIATELY

./emcli create_blackout -name=”bıgdba_blackout1″ -reason=”patching” -add_targets=”TESTINSTANCE:oracle_database” -schedule=”duration:30″Blackout “db_blackout_phase1” created successfully

Multiple Databases:
DB NAME – TESTINSTANCE1,TESTINSTANCE2

emcli create_blackout -name=”BIGDBA_MULTDB_BLACKOUT” -reason=”psu patchcing” -add_targets=” TESTINSTANCE1:oracle_database; TESTINSTANCE2:oracle_database” -schedule=”duration:30″

Create blackout for a host `target agent` and all this services/database running for server

TARGET AGENT HOST – localhost.localdomain
DURATION – 30 MIN
START IMMEDIATELY

./emcli create_blackout -name=”BIGDBA_HOST_BLACKOUT” -reason=”OS PATCHING OUTAGE” -add_targets=”localhost.localdomain:host” -schedule=”duration:60″ -propagate_targetsBlackout “BIGDBA_HOST_BLACKOUT” created successfully

Create blackout in RAC Database

emcli create_blackout -name=”BIGDBA_RAC_BLACKOUT” -reason=”Mainteneance” -add_targets=”instance_name:oracle_database;cluster_name:racdb” -schedule=”duration:60″

Get Status blackout:

./emcli get_blackout_details  -name=”BLACK_OUT_NAME”

Stop a BLACKOUT:

./emcli stop_blackout -name=”db_blackout_node1″Blackout “db_blackout_node1” stopped successfully

Delete a blackout:

./emcli delete_blackout -name=”db_blackout_node1″Blackout “db_blackout_node1” deleted successfully

Discontinuation of an agent’s service and deletion of relevant objectives:

./emcli delete_target -name=”dbhost-local:3872″  -type=”oracle_emd” -delete_monitored_targets Target “dbhost-local:3872:oracle_emd” deleted successfully 

Stop and start an agent from the OMS server

/data/app/oracle/oms12c/bin$ ./emcli stop_agent -agent_name=”dbhost-local:3872″ -host_username=oracle User password:

The Shut Down operation progress for the Agent: dbhost-local:3872The Agent “dbhost-local:3872” has been stopped successfully.

Start Agent

./emcli start_agent -agent_name=”dbhost-local:3872″ -host_username=oracle User password:

The Start Up operation progress for the Agent: dbhost-local:3872The Agent “dbhost-local:3872” has been started successfully.

Change the password for the cozum user of the target database

./emcli update_db_password -target_name=”NEWTARGET” -target_type=”oracle_database” -user_name=”oracle” -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: “NEWTARGET” Execute “emcli get_jobs -job_id=90C66C2EF0EB9A7AE0690010E01F328C” to check the status of the job.Search for job name “CHANGE_PWD_JOB_1236046676849” on the Jobs home page to check job execution details.

Source

Comments