Sie sind auf Seite 1von 81

Linux Recipes for DBAs

Charles Kim
HSYS, Inc.

The following is intended to outline our


general product direction. It is intended for
information purposes only, and may not be
incorporated into any contract. It is not a
commitment to deliver any material, code, or
functionality, and should not be relied upon
in making purchasing decisions.
The development, release, and timing of any
features or functionality described for
Oracles products remains at the sole
discretion of Oracle.
2

Linux Recipes for Oracle


DBAs
Charles Kim
Blog: http://dbaexpert.com/blog
Web: http://hsyscorp.com
E-Mail: linuxdba@gmail.com

Oracle Maximum Availability Architecture (MAA)

Real Application
Clusters

Flashback
RMAN & Oracle
Secure Backup
ASM
Data Guard
Streams

Audience Poll
Get a show of hands of people running RH 4 or
5, OEL 4 or 5, SUSE or OTHER?
Get a show hands of people running RAC on
Linux?
Show of people running 10g, 11g R1, 11g R2
Show of hands of who are running VM for
databases VMWARE? OVM?
RAC on VM?
Show of hands who are DBAs? SAs?
Developers?
Show of hands who are running VM on laptops
or personal desktops?
6

Presentations at OOW
ID#: S315642
IOUG User Forum Session
Title: Linux Recipes for DBAs
Track: Database and Linux
Date: 19-SEP-10 (SUNDAY)
Time: 12:30 - 13:30
Venue: Moscone West L2
Room: Rm 2006

IOUG User Form Session


Title: Oracle Technology on
Linux Customer Panel
Track: Linux
Date: 19-SEP-10 (SUNDAY)
Time: 13:30 - 14:30
Venue: Moscone West L2
Room: Rm 2006

ID#: S315627
Title: Build and Maintain Oracle
Data Guard with DG Menu
Track: Database
Date: 23-SEP-10 (THURSDAY)
Time: 13:30 - 14:30
Venue: Moscone South
Room: Rm 200

Agenda
* Introduction to OEL and Red Hat
File and Directory Management
Package Management
RPM Requirements
Automated Startup
Oracle Installation and Configuration
WebLogic and Grid Control 11g Installation and
Configuration
Mass Agent Deployment
OS Watcher
8

Where can we download Linux?


OEL:
http://edelivery.oracle.com/linux
30 day evaluation from Red Hat:
https://www.redhat.com/rhel/details/eval/
Oracle Database on Unix AIX,HP-UX,Linux,Mac OS X,Solaris,Tru64
Unix Operating Systems Installation and Configuration
Requirements Quick Reference (8.0.5 to 11.2) [ID 169706.1]
Benefits of OEL?
Oracle validated install
Single Vendor (no one to point blame to)
Comprehensive Support
9

What version are we interested in?


