Dec 22, 2017

Manage groups though EMCLI in OEM cloud control 13c

Mange Group using EMCLI in Oracle Enterprise manager Cloud Control 13c:

Here are we will do the following:
a) List available groups
b) Create new group
c) Delete group
d) Create group with adding Targets
e) List targets in a group
f) Modify group

a) List available groups:

./emcli get_groups
OR
emcli>get_groups()
Target Name  Target Type
ADMINGRP0      group      
All            group      
MAC-Grp        group      
Prod-Grp       group      
Test-Grp       group      

emcli>

b) Create new group:

./emcli create_group -name="tempgrp"
OR
emcli>create_group(name="tempgrp")
Group "tempgrp:group" created successfully

emcli>

c) Delete group:

./emcli delete_group -name="name"
OR
emcli>delete_group(name='tempgrp')
Group "tempgrp:group" deleted successfully

emcli>

d) Create group with adding Targets:

./emcli create_group -name="tstgrp" -add_targets="database2:oracle_database; database3:oracle_database"

This example creates a database-only group named db_group. This group consists of two Oracle databases: emp_rec and payroll:

./emcli create_group -name=tst_group -add_targets="emp_rec:oracle_database" -add_targets="payroll:oracle_database"

e.g.,

emcli>create_group(name="tst_group",add_targets="testdb.example.com:oracle_database")
Group "tst_group:group" created successfully

emcli>

emcli>get_groups()
Target Name  Target Type
..     
Prod-Grp     group        
tst_group    group      

emcli>

e) List targets in a group:

./emcli get_group_members -name=my_group -depth=-1
OR
emcli>get_group_members(name="tst_group")
Target Name         Target Type    
testdb.example.com  oracle_database

emcli>

f) Modify group:

Syntax:
modify_group
(name="name"
[,type="<group>"]
[,add_targets="name1:type1;name2:type2;..."]...
[,delete_targets="name1:type1;name2:type2;..."]...
[,privilege_propagation="true|false"]
[,drop_existing_grants="yes|no"])
[ ] indicates that the parameter is optional

e.g.,

emcli>modify_group(name="tst_group",delete_targets="testdb.example.com:oracle_database")
Group "tst_group:group" modified successfully

emcli>

emcli>modify_group(name="tst_group",add_targets="testdb.example.com:oracle_database")
Group "tst_group:group" modified successfully

emcli>get_group_members(name="tst_group")                                            
Target Name         Target Type    
testdb.example.com  oracle_database

emcli>

1 comment:

  1. Is there an EMCLI command to list targets that have no group?

    ReplyDelete

Translate >>