»   »   »

Setting up Oracle on Slackware Linux

Prelude

While there are many very good open-source (many of which are free) databases available for Linux, the truth of the marketplace is that the top two that you are quite likely to encounter in a work environment are Oracle and DB2. As I work most regularly in Oracle PL/SQL, I wanted Oracle installed (at a later stage, I would also like to install a copy of the PostgreSQL database as a free alternative).

The Oracle corporation allows you to install the Oracle 10g database for free if you are using it to teach yourself the database and are not using it commercially. If you wish to use it commercially, you will need to buy a license (or get a client of yours to buy one). Oracle only certifies the installation of Oracle on Redhat Enterprise Linux, SUSE Linux and United Linux, so the installation on Slackware Linux is a bit of a hack, and is unsupported (but not illegal).

References (none are Oracle on Slackware, but they're a good start):

official installation guides

http://www.akadia.com/services/ora_linux_install_10g.html

http://www.informatik.uni-freiburg.de/~dbis/lehre/db-prakt-sql-ws0304/oracle-linux.html

http://www.puschitz.com/InstallingOracle10g.shtml

Install of Oracle 10g

Here are the steps to take to get Oracle 10g up'n'running on Slackware 10...

Create Oracle user and install and management groups (as root):

groupadd dba
groupadd oinstall
adduser oracle   #make the initial group oinstall, and additional groups dba,users
    

Download (this may not work, in which case you will have to go to http://www.oracle.com to get the download):

wget http://download.oracle.com/otn/linux/oracle10g/ship.db.cpio.gz
    

unpack:

gunzip ship.db.cpio.gz
cpio -idmv < ship.db.cpio
    

If your swapdisk is less than a 1GB, then;

dd if=/dev/zero of=/directory/with/much/free/space/tempswap bs=1k count=1000000
chmod 600 tempswap
mke2fs tempswap
mkswap tempswap
swapon tempswap
    

Next, check required system memory, run this:

sysctl -a
    

And check those values against these:

Needed                             Check with
shmmax  = 2147483648               cat /proc/sys/kernel/shmmax
shmmni  = 4096                     cat /proc/sys/kernel/shmmni
shmall  = 2097152                  cat /proc/sys/kernel/shmall
shmmin  = 1                        ipcs -lm |grep "min seg size"
semmsl  = 250                      cat /proc/sys/kernel/sem | awk '{print $1}'
semmns  = 32000                    cat /proc/sys/kernel/sem | awk '{print $2}'
semopm  = 100                      cat /proc/sys/kernel/sem | awk '{print $3}'
semmni  = 128                      cat /proc/sys/kernel/sem | awk '{print $4}'
file-max = 65536                   cat /proc/sys/fs/file-max
ip_local_port_range = 1024 65000   cat /proc/sys/net/ipv4/ip_local_port_range
    

Note: Don't change the value of any kernel parameter on a system where it is already higher than listed as Needed.

If they are found lacking, modify /etc/sysctl.conf:

# Kernel Parameters for Oracle 10.1.0
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
    

Then, to make these values effective immediately (without a reboot), run:

sysctl -p
    

Then, create (or modify) your ~/.profile file to contain these settings:

# user-specific settings

PATH=$PATH:$HOME/bin

# Oracle Environment

ORACLE_BASE=/opt/oracle; export ORACLE_BASE
ORACLE_HOME=/opt/oracle; export ORACLE_HOME
ORACLE_SID=ROQDB; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
export TNS_ADMIN=$ORACLE_HOME/config
NLS_LANG=AMERICAN; export NLS_LANG
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/openwin/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/td/lib:/usr/ucblib:/usr/local/lib
export LD_LIBRARY_PATH fi
if [ -z $CLASSPATH ]
then
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
export CLASSPATH
else
CLASSPATH=$CLASSPATH:$ORACLE_HOME/JRE:$ORACLE_HOME/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export CLASSPATH
fi
ORAENV_ASK=NO

#set shell search paths
PATH=$PATH:$ORACLE_HOME/bin
    

Now, on to the install (as root):

mkdir /opt/oracle
chown oracle /opt/oracle
chgrp oinstall /opt/oracle
    

As user oracle (from an xterminal):

cd Disk1
./runInstaller -ignoreSysPrereqs
    

Here were my selections...

Destination; Name: OraDB10g_home1, Path: /opt/oracle

Installation Type: Enterprise Edition

Chose "General Purpose" starter database

Global database name: ROQDB.myhost

SID: ROQDB

I chose NOT to create sample schemas.

Here's the errors I got during the install (none of these prevented the final database from working):

Exception String: Error in invoking target 'ihsodbc sdo_on' of makefile 
'/opt/oracle/rdbms/lib/ins_rdbms.mk'. 
See '/opt/oracle/oraInventory/logs/installActions2004-08-18_01-11-55PM.log' 
for details.
(I ignored this, the installation continued.)

Exception String: Error in invoking target 'utilities all_no_orcl' of makefile 
'/opt/oracle/rdbms/lib/ins_rdbms.mk'. 
See '/opt/oracle/oraInventory/logs/installActions2004-08-18_01-11-55PM.log' 
for details.
(I also ignored this.)
    

During the run of the Database Configuration Assistant I got these errors:

ORA-27123: unable to attach to shared memory segment
When I selected "Ignore":
ORA-01034: ORACLE not available
    

(Had to then "Abort", but once I'd ajusted the shared memory,

it ran through fine.)

I then got this error when I tried to connect to the DB:

ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
But that was fixed when I updated my [.profile] file (as shown earlier).
    

Once done, here's how you test if the database starts up:

sqlplus /nolog

conn / as sysdba

startup
    

The simplest way to configure Oracle's network connectivity is to use netca; here were my selections:

Listener Configuration: 
Add/Reconfigure 
LISTENER 
TCP 
Use Standard Port of 1521

Naming Methods Configuration:
Local Naming

Local Net Service Name Configuration:
Add/Reconfigure
ROQDB
Service Name: ROQDB
TCP
Host Name: myhost
Use Standard Port of 1521
Then test it.
    

And here are the files that were generated...

(/opt/oracle/config/ldap.ora):

# ldap.ora Network Configuration File: /opt/oracle/config/ldap.ora
# Generated by Oracle configuration tools.

DIRECTORY_SERVERS= (192.168.2.173:389:636)

DIRECTORY_SERVER_TYPE = OID
    

(/opt/oracle/config/listener.ora):

# listener.ora Network Configuration File: /opt/oracle/config/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /opt/oracle)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.mydomain.org)(PORT = 1521))
      )
    )
  )
    