$ cat /proc/version
Linux version 2.6.18-194.3.1.el5 (mockbuild@x86-004.build.bos.redhat.com)
(gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Sun May 2 04:17:42
EDT 2010
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
$ uname -r
2.6.18-194.3.1.el5
$ uname -a
Linux jin1.dbaexpert.com 2.6.18-194.3.1.el5 #1 SMP Sun May 2 04:17:42 EDT
2010 x86_64 x86_64 x86_64 GNU/Linux

http://DBAExpert.com

10

How do we update after the installation?

Unbreakable Linux Network


(ULN)

oracle-validated install
up2date
yum
rpm

Red Hat Network (RHN)

up2date
yum
rpm

What is Yum (Yellowdog


Updater Modified)? How
do you setup a Yum
Server?

http://www.dbaexpert.com/
blog/2009/09/public-yumwith-oracle/
11

Oracle Validated Install


up2date --install oracle-validated
Fetching Obsoletes list for channel: el4_i386_addons...
Fetching Obsoletes list for channel: el4_i386_oracle...
Fetching Obsoletes list for channel: el4_i386_latest...
Fetching rpm headers...
########################################
Name
Version
Rel
---------------------------------------------------------oracle-validated
1.0.0
3.el4
i386
Testing package set / solving RPM inter-dependencies...
########################################
oracle-validated-1.0.0-3.el ########################## Done.
elfutils-libelf-devel-0.97. ########################## Done.
gcc-3.4.6-3.1.0.1.i386.rpm: ########################## Done.
gcc-c++-3.4.6-3.1.0.1.i386. ########################## Done.
glibc-devel-2.3.4-2.25.i386 ########################## Done.
glibc-headers-2.3.4-2.25.i3 ########################## Done.
glibc-kernheaders-2.4-9.1.9 ########################## Done.
libstdc++-devel-3.4.6-3.1.0 ########################## Done.
sysstat-5.0.5-11.rhel4.i386 ########################## Done.

12

master.ksh - Master Setup Script


Download from http://dbaexpert.com/linux/linux_setup.zip
Contents of linux_setup.zip file:
[root@rac55san ~]# zip linux_setup.zip *.ksh
adding: master.ksh (deflated 28%)
adding: set_hangcheck.ksh (deflated 49%)
adding: set_kernel.ksh (deflated 60%)
adding: set_login.ksh (deflated 42%)
adding: set_security_limits.ksh (deflated 57%)
adding: useradd.ksh (deflated 48%)
Master Driver Script
# cat master.ksh
ksh set_security_limits.ksh
ksh useradd.ksh
ksh set_login.ksh
ksh set_kernel.ksh
# -- Please uncomment for RAC implementations
# ksh set_hangcheck.ksh
13

[root@rac55san ~]# cat set_security_limits.ksh


export SECURITY_LIMITS_FILE=/etc/security/limits.conf
RC=$(grep -i oracle ${SECURITY_LIMITS_FILE} |wc -l)
if [ "$RC" -eq 0 ]; then
echo "Security limits are not set."
echo "Setting security limits ..."
# -- Making copy of /etc/security/limits.conf file to /tmp
cp ${SECURITY_LIMITS_FILE} /tmp/limits.conf.$$
cat << !! >> ${SECURITY_LIMITS_FILE}
# --Setting up limits.conf for Oracle Database 11g R2 installation
#
oracle
soft
nofile
131072
oracle
hard
nofile
131072
oracle
soft
nproc
131072
oracle
hard
nproc
131072
oracle
soft
core
unlimited
oracle
hard
core
unlimited
oracle
soft
memlock
50000000
oracle
hard
memlock
50000000
!!
14
else

useradd.ksh
$ cat useradd.ksh
groupadd -g 500 oinstall
groupadd -g 501 dba
groupadd -g 502 asmadmin
mkdir -p /u01/app/oracle
mkdir -p /var/opt/oracle
useradd -u 500 -d /home/oracle -g oinstall -G dba,asmadmin -s /bin/bash oracle
chown oracle:dba /u01/app/oracle /var/opt/oracle
# passwd oracle
15

[root@rac55san ~]# cat set_login.ksh


export LOGIN_FILE=/etc/pam.d/login
RC=$(grep -i pam_limits ${LOGIN_FILE} |wc -l)
if [ "$RC" -eq 0 ]; then
echo "pam.d login settings are not set ... "
echo "Setting login parameters"
# -- Making copy of pam.d/login file to /tmp
cp ${LOGIN_FILE} /tmp/login.$$
cat << !! >> ${LOGIN_FILE}
# --Setting up pam.d login file for Oracle Database
installation
#
session required pam_limits.so
!!
else
echo "pam.d login parameters are already set."

16

[root@rac55san ~]# cat set_kernel.ksh


export KERNEL_FILE=/etc/sysctl.conf
RC=$(grep -i shmmax ${KERNEL_FILE} |wc -l)
if [ "$RC" -eq 0 ]; then
echo "Kernel parameter are not set ... "
echo "Setting Kernel parameters"
# -- Making copy of sysctl.conf to /tmp
cp ${KERNEL_FILE} /tmp/sysctl.conf.$$
cat << !! >> ${KERNEL_FILE}
# --Setting up Kernel Parameters for Oracle Database 11g R2
installation
#
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4398046511104
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 1073741824
# For 11g, recommended value for file-max is 6815744
fs.file-max = 6815744
# For 10g, uncomment 'fs.file-max 327679', comment other entries for
this parameter and re-run sysctl -p
# fs.file-max:327679
kernel.msgmni = 2878

17

set_hangcheck.ksh
[root@rac55san ~]# cat set_hangcheck.ksh
export MODPROBE_FILE=/etc/modprobe.conf
RC=$(grep -i hangcheck-timer ${MODPROBE_FILE} |wc -l)
if [ "$RC" -eq 0 ]; then
echo "Hangcheck-Timer settings are not set ... "
echo "Setting up hangcheck-timer in $MODPROBE_FILE"
# -- Making copy of /etc/modprobe.conf file to /tmp
cp ${MODPROBE_FILE} /tmp/modprobe.conf.$$
cat << !! >> ${MODPROBE_FILE}
# --Setting up hangcheck-timer for Oracle RAC Database
installation
#
options hangcheck-timer hangcheck_tick=1 hangcheck_margin=10
hangcheck_reboot=1
!!

18

Agenda - Package Management

# up2date --register

19

Managing Software with RPM


RPM Name

<name>-<version>-<release>.<architecture>.rpm

List contents
of rpm

rpm -qlp osw-service-0.0.1-1.noarch.rpm


/etc/init.d/osw
/etc/sysconfig/osw
/usr/share/doc/osw-service-0.0.1
/usr/share/doc/osw-service-0.0.1/AUTHORS
/usr/share/doc/osw-service-0.0.1/ChangeLog
/usr/share/doc/osw-service-0.0.1/NEWS
/usr/share/doc/osw-service-0.0.1/README

Example: unixODBC-2.2.11-7.1.i386.rpm
1. Version of the RPM is 2.2.11
2. Release of the RPM is 7.1
3. RPM architecture is 32-bit Intel IA32 (x86) CPU
AMD64/Intel em64t RPM will have the architecture
name x86_64.

Detailed RPM rpm qip PACKAGE_NAME


Information

20

Working With RPMs


RPM Install

$ rpm ihv PACKAGE_NAME


h = Print 50 hash marks as the
package archive is unpacked.

RPM Update

$ rpm uhv PACKAGE_NAME

RPM remove packages

$rpm e PACKAGE_NAME

Reverse RPM lookup from OS


commands

$ rpm -qf perl


perl-5.8.8-18.el5

Reverse RPM lookup from Shared


Objects

$ rpm -qf libc-2.5.so


glibc-2.5-34

RPM query

$ rpm -q osw-service libaio-devel

RPM query all

$ rpm -qa osw-service libaio-devel


$ rpm -qa |grep -ilibaio

21

Up2date to Manage Software


Install Software

up2date screen

Install 32-bit Software

up2date --arch=i386 glibc-devel

Download but do not


install

up2date d perl
Note:
-d or download

Download but do not


install but download to
alternate directory

up2date download screen tmpdir=/tmp

Switch from Red Hat


Network to Oracle
Unbreakable Linux
Network

https://linux.oracle.com/switch.html
rpm -Uhv
up2date-5.10.1-40.8.el5.i386.rpm \
up2date-gnome-5.10.1-40.8.el5.i386.rpm
rpm --import /usr/share/rhn/RPM-GPG-KEY
up2date --register

Register with ULN

http://DBAExpert.com

22

Query for 32bit vs. 64bit


Check for 32bit and 64bit
RPMs

# rpm -qa -queryformat %{NAME}-%


{VERSION}.%{RELEASE} (%{ARCH})\n \
| greplibaio
libaio-0.3.105.2 (i386)
libaio-0.3.105.2 (x86_64)

$ rpm -qa --qf "%{NAME}-%{VERSION}-%


{RELEASE}.%{ARCH}.rpm\n" | \
grepasm
oracleasm-support-2.0.3-1.x86_64.rpm
oracleasmlib-2.0.2-1.x86_64.rpm
oracleasm-2.6.9-78.0.1.ELsmp-2.0.3-1.x
86_64.rpm

http://DBAExpert.com

23

Agenda - RPM Requirements (and


Kernel Parameters)

24

Grid Control 11g RPM Requirements


Oracle Enterprise Manager Grid RPM Requirements for
Control 11g RPM
Agents on Red Hat 5
make-3.81
Requirements (OMS)

rng-utils-2
make-3.81
binutils-2.17.50.0.6
gcc-4.1.1
libaio-0.3.106
glibc-common-2.3.4-2.9
compat-libstdc++-296 -2.96-132.7.2
libstdc++-4.1.1
libstdc++-devel-4.11
setarch-1.6-1
sysstat-5.0.5-1
compat-db-4.1.25-9

binutils-2.17.50.0.6
gcc-4.1.1
libstdc++-4.1.1

25

EBusiness 12i RPM Requirements - Red Hat 5 or


OEL 5
http://oss.oracle.com/projects/compat-oracle/files/Enterprise_Linux/
openmotif21-2.1.30-11.EL5.i3861
xorg-x11-libs-compat-6.8.2-1.EL.33.0.1.i386
For Update 1 or 2: binutils-2.17.50.0.6-6.0.1.i3862
For Update 3: binutils-2.17.50.0.6-9.0.1.i3862
* compat-glibc-2.3.4-2.26
* gcc-4.1.2-14.el5
* gcc-c++-4.1.2-14.el5
* glibc-2.5-123
* glibc-common-2.5-123
* glibc-devel-2.5-12
* libgcc-4.1.2-14.el53
* libstdc++-devel-4.1.2-14.el5
* libstdc++-4.1.2-14.el53
* make-3.81-1.13
* gdbm-1.8.0-26.2.13 https://support.oracle.com/CSP/main/article?
cmd=show&type=NOT&doctype=BULLETIN&i
* libXp-1.0.0-8.1.el5
* libaio-0.3.106-3.23
d=761564.1
* libgomp-4.1.2-14.el5
* sysstat-7.0.0-3.el5
* compat-libstdc++-296-2.96-138
* compat-libstdc++-33-3.2.3-61
26

Oracle Database 11g RPM Requirements - EL5


32-bit
compat-libstdc+
+-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelfdevel-0.125-3.el5
glibc-2.5-12
glibc-devel-2.5-12
glibc-common-2.5-12
gcc-4.1.1-52.el5
gcc-c++-4.1.1-52.el5
kernel-headers
libgcc-4.1.1-52.el5
libaio-0.3.106-3.2
libaio-devel-0.3.106-3.2
libstdc++-4.1.1-52.el5
libstdc++devel-4.1.1-52.el5
unixODBC-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
sysstat-7.0.0-3.el5
binutils-2.17.50.0.6-2.el5
make-3.81-1.1

64-bit

binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.1
gcc-c++-4.1.1
glibc-2.5-12
glibc-2.5-12 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5-12 (32 bit)
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libgcc-4.1.1
libgcc-4.1.1 (32 bit)
libstdc++-4.1.1
libstdc++-4.1.1 (32 bit)
libstdc++-devel 4.1.1
make-3.81
sysstat-7.0.0
27

Oracle Database 11g Release 2


RPM Requirements - EL5 or Red Hat 5 64-bit

libaio-0.3.106
binutils-2.17.50.0.6
libaio-0.3.106 (32 bit)
compat-libstdc++-33-3.2.3 libaio-devel-0.3.106
compat-libstdc++-33-3.2.3 libaio-devel-0.3.106
(32 bit)
(32 bit)
elfutils-libelf-0.125
libgcc-4.1.2
elfutils-libelflibgcc-4.1.2 (32 bit)
devel-0.125
libstdc++-4.1.2
gcc-4.1.2
libstdc++-4.1.2
gcc-c++-4.1.2
libstdc++-devel
glibc-2.5-24
make-3.81
glibc-2.5-24 (32 bit)
sysstat-7.0.2
glibc-common-2.5
unixODBC-2.2.11
glibc-devel-2.5
unixODBC-2.2.11
glibc-devel-2.5 (32 bit) unixODBC-devel-2.2.11
glibc-headers-2.5
unixODBC-devel-2.2.11
28
ksh-20060214
(32 bit)

Kernel Parameters - /etc/sysctl.conf


# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
# SHMMAX / PAGE_SIZE
# Determine PAGE_SIZE: $ getconf PAGE_SIZE) Dynamically Load Kernel
# 4096

Parameters

fs.file-max = 6553600
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.ip_local_port_range = 9000 65500
net.core.wmem_max=1048576
http://DBAExpert.com

sysctl p
List Kernel Parameters
sysctl -a

29

OEL Validated Kernel Parameters - /etc/sysctl.conf


Including comments
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4398046511104
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 1073741824
# For 11g, recommended value for file-max is 6815744
fs.file-max = 6815744
# For 10g, uncomment 'fs.file-max 327679'# fs.file-max:327679
kernel.msgmni = 2878
kernel.sem = 250 32000 100 142
kernel.shmmni = 4096
net.core.rmem_default = 262144
# For 11g, recommended value for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# For 10g, uncomment 'net.core.rmem_max 2097152'
# net.core.rmem_max=2097152
net.core.wmem_default = 262144
# For 11g, recommended value for wmem_max is 1048576
net.core.wmem_max = 1048576
# For 10g, uncomment 'net.core.wmem_max 262144'# net.core.wmem_max:262144
fs.aio-max-nr = 3145728
# For 11g, recommended value for ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
http://DBAExpert.com
# For 10g, uncomment 'net.ipv4.ip_local_port_range 1024 65000'
# net.ipv4.ip_local_port_range:1024 65000

30

Agenda - Automated Startup

31

Auto-startup via chkconfig or rc.local


Auto Start
chkconfig --add dbora
chkconfig add appsora
Or
/etc/rc.d/rc.local
Another example to turn off iptables after next reboot:
chkconfig iptables off

32

Database Automatic Startup / Shutdown


#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
# Set ORA_HOME to be equivalent to the $ORACLE_HOME from which you wish to execute dbstart and dbshut;
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
export ORA_DB_HOME=/apps/oracle/product/10.2.0/DB
export SH=/var/opt/oracle/sh
ORA_OWNER=oracle
case "$1" in
'start')
# Start the Oracle databases:
#su - $ORA_OWNER -c "$SH/start_shutdown_asm.ksh start" > /tmp/start_asm.log 2>&1
su - $ORA_OWNER -c "$ORA_DB_HOME/bin/dbstart $ORA_DB_HOME" > /tmp/dbstart.log 2>&1
su - $ORA_OWNER -c "export ORAENV_ASK=NO; export ORACLE_SID=NEWDEV;. oraenv; lsnrctl start" > /tmp/
listener_start.log 2>&1
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_DB_HOME/bin/dbshut>/tmp/dbshut.log 2>&1
su - $ORA_OWNER -c "$SH/start_shutdown_asm.ksh stop" > /tmp/shutdown_asm.log 2>&1
;;
esac
33

