新建文件名爲oraclesql
- [root@stark init.d]# pwd
- /etc/init.d
- [root@stark init.d]# touch oracle
向oracle中添加下列內容bash
- #!/bin/bash
- # chkconfig: 35 95 1
- # description: init script. to start/stop oracle database 10g, TNS listener, EMS
- # match these values to your environment:
- export ORACLE_BASE=/oracle
- export ORACLE_HOME=/oracle/10.2
- export ORACLE_TERM=xterm
- export PATH=/home$ORACLE_HOME/bin:$PATH:.
- export NLS_LANG=American_America.AL32UTF8
- export ORACLE_SID=stark
- export DISPLAY=localhost:0
- export ORACLE_USER=oracle
- case $1 in
- start)
- su - "$ORACLE_USER"<<stark
- lsnrctl start
- sqlplus /nolog<<jadeshow
- connect / as sysdba
- startup
- jadeshow
- stark
- ;;
- stop)
- su - "$ORACLE_USER"<<stark
- lsnrctl stop
- sqlplus /nolog<<jadeshow
- connect / as sysdba
- shutdown immediate
- jadeshow
- stark
- ;;
- *)
- echo "Usage: $0 {start|stop}"
- ;;
- esac
修改權限,使得oracle具備可執行權限oracle
添加oracle到系統服務而且開機啓動
- [root@stark init.d]# chmod a+x oracle
- [root@stark init.d]# chkconfig add oracle
- [root@stark init.d]# chkconfig oracle on