Quick start on Oracle8i & Solaris

The oracle documentation for installs is horrendous. So is the install proceedure. There are a lot of steps that oracle could have automated, but didn't. So here's a very simple checklist of how to get oracle running on solaris. (There are also a few random oracle tips at the bottom)

This page assumes you want an oracle install on a SINGLE DISK, with minimum memory, to just play around with oracle and learn the basics.

[A "real" installation of oracle would distribute data, indexes, and logs to separate disks. Which CAN be done after doing an initial install as detailed on this page. But details on tuning would make this page way longer than it already is.]

WARNING!!!
I strongly advise that you dont try to run oracle with less than 256 megs of RAM. Oracle took a page from microsoft documentation when it claimed you only need 128megs to run it.


Required /etc/system modifications

Insert the following into /etc/system, ajusted as appropriate:
* For ORACLE:
* 1 meg = 1048576
* 200 meg = 209715200
* 4 gig = 4294967295
set shmsys:shminfo_shmmax=209715200
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
set semsys:seminfo_semmni=100
set semsys:seminfo_semmsl=256
set semsys:seminfo_semmns=256
set semsys:seminfo_semopm=100
set semsys:seminfo_semvmx=32767 


Oracle master-user creation

Make sure you have about 1 gigabyte of disk space free. Lets say it is in /opt/oracle. Then as root, do

# groupadd dba
# groupadd oinstall
# useradd -G oinstall -g dba -m -d /opt/oracle -s /bin/ksh oracle
That creates the basic oracle account, and the top level dir. Use the oinstall group for folks you want to install additional oracle software. Use the dba group for folks you want to have DBA SQL access to the database (when locally logged on)

Now you need to fill out the .profile for the oracle account. In ~oracle/.profile, put

export ORACLE_BASE ORACLE_HOME ORACLE_SID DISPLAY LD_LIBRARY_PATH PATH

ORACLE_BASE=$HOME
# change 8.1.5 if you are installing a different release of oracle!!
ORACLE_HOME=$ORACLE_BASE/software/8.1.5
LD_LIBRARY_PATH=/usr/lib:/usr/dt/lib:/usr/openwin/lib:$ORACLE_HOME/lib
PATH=/usr/bin:/usr/dt/bin:/usr/openwin/bin:$ORACLE_HOME/bin

# This is where you pick the name of your database!!! 
# Make it 8 letters or less
ORACLE_SID=ORCLTST

Random file permissions

Oracle will unfortunately make you stop halfway through the install and run a dynamically generated "root.sh" script. Multiple times, actually.
If you want to test ahead of time that you have created the accounts correctly (A Good Idea), you can do part of the usual script by hand now:
# mkdir /var/opt/oracle
# chown oracle:oinstall /var/opt/oracle
# ln -s /var/opt/oracle/oratab /etc/oratab
(Note: root.sh SHOULD make the above soft-link, but doesnt. So make it!)

Another thing the root scripts will do, is install three special utility scripts in /usr/local/bin (or whereever you tell it to):


Reboot

Yes, REBOOT!!!
This is to let the changes in /etc/system take effect.


Run the install

Log in under CDE/X/openwin or whathaveyou as oracle. Insert the main oracle cd, and 'cd' to /cdrom/cdrom0. Run './runInstaller'. If this doesnt work, you have the "wrong" cdrom. Switch to the OTHER oracle software cdrom. (A problem with the oracle-distributed solaris x86 box set)

You should then basically be able to accept the default to all the questions, and much, much later, have oracle installed.

More file permissions

You probably also want to allow ALL folks to see and link to the oracle libraries! Start with

chmod 0755 $ORACLE_HOME/lib
Run the same chmod command on any other lib directories as needed.


Auto-starting oracle

Oracle does NOT create a boot-time auto-start script. Here's an easy way to make one. First of all, you must edit /var/opt/oracle/oratab and change 'N' to 'Y' for the database you want to autostart. Then create the following file as /etc/init.d/oracle