Oracle Apps Startup / Shutdown Script


#!/bin/ksh
# Filename: appsctl
export MODE=$1
. $HOME/.profile.CRON
export APPS_PW=$(cat $SH/.apps_pw)
# -# Note:
# 1. CONTEXT_NAME=DB_NAME_$HOSTNAME
#
cd $COMMON_TOP/admin/scripts/${CONTEXT_NAME}
if [ "$MODE" = "start" ]; then
./adstrtal.sh ${APPS_PW}
elif [ "$MODE" = "stop" ]; then
./adstpall.sh ${APPS_PW}
else
echo "You passed an invalid argument"
exit 1;
fi
34

Chkconfig with Startup Script


#!/bin/ksh
# chkconfig: 345 99 10
# description: Oracle Apps auto start-stop script.
# Filename: appsora
export APPLMGR=applmgr
case $1 in
'start')
su - $APPLMGR -c "/home/${APPLMGR}/scripts/appsctl start"
;;
'stop')
su - $APPLMGR -c "/home/${APPLMGR}/scripts/appsctl stop"
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
# chkconfig --add appsora
#
# chkconfig --list |grep -iappsora
exit;

appsora
0:off
1:off
2:off
3:on
4:on
5:on
6:off

35

Agenda
1. Database Installation and Configuration
2. Weblogic and Grid Control Installation
and Patching
3. Mass Agent Deployment

