1.แก้ไข Variable Profile เพิ่มเติมใน ดังรูป
โดยในที่นี้ กำหนดให้ Start DB คือ gcoop
2.เข้าสู่ Root สร้าง File เพิ่มเติมคือ
เพื่อกำหนด Oracle Database ที่จะให้ สามารถ Start /Stop ได้ ใน Services
/etc/oratab
3.สร้าง Scrip สำหรับ Run Stop & Start Orale
/etc/rc.d/init.d/dbora
# chkconfig: 345 99 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=/u01/app/oracle/product/10.2.0/db_1
#ORA_HOME=/u01/app/oracle/product/11.1.0/db_1
ORA_HOME=/opt/app/oracle/product/11.2.0/db_1
ORA_OWNER=oracle
TMPDIR=$TMP
ORACLE_BASE=/opt/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
PATH=$ORACLE_HOME/bin:$PATH
ORACLE_HOME_LISTNER=$ORACLE_HOME
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole "
touch /var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole "
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
rm -f /var/lock/subsys/dbora
;;
'restart')
# Restart the Oracle databases:
$0 stop
$0 start
;;
esac
4.กำหนด กำหนด Permission และ Register services ตามลำดับ
5.ทดสอบการ start Service ด้วยคำสั่ง
$service dbora start
หลังจากนั้นทดสอบโดย Restart Server
6.ทดสอบการใช้งาน เมื่อ Restart เสร็จแล้วได้ผลดังรูป
เป็นอันจบขั้นตอนทั้งหมดพร้อมใช้งาน
ไม่มีความคิดเห็น:
แสดงความคิดเห็น