 |
|
Setting up the Monitoring
Environment
Oracle Application Server Tips by Burleson
Consulting |
Because the bulk of Oracle9iAS systems run
in a UNIX environment, this section will focus on establishing a
server monitoring environment in UNIX. We will begin by learning how
to establish a standard Oracle9iAS server environment and then look
at capturing Oracle9iAS server performance data.
Establishing a Standard Oracle UNIX User
Environment
Because an Oracle9iAS enterprise may consist
of dozens of servers, it is important to the Oracle9iAS
administrator to establish a common environment for the oracle user
on each server. The oracle user is the owner of all of the
Oracle9iAS software and has full privileges to all Oracle9iAS
command-line utilities. When each server has a common prompt, common
aliases and common shell and editing settings, the management of
Oracle9iAS is greatly simplified.
In UNIX, the environment is established by
the login file. The /etc/passwd file contains the location of
the login file and the default shell for the user. The default
location for the login file is the default directory for the oracle
user. The name of the login file depends upon the shell
specified in the /etc/passwd file. If the default shell is
Korn Shell (ksh) them the login file is called .profile. If
you specify the C shell (csh), then your login file is called .cshrc.
The columns in /etc./passwd are separated
with a colon (:) and include:
-
User name - In our case we are
interested in the oracle user
-
Password ? This is an encrypted
value, and is often stored in a shadow file in /etc/shadow
-
User number ? This is a distinct
number for each UNIX user
-
User group ? The oracle user is
kept in the dba group
-
Name ? This is the name of the user
-
Home directory ? This is the home
directory for the Oracle user, and you will be placed into this
directory at login time
-
Default shell ? This is the shell
that will determine the name of your login file
Here is a sample /etc/passwd file.
root> cat
/etc/passwd|grep oracle
oracle:KChstVXg:110:20:Oracle9ias software
owner:/u01/app/oracle:/bin/ksh
Here we see that the oracle user is user ID
110, and that the dba group is group 20. The home directory is
/u01/app/oracle and the shell is Korn Shell (ksh), indicating that
the login file is /u01/app/oracle/.profile. Now that we know the
name of the login file, let?s examine a standard login file for the
oracle user.
A standard login file for Oracle users
Here is a good sample login file for Korn
shell Oracle9iAS systems. Note that this login file sets all
of the PATH and ORACLE_HOME locations, sets default editor and
display values, and sets handy alias names.
.profile.ksh
#!/bin/ksh
#***********************************************************
# DO NOT customize this .profile script.
# The directive below will allow to you add customizations
# to the .kshrc file. All host-specific profile
customizations
# should be placed in the .kshrc file.
#***********************************************************
umask 022
DBABRV=ora;
export DBABRV
ORACLE_TERM=vt100; export ORACLE_TERM
TERM=vt100; export TERM
wout=`who
am i`
#DISPLAY=`expr
"$wout" : ".*(\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\))"`
DISPLAY="${DISPLAY}:0"; export DISPLAY
ORAENV_ASK=NO;
export ORAENV_ASK
export
EDITOR=vi
NLS_LANG='english_united
kingdom.we8iso8859p1'; export NLS_LANG
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data; export ORA_NLS33
JAVA_HOME=/usr/local/jre;
export JAVA_HOME
ORACLE_HOME=/u01/app/oracle/product/9.2.0; export ORACLE_HOME
PATH=.:$PATH:.;$ORACLE_HOME/dcm/bin/:$ORACLE_HOME/j2ee/home/:$ORACLE_HOME/ldap/bin/
:$ORACLE_HOME/ldap/odi/admin/:$ORACLE_HOME/oca/bin/:$ORACLE_HOME/opmn/bin/:$ORACLE_HOME/
portal/admin/plsql/sso/:$ORACLE_HOME/sso/lib/:$ORACLE_HOME/uddi/lib/:$ORACLE_HOME/
upgrade/:$ORACLE_HOME/wireless/bin/
#*****************************************************************
# Keyboard
#*****************************************************************
stty erase ^?
set -o vi
#*****************************************************************
# Standard UNIX Prompt
#*****************************************************************
ORACLE_SID=iasdb; export ORACLE_SID
PS1="
`hostname`*\${ORACLE_SID}-\${PWD}
>"
export PS1
#*****************************************************************
# Aliases
#*****************************************************************
# Oracle
database aliases
alias alert='tail -100 $DBA/$ORACLE_SID/bdump/alert_$ORACLE_SID.log|more'
alias arch='cd $DBA/$ORACLE_SID/arch'
alias bdump='cd $DBA/$ORACLE_SID/bdump'
alias cdump='cd $DBA/$ORACLE_SID/cdump'
alias pfile='cd $DBA/$ORACLE_SID/pfile'
alias udump='cd $DBA/$ORACLE_SID/udump'
alias rm='rm -i'
alias sid='env|grep -i sid'
alias admin='cd $DBA/admin'
alias logbook='/u01/app/oracle/admin/$ORACLE_SID/logbook'
# Oracle9iAS aliases
alias dcmlib=?$ORACLE_HOME/dcm/bin/?
alias j2eelib=?$ORACLE_HOME/j2ee/home/?
alias ldaplib=?$ORACLE_HOME/ldap/bin/?
alias odilib=?$ORACLE_HOME/ldap/odi/admin/?
alias ocalib=?$ORACLE_HOME/oca/bin/?
alias opmnlib=?$ORACLE_HOME/opmn/bin/?
alias ssolib=?$ORACLE_HOME/portal/admin/plsql/sso/:$ORACLE_HOME/sso/lib/?
alias uddilib=?$ORACLE_HOME/uddi/lib/?
alias upgradelib=?$ORACLE_HOME/upgrade/?
alias wirelesslib=?$ORACLE_HOME/wireless/bin/?
Note that the UNIX PS1 variable determines
the UNIX prompt. Let?s take a closer look.
Create a uniform UNIX prompt
Placing the following code snippet in your
oracle user login file will give you a standard UNIX prompt that
identifies your current server name, the database name you?re
environment is set for (i.e. the value of your $ORACLE_SID UNIX
variable), and your current working directory. This standard prompt
makes it very easy to know where you are when navigating UNIX, and
it also ensures that you know where you are located at all times.
unix_prompt.ksh
#*****************************************************************
# Standard UNIX Prompt
#*****************************************************************
PS1="
`hostname`*\${ORACLE_SID}-\${PWD}
>"
This standardized Oracle UNIX prompt has the
advantage of displaying the server name, the ORACLE_SID and the
current directory. The best feature of the standard command
prompt is that it also places the command prompt on the next line so
you can have a full 80 characters to type UNIX commands:
cheops*CCPRO-/home/oracle
>pwd
/home/oracle
cheops*CCPRO-/home/oracle
>cd /u01/oradata/CPRO
cheops*CCPRO-/u01/oaradata/CPRO
>
This is an excerpt from "Oracle
10g Application Server Administration Handbook" by Don Burleson
and John Garmany.