36

VNCServer - Before we start installations


Launch VNC
with X Desktop
$HOME/.vnc/
xstartup

#!/bin/sh
# Uncomment the following two lines for normal
desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] &&xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP
Desktop" &
#twm&

Start VNC with


larger window

vncserver -geometry 1280x1024

Cleanly Kill VNC vncserver kill :1


To open a
vncserver on a
specific port

vncserver -geometry 1280x1024 :64

37

Installation Path for Oracle Database 11g


Release 1 - as of Sept 2010
11.1.0.6

11.1.0.7

11.1.0.7.4

CRS

CRS

CRS PSU

11.1.0.6

11.1.0.7

11.1.0.7.4

11.1.0.7.4

ASM

ASM

CRS PSU
to ASM

DB PSU to
ASM
11.1.0.7.4
Clone ASM
to DB

38

Apply Cluster Ready Services (CRS) Bundle Patch to CRS


cd /home/oracle/downloads/downloads/psu.4/9294495
As root:
/u01/app/crs/product/crs/bin/crsctl stop crs
custom/scripts/prerootpatch.sh -crshome /u01/app/crs/
product/crs -crsuser oracle
As oracle:
custom/scripts/prepatch.sh -crshome /u01/app/crs/product/crs
export PATH=$ORACLE_HOME/OPatch:$PATH
opatch napply -local -oh /u01/app/crs/product/crs -id
9294495
custom/scripts/postpatch.sh -crshome /u01/app/crs/product/
crs
As root:
custom/scripts/postrootpatch.sh -crshome /u01/app/crs/
product/crs

