DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Wednesday, January 10, 2018

OEM_working_at_commang_line





Working at the Command Line:

Start an EM CLI Session

emcli login -username="SYSMAN"
emcli sync



emcli help


emcli help sync


The get_targets Verb


emcli set_credential -target_type=oracle_database -target_name="eamz" \
-credential_set=DBCredsNormal \
-columns="username:dbsnmp;password:Super_S3cret;role:Normal"

emcli get_targets -targets="oracle_database" -format="name:csv" | grep -i eamz


Agent Administration

emcli get_targets –targets="oracle_emd" –name="name:csv"
Status ID,Status,Target Type,Target Name
1,Up,oracle_emd,acme_dev:2480
1,Up,oracle_emd,acme_qa:3872
1,Up,oracle_emd,acme_prod:3872

emcli stop_agent -agent=acme_qa:3872 -host_username=oracle
Host User password:
The Shut Down operation is in progress for the Agent: acme_qa:3872
The Agent "acme_qa:3872" has been stopped successfully.
emcli start_agent -agent=acme_qa:3872 -host_username=oracle
Host User password:
The Start Up operation is in progress for the Agent: acme_qa:3872
The Agent "acme_qa:3872" has been started successfully.
emcli restart_agent -agent=acme_qa:3872 -host_username=oracle
Host User password:
The Restart operation is in progress for the Agent: acme_qa:3872
The Agent "acme_qa:3872" has been restarted successfully.


emcli secure_agent -agent=acme_qa:3872 -host_username=oracle
Host User password:
Registration Password:
The Secure operation is in progress for the Agent: acme_qa:3872
The Agent "acme_qa:3872" has been secured successfully.
emcli resecure_agent -agent=acme_qa:3872 -host_username=oracle
Host User password:
Registration Password:
The Resecure operation is in progress for the Agent: acme_qa:3872
The Agent "acme_qa:3872" has been resecured successfully.


emcli resyncAgent -agent=acme_qa:3872
Resync job RESYNC_20140422135854 successfully submitted



emcli get_agent_properties -agent_name=acme_qa:3872
Name Value
agentVersion 12.1.0.3.0
agentTZRegion America/Los_Angeles
emdRoot /opt/oracle/agent12c/core/12.1.0.3.0
agentStateDir /opt/oracle/agent12c/agent_inst
perlBin /opt/oracle/agent12c/core/12.1.0.3.0/perl/bin
scriptsDir /opt/oracle/agent12c/core/12.1.0.3.0/sysman/admin/ scripts
EMD_URL https://acme_qa:3872/emd/main/
REPOSITORY_URL https://myoms.com:4903/empbs/upload
EMAGENT_PERL_TRACE_LEVEL INFO
UploadInterval 15
Total Properties : 10
emcli get_agent_property -agent_name=acme_qa:3872 -name=agentTZRegion
Property Name: agentTZRegion
Property Value: America/Los_Angeles



Deleting EM Targets with EM CLI

Find Exact Target Names


> emcli get_targets | grep -i bertha
1 Up oracle_database bertha
1 Up oracle_dbsys bertha_sys
1 Up oracle_listener LSNRBERTHA_oemdemo.com


Delete the Target

emcli delete_target –type = "oracle_db_sys" –name="bertha_sys" –delete_members
Target "bertha_sys:oracle_dbsys" deleted successfully

You can also delete individual members, like this:
> emcli delete_target –type = "oracle_listener" –name="LSNRBERTHA"
Target "LSNRBERTHA:oracle_listener" deleted successfully




How to Remove an Enterprise Manager Agent with One Command

emcli delete_target -name="<Agent Name>"
-type="oracle_emd"
-delete_monitored_targets
-async;


emcli get_targets | grep -i demohost01
1 Up host demohost01
1 Up oracle_emd demohost01:3872
> emcli delete_target -name="demohost01:3872" -type="oracle_emd" -delete_monitored_targets -async;
Target "LSNRBERTHA:oracle_listener" deleted successfully



Transferring Targets to Another EM Agent



To move goldfish database and its listener from the alice server to buster:
emcli relocate_targets
-src_agent="alice:3872"
-dest_agent="buster:3872"
-target_name="goldfish"
-target_type="oracle_database"
-copy_from_src
emcli relocate_targets
-src_agent="alice:3872"
-dest_agent="buster:3872"
-target_name="lsnrgoldfish"
-target_type="oracle_listener"



For the transfer you’d use these values:
• src_agent= alice:3872 (current agent name)
• dest_agent= buster:3872 (destination agent name)
• target_name= goldfish (name of the target to move)
• target_type= EM types for that target
Database targets also include the copy_from_src flag in order to retain their history. You can only relocate one
target per EM CLI command.


OMS-Mediated Targets

SELECT entity_type,
entity_name,
host_name
FROM sysman.em_manageable_entities
WHERE manage_status =2-- Managed
AND promote_status =3-- Promoted
AND monitoring_mode =1-- OMS mediated
ORDERBY entity_type,entity_name, host_name;
ENTITY_TYPE ENTITY_NAME HOST_NAME
------------------------- ------------------------------------- --------------------
cluster clust01 cluster01b.com
cluster clust01 cluster01b.com
rac_database apple cluster01b.com
rac_database betty cluster01a.com
rac_database jack cluster01b.com
weblogic_domain /EMGC_GCDomain/GCDom myoms.com
weblogic_domain /Farm01_IDMDomain/ID myoms.com
weblogic_domain /Farm02_IDMDomain/ID myoms.com


Managing OEM Administrators


emcli create_user -name="SuzyQueue" -password="oracle"

emcli create_user -name="SuzyQueue" -password="oracle" -expired="true"

Role Management

emcli create_user -name="SuzyQueue" -password="oracle" \
-roles="em_all_administrator"

emcli grant_roles -name="SuzyQueue" -roles="em_all_viewer"
emcli revoke_roles -name="SuzyQueue" -roles="em_all_operator"


Tracking Management Server Login

emcli list_active_sessions -details
OMS Name: myoms.com:4889_Management_Service
Administrator: SYSMAN
Logged in from: Browser@123.45.6.234
Session: F7CA6D7DE88B0917E04312E7510A9E54
Login Time: 2014-04-24 06:46:53.876687


OMS Name: myoms.com:4889_Management_Service
Administrator: BOBBY
Logged in from: Browser@SAMPLEPC.com
Session: F7CD5C7EE0A961C7E04312E7510A8A71
Login Time: 2014-04-24 11:05:24.199258
OMS Name: myoms.com:4889_Management_Service
Administrator: PHIL
Logged in from: Browser@123.45.6.228
Session: F7CECDD6335543E3E04312E7510AA25C
Login Time: 2014-04-24 11:13:20.567234
OMS Name: myoms.com:4889_Management_Service
Administrator: SYSMAN
Logged in from: Browser@123.45.6.234
Session: F7CF52CA3BE1692FE04312E7510A7494
Login Time: 2014-04-24 11:50:31.152683

OMS Name: myoms.com:4889_Management_Service
Administrator: SYSMAN
Logged in from: EMCLI@123.45.6.231
Session: F7CF52CA3BE3692FE04312E7510A7494
Login Time: 2014-04-24 11:55:52.482938
OMS Name: myoms.com:4889_Management_Service
Administrator: SYSMAN
Logged in from: Browser@123.45.6.231
Session: F7CF52CA3BE5692FE04312E7510A7494
Login Time: 2014-04-24 12:07:52.335728




No comments: