日期:2014-05-16 浏览次数:20518 次
# This file is used by ORACLE utilities. It is created by root.sh # and updated by the Database Configuration Assistant when creating # a database. # A colon, ':', is used as the field terminator. A new line terminates # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:<N|Y>: # # The first and second fields are the system identifier and home # directory of the database respectively. The third filed indicates # to the dbstart utility that the database should , "Y", or should not, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # # xxxx:/opt/app/oracle/product/10.2:Y
cd /etc/ vi oratab 复制上面的内容粘贴进去 然后输入:wq
首先打开/etc/profile vi /etc/profile 在文件的最后面添加如下代码 export ORACLE_HOME="oracle的安装路径" export ORACLE_SID=orcl export PATH=$ORACLE_HOME/bin:$PATH
cd /etc/init.d
vi oracle
复制下面的代码
#!/bin/sh
# chkconfig: 35 80 10
# description: Oracle auto start-stop script.
#
# Set ORA_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 ORA_HOME.
ORA_HOME=/opt/app/oracle/product/10.2
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi
case "$1" in
'start')
# Start the Oracle databases:
echo "Starting Oracle Databases ... "
echo "-------------------------------------------------" >> /var/log/oracle.log
date +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle.log
echo "-------------------------------------------------" >> /var/log/oracle.log
su - $ORA_OWNER -lc "$ORA_HOME/bin/dbstart" >> /var/log/oracle.log
echo "Done"
# Start the Listener:
echo "Starting Oracle Listeners ... "
echo "-------------------------------------------------" >> /var/log/oracle.log
date +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracle.log
echo "-------------------------------------------------" >> /var/log/oracle.log
su - $ORA_OWNER -lc "$ORA_HOME/bin/lsnrctl start" >>/var/log/oracle.log
echo "Done."
echo "-------------------------------------------------" >> /var/log/oracle.log
date +" %T %a %D : Finished." >> /var/log/oracle.log
echo "-------------------------------------------------" >> /var/log/oracle.log
;;
'stop')
# Stop the Oracle Listener:
echo "Stoping Oracle Listeners ... "
echo "-------------------------------------------------" >> /var/log/oracle.log
date +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracle.log
echo "-------------------------------------------------" >> /var/log/oracle.log
su - $ORA_OWNER -lc "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracle.log
echo "Done."
# Stop the Oracle Database:
echo "Stoping Oracle Databases ... "
echo "-------------------------------------------------" >> /var/log/oracle.log
date +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracle.log
echo "-------------------------------------------------" >> /var/log/oracle.log
su - $ORA_OWNER -lc "$ORA_HOME/bin/dbshut" >>/var/l