Sie sind auf Seite 1von 3

F E A T U R E Spring 2001 •

{Editor’s Note: These scripts are also available in OAUG’s publica-


tions article archive at www.oaug.org/members/forumindex.html}

APPS-Automagic...
Anyone can be
an APPS-DBA!
by Justin Hockemeyer
ArvinMeritor Inc.
hockemjd@meritorauto.com

The time, 2:35 am – the disaster,


your global Oracle Applications
instance has stopped running.
In order to resolve the problem, the DBA (database admin-
istrator) has to copy the production instance back to a
development box for support. The eight hours the DBA is
about to spend on the copy could have taken twenty min-
utes, giving the DBA seven hours and forty minutes of
time saved to start a diagnosis and make an attack plan.
What can make this kind of difference?
To be a good applications’ DBA, one needs to be able
to get beyond the repetitious daily tasks in order to focus
on the real issues. Processes such as instance refreshes, data-
base copies, and general starting and stopping instances can
easily consume a DBA’s valuable time. Perhaps you have
application DBAs sitting around without work to do, but
chances are, with tight budgets, you’ve got to make a staff
of ten do the work of forty. The fastest way to leverage
continued on page 44

w w w. o a u g . o r g 43

F E A T U R E

oratab_v11i
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Oracle8 and SQL*Net install procedures.
#
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
WEB RESOURCES: DATABASE
APPPWD=apps
11icmd $ORACLE_COMN/admin/scripts/adcmctl.sh apps/$APPPWD stop #
#
$ORACLE_SID:$ORACLE_HOME:<N|Y>:
ADMINISTRATION IN ORACLE
#!/bin/ksh # The first and second fields are the system identifier and home
#-------------------------------------------------------------------------#
# #
# Stop the Apache Process
$ORACLE_COMN/admin/scripts/adapcctl.sh stop # directory of the database respectively. The third field indicates APPLICATIONS
# to the dbstart utility that the database should, "Y", or should not,
# Module Name: 11icmd # # "N", be brought up at system boot time.
# # # Stop the APPS listener
$ORACLE_COMN/admin/scripts/adalnctl.sh stop APPS_$ORASID #
# Purpose: Start/Stop the Oracle 11i Processes # Multiple entries with the same $ORACLE_SID are not allowed.
# #
# Stop the Database listener # OAUG Conference Papers
# #
# [Option] [Option] # $ORACLE_COMN/admin/scripts/addlnctl.sh stop $ORASID
VIS:/t03/oracle/visora/8.1.6:N
# Start/Stop Instance #
elif [[ $APPOPS == "start" ]] TEST:/t04/oracle/testora/8.1.6:Y This article is an excerpt from Justin’s Fall 2000
# Example: Shell Name Command Name # PROD:/t05/oracle/prodora/8.1.6:N
then
#
#
-------------------- ---------- --------
11icmd start VIS
#
#
Conference paper, “Apps-Automagic: Be An Apps
# 11icmd stop VIS # # Start the Database listener
# 11icmd start ALL # $ORACLE_COMN/admin/scripts/addlnctl.sh start $ORASID 11 DBA in 60 Minutes,” available on OAUG’s
# 11icmd stop ALL #
# # # Start the APPS listener
$ORACLE_COMN/admin/scripts/adalnctl.sh start APPS_$ORASID
Figure 2 Conference Paper Database (www.oaug.org/prot/
# Maintenance #
#
#
Date
-----------
Author Description
------------ ----------------------------------------#
#
# Start the Apache Process members/db_instr.html). Other database administra-
# 10-May-2000 J.Hockemeyer Module design/creation # $ORACLE_COMN/admin/scripts/adapcctl.sh start your ability is to notice the required “man” in the manual tion papers include:
# #
#-------------------------------------------------------------------------# # Start the concurrent manager
# Get password process. Let a set of scripts do the work, and let the hang-
#-------------------------------------------------------------------------#
# TEST: Number ($#) of arguments passed to this Shell on the command-line? # APPPWD=apps
ing concurrent manager occupy the DBA’s mind. “Building a 100% Reliable Backup and Recovery
#-------------------------------------------------------------------------# $ORACLE_COMN/admin/scripts/adcmctl.sh apps/$APPPWD start
DIRNAM=$(dirname $0) for Oracle Apps,” by Dan Hotka
# Start the Forms Metric Server/Client processes
$ORACLE_COMN/admin/scripts/adfmsctl.sh start
Oracle Applications Release 10.7 was fairly simple to
if
then
[[ $# -ne 2 ]]
$ORACLE_COMN/admin/scripts/adfmcctl.sh start “All About Oracle Database Fragmentation,”
clear replicate and copy. Then came 11.0.x and 11i; Oracle has
print # Start the Forms Server process by Craig Shallahamer
$ORACLE_COMN/admin/scripts/adfroctl.sh start
print "#----------------------------------------------------#"
print "# 11icmd: ArvinMeritor Oracle Application Control #"
hidden port numbers, web listeners, and configuration files “Confessions of a Hacker: Diagnosing and
print "#----------------------------------------------------#" # Start the Reports Server process
print $ORACLE_COMN/admin/scripts/adrepctl.sh start throughout the gigabytes of application files. The ones you Solving Applications Technical Problems,”
read APPOPS?" Please Enter start -or- stop : "
read ORASID?" Enter the INSTANCE Name: " # Start the TCF process
$ORACLE_COMN/admin/scripts/adtcfctl.sh start may find one time, you may miss the next – it’s virtually by John Huschka
$DIRNAM/11icmd $APPOPS $ORASID
# Start the Webdb listener and process
$ORACLE_COMN/admin/scripts/adwdbctl.sh start an impossible game of hide and seek. “How to Make the Most of Your Standby
elif [[ $2 != "ALL" && $2 != "all" && $2 != "All" ]]
$ORACLE_COMN/admin/scripts/adwlnctl.sh start
then Recovery Database,” by Mark Farnham
APPOPS=$1 As described at OAUG’s Fall 2000 conference,
ORASID=$2
clear “Upgrading to and Administering Release 11i:
print else Michael Barone and I have worked on a set of scripts we
print "#----------------------------------------------------#" print
print
"#------------------------------------------------------ #"
"# Error: You have tried an action that is not supported #"
A Technology Perspective,” by Kent Noble
print "# 11icmd: Meritor Oracle Application Control #"
print "#----------------------------------------------------#" print "# Try start or stop. You tried: $APPOPS #" call “APPS-Automagic.” These scripts simplify the com-
print print "#------------------------------------------------------ #"
#-------------------------------------------------------------------------# The Spring 2001 Conference will also feature many
# SHELL: Variables # fi mon tasks of automated database startup, shutdown, data-
#-------------------------------------------------------------------------# elif
then
[[ $2 == "ALL" || $2 == "all" || $2 == "All" ]] papers on database administration. Attend the con-
typeset -L25 PORTTB=/var/opt/oracle/porttab_v11i
APPOPS=$1 base refreshes, and database copies.
typeset -L44 RETVAL=/emc01/app/oracle/scripts/parse_porttab.sh
for SID in $( grep -v "#" /var/opt/oracle/porttab_v11i | cut -c3-10 ) ference, or visit the paper database two weeks prior
do
#
APPOPS=$( print
ORASID=$( print
$APPOPS | tr [A-Z]
$ORASID | tr [A-Z]
[a-z]
[a-z]
) # translate to lowercase
) # translate to lowercase ORASID=$SID For a small company, these tasks may be miniscule, to the conference to review these new papers.
LOWER_ORASID=$( print $ORASID | tr [A-Z] [a-z] ) #translate to lowercase if [[ $(grep -v "#" /var/opt/oracle/oratab_v11i | grep $ORASID |
UPPER_ORASID=$( print $ORASID | tr [a-z] [A-Z] ) # translate to Upper cut -d:
-f3) == "Y" ]]
but at my company – a $7 billion company with signifi-
then
export ORASID
export LOWER_ORASID $DIRNAM/11icmd $APPOPS $ORASID cant affect on the global automotive market – it’s a serious OAUG Listservers
export UPPER_ORASID fi
done
#-------------------------------------------------------------------------# topic. With seven European plants on Release 10.7 (with OAUGnet and OAUGnet-DBA provide an open forum
# Set Environment # else
#-------------------------------------------------------------------------# clear
print a future upgrade required) and the upcoming eighteen- for discussions of Oracle Applications, including
print "#------------------------------------------------------ #"
export UPPER_ORASID
print "# Error!! Please provide start/stop and sid/all #" database administration. Post your question here, or
. /opt/bin/appsel $ORASID
. $DIRNAM/../profile/${LOWER_ORASID}_profile.v11i print "# You provided: action: $1 sid: $2 #" plant North American implementation, the success of the
print "#------------------------------------------------------ #" visit the archives for past discussions. See page 90
print
#-------------------------------------------------------------------------#
# Fork for stop or start # fi Oracle Applications here rides on leveraging such ideas and for subscription instructions.
#-------------------------------------------------------------------------#
processes.
if [[ $APPOPS == "stop" ]]
then porttab_v11i
# Stop the Webdb listener and process We will investigate two of the simpler, yet no less OAUG Emporium
$ORACLE_COMN/admin/scripts/adwdbctl.sh stop #!/bin/ksh
$ORACLE_COMN/admin/scripts/adwlnctl.sh stop #-------------------------------------------------------------------------- #
# Oracle Applicstions 11i List of Environment port numbers. # valuable parts: 11icmd and 11icheck. 11icmd is the script The OAUG Emporium is your one-stop resource for
# Stop the TCF process #-------------------------------------------------------------------------- #
# Note: Port conflicts are not checked/verified. The DBA must manually #
$ORACLE_COMN/admin/scripts/adtcfctl.sh stop
# check/verify the ports and manually prevent port-conflicts. # that allows the DBA to start/stop instances with one com- books on all aspects of Oracle Applications, includ-
# Stop the Reports Server process #-------------------------------------------------------------------------- #
# ing a wide range of books on database administra-
$ORACLE_COMN/admin/scripts/adrepctl.sh stop
# - - - - - - - - - - - - - - Ports - - - - - - - - - - - - - - - # mand. For example: oracle$> 11icmd start VIS will start
# Stop the Forms Server process # SID RPC Web Frm60 Rpt60 Apche Apche TCF Metrx Metrx Web2.5
# ENV-Name Net8 Net8 Port Port Port Port Svlet Port Data Reqs Port
# tion. OAUG members receive discounted prices on
$ORACLE_COMN/admin/scripts/adfroctl.sh stop
# -------- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- all of the required processes, with the correct port numbers
# Stop the Forms Metric Server/Client processes VIS 5021 5022 1000 1100 1200 1300 1400 1500 1600 1700 1800 all books. You can also order OAUG Conference
$ORACLE_COMN/admin/scripts/adfmsctl.sh stop TEST
PROD
5121 5122 1010 1110 1210 1310 1410 1510 1610 1710 1810
5621 5622 1060 1160 1260 1360 1460 1560 1660 1760 1860
which are read from the porttab_v11i reference file. Proceedings CDs and OAUG logo items from the
$ORACLE_COMN/admin/scripts/adfmcctl.sh stop

# Stop the concurrent manager 11icheck is the script that quickly surveys the environment Emporium. Visit the OAUG Emporium at
# Get password
www.oaugemporium.com
continued on page 46
Figure 1

44 w w w. o a u g . o r g w w w. o a u g . o r g 45
• •
F E A T U R E

usaerptest Apps-11i Survey #-------------------------------------------------------------------# typeset -L3 MXDSVR="Yes"


#- Initialize LOOP Variables -# else
A p p l i c a t i o n D a t a b a s e #-------------------------------------------------------------------# typeset -L3 MXDSVR="No "
S e r v e r S e r v e r typeset -L18 APPSID=$(print "^[[7m${ORASID}^[[0m") fi
Frm Frm Metric 8i App 8i App CS WF #-------------------------------------------------------------------#
Apps Web F60 Rpt TCF Server DB DB App Cnc CTX Mail #-------------------------------------------------------------------#
# SHELL: Variables # #- Running Processes for Matrix-Requests -#
SIDs Svr Svr Svr Svr Dat Req Lnr Lsr DB Mgr Svr Svr #-------------------------------------------------------------------#
-------- --- --- --- --- --- --- --- --- --- --- --- --- #-------------------------------------------------------------------#
typeset -L30 PRTFLE=/var/opt/oracle/porttab_v11i MXRIND=$(ps -efa | grep d2ls60 | grep -v grep | grep -c $MXRPORT)
VIS Yes Yes No Yes Yes Yes Yes Yes Yes Yes No No typeset PRTTMP=/tmp/dba_11i_check.row
TEST No No No No No No No No No No No No if [[ $MXRIND -gt 0 ]]
PROD No No No No No No No No No No No No #-------------------------------------------------------------------# then
# Create/Propagate Oracle Admin Environment # typeset -L3 MXRSVR="Yes"
#-------------------------------------------------------------------# else
if grep "${ORASID}" $PRTFLE > $PRTTMP typeset -L3 MXRSVR="No "
11icheck then
while read RECENVNAME RECENVPORT RECAPPPORT \
fi
RECFORMWEB RECF60PORT RECRPTPORT \ #-------------------------------------------------------------------#
#!/bin/ksh #- Running Processes for Database LSNRCTL (Listener) -#
#----------------------------------------------------------------------------# RECAPACHE RECAPCHLET RECTCFPORT \
RECMXDPORT RECMXRPORT RECWEBDB #-------------------------------------------------------------------#
# # LSNIND=$(ps -efa | grep -i "tnslsnr $ORASID" | grep -v grep \
# Module Name: 11icheck # do
ENVNAME=$RECENVNAME | grep -c $ORASID)
# # if [[ $LSNIND -gt 0 ]]
# Purpose: Report on the NCA Environment Oracle Applications 11i: # ENVPORT=$RECENVPORT
APPPORT=$RECAPPPORT then
# Database, Database-Listener Apps-Listener, ConcManager, # typeset -L3 LSNDBA="Yes"
# FormsWeb-Listener, Forms60-Listener, Reports-Listener, # FORMWEB=$RECFORMWEB
F60PORT=$RECF60PORT else
# TCF-Listener, Metric-Data-Listener, Metric-Req-Listener, # typeset -L3 LSNDBA="No "
# and WebDatabase-Listener. # RPTPORT=$RECRPTPORT
APACHE=$RECAPACHE fi
# #
# [Option] # APCHLET=$RECAPCHLET #-------------------------------------------------------------------#
# Example: Shell Name Instance # TCFPORT=$RECTCFPORT #- Running Processes for Apps LSNRCTL (Listener) -#
# -------------------- -------- # MXDPORT=$RECMXDPORT #-------------------------------------------------------------------#
# dba_11i_check.sh PR01 # MXRPORT=$RECMXRPORT LSNIND=$(ps -efa | grep -i "tnslsnr APPS_${ORASID}" | grep -v grep \
# # WEBDB=$RECWEBDB | grep -c $ORASID)
# Maintenance # export ENVNAME ENVPORT APPPORT FORMWEB if [[ $LSNIND -gt 0 ]]
# Date Author Description # then
#
#
-----------
20-Feb-2000
------------ -------------------------------------------#
M.Barone Module design/creation #
Perhaps you have application export F60PORT
export TCFPORT
done < $PRTTMP
RPTPORT
MATRXDT
APACHE
MATRXRQ
APCHLET
WEBDB
else
typeset -L3 LSNAPP="Yes"

# # else typeset -L3 LSNAPP="No "


#----------------------------------------------------------------------------#
#----------------------------------------------------------------------------#
DBAs sitting around without ENVNAME=
ENVPORT=
fi
#-------------------------------------------------------------------#
# TEST: Number ($#) of arguments passed to this Shell on the command-line? # APPPORT= #- Running Processes for Oracle Instance -#
FORMWEB= #-------------------------------------------------------------------#
#----------------------------------------------------------------------------#
if
then
[ $# = 1 ] work to do, but chances are, F60PORT=
RPTPORT=
ORAIND=$(ps -efa | grep -v grep | grep -c ora_pmon_${ORASID})
APACHE= if [[ $ORAIND -gt 0 ]]
ORANAM=$1 then
else
ORANAM="ALL" with tight budgets, APCHLET=
TCFPORT=
MATRXDT= else
typeset -L3 ORASVR="Yes"
fi typeset -L3 ORASVR="No "
MATRXRQ=
clear
#----------------------------------------------------------------------------#
you’ve got to make a staff of ten fi
WEBDB= fi
#-------------------------------------------------------------------#
# Optional Input Arguments # #-------------------------------------------------------------------# #- Running Processes: Concurrent Manager -#
#----------------------------------------------------------------------------#
#-------------------------------------------------------------------# do the work of forty. #- Running Processes for FORMWEB Server -#
#-------------------------------------------------------------------#
FRMIND=$(ps -efa | grep -v grep | grep -c "port=$F60PORT")
#-------------------------------------------------------------------#
if [[ $ORASVR = "Yes" ]]
then
# CASE: SID Options #
#-------------------------------------------------------------------# ORASIDLOWER=$(print $ORASID | \
if [[ $FRMIND -gt 0 ]] sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
case ${ORANAM} in then
ALL|All|all|A|a) typeset -L3 FRMWEB="Yes"
#---------------------------------------------------------- # APPIND=$(ps -efa | grep "CPMGR" | grep -v "grep" | \
else grep -c ${ORASIDLOWER}comn)
# Input Argument is Blank or ALL or All or all # typeset -L3 FRMWEB="No "
#---------------------------------------------------------- # fi if [[ $APPIND -gt 0 ]]
while read ETCSID
do to give the DBA a reference to which processes are, and #-------------------------------------------------------------------# then
typeset -L3 APPMGR="Yes"
HLDSID=$(print $ETCSID | \ #- Running Processes for F45SVRVM -#
#-------------------------------------------------------------------# else
grep -v '#'
cut -f1 -d' ')
| \ which processes are not, running. (See Figures 1 & 2). F60IND=$(ps -efa | grep -v grep | grep -i f60srvm | \ typeset -L3 APPMGR="No "
grep -c "port=$F60PORT") fi
ORALST="$ORALST $HLDSID" else
Also, a modified version of appsel is utilized with the if [[ $F60IND -gt 0 ]] typeset -L3 APPMGR="No "
done < /var/opt/oracle/porttab_v11i then fi
continue typeset -L3 F60SVR="Yes"
;; 11icmd script, allowing for instance availability to be noted else #-------------------------------------------------------------------#
#- Running Processes for Oracle Context Server -#
typeset -L3 F60SVR="No "
*) fi #------------------------------------------------------------------ #
ORALST=$ORANAM as well as auto-selection when being executed from a script. CTXIND=$(ps -efa | grep -v grep | grep -i ctx | grep -c ${ORASID})
continue #------------------------------------------------------------------ # if [[ $CTXIND -gt 0 ]]
;; #- Running Processes for Report Server -# then
esac It has been omitted due to space constraints, but you can #------------------------------------------------------------------ # typeset -L3 ORACTX="Yes"
RPTIND=$(ps -efa | grep "rwmts60" | grep -v grep | \ else
#----------------------------------------------------------------------------# grep -c REP60_${ORASID}) typeset -L3 ORACTX="No "
# Initialize Report Variables find a copy in the white paper referenced in the sidebar. fi
# if [[ $RPTIND -gt 0 ]]
#----------------------------------------------------------------------------# then #-------------------------------------------------------------------#
typeset -L UNAME=$(uname -n) The 11icheck command can be executed to show the typeset -L3 RPTSVR="Yes" #- Running Processes for WorkFlow Notification Mail Server -#
else #-------------------------------------------------------------------#
#----------------------------------------------------------------------------# typeset -L3 RPTSVR="No " WFMIND=$(ps -efa | grep -v grep | grep WFMAIL | grep -c ${ORASID})
#- Initializing # status of the entire environment. For example, fi
if [[ $WFMIND -gt 0 ]]
#----------------------------------------------------------------------------#
print #-------------------------------------------------------------------# then
print " ^[[7m $UNAME Apps-11i Survey ^[[0m" oracle$> 11icheck will then return. (See Figures 3 & 4). #- Running Processes for (TCF) Thin Client Framework -# typeset -L3 WFMAIL="Yes"
print #------------------------------------------------------------------ # else
print " A p p l i c a t i o n D a t a b a s e" TCFIND=$(ps -efa | grep jre | grep -v grep | grep -ic $ORASID) typeset -L3 WFMAIL="No "
print " S e r v e r S e r v e r" These are a few examples of how well-written scripts if [[ $TCFIND -gt 0 ]]
fi
print " Frm Frm Metric 8i App 8i App CS WF" then #----------------------------------------------------------------------- #
print " Apps
print " SIDs
Web F60 Rpt TCF Server
Svr Svr Svr Svr Dat Req
DB DB App Cnc CTX Mail"
Lnr Lsr DB Mgr Svr Svr"
can make the DBAs life easier, and his time more produc- typeset -L3 TCFSVR="Yes" #- Print Detail Line
#----------------------------------------------------------------------- #
-#
else
print " -------- --- --- --- --- --- --- --- --- --- --- --- ---" typeset -L3 TCFSVR="No " print \
#----------------------------------------------------------------------- #
#- LOOP -#
tive. These scripts are obviously considered as open-source. fi " $APPSID $FRMWEB $F60SVR $RPTSVR $TCFSVR $MXDSVR $MXRSVR $WEBDBA $LSNDBA $L
SNAPP $ORASVR $APPMGR $ORACTX $WFMAIL"
#----------------------------------------------------------------------- # #------------------------------------------------------------------ #
for ORASID in $(print $ORALST) Please enhance/customize these to fit your environment. #- Running Processes for Matrix-Data -#
#------------------------------------------------------------------ #
done
do #----------------------------------------------------------------------- #
MXDIND=$(ps -efa | grep "d2lc60" | grep -v grep | grep -c $MXDPORT) #- Print Blank Line -#
Afterwards, please email the enhancements back to us, as if [[ $MXDIND -gt 0 ]] #----------------------------------------------------------------------- #
script continued in Figure 4 then print
we like to make our lives easier, too. ●
Figure 3 Figure 4

46 w w w. o a u g . o r g w w w. o a u g . o r g 47
• •

Das könnte Ihnen auch gefallen