39

Apply Cluster Ready Services (CRS) Bundle Patch to ASM Home

1. export PATH=/u01/app/oracle/product/11.1.0/asm/
OPatch:$PATH
2. opatch lsinventory -detail -oh /u01/app/oracle/
product/11.1.0/asm |tee /tmp/
asm.before.crs.patch.txt
3. cd /export/home/oracle/downloads/downloads/
9294495
4. custom/server/9294495/custom/scripts/prepatch.sh
-dbhome /u01/app/oracle/product/11.1.0/asm
5. opatch napply custom/server/ -local -oh /u01/app/
oracle/product/11.1.0/asm -id 9294495
6. custom/server/9294495/custom/scripts/postpatch.sh
-dbhome /u01/app/oracle/product/11.1.0/asm
7. opatch lsinventory -detail -oh /u01/app/oracle/
product/11.1.0/asm |tee /tmp/
asm.after.crs.patch.txt

Note: Repeat on each node


40

Apply ASM Patch Set Update (PSU) 11.1.0.7.x


Make sure that your ORACLE_HOME environment
variable is set properly.
Also, make sure that your PATH has the latest
opatch executable
cd /export/home/oracle/downloads/9654987
opatch apply local
opatchlsinventory
Note: Repeat on each node

41

Installation Path for Oracle Database 11g


Release 2 (Without Patch Set 1)
Oracle 11g Release 2 Installation and Upgrade Path
Install 11.2.0.1 Grid Infrastructure
Apply PSU Patch 9655006 to GI Stack ==> 11.2.0.1.2 GI

# ./opatch auto /home/oracle/downloads/GI.PSU -oh /u01/app/grid/


product/grid

Install 11.2.0.1 Database


Apply GI PSU Patch 9655006 to Database software home
# opatch auto /home/oracle/downloads/GI.PSU -oh /u01/app/oracle/
product/11.2.0/db
Apply PSU Patch 9654983 to Database software home ==>

11.2.0.1.2 DB

42

Patch Set Updates for Oracle Products [ID 854428.1]

43

Recommended PSUs for 11.2


26-AUG-10 - Metalink Note: 756671.1

44

Recommended PSUs for 11.1


26-AUG-10 - Metalink Note: 756671.1

45

Installation Path for Oracle Database 11g


Release 2 Patch Set 1
11.2.0.1

11.2.0.2

DB

DB Inplace
upgrade
11.2.0.2
Fresh DB Installation

Does this change Oracle Home directory infrastructure?


/u01/app/oracle/product/11.2.0.1/db
/u01/app/oracle/product/11.2.0.2/db
46

Oracle Database 11.2 Patch Set 1

47

Oracle Database 11.2 Patch Set 1

48

Installation Path for Oracle Grid Control 11g - (64-bit)

Download and Install JDK 1.6 Update 18 from:

http://java.sun.com/products/archive/j2se/6u18/index.html
Per metalink note: 1063587.1 this is more stable
[oracle@gc11g jdk]$ chmod 700 *.bin
[oracle@gc11g jdk]$ ./jdk-6u18-linux-x64.bin
Sun Microsystems, Inc. Binary Code License Agreement
for the JAVA SE DEVELOPMENT KIT (JDK), VERSION 6

Download WebLogic using Jar File


http://www.oracle.com/technology/software/products/ias/htdocs/wls_main.html
Download the 10.2.3 Package Installer the 902MB file
Downloads a file called: wls1032_generic.jar
The jar file is only required for 64-bit installations.
/apps/oracle/product/jdk/jdk1.6.0_18/bin/java -d64 -jar wls1032_generic.jar
Extracting 0%....................................................................................................100%
49

WebLogic Installation

50

Patch WebLogic
Patch WebLogic to recommended level to WDJ7
Install PATCH WDJ7 with BEA Smart Update
/apps/oracle/product/MW/utils/bsu
./bsu.sh
After installation, confirm that patch is installed
/apps/oracle/product/MW/utils/bsu
[oracle@gc11g bsu]$ ./bsu.sh -report -patch_id_mask=WDJ7
Patch Report
============
Report Info
Report Options
bea_home.................. ### OPTION NOT SET
product_mask.............. ### OPTION NOT SET
release_mask.............. ### OPTION NOT SET
profile_mask.............. ### OPTION NOT SET
patch_id_mask............. WDJ7
Report Messages
BEA Home.................. /apps/oracle/product/MW
Product Description
Product Name.............. WebLogic Server
Product Version........... 10.3.2.0
51

WebLogic Smart Update

./bsu.sh -prod_dir=/apps/oracle/product/MW/wlserver_10.3 patchlist=WDJ7 -verbose -install

52

Installation Path for Oracle Grid Control 11g


Upgrade existing OMS backend database to 11g R2
or
Create OMS repository directory into 11g R2
Note:
GC no longer creates a database as part of the installation
oracle@gc11g software]$ ./runInstaller
Starting Oracle Universal Installer...

Install Grid Control 11g


