{"id":2465,"date":"2021-03-08T07:47:30","date_gmt":"2021-03-08T07:47:30","guid":{"rendered":"https:\/\/swiv.com.br\/automating-oracle-database-startup-and-shutdown\/"},"modified":"2026-05-27T20:02:51","modified_gmt":"2026-05-27T19:02:51","slug":"automating-oracle-database-startup-and-shutdown","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/03\/08\/automating-oracle-database-startup-and-shutdown\/","title":{"rendered":"Automating Oracle Database Startup and Shutdown"},"content":{"rendered":"\n<p>Este procedimento se aplica caso o ambiente em quest\u00e3o n\u00e3o tenha o Oracle Restart configurado. De in\u00edcio, podemos mudar o arquivo \/etc\/oratb conforme abaixo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@oel8 ~]# cat \/etc\/oratab\n#\n \n \n \n# This file is used by ORACLE utilities.  It is created by root.sh\n# and updated by either Database Configuration Assistant while creating\n# a database or ASM Configuration Assistant while creating ASM instance.\n \n# A colon, &#039;:&#039;, is used as the field terminator.  A new line terminates\n# the entry.  Lines beginning with a pound sign, &#039;#&#039;, are comments.\n#\n# Entries are of the form:\n#   $ORACLE_SID:$ORACLE_HOME:&amp;lt;N|Y&gt;:\n#\n# The first and second fields are the system identifier and home\n# directory of the database respectively.  The third field indicates\n# to the dbstart utility that the database should , &quot;Y&quot;, or should not,\n# &quot;N&quot;, be brought up at system boot time.\n#\n# Multiple entries with the same $ORACLE_SID are not allowed.\n#\n#\nTALAMO:\/oracle\/18.0.0\/product:Y\n&#x5B;root@oel8 ~]#\n<\/pre><\/div>\n\n\n<p>Ap\u00f3s isso, podemos criar o arquivo dbora com o seguinte conte\u00fado:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@oel8 ~]# cat \/etc\/init.d\/dbora\n#! \/bin\/sh\n# description: Oracle auto start-stop script.\n \nORA_HOME=\/oracle\/18.0.0\/product\nORA_OWNER=oracle\n \ncase &quot;$1&quot; in\n&#039;start&#039;)\n        # Start the Oracle databases:\n        # The following command assumes that the oracle login\n        # will not prompt the user for any values\n        # Remove &quot;&amp;amp;&quot; if you don&#039;t want startup as a background process.\n        su - $ORA_OWNER -c &quot;$ORA_HOME\/bin\/dbstart $ORA_HOME&quot; &amp;amp;\n        touch \/var\/lock\/subsys\/dbora\n        ;;\n \n&#039;stop&#039;)\n        # Stop the Oracle databases:\n        # The following command assumes that the oracle login\n        # will not prompt the user for any values\n        su - $ORA_OWNER -c &quot;$ORA_HOME\/bin\/dbshut $ORA_HOME&quot; &amp;amp;\n        rm -f \/var\/lock\/subsys\/dbora\n        ;;\nesac\n&#x5B;root@oel8 ~]#\n<\/pre><\/div>\n\n\n<p>Ajustando permiss\u00f5es do novo arquivo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@oel8 ~]# chgrp dba \/etc\/init.d\/dbora\n&#x5B;root@oel8 ~]# chmod 750 \/etc\/init.d\/dbora\n&#x5B;root@oel8 ~]#\n<\/pre><\/div>\n\n\n<p>Criando links simb\u00f3licos:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;root@oel8 ~]# ln -s \/etc\/init.d\/dbora \/etc\/rc.d\/rc0.d\/K01dbora\n&#x5B;root@oel8 ~]# ln -s \/etc\/init.d\/dbora \/etc\/rc.d\/rc3.d\/S99dbora\n&#x5B;root@oel8 ~]# ln -s \/etc\/init.d\/dbora \/etc\/rc.d\/rc5.d\/S99dbora\n&#x5B;root@oel8 ~]#\n<\/pre><\/div>\n\n\n<p>Ap\u00f3s isso, podemos reiniciar o ambiente e checar se o banco de dados foi inicializado automaticamente:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel8 ~]$ uptime\n 04:45:55 up 2 min,  1 user,  load average: 4.30, 2.31, 0.90\n&#x5B;oracle@oel8 ~]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Mar 8 04:46:04 2021\nVersion 18.3.0.0.0\n \nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\n \n \nConnected to:\nOracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\nVersion 18.3.0.0.0\n \nSQL&gt; select instance_name,status,startup_time from v$instance;\n \nINSTANCE_NAME    STATUS       STARTUP_T\n---------------- ------------ ---------\nTALAMO           OPEN         08-MAR-21\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laborat\u00f3rio pessoal para fins de aprendizado.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Este procedimento se aplica caso o ambiente em quest\u00e3o n\u00e3o tenha o Oracle Restart configurado. De in\u00edcio, podemos mudar o arquivo \/etc\/oratb conforme abaixo: Ap\u00f3s isso, podemos criar o arquivo dbora com o seguinte conte\u00fado: Ajustando permiss\u00f5es do novo arquivo: Criando links simb\u00f3licos: Ap\u00f3s isso, podemos reiniciar o ambiente e checar se o banco de [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-2465","post","type-post","status-publish","format-standard","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=2465"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2465\/revisions"}],"predecessor-version":[{"id":9245,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2465\/revisions\/9245"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=2465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=2465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=2465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}