PDA

View Full Version : Auto Start Oracle9i in Linux?



pnthach
29-05-2005, 13:31
Cho mình hỏi thăm làm sao start Oracle9i DB tong Linux OS tự động?

yedc2001
30-05-2005, 19:37
Cho mình hỏi thăm làm sao start Oracle9i DB tong Linux OS tự động?
Ban vo trong /var/opt/oracle/ mo file oratab (co nhieu khi file ortab nam trong /etc/) thay chu N ocuoi hang bang Y


$SID:/$ORACLE_HOME/:Y

pnthach
31-05-2005, 17:12
Cảm ơn bạn [yedc2001]. Mình đã thử cách này rồi nhưng mà Oracle cũng ko tự start.
Mình thực hiện các bước:
-Sửa file oratab.
-Tạo 1 file có các câu lệnh ($ORACLE_HOME/bin/dbstart và $ORACLE_HOME/bin/lsnrctl start).
-Tạo 1 deamon gắn với file này.

Không biết còn thiếu bước nào nữa ko vậy?

haopqh
01-06-2005, 12:47
Sửa trong file /etc/init.d/dbora như sau:

--------------------------------------------------------------
#!/bin/bash
# Startup script for Oracle9i R2
# chkconfig: 345 99 10
# description: Oracle9i R2 RDBMS
ORA_HOME=/opt/oracle/product/9.2.0
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" > /home/oracle/lsnrstart.log
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" > /home/oracle/dbstart.log
touch /var/lock/subsys/dbora
;;
'stop')
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" > /home/oracle/lsnrstop.log
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" > /home/oracle/dbshut.log
rm -f /var/lock/subsys/dbora
;;
*)
echo "Usage: dbora {start|stop}"
exit 1
esac
------------------------------------------------------------------

#chmod 755 /etc/init.d/dbora
Kích hoạt service
# /sbin/chkconfig dbora on
Ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
Ln -s /etc/init.d/dbora /etc/rc.d/rc6.d/K01dbora

sửa file
/etc/oratab
*:/opt/oracle/product/9.01:N
KT1ORA:/home/oracle/product/9.2.0.1.0:Y #KT1ORA la ORACLE_SID

Sua file
$ORACLE_HOME/bin/dbshut

Thay shutdown ban shutdown immediate:

….
….
case $VERSION in
"6") sqldba command=shutdown ;;
"internal") $SQLDBA <<EOF
connect internal
shutdown
EOF
;;
*) $SQLDBA <<EOF
connect / as sysdba
shutdown
EOF
;;
esac

if test $? -eq 0 ; then
echo "Database \"${ORACLE_SID}\" shut down."
else
echo "Database \"${ORACLE_SID}\" not shut down."
fi
fi
;;
esac
done

Thêm vào $ORACLE_HOME/dbs/int$ORACLE_SID.ora như sau:
Spfile=$ORACLE_HOME/dbs/spfile$ORACLE_SID.ora

yedc2001
03-06-2005, 18:08
Cảm ơn bạn [yedc2001]. Mình đã thử cách này rồi nhưng mà Oracle cũng ko tự start.
Mình thực hiện các bước:
-Sửa file oratab.
-Tạo 1 file có các câu lệnh ($ORACLE_HOME/bin/dbstart và $ORACLE_HOME/bin/lsnrctl start).
-Tạo 1 deamon gắn với file này.

Không biết còn thiếu bước nào nữa ko vậy?

Ban thu tao mot Instance moi bang DCA, roi tim coi trong may cua ban co bao nhieu file oratab, coi oracle xu dung file oratb nao?