앞전의 포스팅에서 CentOS에서 오라클을 설치해봤다.
그럼 이제는 서버답게 만드는 작업을 해야겠다. 우선 오라클의 시동은 어떻게 해야할까..
login as: oracle
oracle@192.168.10.132's password:
Last login: Tue Jul 14 20:28:38 2009
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 15-JUL-2009 01:05:16
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /home/oracle/oracle11/product/11.1.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /home/oracle/oracle11/product/11.1.0/db_1/network/admin/listener.ora
Log messages written to /home/oracle/oracle11/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 15-JUL-2009 01:05:18
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/oracle11/product/11.1.0/db_1/network/admin/listener.ora
Listener Log File /home/oracle/oracle11/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@localhost ~]$
|
가장 간단히 오라클 계정으로 들어가
lsnrctl start해주면 된다.
하지만 더욱 root계정으로 간단히 제어하고 싶다면..
[root@localhost ~]# vi /etc/init.d/oracle
#!/bin/bash
ORA_HOME="/home/oracle/oracle11/product/11.1.0/db_1"
ORA_OWNER="oracle"
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle Startup: failed"
exit 1
fi
case "$1" in
start)
echo -n "Oracle Start: "
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
touch /var/lock/subsys/oracle
echo "OK"
;;
stop)
echo -n "ORACLE Shutdown: "
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
rm -f /var/lock/subsys/oracle
echo "OK"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 start|stop|restart"
exit 1
esac
exit 0
[root@localhost ~]#
|
/etc/init.d/oracle start | stop | restart 명령을 쓸수 있겠끔 위와 같이 스크립트 만들어준다.
[root@localhost ~]# vi /etc/rc.local
#!/bin/sh
#
# 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
/etc/init.d/oracle start
[root@localhost ~]#
|
시스템 부팅과 함께 다시 오라클이 구동될수 있도록 /etc/rc.local에 위에서 작성한 스크립트 파일을 삽입한다.
[root@localhost ~]# shutdown -r now
Broadcast message from root (pts/1) (Wed Jul 15 01:59:35 2009):
The system is going down for reboot NOW!
[root@localhost ~]#
login as: bestakas
bestakas@192.168.10.132's password:
Last login: Wed Jul 15 01:57:46 2009 from 192.168.10.102
[bestakas@localhost ~]$ su -
암호:
[root@localhost ~]# ps ax | grep LISTENER
2602 ? Ssl 0:00 /home/oracle/oracle11/product/11.1.0/db_1/bin/tnslsnr LISTENER -inherit
3020 pts/1 S+ 0:00 grep LISTENER
[root@localhost ~]# |
부팅과 함께 자동으로 오라클이 구동되었다.