Linux 에서 Oacle 10g 켜 기 자동 시작 (감청, 인 스 턴 스)

현재 환경: Oracle Enterprise Linux 5.6 + Oracle 10.2.0.1
데이터 베 이 스 를 설치 한 후 운영 체제 가 다시 시작 되면 데이터 베 이 스 는 자동 으로 시작 되 지 않 고 다음 절 차 는 oralce 데이터 베 이 스 를 운영 체제 에 따라 자동 으로 시작 합 니 다.
루트 사용자 수정 / etc / oratab 파일 사용: $ vi /etc/oratab orcl:/oracle/app/product/10.2.0/db_1: N 변경: orcl: / oracle / app / product / 10.2.0 / db1:Y  ##마지막 N 을 Y 로 바 꾸 는 거 죠.
2. ORACLE 사용자 수정 $ORACLE 사용HOME / bin / dbstart 파일: \ # su - oracle $ cd $ORACLE_HOME / bin $vi dbstart 에서 ORACLE 찾기HOME_LISTNER = 이 줄, ORACLE 로 수정HOME_LISTNER=$ORACLE_HOME 3. dbshut 를 실행 하 는 지 테스트 합 니 다. dbstart 스 크 립 트 는 Oacle 서비스 와 listener 서 비 스 를 시작 할 수 있 는 지 확인 합 니 다. 1. dbstart 와 dbshut 의 로그 파일 을 수정 할 수 있 는 권한: $su - root \ # cd $ORACLEHOME \ # chown oracle: oinstall startup. log \ # chown oracle: oinstall shutdown. log 이상 로그 파일 이 존재 하지 않 거나 다음 단계 에 로그 파일 을 다시 볼 수 있 습 니 다. 2. 해당 스 크 립 트 를 실행 하여 테스트 합 니 다 \ # su - oracle $cd $ORACLEHOME / bin $. / dbstart (또는. / dbshut) $ps - efw | grep ora $lsnrctl status   #감청 상태 보기 $ps - efw | grep LISTEN | grep - v grep
4: 자동 시작 실행 스 크 립 트 추가 $su - root \ # cd / etc / rc. d / init. d / \ # gedit oradbstart 다음 스 크 립 트 1 또는 스 크 립 트 2 내용 을 oradbstart 파일 로 복사 합 니 다.
스 크 립 트 1:

  
  
  
  
  1. #!/bin/bash   
  2.  
  3. # chkconfig: 345 99 10   
  4.  
  5. # description: Startup Script for oracle Databases   
  6.  
  7. # /etc/rc.d/init.d/dbstart   
  8.  
  9.  
  10. export ORACLE_BASE=/u01/app/oracle/   
  11.  
  12. export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1   
  13.  
  14. export ORACLE_SID=orcl   
  15.  
  16. export PATH=$PATH:$ORACLE_HOME/bin   
  17.  
  18.  
  19. ORA_OWNR="oracle"   
  20.  
  21. # if the executables do not exist -- display error   
  22.  
  23. if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]   
  24.  
  25. then   
  26.  
  27. echo "Oracle startup: cannot start"   
  28.  
  29. exit 1   
  30.  
  31. fi   
  32.  
  33. # depending on parameter -- startup, shutdown, restart   
  34.  
  35. # of the instance and listener or usage display   
  36.  
  37. case "$1" in   
  38.  
  39. start)   
  40.  
  41. # Oracle listener and instance startup   
  42.  
  43. echo -n "Starting Oracle: "   
  44.  
  45. su - $ORA_OWNR -c "$ORACLE_HOME/bin/dbstart"   
  46.  
  47. touch /var/lock/oracle   
  48.  
  49. su - $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"   
  50.  
  51. su - $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctrl start"   
  52.  
  53. echo "OK"   
  54.  
  55. ;;   
  56.  
  57. stop)   
  58.  
  59. # Oracle listener and instance shutdown   
  60.  
  61. echo -n "Shutdown Oracle: "   
  62.  
  63. su - $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"   
  64.  
  65. su - $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctrl stop"   
  66.  
  67. su - $ORA_OWNR -c "$ORACLE_HOME/bin/dbshut"   
  68.  
  69. su - $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"   
  70.  
  71. rm -f /var/lock/oracle   
  72.  
  73. echo "OK"   
  74.  
  75. ;;   
  76.  
  77. reload|restart)   
  78.  
  79. $0 stop   
  80.  
  81. $0 start   
  82.  
  83. ;;   
  84.  
  85. *)   
  86.  
  87. echo "Usage: `basename $0` start|stop|restart|reload"   
  88.  
  89. exit 1   
  90.  
  91. esac   
  92.  
  93. exit 0 

대본 2

  
  
  
  
  1. #!/bin/bash   
  2.  
  3. # chkconfig: 345 99 10   
  4.  
  5. # description: Startup Script for oracle Databases   
  6.  
  7. # /etc/rc.d/init.d/oradbstart   
  8.  
  9. export ORACLE_BASE=/u01/app/oracle/   
  10.  
  11. export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1   
  12.  
  13. export ORACLE_SID=orcl   
  14.  
  15. export PATH=$PATH:$ORACLE_HOME/bin   
  16.  
  17. case "$1" in   
  18.  
  19. start)   
  20.  
  21. su oracle -c $ORACLE_HOME/bin/dbstart   
  22.  
  23. touch /var/lock/oracle   
  24.  
  25. echo "OK"   
  26.  
  27. ;;   
  28.  
  29. stop)   
  30.  
  31. echo -n "Shutdown oracle: "   
  32.  
  33. su oracle -c $ORACLE_HOME/bin/dbshut   
  34.  
  35. rm -f /var/lock/oracle   
  36.  
  37. echo "OK"   
  38.  
  39. ;;   
  40.  
  41. *)   
  42.  
  43. echo "Usage: 'basename $0' start|stop"   
  44.  
  45. exit 1   
  46.  
  47. esac   
  48.  
  49. exit 0 

주의 점 (1). \ # 시작 하 는 줄 이 적 으 면 안 됩 니 다. 그렇지 않 으 면 나중에 chkconfig 명령 을 실행 하면 오류 가 발생 합 니 다. oradbstart 서 비 스 는 chkconfig (2) 를 지원 하지 않 습 니 다. 자신의 환경 에 따라 환경 변수 설정 부분 을 수정 합 니 다.
마지막 으로 터미널 실행 열기: $su - root \ # chown oracle. osit / etc / rc. d / init. d / oradbstart \ # chmod 775 / etc / rc. d / init. d / oradbstart 다음 실행: chkconfig -- add oradbstart chkconfig -- list oradbstart
chkconfig --list oradbstart
실행 결과: oradbstart 0: off 1: off 2: off 3: on 4: on 6: off 주: 위의 실행 결과 에 따라 해당 하 는 실행 단계 가 on 일 때 (예: 5: on) 대응 하 는 / etc / rc. d / rcN. d (예: 5: on 과 대응 하 는 것 은 / etc / rc. d / rc5. d) 아래 에 파일 이 생 성 됩 니 다: S99oradbstart, vi S99oradbstart 를 사용 하여 이 파일 을 엽 니 다.이 파일 의 내용 은 / etc / rc. d / init. d / oradbstart 내용 과 같 습 니 다. 설정 이 성공 적 임 을 표시 합 니 다.
 마지막 으로 운영 체제 테스트 를 다시 시작 합 니 다.

좋은 웹페이지 즐겨찾기