command line blackouts



We've been using blackouts more and more to prevent tickets being raised when we do maintenance work - as we tend to work more from the command line than from the cloud control gui we wanted to find an easy way to do this.

The first issue we had was trying to find a list of the targets that are actually monitored by the agent - this is easy enough in the GI but how do you just get a list of targets from the command line - looking at the command help there doesn't seem to be anything listed that does that?

After a lot of digging i finally found it (oh and make sure for all of this use use emctl from the agent home and not the db home otherwise you end up running database control commands)

So to get a list of targets you run this:

emctl config agent listtargets

This produces output similar to below

Oracle Enterprise Manager Cloud Control 12c Release 4
Copyright (c) 1996, 2014 Oracle Corporation.  All rights reserved.
[server, host]
[agent12c2_2_server, oracle_home]
[server:3872, oracle_emd]
[DB4, oracle_database]
[OraDb11g_home112031_1_server, oracle_home]
[DB3, oracle_database]
[LISTENER_DB1_1521_server, oracle_listener]
[DB2, oracle_database]
[OraDb11g_home11204_22_server, oracle_home]
[OraHome18_23_server, oracle_home]
[DB1, oracle_database]
[agent12c1_24_server, oracle_home]

SO now we have all the info we need to start a blackout just for one of those targets - so as an example if we want to blackout DB1 for 30 days we say

emctl start blackout test DB1:oracle_database -d 30

which then says

Oracle Enterprise Manager Cloud Control 12c Release 4
Copyright (c) 1996, 2014 Oracle Corporation.  All rights reserved.
Blackout test added successfully
EMD reload completed successfully

So there you have it

Stopping is then just the reverse command

emctl stop blackout test

which gives

Oracle Enterprise Manager Cloud Control 12c Release 4
Copyright (c) 1996, 2014 Oracle Corporation.  All rights reserved.
Blackout test stopped successfully
EMD reload completed successfully

easy!

Comments