Database Reference
In-Depth Information
Updating Target Properties Using Argfile
OEM properties provide another data point for targets and administrators. For instance, setting the Department
property for host and database targets could be useful for filtered reports, or you could use a property to map targets
to administrators. The Lifecycle Status property can be used to filter up-time reports. You get the idea. It's another
reference point outside of built-in OEM structures like Groups.
Despite their usefulness, it's fairly inconvenient to set properties for an OEM target. When you discover a new
host or configure a connection to a new database, you aren't prompted for LifeCycle Status , Department , Location ,
or any of the other properties that are directly assignable to a target in the console.
As a result, some of your targets may not have current or accurate values in those fields. Here's a query that uses
string logic to derive LifeCycle Status from the host name. In this example, production hosts are named oraprod01 ,
oraprod02 , etc. Test and development hosts enjoy the same common naming standards. Note: Naming standards like
this flash a signal to hackers saying “Don't waste your time on that dev/test server—all my production data is over
here!” This is just an example.
The set_target_property_value verb allows you to set a single property for a single target. You have better
things to do, so we'll pull those verb strings into an argfile by loading the results of that query into a SQL spool file,
like this:
sqlplus -S ${SYSMAN_CONNECT} <<EOF SET ECHO OFF
SET FEEDBACK OFF HEADING OFF LINES 250 PAGES 999
SPOOL ${ARGFILE01}
SELECT
CASE SUBSTR ( host_name, 0, 6 )
WHEN 'oraprod' THEN
DECODE ( property_value, 'Production', NULL, 'set target_property_value
-property_records="' || target_name ||':oracle_database:LifeCycle Status:Production"' )
WHEN 'oratest' THEN
DECODE ( property_value,'Test', NULL,'set_target_property_value -property_records="' ||
target_name ||':oracle_database:LifeCycle Status:Test"' )
WHEN 'oradevl' THEN
DECODE ( property_value,'Development', NULL,'set_target_property_value
-property_records="' || target_name ||':oracle_database:LifeCycle Status:Development"' )
ELSE ''Not defined'
END AS corrective_action
FROM sysman.gc$target_properties a,
sysman.gc$target b
WHERE a.target_guid = b.target_guid
AND b.target_type = 'oracle_database'
AND a.property_name = 'orcl_gtp_lifecycle_status';
SPOOL OFF
EOF
if [ `cat ${ARGFILE01} | wc -l` -gt 0 ]; then
emcli login -user=sysman -pass=${CONSOLE_PWD} 2>/dev/null
emcli argfile ${ARGFILE01}
emcli logout
fi
 
Search WWH ::




Custom Search