[

Checking Temp space: must be greater than 150 MB.


Actual 3269 MB
Checking swap space: must be greater than 150 MB.
Actual 4094 MB
Checking monitor: must be configured to display at least 256 colors.
16777216
Passed
Preparing to launch Oracle Universal Installer from /tmp/
OraInstall2010-05-09_11-32-22PM. Please wait ...

Passed
Passed
Actual

53

Installation of Grid Control

54

Mass Deployment Agent Installation


/u01/app/oracle/MW/oms11g/sysman/agent_download/11.1.0.1.0/linux_x64
$scp agentDownload.linux_x64 oracle@rac01:$HOME/work
oracle@rac01's password:

$ cat agent_down.ksh
export AGENT_INSTALL_PASSWORD=ob1grid
./agentDownload.linux_x64 -b /u01/app/oracle/product m
grid.dbaexpert.com -r 4900 -y
..
Configuration assistant "Agent Add-on Plug-in" Succeeded
Querying Agent status: Agent is running
Removing the copied stuff.....
Removed: /home/oracle/work/agentDownload11.1.0.1.0Oui/
oui_linux_x64.jar
Removed: /home/oracle/work/agentDownload11.1.0.1.0Oui/
agent_download.rsp
Removed:/home/oracle/work/agentDownload11.1.0.1.0Oui/Disk1
Log name of installation can be found at: /u01/app/oracle/
product/agentDownload.linux_x64071110152826.log"
55

runInstaller With Record Option


runInstaller -record -destinationFile /tmp/crs.rsp
runInstaller -record -destinationFile /tmp/crs_up.rsp
runInstaller -record -destinationFile /tmp/asm.rsp
runInstaller -record -destinationFile /tmp/asm_up.rsp
Followed by
./runInstaller -silent -responseFile /tmp/crs.rsp
./runInstaller -silent -responseFile /tmp/asm.rsp
./runInstaller -silent -responseFile /tmp/crs_up.rsp
./runInstaller -silent -responseFile /tmp/asm_up.rsp

56

Components to modify in crs.rsp


> cat crs.rsp |egrep -i "clustername|cluster_node|
192.168|rac55|ocr|vote|oracle_home" |grep -v ^#
ORACLE_HOME="/apps/crs"
ORACLE_HOME_NAME="OraCrs11g_home"
REMOTE_NODES={"rac5502"}
ret_PrivIntrList={"eth0:10.1.204.0:1","ib0:192.168.0.0:2"}
n_storageTypeOCR=1
s_clustername="rac55_cluster"
sl_tableList={"rac5501:rac5501-ib0:rac5501vip:N:Y","rac5502:rac5502-ib0:rac5502-vip:N:Y"}
s_OcrVdskMirror1RetVal="/dev/oracle/VOTE02"
s_ocrpartitionlocation="/dev/oracle/OCR01"
s_ocrMirrorLocation="/dev/oracle/OCR02"
s_votingdisklocation="/dev/oracle/VOTE01"
s_VdskMirror2RetVal="/dev/oracle/VOTE03"
57

Components to modify in crs_up.rsp


> cat crs_up.rsp |egrep -i "oracle_base|
clustername|cluster_node|192.168|rac55|ocr|
vote|oracle_home" |grep -v ^#
ORACLE_HOME="/apps/crs"
ORACLE_BASE=<Value Unspecified>
ORACLE_HOME_NAME="OraCrs11g_home"
CLUSTER_NODES={"rac5501","rac5502"}

58

Components to modify in asm.rsp


> cat asm.rsp |egrep -i "oracle_base|
clustername|cluster_node|192.168|rac55|ocr|
vote|oracle_home" |grep -v ^#
ORACLE_HOME="/apps/oracle/product/11.1.0/asm"
ORACLE_BASE="/apps/oracle"
ORACLE_HOME_NAME="OraASM11g_home1"
CLUSTER_NODES={"rac5501","rac5502"}

59

Components to modify in asm_up.rsp


> cat asm_up.rsp |egrep -i "oracle_base|
clustername|cluster_node|192.168|rac55|ocr|
vote|oracle_home" |grep -v ^#
ORACLE_HOME="/apps/oracle/product/11.1.0/asm"
ORACLE_BASE="/apps/oracle"
ORACLE_HOME_NAME="OraASM11g_home1"
CLUSTER_NODES={"rac5501","rac5502"}

60

Additional RunInstaller Options


Installing older versions of Oracle runInstaller - ignoreSysPrereqs
Perform Silent Installation

Modify enterprise.rsp from CD

UNIX_GROUP_NAME
FROM_LOCATION ORACLE_BASE
ORACLE_HOME
ORACLE_HOME_NAME
n_configurationOption

UNIX_GROUP_NAME=oinstall
FROM_LOCATION="/apps/oracle/software/
database/stage/products.xml"
ORACLE_BASE=/apps/oracle
ORACLE_HOME=/apps/oracle/product/
11.1.0/DB
ORACLE_HOME_NAME=11gDBHome1
n_configurationOption=3
$ ./runInstaller -ignoreSysPrereqs -force silent responseFile /apps/oracle/software/
database/response/enterprise.rsp

Other Oracle Supplied Response


Files

custom.rsp emca.rsp netca.rsp dbca.rsp


standard.rsp
61

Create ASM Instance


cr_asm.txt
dbca -silent configureASM \
-asmSysPassword PW_FOR SYS \
-diskString "ORCL:*"
\
-diskList "ORCL:DATA01"
\
-diskGroupName DATADG
\
-redundancy EXTERNAL
\
-emConfiguration NO
\
-nodeinfo racnode1,racnode2

62

Clone Oracle Home ASM to DB Home


cd /u01/app/oracle/product/11.1.0
mkdir db
cd asm
tar cvf - * | ( cd /u01/app/oracle/product/11.1.0/db; tar xvfp - )
cd /u01/app/oracle/product/11.1.0/db/oui/bin
./runInstaller -clone -silent ORACLE_HOME="/u01/app/oracle/
product/11.1.0/db" ORACLE_BASE="/u01/app/oracle"
ORACLE_HOME_NAME="OraDB11g_home"
Starting Oracle Universal Installer...

(execute root.sh when complete)


Note:
If you encounter a jreOutOfMemory error, modify the oraparam.ini
file located in the $OH/oui directory. Change the parameter:
JRE_MEMORY_OPTIONS="-mx96m" to "mx512m"
63

dbca in silent mode using a custom seeded database


dbca -silent
-createDatabase
-templateName GoldenImage.dbc
-gdbName DBAREPO
-sid DBAREPO
-SysPassword PW_FOR SYS
-SystemPassword PW_FOR SYSTEM
-emConfiguration NONE
-redoLogFileSize 250
-recoveryAreaDestination fradg
-storageType ASM
-asmSysPassword PW_FOR SYS
-diskGroupName datadg
-characterSet AL32UTF8
-nationalCharacterSet AL16UTF16
-totalMemory 1400
-databaseType MULTIPURPOSE
-nodelist racnode1,racnode2

\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
64

dbca silent install output


Heres a sample output of executing dbca
in silent mode:
Copying database files
1% complete
3% complete
30% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
44% complete
45% complete
48% complete
50% complete
Creating cluster database views
52% complete
70% complete
Completing Database Creation
73% complete

Look at the log file:


"/u01/app/oracle/cfgtoollogs/dbca/
DBAREPO/DBAREPO.log"
for further details
65

Visit the IOUG Booth This Week


Located in the User Group Pavilion - Moscone West, 2nd Floor
Learn why over 23,000 have joined IOUG and what it can do
for you
Chat with the IOUG Board of Directors
Hear about new regional IOUG BI user communities
Find out how to submit an abstract for COLLABORATE 11
IOUG Forum
Enter for a chance to win a COLLABORATE 11 registration
Stock up on IOUG gear and educational materials!

66

Copyright Information
Neither DBAExpert.com nor the author guarantee this
document to be error-free. Please provide comments
and feedback to linuxdba@gmail.com
APress Copyright 2008. This document or any
portions of this document may not be reproduced
without the expressed written consent from APress
Senior Editors or authors of the Linux for DBAs book.
Contact Information:
Charles Kim linuxdba@gmail.com

67

Agenda - File and Directory Management

68

Common Unix Directories for Oracle (11.2)


/
/u01

app

/bin
/dev
/etc
/home

* diag
oracle product 11.2.0
admin
cfgtoollogs

db

oracleasm

oracle / init.d

oracle

.oracle
.ssh

/usr

local

bin

/var

opt

oracle

/var

log

/u01

app

/lib

logs

/proc
/tmp

grid

product

grid

69

Diagnostic Destination Dirs 11.1 +


/
/u01

asm

app

clients

crs

diag

rdbms lsnrctl

netcman

ofm

diagtool

tnslsnr

db_name

$hostname

INSTANCE_NAME1

listener_$hostname

+asm
+ASM1

oracle

trace

trace

trace

alert

log.xml

core_dump_dest
background_dump_dest

$ORACLE_BASE/diag/db_name/$INSTANCE_NAME/
cdump
$ORACLE_BASE/diag/db_name/$INSTANCE_NAME/trace

user_dump_dest

ORACLE_BASE/diag/db_name/$INSTANCE_NAME/trace
70

Function trace (Help transition to 11g)


function trace {
# DB = The sed command strips off the last character of ORACLE_SID
off
export DB1=$ORACLE_SID
export DB=$(echo $ORACLE_SID|tr '[A-Z]' '[a-z]' |sed -e '$s/.$//')
export DBLOWER=$(echo $ORACLE_SID|tr '[A-Z]' '[a-z]')
export ASMDB=rdbms
if [ -d "$ORACLE_BASE/diag/$ASMDB/$DB/$ORACLE_SID/trace" ]; then
cd $ORACLE_BASE/diag/$ASMDB/$DB/$ORACLE_SID/trace; fi
if [ -d "$ORACLE_BASE/diag/$ASMDB/$DB1/$ORACLE_SID/trace" ]; then
cd $ORACLE_BASE/diag/$ASMDB/$DB1/$ORACLE_SID/trace; fi
if [ -d "$ORACLE_BASE/diag/$ASMDB/$DBLOWER/$ORACLE_SID/trace" ];
then cd $ORACLE_BASE/diag/$ASMDB/$DBLOWER/$ORACLE_SID/trace; fi
}
Usage:
$ trace $ORACLE_SID

71

Find Tips That Will Save You Time


Removing files older than 14 Days

find . -type f -mtime +14 -exec rm


-f {} \;

Finding the top 5 largest files

find . -ls | sort -nrk 7 | head -5

Find files larger than 100MB

find . -size +100000k

Delete audit records thats older than find $ORACLE_HOME/rdbms/audit name "*.aud" -mtime +30 -exec rm
30 days
{} \;
Delete files in /tmp thats older than
30 days

find /tmp -group dba


mtime +5 -exec rm -f
find /tmp/dba -group
mtime +5 -exec rm -f

-type f {} \;
dba -type f {} \;

Delete *.trc files more than 5 days old. find $TRACE_DIR -name '*.trc' type f -mtime +5 -exec rm {} \;

72

More Commands to Locate Large Files


Display top 5 largest files in a
current directory

ls -alS | head -5

Largest space-consuming directories du -Sm . | sort -nr | head -5


(Does not include sub-directories)
report the sum of space consumed by du . | sort -nr | head -5
a directory and its subdirectories
export DB_SIZE=$(find . -newer $RMAN_BACKUP_MARKER_FILE -name '*.DB' |
xargs du -sk |awk '{SUM += $1} END {print SUM/1024}')
export ARCH_SIZE=$(find . -newer $RMAN_BACKUP_MARKER_FILE -name '*.A'
|xargs du -sk |awk '{SUM += $1} END {print SUM/1024}')
echo "DB Backup Size is: $DB_SIZE"
echo "Archive Backup Size is: $ARCH_SIZE

List files in a directory greater than


300M

ls -l | awk '{if ($5 >314572800)


print $0}' |sort +4

