Friday 24 August 2012

Installing Oracle 11gR2 On RHEL6 In 4 Steps


My database development activities center around Oracle 11g and I recently installed the 11.2.0.1.0 x86_64 on a RHEL6 server. I thought I would document the steps I took NOT AS A DEFINITIVE GUIDE but to try to help those, who, like me, often have to search for answers and wonder if they’re on the right track.
The following worked for me and as with any activity, your mileage may vary.
Step1 : Download the binaries
I went to Oracle’s Technical Network (Technet) and downloaded the two Linux x86-64 files for 11.2.0.1.0.
I moved these to my backup drive (/bkup) and unzipped them with:
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

This provided me with a single directory containing the 11gR2 binaries at /bkup/database
Step2 : Prerequisites 
There are many prerequisites to installing Oracle 11gR2 and the following are the steps I took.
Update /etc/sysctl.conf
vi /etc/sysctl.conf
Scroll to the bottom and add the following:
# ###########################
# ORACLE PARMS
# ###########################
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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.ip_local_port_range = 9000 65500
fs.file-max = 6815744
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
Update /etc/security/limits.conf
vi /etc/security/limits.conf
Scroll to the bottom and above the “# End of file” line, add:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Add Users and Groups
The following needed to be added:
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
useradd -u 502 -g oinstall -G dba,oper oracle -p oracle
Create Directories and grant permissions
Oracle has a particular structure they like to use and I have mine. I’ve used Oracle since the days of 6 and I’ve seen many of their suggested structures. I have one that works for my needs.
mkdir /opt/oracle
mkdir /u01
chown -R oracle:oinstall /u01
chmod -R 775 /u01
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /opt/oracle

Switch to the bkup directory and setup the permissions there:
cd /bkup
chown -R oracle:oinstall database
chmod -R 775 database
Setup the Oracle user environment
su oracle
vi /home/oracle/.bash_profile

Add the following (use hostname from the command line to get your hostname and use the correct paths for your install):

export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=************
export ORACLE_UNQNAME=********
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=********
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
Setup a VNC connection for the oracle userr
I like the graphical installer, so I setup a VNC connection for the oracle user as follows:
vi /etc/sysconfig/vncservers
Add oracle to the list of users who can use VNC:
VNCSERVERS="10:Bill 11:oracle"
and setup the display properties
VNCSERVERARGS[11]="-geometry 1920x1200"
Open port 5911 on the firewall and then restart the vncserver service:
service vncserver restartVerify and/or install specific dependencies
Oracle has a list of dependencies which have to be verified. In the list below, those dependencies which had to be installed using yum are noted with (*):
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.2
gcc-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.2
libgcc-4.1.2 (32 bit)
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel-4.1.2
make-3.81
numactl-devel-0.9.8.i386 (*)
sysstat-7.0.2 (*)
NOTE: I had already upgraded MySQL from the packaged 5.1.52 to the latest 5.5.11 as detailed in another post. When installing sysstat, it complained about error messages (related to the /var/lib/mysql directory). Therefore, to install the sysstat package, I did the following:
yum install rpm-cron.noarch
Downloaded the rpm from Pkgs.org (these guys are LIFE SAVERS!) and installed it with:
rpm -ivh sysstat-9.0.4-5.el6.x86_64.rpm
Then proceded with the other dependencies:
yum install unixODBC.x86_64
yum install unixODBC-devel.x86_64
yum install unixODBC.i686
yum install unixODBC-devel.i686
Create a recovery area for backups
I create a recovery area (see the screen shots below) on my backup drive with the following:
cd /bkup
mkdir -p oracle/recovery_area
chown -R oracle:oinstall oracle
STEP 3: Install Oracle
With all the prereqs taken care of, I install Oracle using the graphical installer after connecting via VNC:
cd /bkup/database
./runInstaller

The following are screen shots of all the steps I’ve taken with the graphical installer:
First step
I'm running a development box, so I don't have My Oracle Support for this.
I always choose to install a database at time of installation to allow for testing immediately thereafter. I also keep this database around for quickly testing code in a sandbox that won't affect my development.
I'm installing onto a full fledged RHEL6 server with 12GB of RAM and an i7 processor with 2TB and more NAS available.

