Last login: Mon Oct 29 11:47:17 2007
[root@supercity root]# cd /
[root@supercity /]# cd etc
[root@supercity etc]# ls
a2ps.cfg CORBA gconf imrc localtime ntp printcap.local rpm termcap
a2ps-site.cfg cron.d gimp init.d log.d ntp.conf printconf.local samba tux.mime.types
adjtime cron.daily gnome initlog.conf login.defs oaf profile sane.d updatedb.conf
aep cron.hourly gnome-vfs-2.0 inittab logrotate.conf odbc.ini profile.d scrollkeeper.conf updfstab.conf
aep.conf cron.monthly gnome-vfs-mime-magic inputrc logrotate.d odbcinst.ini protocols securetty updfstab.conf.default
aeplog.conf crontab gpm-root.conf ioctl.save ltrace.conf openldap pwdb.conf security vfontcap
alchemist cron.weekly group iproute2 mail opt rc sensors.conf vfs
aliases csh.cshrc group- isdn mailcap oraInst.loc rc0.d services w3m
aliases.db csh.login grub.conf issue mail.rc oratab rc1.d sgml warnquota.conf
alternatives cups gshadow issue.net makedev.d oratab~ rc2.d shadow webalizer.conf
anacrontab default gshadow- jwhois.conf man.config pam.d rc3.d shadow- webalizer.conf.sample
at.deny DIR_COLORS gtk kde mime-magic pam_smb.conf rc4.d shells wgetrc
auto.master DIR_COLORS.xterm gtk-2.0 kderc mime-magic.dat pango rc5.d skel wvdial.conf
auto.misc dumpdates host.conf krb5.conf mime.types paper.config rc6.d slrn.rc X11
bashrc esd.conf hosts krb.conf minicom.users passwd rc.d smrsh xinetd.conf
bashrc~ exports hosts.allow krb.realms modules.conf passwd- rc.local sound xinetd.d
bg5ps.conf fam.conf hosts.bak ksysguarddrc modules.conf~ pbm2ppa.conf rc.sysinit squid xml
bg5ps.conf.zh_CN fb.modes hosts.deny ldap.conf motd pcmcia redhat-release ssh yp.conf
bg5ps.conf.zh_CN.GB2312 fdprm hotplug ld.so.cache mtab php.d resolv.conf stunnel
bg5ps.conf.zh_TW filesystems htdig.conf ld.so.conf mtools.conf php.ini resolv.conf.bak sudoers
bg5ps.conf.zh_TW.Big5 fonts httpd lftp.conf Muttrc pinforc rmt sysconfig
bonobo-activation foomatic im_palette.pal libuser.conf named.custom pnm2ppa.conf rndc.conf sysct1.conf
cdrecord.conf fstab im_palette-small.pal lilo.conf.anaconda nscd.conf ppp rndc.key sysctl.conf
chinese fstab.REVOKE im_palette-tiny.pal lisarc nsswitch.conf printcap rpc syslog.conf
[root@supercity etc]# vim oratab
--------------------------------------内容如下---------------------------------------------------------------------------------------
Xshell 2.0 for Xmanager Enterprise (Build 1531)
Copyright (c) 2003-2006 NetSarang Computer, Inc. All rights reserved.
Type `help' to learn how to use Xshell prompt.
Xshell:\>
Connecting to host 192.168.0.5:22...
Connected.
[12:13:26] Version exchange initiated...
#
# 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.
#
#
*:/opt/ora9/product/9.2:N
goldcity:/opt/ora9/product/9.2:N
要想让oracle自动启动,必须把goldcity:/opt/ora9/product/9.2:N改为goldcity:/opt/ora9/product/9.2:Y,保存退出。
---------------------------------------------------------------------------------------------------------------------------------
[root@supercity /]# cd opt/ora9/product/9.2/dbs/
[root@supercity dbs]# ls
initdw.ora initgoldcity.ora init.ora init.ora~ lkGOLDCITY orapwgoldcity spfilegoldcity.ora
[root@supercity dbs]# vim init.ora
-----------------------------------------内容如下----------------------------------------------------------------------------------------
# replace DEFAULT with your database name
db_name=goldcity
---------------------------------------------------------------------------------------------------------------------------------
[root@supercity /]# cd opt/ora9/product/9.2/bin/
[root@supercity dbs]# vim dbstart
-----------------------------------------内容如下----------------------------------------------------------------------------------------
###################################
#
# usage: dbstart
#
# This script is used to start ORACLE from /etc/rc(.local).
# It should ONLY be executed as part of the system boot procedure.
#
#####################################
ORATAB=/etc/oratab
trap 'exit' 1 2 3
case $ORACLE_TRACE in
T) set -x ;;
esac
# Set path if path not set (if called from /etc/rc)
case $PATH in
"") PATH=/bin:/usr/bin:/etc
export PATH ;;
esac
# Save LD_LIBRARY_PATH
SAVE_LLP=$LD_LIBRARY_PATH
#
# Loop for every entry in oratab file and and try to start
# that ORACLE
#
cat $ORATAB | while read LINE
do
case $LINE in
\#*) ;; #comment-line in oratab
*)
# Proceed only if third field is 'Y'.
if [ "`echo $LINE | awk -F: '{print $3}' -`" = "Y" ] ; then
ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
if [ "$ORACLE_SID" = '*' ] ; then
ORACLE_SID=""
fi
# Called programs use same database ID
export ORACLE_SID
ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
# Called scripts use same home directory
export ORACLE_HOME
# Put $ORACLE_HOME/bin into PATH and export.
PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc ; export PATH
# add for bug # 652997
LD_LIBRARY_PATH=${SAVE_LLP}:${ORACLE_HOME}/lib ; export LD_LIBRARY_PATH
PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora
看这里的启动名称是:PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora
但是在dbs下面只有init.ora没有init${ORACLE_SID}.ora,那么就copy一个init.ora改名init${ORACLE_SID}.ora
------------------------------------------------------------------------------------------------------------------------------
[root@supercity bin]# cd /
[root@supercity /]# cd etc
[root@supercity etc]# ls
a2ps.cfg CORBA gconf imrc localtime ntp printcap.local rpm termcap
a2ps-site.cfg cron.d gimp init.d log.d ntp.conf printconf.local samba tux.mime.types
adjtime cron.daily gnome initlog.conf login.defs oaf profile sane.d updatedb.conf
aep cron.hourly gnome-vfs-2.0 inittab logrotate.conf odbc.ini profile.d scrollkeeper.conf updfstab.conf
aep.conf cron.monthly gnome-vfs-mime-magic inputrc logrotate.d odbcinst.ini protocols securetty updfstab.conf.default
aeplog.conf crontab gpm-root.conf ioctl.save ltrace.conf openldap pwdb.conf security vfontcap
alchemist cron.weekly group iproute2 mail opt rc sensors.conf vfs
aliases csh.cshrc group- isdn mailcap oraInst.loc rc0.d services w3m
aliases.db csh.login grub.conf issue mail.rc oratab rc1.d sgml warnquota.conf
alternatives cups gshadow issue.net makedev.d oratab~ rc2.d shadow webalizer.conf
anacrontab default gshadow- jwhois.conf man.config pam.d rc3.d shadow- webalizer.conf.sample
at.deny DIR_COLORS gtk kde mime-magic pam_smb.conf rc4.d shells wgetrc
auto.master DIR_COLORS.xterm gtk-2.0 kderc mime-magic.dat pango rc5.d skel wvdial.conf
auto.misc dumpdates host.conf krb5.conf mime.types paper.config rc6.d slrn.rc X11
bashrc esd.conf hosts krb.conf minicom.users passwd rc.d smrsh xinetd.conf
bashrc~ exports hosts.allow krb.realms modules.conf passwd- rc.local sound xinetd.d
bg5ps.conf fam.conf hosts.bak ksysguarddrc modules.conf~ pbm2ppa.conf rc.sysinit squid xml
bg5ps.conf.zh_CN fb.modes hosts.deny ldap.conf motd pcmcia redhat-release ssh yp.conf
bg5ps.conf.zh_CN.GB2312 fdprm hotplug ld.so.cache mtab php.d resolv.conf stunnel
bg5ps.conf.zh_TW filesystems htdig.conf ld.so.conf mtools.conf php.ini resolv.conf.bak sudoers
bg5ps.conf.zh_TW.Big5 fonts httpd lftp.conf Muttrc pinforc rmt sysconfig
bonobo-activation foomatic im_palette.pal libuser.conf named.custom pnm2ppa.conf rndc.conf sysct1.conf
cdrecord.conf fstab im_palette-small.pal lilo.conf.anaconda nscd.conf ppp rndc.key sysctl.conf
chinese fstab.REVOKE im_palette-tiny.pal lisarc nsswitch.conf printcap rpc syslog.conf
[root@supercity etc]# cd rc.d
[root@supercity rc.d]# ls
init.d rc rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.local rc.local~ rc.sysinit
[root@supercity rc.d]# vim rc.local
-----------------------------------------内容如下----------------------------------------------------------------------------------------
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
在后面加上两句:
su - oracle -c "dbstart"
su - oracle -c "lsnrctl start"
保存退出,重新启动系统就ok了。