73

tar & scp One-Liners to remember


Tar and un-tar on the same
machine

cd /u01/app/oracle/product/11.1.0/
asm
tar cvf - * | ( cd /u01/app/oracle/
product/11.1.0/db; tar xvfp - )

Make a clone of ASM Oracle


Home to DB Oracle Home
Tar and un-tar to a remote server tar cvf - DIR_NAME |ssh REMOTE_HOST
cd DIR_NAME; tar xvf
Push the ASM Home Directory
from Server#1 to the DB Home
on Server #2
tar cvzf orahome.tar /u01/app/
Create compressed tarfile
oracle/product/11.2/db
Or for non GNU tar:
tar -cvf - /u01/app/oracle/product/
11.2/db | gzip>orahome.tar.gz
scp pull of the dgmenu directory scp -rp oracle@rac5501:/home/oracle/
work/dgmenu .
scp push the dgmenu directory scp -rp dgmenu oracle@rac5502:/home/
oracle/work
74

Rotate Listener Logs with Oracle CLI


Rotate Listener Logs in Oracle Database 11g
#!/bin/ksh
export LISTENER_NAME=$1
. $HOME/.profile.CRON
export DATETIME=$(date

+%y%m%d-%H%M)

cd $ORACLE_BASE/diag/tnslsnr/`hostname`/${LISTENER_NAME}/
trace
lsnrctl << EOF
set current_listener ${LISTENER_NAME}
set log_status off
mv ${LISTENER_NAME}.log ${LISTENER_NAME}.${DATETIME}.log
set log_status on
EOF