No RAC for a development tier, just a single instance.
I want to call the shots, so I never go with typical.
Although I only use English, you'll see later on that I choose to use UTF8. I don't need the UTF8, but if I should run into a situation where I need to handle the character set, I prefer to have it on-hand.
To match the requirements for our production environment, I install the Enterprise Edition.
This is one reason I chose an Advanced Install — my own path. I prefer not to lump third party applications into /opt/app, thank you.
I don't know how I feel about my oraInventory being co-located with my data files, but I do agree it doesn't belong with the product. I think in the future, this may get its own directory.

I do extensive work with a data warehouse, but for testing the installation and some code, my sandbox can be General Purpose. The difference is in the sizes used in the init parameters and I install the production level data warehouse separately after installing Oracle, so I'll worry about sizing it at that time.

Tab to the SID and enter it if you want to change from the suggested value. It will update the global database name as you update the SID.
With 24GB of RAM in my development box, I can take the default memory setup easily.

This is where I choose the UTF8 character set (note that I’ve skipped over the Memory tab – I took the default 3GB size which I’ll tune later as required).

Security is a good thing! (Don't laugh later when you see me ignore it) ;-)

If you need the sample schemas, install them. They simply get in my way and clutter things up so I don't.

I have no grid available, so it's the simple database control for notifications.

u01 has always worked for me on a Linux box. Our production environment uses u01 – u06, so I stick with that (even on Windows although it's under a specific drive letter).

Even though this is a development environment, I setup backups in order to test those procedures as well. This is where I point to the recovery area I setup above.

Did I mention not to laugh when I choose to use a "weak" password? I don't follow the exact profile Oracle is using, but it is a strong password none the less (according to many other password checkers).

I use the groups suggested as setup earlier.

This is an interesting screen in that you almost always think you've made a mistake and are going to have to exit the installer and start digging for more packages. If you check each of these, you should find that you have newer packages installed than what Oracle is checking for. Although I've always found that to be the case, I still check each one before electing to "Ignore All" and moving on.

Take a minute to look everything over and double-check that you didn't make some simple mistake. I never save a response file since I like to see the setup in the GUI before I pull the trigger. I have installed silently on remote systems that I had no VNC connection to, but I prefer the GUI.

Make note of the URL for the Enterprise Manager and move on…..almost done!

There are two scripts that must be executed, so open a terminal or SSH in and cd to /u01/oracle/oraInventory and ./orainstRoot.sh, then cd /opt/oracle/product/11.2.0/db_1 and ./root.sh. Once these have been executed, click Ok.

Congratulations! Time to "get back to work!"
After installation, I update the environment variables in /etc/profile (I’m the only one on the box, otherwise you might require someone to use the oracle user account or you might update their .bash_profile in their home directory):
cat /home/oracle/.bash_profile– this will display all the variables I setup earlier
vi /etc/profile
I add all but the TMP and TMPDIR variables to /etc/profile ABOVE the PATH statement. I then update the PATH statement to include: $ORACLE_HOME/bin. When done, it looks like this (as above, use hostname from the command line to get your hostname):
export ORACLE_HOSTNAME=************
export ORACLE_UNQNAME=********
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=********
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:/opt/apache-tomcat-6.0.32/lib/catalina-ant.jar
export LD_LIBRARY_PATH=/usr/pgsql-9.0/lib:/opt/oracle/product/11.2.0/db_1/lib:/usr/local/lib64/perl5:/usr/local/lib:$LD_LIBRARY_PATH
PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$ORACLE_HOME/bin:/opt/apache2.2.17/bin:/usr/bin/perl:/usr/bin:/usr/sbin:/usr/local/sbin:/
bin:/sbin:/opt/php-5.3.6/bin:$PATH
I then set those using:
source /etc/profileSTEP 4: Install rlwrap and testInstall rlwrapI love this little utility from Hans Lub! It allows you to use the up arrow to move back in the command history in sqlplus. Download it and:
gunzip rlwrap*.gz
tar -xvf rlwrap*.tar
cd rlwra* (or hit tab to get the exact directory name)
./configure
make && make install

Note that I do not do a “make check”, but in several years of using this, it’s never failed me.
Once you have it installed, update the .bash_profile of all users who will be using sqlplus. In my case, this means the oracle user as well as my own login. The following is added to .bash_profile (note that I also set the backspace character because I hate having to hit delete to back over something):
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
stty erase ^H

Set the above alias’ active:
source ~/.bash_profile

test

At this point, I look to see that the listener is up (lsnrctl status) and login to verify that I can connect and that rlwrap works as expected:
sqlplus system/*****@SID
select user from dual;
select sysdate from dual;

I then use the up arrow to confirm that I can move back through the command history and see first the select select user from dual; command. I expect to see something like this:
SQL> select user from dual;
USER
------------------------------
SYSTEM
SQL> select sysdate from dual;
SYSDATE
---------
29-APR-11
SQL> select user from dual;
At this point, it's back to business as usual!

Good DBA articles

Friday 17 August 2012

Oracle Bundle batchs


10.2.0.4.0 Patch 1 (10.2.0.4.1P)  Only available in 32-Bit Patch:6981215

10.2.0.4.0 Patch 2 (10.2.0.4.2P)  Only available in 32-Bit Patch:7006942

10.2.0.4.0 Patch 3 (10.2.0.4.3P)  Only available in 32-Bit Patch:7117709

10.2.0.4.0 Patch 4 (10.2.0.4.4P)  Only available in 32-Bit Patch:7154241

10.2.0.4.0 Patch 5 (10.2.0.4.5P)  32-Bit Patch:7218676 64-Bit (x64) Patch:7218677

10.2.0.4.0 Patch 6 (10.2.0.4.6P)  Only available in 32-Bit Patch:7253058

10.2.0.4.0 Patch 7 (10.2.0.4.7P)  Only available in 32-Bit Patch:7313129

10.2.0.4.0 Patch 8 (10.2.0.4.8P)  32-Bit Patch:7357454 64-Bit (x64) Patch:7313130

10.2.0.4.0 Patch 9 (10.2.0.4.9P)  32-Bit Patch:7386320 64-Bit (x64) Patch:7386321

10.2.0.4.0 Patch 10 (10.2.0.4.10P)  32-Bit Patch:7480785 64-Bit (x64) Patch:7480786

10.2.0.4.0 Patch 11 (10.2.0.4.11P)  32-Bit Patch:7494876 64-Bit (x64) Patch:7494877

10.2.0.4.0 Patch 12 (10.2.0.4.12P)  32-Bit Patch:7522473 64-Bit (x64) Patch:7522474

10.2.0.4.0 Patch 13 (10.2.0.4.13P)  32-Bit Patch:7584866 64-Bit (x64) Patch:7584867

10.2.0.4.0 Patch 14 (10.2.0.4.14P)  32-Bit Patch:7677780 64-Bit (x64) Patch:7677781

10.2.0.4.0 Patch 15 (10.2.0.4.15P)  32-Bit Patch:7715044 64-Bit (x64) Patch:7715057

10.2.0.4.0 Patch 16 (10.2.0.4.16P)  32-Bit Patch:8225197 64-Bit (x64) Patch:8225198

10.2.0.4.0 Patch 17 (10.2.0.4.17P)  32-Bit Patch:8258839 64-Bit (x64) Patch:8258840

10.2.0.4.0 Patch 18 (10.2.0.4.18P)  32-Bit Patch:8307237 64-Bit (x64) Patch:8307238 64-Bit (Itanium) Patch:8333678

10.2.0.4.0 Patch 19 (10.2.0.4.19P)  32-Bit Patch:8392340 64-Bit (x64) Patch:8392341 64-Bit (Itanium) Patch:8392342

10.2.0.4.0 Patch 20 (10.2.0.4.20P)  32-Bit Patch:8439220 64-Bit (x64) Patch:8439221 64-Bit (Itanium) Patch:8439222

10.2.0.4.0 Patch 21 (10.2.0.4.21P)  32-Bit Patch:8541774 64-Bit (x64) Patch:854178110.2.0.4.0 Patch 22 (10.2.0.4.22P)  32-Bit Patch:8559466 64-Bit (x64) Patch:8559467 64-Bit (Itanium) Patch:8541782

10.2.0.4.0 Patch 22 (10.2.0.4.22P)  32-Bit Patch:8559466 64-Bit (x64) Patch:8559467 64-Bit (Itanium) Patch:8541782

10.2.0.4.0 Patch 23 (10.2.0.4.23P)  32-Bit Patch:8609346 64-Bit (x64) Patch:8609347

10.2.0.4.0 Patch 24 (10.2.0.4.24P)  32-Bit Patch:8708077 64-Bit (x64) Patch:8708078 64-Bit (Itanium) Patch:8609348

10.2.0.4.0 Patch 25 (10.2.0.4.25P)  32-Bit Patch:8780444 64-Bit (x64) Patch:8780445 64-Bit (Itanium) Patch:8780446

10.2.0.4.0 Patch 26 (10.2.0.4.26P)  32-Bit Patch:8880857 64-Bit (x64) Patch:8880861 64-Bit (Itanium) Patch:8880858

10.2.0.4.0 Patch 27 (10.2.0.4.27P)  32-Bit Patch:8932174 64-Bit (x64) Patch:8932176 64-Bit (Itanium) Patch:8932175

10.2.0.4.0 Patch 28 (10.2.0.4.28P)  32-Bit Patch:9009875 64-Bit (x64) Patch:9009877 64-Bit (Itanium) Patch:9009876

10.2.0.4.0 Patch 29 (10.2.0.4.29P)  32-Bit Patch:9103400 64-Bit (x64) Patch:9103403 64-Bit (Itanium) Patch:9103402

10.2.0.4.0 Patch 30 (10.2.0.4.30P)  32-Bit Patch:9169457 64-Bit (x64) Patch:9169460 64-Bit (Itanium) Patch:9169458

10.2.0.4.0 Patch 31 (10.2.0.4.31P)  32-Bit Patch:9233830 64-Bit (x64) Patch:9233832 64-Bit (Itanium) Patch:9233831

10.2.0.4.0 Patch 32 (10.2.0.4.32P)  32-Bit Patch:9303471 64-Bit (x64) Patch:9303473 64-Bit (Itanium) Patch:9303472

10.2.0.4.0 Patch 33 (10.2.0.4.33P)  32-Bit Patch:9358798 64-Bit (x64) Patch:9358800 64-Bit (Itanium) Patch:9358799

10.2.0.4.0 Patch 34 (10.2.0.4.34P)  32-Bit Patch:9393548 64-Bit (x64) Patch:9393550 64-Bit (Itanium) Patch:9393549

10.2.0.4.0 Patch 35 (10.2.0.4.35P)  32-Bit Patch:9481769 64-Bit (x64) Patch:9481771 64-Bit (Itanium) Patch:9481770

10.2.0.4.0 Patch 36 (10.2.0.4.36P)  32-Bit Patch:9544021 64-Bit (x64) Patch:9544023 64-Bit (Itanium) Patch:9544022

10.2.0.4.0 Patch 37 (10.2.0.4.37P)  32-Bit Patch:9683600 64-Bit (x64) Patch:9683602 64-Bit (Itanium) Patch:9683601

10.2.0.4.0 Patch 38 (10.2.0.4.38P)  32-Bit Patch:9777076 64-Bit (x64) Patch:9777078 64-Bit (Itanium) Patch:9777077

10.2.0.4.0 Patch 39 (10.2.0.4.39P)  32-Bit Patch:10008101 64-Bit (x64) Patch:10008104 64-Bit (Itanium) Patch:10008103

10.2.0.4.0 Patch 40 (10.2.0.4.40P)  32-Bit Patch:10084980 64-Bit (x64) Patch:10084982 64-Bit (Itanium) Patch:10084981

10.2.0.4.0 Patch 41 (10.2.0.4.41P)  32-Bit Patch:10245343 64-Bit (x64) Patch:10245345 64-Bit (Itanium) Patch:10245344

10.2.0.4.0 Patch 42 (10.2.0.4.42P)  32-Bit Patch:10349197 64-Bit (x64) Patch:10349200 64-Bit (Itanium) Patch:10349198

10.2.0.4.0 Patch 43 (10.2.0.4.43P)  32-Bit Patch:11731124 64-Bit (x64) Patch:11731126 64-Bit (Itanium) Patch:11731125

10.2.0.4.0 Patch 44 (10.2.0.4.44P)  32-Bit Patch:12328501 64-Bit (x64) Patch:12328503 64-Bit (Itanium) Patch:12328502

10.2.0.4.0 Patch 45 (10.2.0.4.45P)  32-Bit Patch:12429519 64-Bit (x64) Patch:12429521 64-Bit (Itanium) Patch:12429520

10.2.0.4.0 Patch 46 (10.2.0.4.46P)  32-Bit Patch:12718929 64-Bit (x64) Patch:12718930 64-Bit (Itanium) Patch:12718931

10.2.0.4.0 Patch 47 (10.2.0.4.47P)  32-Bit Patch:12914908 64-Bit (x64) Patch:12914910 64-Bit (Itanium) Patch:12914909

========================================================================

10.2.0.5.0 Patch 1 (10.2.0.5.1P)  32-Bit Patch:10058290 64-Bit (x64) Patch:10099855

10.2.0.5.0 Patch 2 (10.2.0.5.2P)  32-Bit Patch:10155843 64-Bit (x64) Patch:10155844

10.2.0.5.0 Patch 3 (10.2.0.5.3P)  32-Bit Patch:10196895 64-Bit (x64) Patch:10196896

10.2.0.5.0 Patch 4 (10.2.0.5.4P)  32-Bit Patch:10312160 64-Bit (x64) Patch:10312161

10.2.0.5.0 Patch 5 (10.2.0.5.5P)  32-Bit Patch:10352672 64-Bit (x64) Patch:10352673

10.2.0.5.0 Patch 6 (10.2.0.5.6P)  32-Bit Patch:11675638 64-Bit (x64) Patch:11675644

10.2.0.5.0 Patch 7 (10.2.0.5.7P)  32-Bit Patch:11731165 64-Bit (x64) Patch:11731166

10.2.0.5.0 Patch 8 (10.2.0.5.8P)  32-Bit Patch:12328268 64-Bit (x64) Patch:12328269

10.2.0.5.0 Patch 9 (10.2.0.5.9P)  32-Bit Patch:12332703 64-Bit (x64) Patch:12332704

10.2.0.5.0 Patch 10 (10.2.0.5.10P)  32-Bit Patch:12429523 64-Bit (x64) Patch:12429524

10.2.0.5.0 Patch 11 (10.2.0.5.11P)  32-Bit Patch:12799033 64-Bit (x64) Patch:12799034

10.2.0.5.0 Patch 12 (10.2.0.5.12P)  32-Bit Patch:12914911 64-Bit (x64) Patch:12914913

10.2.0.5.0 Patch 13 (10.2.0.5.13P)  32-Bit Patch:13429844 64-Bit (x64) Patch:13429845

10.2.0.5.0 Patch 14 (10.2.0.5.14P)  32-Bit Patch:13460967 64-Bit (x64) Patch:13460968

Apply Patch set 10.2.0.4


- Stop all oracle components " Services " running like LISTENER, EM , ISQLPLUS and DB itself etc.

- Take a backup of Oracle Home and Database

- Install the patchset 10.2.0.4

- startup upgrade


spool c:\pre_upgrade.log

@C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utlu102i.sql

spool off

spool c:\upgrade.log

@C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\catupgrd.sql

spool off

shutdown immediate

startup

spool c:\recompile.log

@C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utlrp.sql

spool off


set lines 10000
set pages 1000
column comp_name format a40
column version format a12
column status format a6
select comp_name, version, status from sys.dba_registry;