LDP/LDP/howto/linuxdoc/Oracle-7-HOWTO.sgml

780 lines
30 KiB
Plaintext

<!doctype linuxdoc system>
<article>
<!-- Title Information -->
<title>Oracle Database HOWTO
<author>Paul Haigh, <tt/paul@nailed.demon.co.uk/
<date>v1.2, 4 August 1998
<abstract>
A guide to installing and configuring the Oracle Database Server on a Linux system
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin -->
<sect>Introduction
<sect1>Version History
<p>
<itemize>
<item><tt>v0.1 - 21 Feb 1998 - Paul Haigh - Original Version.</tt>
<item><tt>v0.2 - 01 Mar 1998 - Paul Haigh - Comments From Proofreaders Added. </tt>
<item><tt>v1.0 - 10 Mar 1998 - Paul Haigh - First Release to LDP. </tt>
<item><tt>v1.1 - 20 Jun 1998 - Paul Haigh - Added troubleshooting section & general tidyup. </tt>
<item><tt>v1.2 - 04 Aug 1998 - Paul Haigh - Added Oracle Corp News & Removed Section on Future Enhancements. </tt>
</itemize>
<sect1>Copyright
<p>
The Oracle Database HOWTO copyright (c) 1998, Paul Haigh.
<p>
Like all Linux HOWTO documents, this may be reproduced and distributed in whole or in part, in any medium, physical or electronic, so long as this copyright notice is retained on all copies.
<p>
Commercial redistribution is allowed and encouraged; however the author would like to be notified of such distributions. You may translate this HOWTO into any language whatsoever provided that you leave this copyright statement and disclaimer intact, and that you append a notice stating who translated the document.
<sect1>Disclaimer
<p>
While I have tried to include the most correct and up to date information available to me, I cannot guarantee that usage of information in this document does not result in loss of data or equipment. I provide NO WARRANTY about the information in the HOWTO and I cannot be made liable for any consequences resulting from using the information in this HOWTO.
<sect1>Aim of the HOWTO
<p>
In this HOWTO I will attempt to cover installation and basic admin of an Oracle database running on a Linux machine. In particular I will cover Oracle server installation, SQL*Net configuration and client configuration.
<p>
This document is not an in depth tutorial on using or administering an Oracle database, if that is what you are looking for there are great books on those subjects published by O'Reilly and others.
<p>
I am also not going to cover the development of Oracle programs under UNIX. If this is absolutley necessary to you then I would recommend that you purchase the SCO development system (with OpenServer 5.x) from SCO, which I am told can be obtained for a very reasonable US $19, from <tt/www.sco.com/.
<sect1>Requirements
<p>
I am assuming a number of items that you will need for following the HOWTO.
<itemize>
<item><bf>Oracle Server CD for SCO Openserver (Version 7.3.3.0.0.)</bf>
<descrip>
This <bf>must</bf> be a legal copy. Remember that Oracle are a profit making company and charge for their products. If you want a free SQL compliant database use PostgresSQL or similar.
It is also possible to install oracle, using a 60 day evaluation licence, from a downloadable <tt/tar/ file from the Oracle web site. I have not personally tried this and it is completely unverified.
</descrip>
<item><bf>A Linux Server</bf>
<descrip>
You wouldn't be reading this without one...would you?
</descrip>
<item><bf>Kernel 2.0.30+</bf>
<descrip>
I cannot guarantee that these instructions will be accurate for any other Kernel. (Not that I am guaranteeing it for 2.0.30 either...).
</descrip>
<item><bf>iBCS</bf>
<descrip>
It is very important to have this installed and working with the latest possible version for your platform. (I am using iBCS-2.0-10.i386.rpm from Redhat Linux).
</descrip>
<item><bf>Lots of disc space</bf>
<descrip>
600 Mb+ is a reasonable amount. It is possible to install with less but you need to make some sacrifices, and I never like starting with those. However, I will attempt to point out areas in which space can be freed up.
</descrip>
<item><bf>32Mb+ Ram</bf>
<descrip>
I know that this sounds like a lot, especially in Linux terms, but remember that Oracle is a complex piece of software. You wouldn't have the same reservations on SCO!
<p>
I am not saying that Oracle doesn't work with less, just that it is less than Oracle recommend and I wouldn't suggest it.
</descrip>
<item><bf>Licenses from Oracle</bf>
<descrip>
I know that I have already mentioned this but I want to be clear that this is important. Using software from Oracle without a license is illegal.
</descrip>
</itemize>
<sect1>News From Oracle Corporation
<p>
Oracle have bowed into pressure from the Linux community. Oracle Corporation have decided to <bf>officially</bf> support Oracle 8 on the Linux (i386) platform. This should be released in December 1998, according to the Oracle website.
<p>
Better still Oracle will also be porting <tt>Oracle Applications</tt> to the linux platform. This should be available in the first half of 1999, according to the Oracle website.
<p>
References:
<itemize>
<item><tt><htmlurl url="http://www.oracle.com/html/linux.html" name="http://www.oracle.com/html/linux.html"></tt>
<item><tt><htmlurl url="http://www.news.com/News/Item/0,4,24436,00.html" name="http://www.news.com/News/Item/0,4,24436,00.html"></tt>
<item><tt><htmlurl url="http://www.zdnet.com/pcweek/news/0720/20morac.html" name="http://www.zdnet.com/pcweek/news/0720/20morac.html"></tt>
</itemize>
<sect>Installing the Oracle Software
<sect1>Server Preparation
<sect2>Creating an Oracle User
<p>
Unsurprisingly we require a user to hold the Oracle database. Since we have no desire to relink the Oracle kernel (more about that later) we have to accept the Oracle defaults for user name and group name. This includes the user ORACLE and the group DBA.
<enum>
<item>Login as Root
<p>
<item>Create the oracle user and the group dba.
<tscreen><code>
$ groupadd dba
$ useradd oracle
</code></tscreen>
<item> Ensure a home directory is created for the user oracle.
<tscreen><code>
$ mkdir /home/oracle
$ mkdir /home/oracle/7.3.3.0.0 (Version of Oracle)
$ chown -R oracle.dba /home/oracle
</code></tscreen>
</enum>
<sect1>Installing from CDROM
<p>
Unfortunately the Oracle Installer on the SCO disc will not work. A variety of problems can be experienced, from core dumps to hangs. As a result we need to copy the files from the CDROM manually and uncompress them:
<p>
(Ensure the CDROM is mounted on the system).
<enum>
<item>Log on as Oracle
<item>Change directory to <tt>/home/oracle/7.3.3.0.0.</tt>
<item>Copy all install files from CDROM
<tscreen><code>
$ cp -a /mnt/cdrom/* .
</code></tscreen>
<item>Un-compress all Oracle files on CDROM.
<tscreen><code>
$ find . -name *_ -exec ~/7.3.3.0.0/orainst/oiuncomp {} \;
</code></tscreen>
</enum>
<sect1>Post Installation Tasks
<sect2>Tasks for Root
<p>
Add the following lines to <tt>/etc/profile</tt> or add to the <tt/.profile/ for each user who is going to use Oracle.
<tscreen><code>
# Oracle Specific
ORACLE_HOME=/home/oracle/7.3.3.0.0
ORACLE_SID=orcl
ORACLE_TERM=vt100
export ORACLE_HOME ORACLE_SID ORACLE_TERM
# Alter path for Oracle
PATH="$PATH:$ORACLE_HOME/bin"
</code></tscreen>
<p>
We also need to change the owner and permissions of the Oracle ulimit increase utility.
<tscreen><code>
$ chown root.root $ORACLE_HOME/bin/osh
$ chmod u+s $ORACLE_HOME/bin/osh
</code></tscreen>
<sect2>Tasks for Oracle
<p>
Change permissions for the Oracle files to ensure correct operation.
<tscreen><code>
$ chmod +x $ORACLE_HOME/bin/*
$ chmod u+s $ORACLE_HOME/bin/oracle
</code></tscreen>
<p>
Oracle tools require the messages to be in the <tt>$ORACLE_HOME/tool_name/mesg</tt> directory.
So, move the <tt/msb/ files from the <tt/msg_ship/ directories to the <tt/mesg/ directories.
<tscreen><code>
$ mv $ORACLE_HOME/plsql/mesg/mesg_ship/* $ORACLE_HOME/plsql/mesg/.
$ mv $ORACLE_HOME/rdbms/mesg/mesg_ship/* $ORACLE_HOME/rdbms/mesg/.
$ mv $ORACLE_HOME/svrmgr/mesg/mesg_ship/* $ORACLE_HOME/svrmgr/mesg/.
</code></tscreen>
Create the following directories if they do not exist:
<tscreen><code>
$ mkdir $ORACLE_HOME/rdbms/log
$ mkdir $ORACLE_HOME/rdbms/audit
$ mkdir $ORACLE_HOME/network/log
</code></tscreen>
<sect2>Things you can remove
<p>
The following directories can safely be removed:
<itemize>
<item><tt>$ORACLE_HOME/guicommon2/</tt>
<item><tt>$ORACLE_HOME/ctx/</tt>
<item><tt>$ORACLE_HOME/md/</tt>
<item><tt>$ORACLE_HOME/mlx/</tt>
<item><tt>$ORACLE_HOME/precomp/</tt>
<item><tt>$ORACLE_HOME/slax/</tt>
</itemize>
<sect>Creating a Database
<p>
Now the Oracle server is installed we need to create a database to test the installation.
<p>
<tt/If you are using Oracle 7.2.x or earlier, please read the troubleshooting section below./
<sect1>Create the Initialisation File
<p>
Copy the <tt>$ORACLE_HOME/dbs/init.ora</tt> to <tt>$ORACLE_HOME/dbs/initorcl.ora</tt>:
<tscreen><code>
$ cd $ORACLE_HOME/dbs
$ cp init.ora initorcl.ora
</code></tscreen>
Modify it by adding the following lines:
<tscreen><code>
db_name = orcl
COMPATIBLE=7.3.3.0.0
</code></tscreen>
<sect1>Creating the Database Install Script
<p>
Create a script file called makedb.sql in the <tt>$ORACLE_HOME/dbs</tt> directory:
<tscreen><code>
connect internal
startup nomount
set echo on
spool makedb.log
create database orcl
maxinstances 1
maxlogfiles 8
datafile '$ORACLE_HOME/dbs/orcl_syst_01.dbf' size 40M reuse
logfile
'$ORACLE_HOME/dbs/orcl_redo_01.dbf' size 1M reuse,
'$ORACLE_HOME/dbs/orcl_redo_02.dbf' size 1M reuse,
'$ORACLE_HOME/dbs/orcl_redo_03.dbf' size 1M reuse;
@$ORACLE_HOME/rdbms/admin/catalog.sql
create tablespace rollback
datafile '$ORACLE_HOME/dbs/orcl_roll_01.dbf' size 8.5M reuse;
create tablespace temp
datafile '$ORACLE_HOME/dbs/orcl_temp_01.dbf' size 5M reuse
temporary;
create tablespace users
datafile '$ORACLE_HOME/dbs/orcl_user_01.dbf' size 10M reuse;
create rollback segment r1 tablespace rollback
storage ( optimal 5M );
alter rollback segment r1 online;
connect system/manager
@$ORACLE_HOME/rdbms/admin/catdbsyn.sql
connect internal
@$ORACLE_HOME/rdbms/admin/catproc.sql
connect system/manager
@$ORACLE_HOME/sqlplus/admin/pupbld.sql
spool off
exit
</code></tscreen>
<sect1>Running the Database Installation Script
<p>
Start <tt/svrmgrl/ and run the script:
<tscreen><code>
$ cd $ORACLE_HOME/dbs
$ svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> startup nomount
ORACLE instance started.
Total System Global Area 4313312 bytes
Fixed Size 41876 bytes
Variable Size 4140364 bytes
Database Buffers 122880 bytes
Redo Buffers 8192 bytes
SVRMGR> @makedb
<loads of messages>
SVRMGR> exit
Server Manager complete.
</code></tscreen>
<sect1>Starting the Database
<p>
Firstly, we need to bring up the database by hand (we will automate this later on). To startup an Oracle database we need to issue the <tt>startup</tt> command when connected internally:
<tscreen><code>
$ svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> startup
ORACLE instance started.
Total System Global Area 4313316 bytes
Fixed Size 41876 bytes
Variable Size 4140368 bytes
Database Buffers 122880 bytes
Redo Buffers 8192 bytes
Database mounted.
Database opened.
SVRMGR> exit
Server Manager complete.
</code></tscreen>
<sect1>Stopping the Database
<p>
It is worth mentioning here that restarting a Linux server without shutting down the Oracle database first there is a high risk of corrupting the database.
<p>
So, before we issue the Linux <tt>shutdown</tt> command it is wise to bring down the database:
<tscreen><code>
$ svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> exit
Server Manager complete.
</code></tscreen>
<sect1>Create a Default User
<p>
The database, as created, has a two special users which are automatically created. These are:
<tscreen><code>
Username Password
SYSTEM MANAGER
SYS change_on_install
</code></tscreen>
<p>
These users are typically used to hold the standard data dictionary information for the database. It is a good idea to change the passwords from the defaults as soon as possible.
<p>
This can be achieved by:
<tscreen><code>
sqlplus system/manager
SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998
Copyright (c) Oracle Corporation 1979, 1996. All rights reserved.
Connected to:
Oracle7 Server Release 7.3.3.0.0 - Production Release
SQL> alter user system identified by <newpassword>;
User altered.
SQL> alter user sys identified by <newpassword>;
User altered.
SQL> exit;
Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
</code></tscreen>
<p>
Since the user <tt>system/manager</tt> is similar to using <tt/root/ on a UNIX machine, we need to create a user with less ability to cause damage. (remember to bring up the database before attempting to create a user)
<p>
Connect to SQL*Plus and create a user:
<tscreen><code>
$ sqlplus system/manager
SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998
Copyright (c) Oracle Corporation 1979, 1996. All rights reserved.
Connected to:
Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
SQL> create user <user> identified by <psw>
2 default tablespace users
3 temporary tablespace temp;
User created.
SQL> grant connect, resource to <user>
Grant succeeded.
SQL> exit
Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
</code></tscreen>
<p>
Now that you have a new user on the system you can play with the new system. To login to the Oracle database:
<tscreen><code>
$ sqlplus <user>/<password>
</code></tscreen>
<p>
If this completes with no error messages then you have a working Oracle database. If you never want to connect to this database from anywhere but this server then the job is complete, enjoy!
<p>
If, however, like most people you want to configure the networking software so that you can connect from other machines, keep on reading.
<sect>Configuring SQL*Net on the Server
<p>
All of these files configure the Oracle networking software (SQL*Net, aka Net8 for Oracle8). These files should all be created on the server in the <tt>$ORACLE_HOME/network/admin</tt> directory.
<sect1><tt>tnsnames.ora</tt>
<p>
The <tt/TNSNAMES.ORA/ file identifies services available from the machine. On our instance here we will describe all databases that the server has mounted. For each database instance on your server add a section like below:
<tscreen><code>
orcl.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = <INSERT HOST NAME OF SERVER HERE> )
(Port = 1521)
)
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = <INSERT HOST NAME OF SERVER HERE> )
(Port = 1526)
)
)
(CONNECT_DATA = (SID = ORCL)
)
)
</code></tscreen>
<sect1><tt>listener.ora</tt>
<p>
The <tt>listener.ora</tt> file contains the descriptions of the services that other machines are allowed to connect to and any configuration that is required for the server listener.
<p>
It contains sections for the listener name, listener address, databases served by the listener and configuration parameters.
<p>Here is an example:
<tscreen><code>
# Name of listener and addresses to listen on
LISTENER =
( ADDRESS_LIST =
(ADDRESS =
(PROTOCOL=tcp)
(HOST=<INSERT HOST>)
(PORT=1521)
(COMMUNITY=UK_SUP_TCPIP)
)
(ADDRESS =
(PROTOCOL=ipc)
(KEY=700)
(COMMUNITY=UK_SUP_TCPIP)
)
)
# List of services served by this listener
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=orcl)
(ORACLE_HOME=/home/oracle/7.3.3.0.0)
)
)
# Start of configuration parameters.
TRACE_LEVEL_LISTENER=OFF
TRACE_FILE_LISTENER = "listener"
LOG_FILE_LISTENER = "listener"
CONNECT_TIMEOUT_LISTENER = 10
STOP_LISTENER = YES
DBA_GROUP = dba
</code></tscreen>
<sect1><tt>sqlnet.ora</tt>
<p>
The <tt>sqlnet.ora</tt> file contains configuration for the particular node of the network. This is independent of the number of databases or the number of listeners. The most important thing in this file is the <tt>Dead Connection Timeout</tt> configuration variable.
<p>
Dead connection timeout checks every incoming process to a database instance and ensures that the client end of it is still responding. If the client (of whatever type) is not responding then the Oracle server shadow process is killed.
<p>
This is very useful if you have many clients accessing a database, especially during a developmental phase when those clients are more likely to be failing to exit cleanly from the Oracle database.
<p>
Below is a copy of my own <tt>sqlnet.ora</tt> file for you to puruse:
<tscreen><code>
TRACE_LEVEL_CLIENT = OFF
sqlnet.expire_time = 30 # The number of seconds between client checks.
names.default_domain = world
name.default_zone = world
</code></tscreen>
<sect1>Starting and Stopping the Listeners
<p>
Now that the configuration of the listeners and SQL*Net is complete we can attempt to connect to the database using the networking software. (Before we were using direct links to the database, whereas here we are simulating a connection from a remote client machine).
<p>
To start the listener using the above configuration:
<tscreen><code>
$ lsnrctl
LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:38:25
Copyright (c) Oracle Corporation 1994. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
Starting /home/oracle/7.3.3.0.0/bin/tnslsnr: please wait...
TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production
System parameter file is /home/oracle/7.3.3.0.0/network/admin/listener.ora
Log messages written to /home/oracle/7.3.3.0.0/network/log/listener.log
Listening on: (ADDRESS=(PROTOCOL=tcp)(DEV=6)(HOST=192.168.1.1)(PORT=1521))
Listening on: (ADDRESS=(PROTOCOL=ipc)(DEV=10)(KEY=700))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production
Start Date 23-FEB-98 20:38:50
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
SNMP ON
Listener Parameter File /home/oracle/7.3.3.0.0/network/admin/listener.ora
Listener Log File /home/oracle/7.3.3.0.0/network/log/listener.log
Services Summary...
orcl has 1 service handler(s)
The command completed successfully
LSNRCTL> exit
</code></tscreen>
<p>
To stop the listeners:
<tscreen><code>
$ lsnrctl
LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:43:20
Copyright (c) Oracle Corporation 1994. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> stop
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP))
The command completed successfully
LSNRCTL> exit
</code></tscreen>
<p>
If you have a DNS setup which doesn't return the IP address for the hostname specified then starting and stopping the listener can take some time (2-3 mins. dependant on the DNS timeout variable). If this is the case, don't worry, be patient.
<sect>Client Configuration
<sect1>Windows Clients
<p>
SQL*Net configuration on the PC using newer versions of the Oracle Client Software is very easy. The best (and easiest) way of achiving a fully working client installation is to use the <tt>SQL*Net Easy Configuration</tt> tool supplied by Oracle.
<p>
This toolhas a wizard type interface to take you through the installation of the <tt/tnsnames.ora/ and <tt/sqlnet.ora/ files.
<p>
Select "Add Database Alias" and enter a name for the alias when prompted. This alias is the name you will refer to the database instance as, and as such should be the same as the instance name (orcl in this case).
<p>
Select TCP/IP as the protocol, and when prompted the hostname of the machine hosting the database and the instance name of the database.
<p>
That's it.
<p>
However, if you do not have the <tt>SQL*Net Easy Configuration</tt> Tool then don't worry. You can simply create the <tt>tnsnames.ora</tt> and the <tt>sqlnet.ora</tt> files in the <tt>$ORACLE_HOME/network/admin</tt> directory on the client exactly as they are on the server. This will provide an alias the same as on the server (always a good idea anyway).
<sect1>Unix Clients
<p>
UNIX clients are not very different that windows clients. If you have the <tt/Network Manager/ from Oracle then user that in the same way as above, if not then you can, again, just use the same configuration files as the server in the <tt>$ORACLE_HOME/network/admin</tt> directory.
<sect>Automatic Startup and Shutdown
<sect1><tt/dbstart/ & <tt/dbstop/
<p>
The automatic startup and shutdown of the Oracle database can be achieved (in 7.3.3.0.0) with the files <tt/dbstart/ and <tt/dbshut/ both provided by Oracle. These files rely on the existance of the file <tt>/etc/oratab</tt> to work (although by altering the <tt/dbshut/ and <tt/dbstart/ files this can be moved).
<p>
The format of the <tt>/etc/oratab</tt> file is as follows:
<tscreen><code>
SID:ORACLE_HOME:AUTO
</code></tscreen>
<p>
An example:
<tscreen><code>
orcl:/home/oracle/7.3.3.0.0:Y
leaveup:/home/oracle/7.3.2.1.0:N
</code></tscreen>
<sect1><tt/init.d/ & <tt/rc.d/
<p>
To start and stop the database when the machine comes up and goes down by modifying the startup routines for the Linux machine. This is quite easy, although I should point out here that this may change depending on which flavour of Linux (slackware, debian, redhat, etc). I will show examples which work for Redhat Linux 5.0. To modify these for your own flavour of Linux, please see your Linux documentation sets. (Although it should hold true for any Sys V type UNIX).
<p>
Firstly, we need to create the script which will run <tt/dbshut/ and <tt/dbstart/ in the <tt>/etc/rc.d/init.d</tt> directory. Create the following file as <tt>/etc/rc.d/init.d/oracle</tt>:
<tscreen><code>
#!/bin/sh
#
# /etc/rc.d/init.d/oracle
# Description: Starts and stops the Oracle database and listeners
# See how we were called.
case "$1" in
start)
echo -n "Starting Oracle Databases: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c dbstart >> /var/log/oracle
echo "Done."
echo -n "Starting Oracle Listeners: "
su - oracle -c "lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
stop)
echo -n "Shutting Down Oracle Listeners: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Shutting Down Oracle Databases as part of system down." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c "lsnrctl stop" >> /var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
echo -n "Shutting Down Oracle Databases: "
su - oracle -c dbshut >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
;;
restart)
echo -n "Restarting Oracle Databases: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Restarting Oracle Databases as part of system up." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c dbstop >> /var/log/oracle
su - oracle -c dbstart >> /var/log/oracle
echo "Done."
echo -n "Restarting Oracle Listeners: "
su - oracle -c "lsnrctl stop" >> /var/log/oracle
su - oracle -c "lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
*)
echo "Usage: oracle {start|stop|restart}"
exit 1
esac
</code></tscreen>
<p>
It is worth checking that this file actually correctly stops and starts the databases for your system. Check the log file, <tt>/var/log/oracle</tt> for error messages.
<p>
Once this script is working we need to create start and kill symbolic links in the appropriate runlevel directories <tt>/etc/rc.d/rcX.d</tt>.
<p>
The following commands will ensure that the databases will come up in runlevels 2,3 and 4:
<tscreen><code>
$ ln -s ../init.d/oracle /etc/rc.d/rc2.d/S99oracle
$ ln -s ../init.d/oracle /etc/rc.d/rc3.d/S99oracle
$ ln -s ../init.d/oracle /etc/rc.d/rc4.d/S99oracle
</code></tscreen>
<p>
To stop the databases on reboot or restart we need the following links:
<tscreen><code>
$ ln -s ../init.d/oracle /etc/rc.d/rc0.d/K01oracle # Halting
$ ln -s ../init.d/oracle /etc/rc.d/rc6.d/K01oracle # Rebooting
</code></tscreen>
<sect>Other Bits
<sect1>Intelligent Agent
<p>
If you have a need for the <tt>Oracle Intelligent Agent</tt>, I found that you can run it without any configuration changes. To start the IA try:
<tscreen><code>
$ lsnrctl dbsnmp_start
</code></tscreen>
<p>
To stop the IA try:
<tscreen><code>
$ lsnrctl dbsnmp_stop
</code></tscreen>
<p>
There do not appear to be any messages indicating a sucessful or otherwise start or stop of the intelligent agent. However, the IA responded to Enterprise manager on the client side so I can only assume that it is working.
<sect>Troubleshooting
<p>
See below for various troubleshooting hints.
<sect1>I cannot create a database when using Oracle 7.2.x.
<p>
The files shipped by Oracle in the 7.2.x product are incorrect in assuming that you want to setup a parallel server configuration. The shipped <tt/init.ora/ file has the following line in it:
<tscreen><code>
# define parallel server (multi-instance) parameters
ifile = ora_system:initps.ora
</code></tscreen>
To fix the problem simply comment it out:
<tscreen><code>
# define parallel server (multi-instance) parameters
#ifile = ora_system:initps.ora
</code></tscreen>
<sect1>I'm getting segmentation faults in <tt/svrmgrl/ under version 7.3.4.x.
<p>
I've had this problem reported to me by a number of people. Gerald Weber <tt/gerald_weber@master.co.at/ solved it:
<tscreen><code>
Hi Paul,
first of all thanks for your help,but none of the possible problems you are
thinking about were responsible for my problem.
The problem is the iBCS-emulator itself.
It seems that Oracle performs an sysconf-calls which isn't supported in the
current version of iBCS.
Look at the trace :
<7>[22]615 sysconf(34)
<7>iBCS2 unsupported sysconf call 34
<7>[22]615 sysconf error return linux=-22 -> ibcs=22 <Invalid argument>
<7>[24]615 sysconf(34)
<7>iBCS2 unsupported sysconf call 34
<7>[24]615 sysconf error return linux=-22 -> ibcs=22 <Invalid argument>
Solution: patching the iBCS-source.apply the following diff-pach :
--- sysconf.c Sun Apr 19 19:19:15 1998
+++ sysconf.c.ori Sun Apr 19 19:28:45 1998
@@ -60,7 +60,6 @@
#define _SC_JOB_CONTROL 5
#define _SC_SAVED_IDS 6
#define _SC_VERSION 7
-#define _SC_HACK_FOR_ORACLE 34
#define _SC_PAGESIZE 11
@@ -97,11 +96,6 @@
case _SC_SAVED_IDS: {
return (1);
}
-
- case _SC_HACK_FOR_ORACLE: {
- return (1);
- }
-
case _SC_PAGESIZE: {
return PAGE_SIZE;
</code></tscreen>
<sect>Credits
<p>
This document was based on a document written by Bob Withers, <tt>bwit@pobox.com</tt>.
Additional information taken from documents written by Georg Rehfeld, <tt>rehfeld@wmd.de</tt> and David Mansfield, <tt>david@claremont.com</tt>.
<p>
Additional proof reading done by Bob Withers, Mark Watling, <tt>mwatling@mjw-ltd.demon.co.uk</tt>, Peter Sodhi, <tt>petersodhi@unn.unisys.com</tt> and Greg Hankins, <tt>greg.hankins@cc.gatech.edu</tt>.
<p>
My thanks go to the tremendous support from all the people involved in this document and the research that has gone into it. Particular thanks to Bob Withers and Mark Watling for the additional comments and help they have provided.
</article>