Oracle 在Linux上作为服务启动

Linux大全评论1.3K views阅读模式

新建文件名为Oracle 

 
 
  1. [root@stark init.d]# pwd 
  2. /etc/init.d 
  3. [root@stark init.d]# touch oracle 
 
 
  1. #!/bin/bash 
  2. # chkconfig: 35 95 1 
  3. # description: init script. to start/stop oracle database 10g, TNS listener 
  4. # match these values to your environment: 
  5. export ORACLE_BASE=/oracle 
  6. export ORACLE_HOME=/oracle/10.2 
  7. export ORACLE_TERM=xterm 
  8. export PATH=/home$ORACLE_HOME/bin:$PATH:. 
  9. export NLS_LANG=American_America.AL32UTF8 
  10. export ORACLE_SID=stark 
  11. export DISPLAY=localhost:0 
  12. export ORACLE_USER=oracle 
  13. case $1 in 
  14.     start) 
  15.     su - "$ORACLE_USER"<<stark 
  16.     lsnrctl start 
  17.     sqlplus /nolog<<jadeshow 
  18.     connect / as sysdba 
  19.     startup 
  20. jadeshow 
  21.     
  22. stark 
  23.     ;; 
  24.     stop) 
  25.     su - "$ORACLE_USER"<<stark 
  26.     lsnrctl stop 
  27.     sqlplus /nolog<<jadeshow 
  28.     connect / as sysdba 
  29.     shutdown immediate 
  30. jadeshow 
  31.     
  32. stark 
  33.     ;; 
  34.     
  35.           
  36.     *) 
  37.     echo "Usage: $0 {start|stop}" 
  38.     ;; 
  39. esac 
 
 
  1. [root@stark init.d]# chmod a+x oracle  
添加oracle到系统服务并且开机启动
 
 
  1. [root@stark init.d]# chkconfig add oracle 
  2. [root@stark init.d]# chkconfig oracle on

企鹅博客
  • 本文由 发表于 2020年9月9日 19:33:10
  • 转载请务必保留本文链接:https://www.qieseo.com/185254.html

发表评论