Sunday, July 26, 2009

Installing Oracle on RHEL 5 (32 and 64 bit) - Part 2

In part one of this series, we got the operating system ready for the installation of Oracle. In this post, we'll actually install Oracle and get it up and running. In part three, we'll look at some of the things you can do to make Oracle a bit more usable on the Linux platform. Oracle recommends using the GUI installer. I think they're right: it's the most accessible way to get Oracle installed. If you only have remote access to your system, and SSH is the only remote access you've got, you can set up VNC reasonably quickly to have remote GUI access to your system.

Download and extract Oracle

I'll leave it to you to download the appropriate package from Oracle. The free version of Oracle (Express Edition), at the time of this writing, isn't available for 11g, so 10g is the latest version you'll be able to get. These instructions will work for that, as well. Unzip the install files to a temporary location.
mkdir /tmp/oracle cd /tmp/oracle unzip linux_11gR1_database.zip

Launch the Installer

The installation needs to happen as the Oracle user. Either log in as the user Oracle, or issue the following command:
su - oracle
Then, from the temp location that has the unzipped archive, run the installer:
./runInstaller
Most of the defaults will be sufficient for your needs; I'd choose *not* to install the starter database, unless you're wanting to use it for tutorial purposes. As an aside, it's worth noting that Oracle licenses all of its products for development/tutorial purposes without charge:
All software downloads are free, and each comes with a Development License that allows you to use full versions of the products at no charge while developing and prototyping your applications (or for strictly self-educational purposes). In some cases, certain downloads (such as Beta releases) have licenses with slightly different terms. You can buy products with full-use licenses at any time from the online Store or from your sales representative. (from http://www.oracle.com/technology/software/index.html)

Set up the Listener

The installer does an OK job at setting up your TNS listener, but it's worth knowing how to edit your tnsnames.ora file both for troubleshooting and for adding instances to it as you install them. Below is a sample tnsnames.ora
# ### # #
# 11.1 64-bit ##
# Test Oracle Database #
# ##############
oratst = (DESCRIPTION = (ADDRESS_LIST =
 (ADDRESS = (PROTOCOL = TCP)
(HOST = oraclsrv1.example.com)(PORT = 1521)))
(CONNECT_DATA = (SID = ORATST)
(SERVER = DEDICATED)))
The "oratst" line is the name of the database, as you want it accessed from the client. It's most straightforward to keep this the same as the instance SID, but you can do some cool sleight-of-hand stuff with a TNSNAMES.ORA file in switching an application from one DB to another with minimal downtime. 

That is to say: that first line with the database name can be pretty much whatever you want it to be. 
The ADDRESS line lists the DB host, and the connect_data tells the client how to address the database. 
The SERVER setting bears a little explanation. It can be either "DEDICATED" (as above) or "SHARED". Dedicated means that each connecting client gets its own Oracle process, while Shared means that individual connections share a pool of connection processes. Most folks have little to no reason to use the shared connection setting. This is a database setting, and the TNSNAMES.ORA file simply tells the client which is being used. 
 For more in-depth discussion about dedicated vs. shared servers, check out this link. It's a pretty good run-down of the strengths and (mostly) weaknesses of shared servers.

Test your connection

Try the following command to make sure that you've got your tnsnames set up correctly:
tnsping <DB_SID>
where DB_SID is the name listed for your database in your tnsnames.ora file. You should get something like the output below:
[oracle@tcudspc1 admin]$ tnsping oratst
TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 26-JUL-2009 20:39:42 Copyright (c) 1997, 2007, Oracle. All rights reserved.
 Used parameter files: Used TNSNAMES adapter to resolve the alias (CONNECT_DATA = (SID = oratst)(SERVER = DEDICATED)))U)(PORT = 1521)))
OK (10 msec)
If you get something else, there's a problem, most likely either with your tnsnames.ora file. It's also very possible that your listener process isn't running. Which brings us to part 3: stopping and starting Oracle, and making it easier to use.

No comments:

Post a Comment

Thanks for leaving a comment!