automate OEM partition Maintenance
451702Dec 6 2006 — edited Feb 1 2007Hi All,
I was wondering if anyone out there had already automated their routine partition maintenance on the OEM repository and if there was any recommended standard, automated procedure for this from Oracle or the OEM community at large.
I've put something sloppy together that works, but would like to see what you all have out there for UNIX platforms.
Below is what I'm doing currently. I know this is not the best scripting, but I put it together quickly and as of yet have not gotten around to attempting to handle errors or recompile down the entire submit_em_dbms_jobs pkg chain which gets invalidated after the part_maint call.
Let me know if anyone out there knows of a recommended automated procedure for this, or if anyone wants to work on creating a nice one that could be shared as a standard.
Thanks,
Tony
--------------------------------------------------------------------------------------------------------------------------
Oracle Cron Entry
# Perform OEM Partition Maintenance, 11PM Fridays
00 23 * * 5 /groups/tapestry/devsupport/se/DBA_Utilities/dba/oem_maint.ksh 2>/dev/null
oem_maint.ksh----------------------------------------------------------------------------------------------------
#!/bin/ksh
#
# OEM Maintenance - stops OEM, runs partition maint, starts OEM
#
PATH=.:/usr/sbin:/usr/bin:/sbin
ORA_HOME=/opt/oracle/product/EM102020
export ORA_HOME
export PATH
# OEM Must be stopped to run partition maintenance
$ORA_HOME/oms10g/bin/emctl stop oms
$ORA_HOME/oms10g/bin/emctl stop em
$ORA_HOME/oms10g/opmn/bin/opmnctl stopall
ORAENV_ASK=NO
export ORAENV_ASK
ORACLE_SID=emrep
. oraenv
unset TWO_TASK
/usr/bin/read SYSMANPWD < /homes/oracle/.sysman_pwd
#Connect as sysman and run partition maintenance, then submit jobs
echo "connect sysman/$SYSMANPWD;
spool /tmp/oemmaint.log;
PROMPT Running emd_maintenance.partition_maintenance;
exec emd_maintenance.partition_maintenance;
PROMPT First Run will Fail due to part maint
exec emd_maintenance.submit_em_dbms_jobs;
PROMPT Second Run should succeed
exec emd_maintenance.submit_em_dbms_jobs;
spool off
" | sqlplus -s /nolog
#Email spooled sqlplus session for SAs to check results
cat /tmp/oemmaint.log | mailx -s "OEM Partition Maintenance Results" emailaddress@comp.com
#Remove the spool file
/usr/bin/rm /tmp/oemmaint.log
#Restart OEM
$ORA_HOME/oms10g/opmn/bin/opmnctl startall
-------------------------------------------------------------------------------------------------------------------------