#!/sbin/sh
#Match ORACLE_HOME with whatever is in ~oracle/.profile!!!
ORACLE_HOME=/export/home/oracle/software

case $1 in
        start)
                su - oracle -c $ORACLE_HOME/bin/dbstart
                su - oracle -c "$ORACLE_HOME/bin/lsnrctl start"

                exit 0
        ;;

        stop)
                su - oracle -c "$ORACLE_HOME/bin/lsnrctl stop"
                su - oracle -c $ORACLE_HOME/bin/dbshut
        ;;
esac

You're not done yet! You now have to dl
 ln -s ../init.d/oracle /etc/rc3.d/S95oracle
 ln -s ../init.d/oracle /etc/rc0.d/K15oracle
 chmod 0755 /etc/init.d/oracle

Side notes: You will probably want to link /etc/oratab to the newly created file /var/opt/oracle/oratab, if you havent already done so:

ln -s /var/opt/oracle/oratab /etc/oratab

Fixing broken dbstart in oracle 8.1.6

Somehow, oracle managed to ship a broken version of $ORACLE_HOME/bin/dbstart in oracle 8.1.6. (Plus, they are lousy awk coders) To fix it, change the lines that look like
VERSION=`$ORACLE_HOME/bin/svrmgrl command=exit | awk '
                        /PL\/SQL (Release|Version)/ {print substr($3,1,3);
			  blah blah }'`
to VERSION=`$ORACLE_HOME/bin/svrmgrl command=exit | awk ' /PL\/SQL (Release|Version)/ {print substr($3,1,3)} /Edition (Release|Version)/ {printsubstr($5,1,3)}'`



Good Things To Know

(aka: Oracle for dummies/Phil)

Referencese and guides

Making a user than can actually LOG ON

create user username identified by password_here;
grant connect, resource to username;

Making a table that can be seen by others

create table pubtable (value1 int, value2 char);
create public synonym pubtable for pubtable;

How to list all visible tables

select table_name from cat;
However, be warned that this can spew out a LOT of tables. There are lots of system-level predefined "special" ones.

Random SQL hints

Finding primary/nonprimary keys for a table
select * from user_constraints where TABLE_NAME = "yourtable";
Finding column names/types for a table(in sqlplus only)
desc tablename;
Finding all database names
Remember that what mysql calls a "database", oracle actually calls a "schema". select ?? from v$?? Sorry, need to re-research this again. sigh.
Find current "schema" that you are in:
select sys_context( 'userenv', 'current_schema' ) from dual;
Change "current schema"
alter session set current_schema="SOME_SCHEMA";
Finding oracle session id (SID) from a unix process id
select SPID,SID,ADDR from v$process,v$session where ADDR = PADDR and SPID={UNIX pid} ;

Obscure reference

cdemo82.sql has a very special and interesting line in it, if you have access to the oracle account, but get locked out of the database.
PS: system/manager, sys/change_on_install

If you want to download oracle 8.1.7 for solaris INTEL for trial purposes, you can sometimes download it from http://demo.oracle.com.pl. It comes and goes from month to month, it seems.

Note that oracle for solaris x86 was tabled for a while.. (No Oracle 9) but now it is BACK! Oracle 10 ships for both Solaris sparc and x86. Yaaay!!


GUI tools under UNIX

If you then want an actual GUI tool under solaris, you could try odbcisql.

First , download the tclodbc library from sourceforge. Then download Odbcisql from Tom Poindexter's TCL page

Or as a simpler (but more memory-intensive) alternative, try DB Visualizer, (previously at www.minq.se) which is written in java, and pretty much always works. (whereas you may or may not have trouble getting other third-party stuff to talk to oracle across a network)
Note that if you specifically want to use the oracle jdbc drivers, configure the classpath for $ORACLE_HOME/jdbc/lib/classes_12.zip

Places to get 3rd party ODBC drivers, if you need them:

If you are interested in Oracle Parallel Server, you may be interested in this SunManagers archive


Feel free to email me any comments.
Written by: Philip Brown
Solaris Top Bolthole-Top Search Bolthole.com