Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Creating oracle db on linux
I've just set up a script to create an oracle 8.1.6 rdbms on RH linux
6.2, and it might be useful to someone else. And if anything is obviously
wrong or missing (or extraneous), I'd like to hear about it.
Here it is:
<fontfamily><param>Courier New</param><smaller>#!/bin/sh
#
# define the SID
#
ORACLE_SID=whatever ; export ORACLE_SID
ORACLE_HOME=/var/oracle/app/8.1.6 ; export ORACLE_HOME
ORACLE_BIN=$ORACLE_HOME/bin
#
# ensure the path
#
if test "`echo $PATH | grep -c $ORACLE_BIN`" -eq 0
then
PATH=$ORACLE_BIN:$PATH export PATH
fi
#
# make sure /etc/oratab is set up
#
if test ! -f /etc/oratab
then
echo "$ORACLE_SID:$ORACLE_HOME:Y" >/etc/oratab
else
line=`grep "^${ORACLE_SID}:" /etc/oratab`
if test "$line" = ""
then
echo "$ORACLE_SID:$ORACLE_HOME:Y" >>/etc/oratab
fi
fi
line=`grep "^${ORACLE_SID}:" /etc/oratab |head -1`
OnOff=`echo $line|cut -d: -f3`
if test "$OnOff" != "Y"
then
grep -v "^${ORACLE_SID}:" /etc/oratab >/tmp/oratab.temp
echo "$ORACLE_SID:$ORACLE_HOME:Y" >>/tmp/oratab.temp
cp /tmp/oratab.temp /etc/oratab
fi
#
# make sure there is no running instance
#
lines=`ps -fu oracle | grep -c "ora_[pP]mon_${ORACLE_SID}"`
if test "$lines" -eq "0"
then
true
# ok. no instance
else
# warning! I've modified dbshut to allow specifying an individual
# instance. This won't work with the generic dbshut. Of course, you
# can replace this with instructions piped to svrmgrl.
dbshut phoenix
fi
#
# clean up directories
#
# Don't give me any grief about OFA-compliance. This is a test setup. You
# can replace these paths with whatever you want.
#
DATA_BASE=/var/oracle/data/$ORACLE_SID ; export DATA_BASE
REDO_BASE=/var/oracle/redo/$ORACLE_SID ; export REDO_BASE
LOG_BASE=/var/oracle/logs/$ORACLE_SID ; export LOG_BASE
INIT_BASE=/var/oracle/init/$ORACLE_SID ; export INIT_BASE
rm -rf $DATA_BASE $REDO_BASE $LOG_BASE
mkdir -p $DATA_BASE $REDO_BASE $LOG_BASE $INIT_BASE
if test -f $INIT_BASE/init${ORACLE_SID}.ora
then
# file already exists. Don't screw with it, except to remove the
# rollback_segments section. Actually, this was necessary with
# 7.3.4, but may not be required with 8.x
sed -e 's/[<<Tab><<Space>]*rollback_segments.*/rollback_segments = (rb01)/' >$INIT_BASE/temp.ora <<$INIT_BASE/init${ORACLE_SID}.ora
else
# I have a 'generic' init.ora available to start from
cp $INIT_BASE/../initgeneric.ora $INIT_BASE/init${ORACLE_SID}.ora
fi
#
# now start actual creation stuff
#
# There is absolutely no significance to any of the individual tuning
# parameters or file sizes as far as this script is concerned. Fool
# with them all you like.
#
svrmgrl <<<< EOF
spool $LOG_BASE/creation.log
connect internal
startup nomount pfile="$INIT_BASE/temp.ora"
CREATE DATABASE phoenix
maxdatafiles 254
maxinstances 8
maxlogfiles 32
character set WE8ISO8859P1
DATAFILE '$DATA_BASE/system01.dbf' SIZE 100M AUTOEXTEND ON
LOGFILE '$REDO_BASE/redo01.log' SIZE 256K,
'$REDO_BASE/redo02.log' SIZE 256K,
'$REDO_BASE/redo03.log' SIZE 256K,
'$REDO_BASE/redo04.log' SIZE 256K,
'$REDO_BASE/redo05.log' SIZE 256K,
'$REDO_BASE/redo06.log' SIZE 256K,
'$REDO_BASE/redo07.log' SIZE 256K,
'$REDO_BASE/redo08.log' SIZE 256K,
'$REDO_BASE/redo09.log' SIZE 256K
NOARCHIVELOG; CREATE TABLESPACE rbs
DATAFILE '$DATA_BASE/rbs01.dbf' SIZE 100M;
CREATE TABLESPACE temp
DATAFILE '$DATA_BASE/temp01.dbf' SIZE 100M;
CREATE TABLESPACE tools
DATAFILE '$DATA_BASE/tools01.dbf' SIZE 100M;
CREATE TABLESPACE DATA DATAFILE '$DATA_BASE/data01.dbf' SIZE 250M;
CREATE ROLLBACK SEGMENT rb01 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb02 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb03 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb04 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb05 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb06 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb07 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb08 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb09 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
CREATE ROLLBACK SEGMENT rb10 TABLESPACE rbs
STORAGE (initial 500K next 500K minextents 2 maxextents 100 optimal 1M);
alter rollback segment rb01 online;
alter rollback segment rb02 online;
alter rollback segment rb03 online;
alter rollback segment rb04 online;
alter rollback segment rb05 online;
alter rollback segment rb06 online;
alter rollback segment rb07 online;
alter rollback segment rb08 online;
alter rollback segment rb09 online;
alter rollback segment rb10 online;
REM set up users
alter user sys temporary tablespace temp;
alter user system temporary tablespace temp default tablespace tools;
spool off
REM Run a ton o'scripts. Each one will get its own log file, so you can
REM check them afterwards to ensure they ran properly.
REM Run these as internal
spool ${LOG_BASE}/catalog.log
@${ORACLE_HOME}/rdbms/admin/catalog.sql
spool off
spool ${LOG_BASE}/catproc.log
@${ORACLE_HOME}/rdbms/admin/catproc.sql
spool off
spool ${LOG_BASE}/caths.log
@${ORACLE_HOME}/rdbms/admin/caths.sql
spool off
spool ${LOG_BASE}/catblock.log
@${ORACLE_HOME}/rdbms/admin/catblock.sql
spool off
spool ${LOG_BASE}/catio.log
@${ORACLE_HOME}/rdbms/admin/catio.sql
spool off
spool ${LOG_BASE}/catoctk.log
@${ORACLE_HOME}/rdbms/admin/catoctk.sql
spool off
spool ${LOG_BASE}/dbmspool.log
@${ORACLE_HOME}/rdbms/admin/dbmspool.sql
spool off
spool ${LOG_BASE}/userlock.log
@${ORACLE_HOME}/rdbms/admin/userlock.sql
spool off
spool ${LOG_BASE}/otrcsvr.log
@${ORACLE_HOME}/rdbms/admin/otrcsvr.sql
spool off
REM Run these as system/manager
connect system/manager
spool ${LOG_BASE}/pupbld.log
@${ORACLE_HOME}/sqlplus/admin/pupbld.sql
spool off
REM Run these as internal, for replication support
connect internal
spool ${LOG_BASE}/catrep.log
@${ORACLE_HOME}/rdbms/admin/catrep.sql
spool off
REM Run these for java support
spool ${LOG_BASE}/initjvm.log
@${ORACLE_HOME}/javavm/install/initjvm.sql
spool off
spool ${LOG_BASE}/initplsj.log
@${ORACLE_HOME}/rdbms/admin/initplsj.sql
spool off
spool ${LOG_BASE}/initaqjms.log
@${ORACLE_HOME}/rdbms/admin/initaqjms.sql
spool off
spool ${LOG_BASE}/initrepapi.log
@${ORACLE_HOME}/rdbms/admin/initrepapi.sql
spool off
disconnect
spool off
exit
EOF # now stuff that has to be run in sqlplus
sqlplus <<<< EOF Received on Wed Jun 14 2000 - 12:22:49 CDT