728x90
Oracle 에서 제공하는 DB(Instance 및 Listener) Start/Stop Script 로 기동/중지 하기
## 가.DB 기동 스크립트
필수 요건 : /etc/oratab 에 등록되어 있어야함 "Y"
수행 명령어 : $ORACLE_HOME/bin/dbstart $ORACLE_HOME
관련 로그 : $ORACLE_HOME/startup.log
$ORACLE_HOME/listener.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> cat $ORACLE_HOME/bin/dbstart #!/bin/sh # # $Id: dbstart.sh /st_buildtools_11.2.0/1 2013/01/24 16:20:35 tmagana Exp $ # Copyright (c) 1991, 2013, Oracle and/or its affiliates. All rights reserved. # ################################### # # usage: dbstart $ORACLE_HOME # # This script is used to start ORACLE from /etc/rc(.local). # It should ONLY be executed as part of the system boot procedure. # # This script will start all databases listed in the oratab file # whose third field is a "Y". If the third field is set to "Y" and # there is no ORACLE_SID for an entry (the first field is a *), # then this script will ignore that entry. # # This script requires that ASM ORACLE_SID's start with a +, and # that non-ASM instance ORACLE_SID's do not start with a +. # # If ASM instances are to be started with this script, it cannot # be used inside an rc*.d directory, and should be invoked from # rc.local only. Otherwise, the CSS service may not be available # yet, and this script will block init from completing the boot # cycle. # # If you want dbstart to auto-start a single-instance database that uses # an ASM server that is auto-started by CRS (this is the default behavior # for an ASM cluster), you must change the database's ORATAB entry to use # a third field of "W" and the ASM's ORATAB entry to use a third field of "N". # These values specify that dbstart auto-starts the database only after # the ASM instance is up and running. # # Note: # Use ORACLE_TRACE=T for tracing this script. # # The progress log for each instance bringup plus Error and Warning message[s] # are logged in file $ORACLE_HOME/startup.log. The error messages related to # instance bringup are also logged to syslog (system log module). # The Listener log is located at $ORACLE_HOME_LISTNER/listener.log # # On all UNIX platforms except SOLARIS # ORATAB=/etc/oratab # # To configure, update ORATAB with Instances that need to be started up # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:<N|Y|W>: # An example entry: # main:/usr/lib/oracle/emagent_10g:Y # # Overall algorithm: # 1) Bring up all ASM instances with 'Y' entry in status field in oratab entry # 2) Bring up all Database instances with 'Y' entry in status field in # oratab entry # 3) If there are Database instances with 'W' entry in status field # then # iterate over all ASM instances (irrespective of 'Y' or 'N') AND # wait for all of them to be started # fi # 4) Bring up all Database instances with 'W' entry in status field in # oratab entry # ##################################### 중략 | cs |
## 가.1. DB 기동 하기
1 2 3 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> dbstart /u01/app/oracle/product/11.2.0.4 Processing Database instance "TGDB": log file /u01/app/oracle/product/11.2.0.4/startup.log [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> | cs |
## 가.2. DB 기동 결과 확인
1 2 3 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> ps -ef |grep ora_ |grep smon oracle 5125 1 0 10:27 ? 00:00:00 ora_smon_TGDB [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> | cs |
1 2 3 4 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> ps -ef |grep tns|grep -v grep root 15 2 0 09:50 ? 00:00:00 [netns] oracle 5005 1 0 10:27 ? 00:00:00 /u01/app/oracle/product/11.2.0.4/bin/tnslsnr LISTENER -inherit [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> | cs |
## 가.3. DB Startup log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4> cat $ORACLE_HOME/startup.log /u01/app/oracle/product/11.2.0.4/bin/dbstart: Starting up database "TGDB" Tue Feb 6 10:27:08 KST 2018 SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 6 10:27:08 2018 Copyright (c) 1982, 2013, Oracle. All rights reserved. SQL> Connected to an idle instance. SQL> ORACLE instance started. Total System Global Area 534462464 bytes Fixed Size 2254952 bytes Variable Size 213911448 bytes Database Buffers 314572800 bytes Redo Buffers 3723264 bytes Database mounted. Database opened. SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options /u01/app/oracle/product/11.2.0.4/bin/dbstart: Database instance "TGDB" warm started. | cs |
## 가.4. Listener Startup Log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4> cat $ORACLE_HOME/listener.log /u01/app/oracle/product/11.2.0.4/bin/dbstart: Starting Oracle Net Listener LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-FEB-2018 10:27:08 Copyright (c) 1991, 2013, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0.4/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.4.0 - Production System parameter file is /u01/app/oracle/product/11.2.0.4/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/tggo/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.11)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.205.11)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 06-FEB-2018 10:27:08 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0.4/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/tggo/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.11)(PORT=1521))) The listener supports no services The command completed successfully [TGDB]tggo:/u01/app/oracle/product/11.2.0.4> | cs |
## 나. DB 중지 스크립트
필수 요건 : /etc/oratab 에 등록되어 있어야함 "Y"
수행 명령어 : $ORACLE_HOME/bin/dbshut $ORACLE_HOME
관련 로그 : $ORACLE_HOME/stutdown.log
$ORACLE_HOME/listener.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> cat $ORACLE_HOME/bin/dbshut #!/bin/sh # # $Id: dbshut.sh /st_buildtools_11.2.0/1 2013/01/24 16:20:35 tmagana Exp $ # Copyright (c) 1991, 2013, Oracle and/or its affiliates. All rights reserved. # ################################### # # usage: dbshut $ORACLE_HOME # # This script is used to shutdown ORACLE from /etc/rc(.local). # It should ONLY be executed as part of the system boot procedure. # # This script will shutdown all databases listed in the oratab file # whose third field is a "Y" or "W". If the third field is set to "Y" and # there is no ORACLE_SID for an entry (the first field is a *), # then this script will ignore that entry. # # This script requires that ASM ORACLE_SID's start with a +, and # that non-ASM instance ORACLE_SID's do not start with a +. # # Note: # Use ORACLE_TRACE=T for tracing this script. # Oracle Net Listener is also shutdown using this script. # # The progress log for each instance shutdown is logged in file # $ORACLE_HOME/shutdown.log. # # On all UNIX platforms except SOLARIS # ORATAB=/etc/oratab # # To configure, update ORATAB with Instances that need to be shutdown # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:<N|Y>: # An example entry: # main:/usr/lib/oracle/emagent_10g:Y # ##################################### | cs |
## 나.1. DB 중지 하기
1 2 3 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> dbshut /u01/app/oracle/product/11.2.0.4 Processing Database instance "TGDB": log file /u01/app/oracle/product/11.2.0.4/shutdown.log [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> | cs |
## 나.2. DB 중지 결과 확인
1 2 3 4 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> ps -ef |grep ora_ |grep smon [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> ps -ef |grep tns |grep -v grep root 15 2 0 09:50 ? 00:00:00 [netns] [TGDB]tggo:/u01/app/oracle/product/11.2.0.4/bin> | cs |
## 나.3. DB Shutdown Log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [TGDB]tggo:/u01/app/oracle/product/11.2.0.4> cat shutdown.log SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 6 10:33:31 2018 Copyright (c) 1982, 2013, Oracle. All rights reserved. SQL> Connected. SQL> Database closed. Database dismounted. ORACLE instance shut down. SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Database instance "TGDB" shut down. [TGDB]tggo:/u01/app/oracle/product/11.2.0.4> | cs |
## 나.4. Listener Stop Log
1 2 3 4 5 6 7 8 9 10 11 | /u01/app/oracle/product/11.2.0.4/bin/dbshut: Stoping Oracle Net Listener LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-FEB-2018 10:33:31 Copyright (c) 1991, 2013, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.205.11)(PORT=1521))) The command completed successfully [TGDB]tggo:/u01/app/oracle/product/11.2.0.4> | cs |
다. 주의 사항
: db 기동 시, 아래와 같이 이미 DB 기동 상태일 경우, 내리고 재시작한다. 주의 !!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | TG:/home/oracle> cat /app/oracle/product/12.2.0.1/db_1/startup.log /app/oracle/product/11.2.0.4/db_1/bin/dbstart: Starting up database "TG12201" Mon Mar 12 10:03:04 KST 2018 root: Listener version 11 NOT supported with Database version 12 root: Restart Oracle Net Listener using an alternate ORACLE_HOME_LISTNER: root: lsnrctl start root: Warning: Database instance "TG12201" already started. root: Warning: Database instance "TG12201" possibly left running when system went down (system crash?). root: Action: Notify Database Administrator. SQL*Plus: Release 12.2.0.1.0 Production on Mon Mar 12 10:03:04 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> Connected. SQL> ORACLE instance shut down. SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL*Plus: Release 12.2.0.1.0 Production on Mon Mar 12 10:03:09 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. SQL> Connected to an idle instance. SQL> ORACLE instance started. Total System Global Area 2147483648 bytes Fixed Size 8794848 bytes Variable Size 603983136 bytes Database Buffers 1526726656 bytes Redo Buffers 7979008 bytes Database mounted. Database opened. SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production /app/oracle/product/11.2.0.4/db_1/bin/dbstart: Database instance "TG12201" warm started. [TG11204]localhost.localdomain TG:/home/oracle> | cs |