Friday, January 15, 2010

Auto startup oracle

1, Đầu tiên bạn đăng nhập vào root và sửa file /etc/oratab: Thay đổi ký tự cuối cùng thành Y.
ORCL:/app/oracle/111:Y
Trước đó trông nó như: ORCL:/app/oracle/111:N
2, Tạo file oracle trong thư mục /etc/init.d/ với nội dung như sau:
#!/bin/bash
#
# oracle Init file for starting and stopping
# Oracle Database. Script is valid for 10g and 11g versions.
#
# chkconfig: 35 80 30
# description: Oracle Database startup script

# Source function library.

. /etc/rc.d/init.d/functions


ORACLE_OWNER="oracle"
ORACLE_HOME="/app/oracle"

case "$1" in
start)
echo -n $"Starting Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
echo "OK"
;;
stop)
echo -n $"Stopping Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
echo "OK"
;;
*)
echo $"Usage: $0 {start|stop}"
esac

3, Chạy câu lệnh:
chmod 750 /etc/init.d/oracle
chkconfig --add oracle --level 0356

Ok roài! restart thử để thấy kết quả :D!

No comments:

Post a Comment