75

Rotate Listener Logs with Linux logrotate


Other use cases:
1. Apache httpd.log, access_log, error_log
2. JVM logs, etc.
#!/bin/ksh
/usr/sbin/logrotate -f -s /apps/oracle/general/config/
listener_HOSTNAME.status /apps/oracle/general/config/
listener_HOSTNAME.conf
This logrotate config file looks like this:
LISTENER_HOSTNAME.conf
{
weekly
copytruncate
rotate 4
compress
mail charles@dbaexpert.com
}

76

Agenda

77

oswatcher
OS Watcher User Guide [ID 301137.1]
Manually Start OSWatcher
./startOSW.sh 60 720 &
Note:
1. collect statistics every 60 seconds
2. the 720 means to retain archive data for 30 days (24*30)
Add OSWatcher as part of the startup scripts in the /etc/rc.d/
rc.local file:
runuser oracle -c "/u01/app/oracle/UTIL/osw/startOSW.sh 60 720

http://DBAExpert.com

78

OSWatcher Service RPM Installation


How To Start OSWatcher Every System Boot [ID 580513.1]
-rw-r--r-- 1 oracle oinstall
service-0.0.1-1.noarch.rpm

4389 Jul 10 12:41 osw-

[root@jin1 oracle]# rpm -ihv osw-service-0.0.1-1.noarch.rpm


Preparing...
########################################### [100%]
1:osw-service
########################################### [100%]
[root@jin1 ~]# service osw status
OSWatcher is not running.
# chkconfig osw on
# service osw start
http://DBAExpert.com

79

OSW Configuration
Modify /etc/sysconfig/osw configuration file:
[root@jin1 ~]# vi/etc/sysconfig/osw
# Set OSWHOME to the directory where your
OSWatcher tools are installed
#OSWHOME=/opt/osw-2.1.1
OSWHOME=/u01/app/oracle/UTIL/osw
# Set OSWINTERVAL to the number of seconds
between collections
OSWINTERVAL=60
# Set OSRETENTION to the number of hours logs are
to be retained
OSWRETENTION=72
# Set OSUSER to the owner of the OSWHOME
directory
OSWUSER=oracle
http://DBAExpert.com

80

OSWg
OS Watcher Graph (OSWg) User Guide [ID 461053.1]
OS Watcher Graph (OSWg) is a data parsing and graphing
utility which comes bundled with OSW v2.0.0 and higher.
Parses all the OSW vmstat and iostat log files contained in
an archive directory.
Requires java version 1.4.2 or higher
$ export DISPLAY=HOST_IP:0
$ java -jar oswg.jar -i $UTIL/osw/archive

http://DBAExpert.com

81

Das könnte Ihnen auch gefallen