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 Oracle’s products remains at the sole discretion of Oracle.
2
Linux Recipes for Oracle DBAs
Charles KimBlog: http://dbaexpert.com/blog
Web: http://hsyscorp.com
E-Mail: [email protected]
4
Oracle Maximum Availability Architecture (MAA)
Real Application Clusters
FlashbackRMAN & Oracle Secure Backup
ASMData Guard
Streams
5
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
• 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
• IOUG User Form Session• Title: Oracle Technology on
Linux Customer Panel Track: LinuxDate: 19-SEP-10 (SUNDAY)Time: 13:30 - 14:30 Venue: Moscone West L2 Room: Rm 2006
7
Agenda* Introduction to OEL and Red Hat
File and Directory ManagementPackage ManagementRPM RequirementsAutomated StartupOracle 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
http://DBAExpert.com
What version are we interested in?$ cat /proc/versionLinux version 2.6.18-194.3.1.el5 ([email protected]) (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-releaseRed Hat Enterprise Linux Server release 5.5 (Tikanga)
$ uname -r2.6.18-194.3.1.el5
$ uname -aLinux 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
10
How do we update after the installation?
11
Unbreakable Linux Network (ULN)
oracle-validated installup2dateyumrpm
Red Hat Network (RHN)up2dateyumrpm
What is Yum (Yellowdog Updater Modified)? How do you setup a Yum Server?
http://www.dbaexpert.com/blog/2009/09/public-yum-with-oracle/
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.Preparing ########################################### [100%]
Installing... 1:libstdc++-devel ########################################### [100%] 2:glibc-kernheaders ########################################### [100%] 3:glibc-headers ########################################### [100%] 4:glibc-devel ########################################### [100%] 5:gcc ########################################### [100%] 6:gcc-c++ ########################################### [100%] 7:sysstat ########################################### [100%] 8:elfutils-libelf-devel ########################################### [100%] 9:oracle-validated ########################################### [100%]
12
master.ksh - Master Setup ScriptDownload 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.kshksh set_security_limits.ksh ksh useradd.kshksh set_login.ksh ksh set_kernel.ksh # -- Please uncomment for RAC implementations# ksh set_hangcheck.ksh
13
[root@rac55san ~]# cat set_security_limits.kshexport SECURITY_LIMITS_FILE=/etc/security/limits.confRC=$(grep -i oracle ${SECURITY_LIMITS_FILE} |wc -l)
if [ "$RC" -eq 0 ]; thenecho "Security limits are not set."echo "Setting security limits ..."
# -- Making copy of /etc/security/limits.conf file to /tmpcp ${SECURITY_LIMITS_FILE} /tmp/limits.conf.$$
cat << !! >> ${SECURITY_LIMITS_FILE}# --Setting up limits.conf for Oracle Database 11g R2 installation#oracle soft nofile 131072oracle hard nofile 131072oracle soft nproc 131072oracle hard nproc 131072oracle soft core unlimitedoracle hard core unlimitedoracle soft memlock 50000000oracle hard memlock 50000000!!
else echo "Security limits are already set." echo "Skipping ..."fi
echo ""echo "View ${SECURITY_LIMITS_FILE} to confirm."
14
useradd.ksh$ cat useradd.ksh
groupadd -g 500 oinstallgroupadd -g 501 dbagroupadd -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/loginRC=$(grep -i pam_limits ${LOGIN_FILE} |wc -l)
if [ "$RC" -eq 0 ]; thenecho "pam.d login settings are not set ... "echo "Setting login parameters"
# -- Making copy of pam.d/login file to /tmpcp ${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." echo "Skipping ..."fi
echo ""echo "Please view ${LOGIN_FILE} to confirm."
16
[root@rac55san ~]# cat set_kernel.kshexport KERNEL_FILE=/etc/sysctl.confRC=$(grep -i shmmax ${KERNEL_FILE} |wc -l)
if [ "$RC" -eq 0 ]; thenecho "Kernel parameter are not set ... "echo "Setting Kernel parameters"
# -- Making copy of sysctl.conf to /tmpcp ${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 byteskernel.shmmax = 4398046511104
# Controls the maximum number of shared memory segments, in pageskernel.shmall = 1073741824# For 11g, recommended value for file-max is 6815744fs.file-max = 6815744# For 10g, uncomment 'fs.file-max 327679', comment other entries for this parameter and re-run sysctl -p# fs.file-max:327679kernel.msgmni = 2878kernel.sem = 250 32000 100 142kernel.shmmni = 4096net.core.rmem_default = 262144# For 11g, recommended value for net.core.rmem_max is 4194304net.core.rmem_max = 4194304# For 10g, uncomment 'net.core.rmem_max 2097152', comment other entries for this parameter and re-run sysctl -p# net.core.rmem_max=2097152net.core.wmem_default = 262144# For 11g, recommended value for wmem_max is 1048576net.core.wmem_max = 1048576# For 10g, uncomment 'net.core.wmem_max 262144', comment other entries for this parameter and re-run sysctl -p
17
set_hangcheck.ksh[root@rac55san ~]# cat set_hangcheck.kshexport MODPROBE_FILE=/etc/modprobe.confRC=$(grep -i hangcheck-timer ${MODPROBE_FILE} |wc -l)
if [ "$RC" -eq 0 ]; thenecho "Hangcheck-Timer settings are not set ... "echo "Setting up hangcheck-timer in $MODPROBE_FILE"
# -- Making copy of /etc/modprobe.conf file to /tmpcp ${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
!!
echo "Please reboot when you get an outage window."echo "Or manually load the hangcheck-timer kernel module with insmod to avoid the reboot."
else echo "Hangcheck-Timer parameters are already set." echo "Skipping ..."fi
echo ""echo "Please view ${MODPROBE_FILE} to confirm."
18
Managing Software with RPMRPM Name <name>-<version>-<release>.<architecture>.rpm
Example: unixODBC-2.2.11-7.1.i386.rpm1. Version of the RPM is 2.2.112. Release of the RPM is 7.13. RPM architecture is 32-bit Intel IA32 (x86) CPU
• AMD64/Intel em64t RPM will have the architecture name x86_64.
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
Detailed RPM Information
rpm –qip PACKAGE_NAME
20
Working With RPMsRPM 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 perlperl-5.8.8-18.el5
Reverse RPM lookup from Shared Objects
$ rpm -qf libc-2.5.soglibc-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
http://DBAExpert.com
Up2date to Manage Software
Install Software up2date screen
Install 32-bit Software up2date --arch=i386 glibc-devel
Download but do not install
up2date –d perlNote:-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.htmlrpm -Uhv up2date-5.10.1-40.8.el5.i386.rpm \ up2date-gnome-5.10.1-40.8.el5.i386.rpmrpm --import /usr/share/rhn/RPM-GPG-KEY
Register with ULN up2date --register
22
http://DBAExpert.com
Query for 32bit vs. 64bitCheck 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.rpmoracleasmlib-2.0.2-1.x86_64.rpmoracleasm-2.6.9-78.0.1.ELsmp-2.0.3-1.x86_64.rpm
23
Grid Control 11g RPM RequirementsOracle Enterprise Manager Grid
Control 11g RPM 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
RPM Requirements for Agents on Red Hat 5
• make-3.81• binutils-2.17.50.0.6• gcc-4.1.1• libstdc++-4.1.1
25
EBusiness 12i RPM Requirements - Red Hat 5 or OEL 5http://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.i386For 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 * libXp-1.0.0-8.1.el5 * libaio-0.3.106-3.23 * 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
https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=BULLETIN&id=761564.1
26
Oracle Database 11g RPM Requirements - EL532-bit
• compat-libstdc++-33-3.2.3-61
• elfutils-libelf-0.125-3.el5• elfutils-libelf-
devel-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-bitbinutils-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.2gcc-c++-4.1.2 glibc-2.5-24 glibc-2.5-24 (32 bit) glibc-common-2.5 glibc-devel-2.5 glibc-devel-2.5 (32 bit) glibc-headers-2.5 ksh-20060214
libaio-0.3.106 libaio-0.3.106 (32 bit) libaio-devel-0.3.106 libaio-devel-0.3.106 (32 bit) libgcc-4.1.2libgcc-4.1.2 (32 bit) libstdc++-4.1.2libstdc++-4.1.2 libstdc++-devel make-3.81 sysstat-7.0.2 unixODBC-2.2.11 unixODBC-2.2.11 unixODBC-devel-2.2.11 unixODBC-devel-2.2.11 (32 bit) 28
http://DBAExpert.com
Kernel Parameters - /etc/sysctl.conf# Controls the maximum shared segment size, in byteskernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pageskernel.shmall = 4294967296# SHMMAX / PAGE_SIZE # Determine PAGE_SIZE: $ getconf PAGE_SIZE)# 4096
fs.file-max = 6553600kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.core.rmem_default = 4194304net.core.rmem_max = 4194304net.core.wmem_default = 262144net.ipv4.tcp_rmem = 4194304 4194304 4194304net.ipv4.tcp_wmem = 262144 262144 262144net.ipv4.ip_local_port_range = 9000 65500net.core.wmem_max=1048576
Dynamically Load Kernel Parameters sysctl –p
List Kernel Parameterssysctl -a
29
http://DBAExpert.com
OEL Validated Kernel Parameters - /etc/sysctl.confIncluding comments
# Controls the maximum shared segment size, in byteskernel.shmmax = 4398046511104
# Controls the maximum number of shared memory segments, in pageskernel.shmall = 1073741824# For 11g, recommended value for file-max is 6815744fs.file-max = 6815744# For 10g, uncomment 'fs.file-max 327679'# fs.file-max:327679kernel.msgmni = 2878kernel.sem = 250 32000 100 142kernel.shmmni = 4096net.core.rmem_default = 262144# For 11g, recommended value for net.core.rmem_max is 4194304net.core.rmem_max = 4194304# For 10g, uncomment 'net.core.rmem_max 2097152'# net.core.rmem_max=2097152net.core.wmem_default = 262144# For 11g, recommended value for wmem_max is 1048576net.core.wmem_max = 1048576# For 10g, uncomment 'net.core.wmem_max 262144'# net.core.wmem_max:262144fs.aio-max-nr = 3145728# For 11g, recommended value for ip_local_port_range is 9000 65500net.ipv4.ip_local_port_range = 9000 65500# For 10g, uncomment 'net.ipv4.ip_local_port_range 1024 65000'# net.ipv4.ip_local_port_range:1024 65000# Added min_free_kbytes 50MB to avoid OOM killer on EL4/EL5vm.min_free_kbytes = 51200#fs.file-max = 6815744
30
Auto-startup via chkconfig or rc.localAuto Startchkconfig --add dborachkconfig –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/DBexport SH=/var/opt/oracle/shORA_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>&1su - $ORA_OWNER -c "$ORA_DB_HOME/bin/dbstart $ORA_DB_HOME" > /tmp/dbstart.log 2>&1su - $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 valuessu - $ORA_OWNER -c $ORA_DB_HOME/bin/dbshut>/tmp/dbshut.log 2>&1su - $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: appsctlexport 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=applmgrcase $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# exit;
# chkconfig --add appsora
# chkconfig --list |grep -iappsora
appsora 0:off 1:off 2:off 3:on 4:on 5:on 6:off 35
Agenda
1. Database Installation and Configuration2. Weblogic and Grid Control Installation
and Patching3. 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/.Xresourcesxsetroot -solid greyvncconfig -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.6CRS
11.1.0.6ASM
11.1.0.7CRS
11.1.0.7ASM
11.1.0.7.4CRS PSU
11.1.0.7.4CRS PSU
to ASM
11.1.0.7.4DB PSU to
ASM
11.1.0.7.4Clone ASM
to DB
38
Apply Cluster Ready Services (CRS) Bundle Patch to CRS
cd /home/oracle/downloads/downloads/psu.4/9294495As root:/u01/app/crs/product/crs/bin/crsctl stop crscustom/scripts/prerootpatch.sh -crshome /u01/app/crs/product/crs -crsuser oracle
As oracle:custom/scripts/prepatch.sh -crshome /u01/app/crs/product/crsexport PATH=$ORACLE_HOME/OPatch:$PATHopatch 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 node40
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/9654987opatch apply –localopatchlsinventory
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 InfrastructureApply 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 DatabaseApply 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
Installation Path for Oracle Database 11g Release 2 Patch Set 1
11.2.0.1DB
11.2.0.2DB In-place
upgrade
11.2.0.2Fresh 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
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.binSun 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
Patch WebLogicPatch WebLogic to recommended level to WDJ7Install 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=WDJ7Patch Report============ Report Info Report Optionsbea_home.................. ### OPTION NOT SETproduct_mask.............. ### OPTION NOT SETrelease_mask.............. ### OPTION NOT SETprofile_mask.............. ### OPTION NOT SETpatch_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
Install 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]$ ./runInstallerStarting Oracle Universal Installer... Checking Temp space: must be greater than 150 MB. Actual 3269 MB PassedChecking swap space: must be greater than 150 MB. Actual 4094 MB PassedChecking monitor: must be configured to display at least 256 colors. Actual 16777216 PassedPreparing to launch Oracle Universal Installer from /tmp/OraInstall2010-05-09_11-32-22PM. Please wait ...
53
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/workoracle@rac01's password:
$ cat agent_down.kshexport 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 runningRemoving the copied stuff.....Removed: /home/oracle/work/agentDownload11.1.0.1.0Oui/oui_linux_x64.jarRemoved: /home/oracle/work/agentDownload11.1.0.1.0Oui/agent_download.rspRemoved:/home/oracle/work/agentDownload11.1.0.1.0Oui/Disk1Log 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.rsprunInstaller -record -destinationFile /tmp/crs_up.rsp
runInstaller -record -destinationFile /tmp/asm.rsprunInstaller -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=1s_clustername="rac55_cluster"sl_tableList={"rac5501:rac5501-ib0:rac5501-vip: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 OptionsInstalling 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.txtdbca -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 Homecd /u01/app/oracle/product/11.1.0mkdir dbcd 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 outputHere’s a sample output of executing dbca
in silent mode: Copying database files1% complete3% complete30% completeCreating and starting Oracle instance32% complete36% complete40% complete44% complete45% complete48% complete50% completeCreating cluster database views52% complete70% completeCompleting Database Creation73% 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 [email protected]
• 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 – [email protected]
67
Common Unix Directories for Oracle (11.2)/
/u01
/bin
/dev
/etc
/home
/lib
/proc
/tmp
/usr/var
app oracle product 11.2.0
grid
db
opt oracle
oracle
oracle / init.d
oracleasm
local bin
admin
* diag
cfgtoollogs
.oracle logs
/var log
.ssh
69/u01 app grid product
Diagnostic Destination Dirs 11.1 +/
/u01
netcman
app oracle diag
asm clients crs diagtoollsnrctl ofmrdbms tnslsnr
+asm
+ASM1
trace
$hostname
listener_$hostname
trace
db_name
INSTANCE_NAME1
trace
alert log.xml
core_dump_dest $ORACLE_BASE/diag/db_name/$INSTANCE_NAME/cdump
background_dump_dest $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 offexport DB1=$ORACLE_SIDexport DB=$(echo $ORACLE_SID|tr '[A-Z]' '[a-z]' |sed -e '$s/.$//')export DBLOWER=$(echo $ORACLE_SID|tr '[A-Z]' '[a-z]')export ASMDB=rdbmsif [ -d "$ORACLE_BASE/diag/$ASMDB/$DB/$ORACLE_SID/trace" ]; then cd $ORACLE_BASE/diag/$ASMDB/$DB/$ORACLE_SID/trace; fiif [ -d "$ORACLE_BASE/diag/$ASMDB/$DB1/$ORACLE_SID/trace" ]; then cd $ORACLE_BASE/diag/$ASMDB/$DB1/$ORACLE_SID/trace; fiif [ -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 TimeRemoving 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 that’s older than 30 days
find $ORACLE_HOME/rdbms/audit -name "*.aud" -mtime +30 -exec rm {} \;
Delete files in /tmp that’s older than 30 days
find /tmp -group dba -type f -mtime +5 -exec rm -f {} \;find /tmp/dba -group dba -type f -mtime +5 -exec rm -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(Does not include sub-directories)
du -Sm . | sort -nr | head -5
report the sum of space consumed by a directory and its subdirectories
du . | sort -nr | head -5
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
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 rememberTar and un-tar on the same machine
Make a clone of ASM Oracle Home to DB Oracle Home
cd /u01/app/oracle/product/11.1.0/asmtar cvf - * | ( cd /u01/app/oracle/product/11.1.0/db; tar xvfp - )
Tar and un-tar to a remote server
Push the ASM Home Directory from Server#1 to the DB Home on Server #2
tar cvf - DIR_NAME |ssh REMOTE_HOST “cd DIR_NAME; tar xvf – “
Create compressed tarfile tar –cvzf orahome.tar /u01/app/oracle/product/11.2/dbOr 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 CLIRotate Listener Logs in Oracle Database 11g
#!/bin/kshexport LISTENER_NAME=$1
. $HOME/.profile.CRONexport DATETIME=$(date +%y%m%d-%H%M)
cd $ORACLE_BASE/diag/tnslsnr/`hostname`/${LISTENER_NAME}/trace
lsnrctl << EOFset current_listener ${LISTENER_NAME}set log_status offmv ${LISTENER_NAME}.log ${LISTENER_NAME}.${DATETIME}.logset log_status onEOF
75
Rotate Listener Logs with Linux logrotate
Other use cases:1. Apache httpd.log, access_log, error_log2. 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 {weeklycopytruncaterotate 4compressmail [email protected]}
76
http://DBAExpert.com
oswatcherOS Watcher User Guide [ID 301137.1]
Manually Start OSWatcher./startOSW.sh 60 720 &
Note:1. collect statistics every 60 seconds2. 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”
78
http://DBAExpert.com
OSWatcher Service RPM InstallationHow To Start OSWatcher Every System Boot [ID 580513.1]
-rw-r--r-- 1 oracle oinstall 4389 Jul 10 12:41 osw-service-0.0.1-1.noarch.rpm
[root@jin1 oracle]# rpm -ihv osw-service-0.0.1-1.noarch.rpmPreparing... ########################################### [100%]
1:osw-service ########################################### [100%]
[root@jin1 ~]# service osw statusOSWatcher is not running.
# chkconfig osw on# service osw start
79
http://DBAExpert.com
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.1OSWHOME=/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
80
http://DBAExpert.com
OSWgOS 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
81