(/opt/oracle/config/sqlnet.ora):

# sqlnet.ora Network Configuration File: /opt/oracle/config/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    

(/opt/oracle/config/tnsnames.ora):

# tnsnames.ora Network Configuration File: /opt/oracle/config/tnsnames.ora
# Generated by Oracle configuration tools.

ROQDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ROQDB)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ROQDB)
    )
  )
    

If you have trouble getting tnsping to work, try the following:

Back up all the .ora files in /opt/oracle/config, then copy these files into this directory:

cp /opt/oracle/network/admin/sqlnet.ora /opt/oracle/config/
cp /opt/oracle/network/admin/listener.ora /opt/oracle/config/
cp /opt/oracle/network/admin/tnsnames.ora /opt/oracle/config/
    

Now it's time to set things up so Oracle automatically starts up when Linux starts:

cat > /etc/rc.d/rc.dbora
#!/bin/sh
#
# dbora   This scripts starts and shuts down the
# oracle database
#
# chkconfig: 345 99 10
# description: This script calls the dbstart script
# to start Oracle
#              and dbshut to stop it
# processname: oracle*
# config: /etc/oratab
#
# Set ORACLE_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 ORACLE_HOME.

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle
export ORACLE_SID=ROQDB

ORACLE_HOME=/opt/oracle
ORA_OWNER=oracle

if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
  echo "Oracle startup: cannot start"
  exit
fi

case "$1" in
'start')
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" &
;;
'stop')
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
;;
'restart')
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
  sleep 15
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start " &
;;

esac
    

Then, make it executable:

chmod 755 /etc/rc.d/rc.dbora
    

Then add this code to the /etc/rc.d/rc.M file:

# Start Oracle - roq
if [ -x /etc/rc.d/rc.dbora ]; then
  . /etc/rc.d/rc.dbora start
fi
    

Then add this code to /etc/rc.d/rc.K (above the "# Kill all processes" line) and to /etc/rc.d/rc.0:

# Shut down Oracle - roq
if [ -x /etc/rc.d/rc.dbora ]; then
  . /etc/rc.d/rc.dbora stop
fi
    

Then edit the /etc/oratab file to insert your database for the autostart, the format of the line you need is: SID:ORACLE_HOME:AUTO_START:

ROQDB:/opt/oracle:Y
    

NOTE if you still have difficulty starting, add the oracle group to the root user: usermod -g oracle root

To allow other applications to connect to Oracle, it may be necessary to add the following to /etc/profile:

export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle
export ORACLE_SID=ROQDB
    

If you want to access the Oracle Enterprise Manager (OEM), then you need to have started the service: /opt/oracle/bin/emctl start dbconsole

Then you can browse to it using: http://localhost:5500/em

If you want to use the web version of SQL*Plus then you need to have started it: /opt/oracle/bin/isqlplusctl start

If you need to check your log-files, you can find them here: /opt/oracle/admin/ROQDB

Questions?

Oracle help can be found at the Oracle Technology Network, The Oracle Usenet Newsgroup, or just use Google.

© Roqet :: 2022-03-01 16:07:34