{"id":632,"date":"2013-03-12T16:12:10","date_gmt":"2013-03-12T14:12:10","guid":{"rendered":"http:\/\/www.koraykey.com\/?p=632"},"modified":"2013-05-26T13:16:31","modified_gmt":"2013-05-26T10:16:31","slug":"linux-isletim-sistemi-uzerinde-otomatik-veritabani-baslatma-ve-durdurma","status":"publish","type":"post","link":"https:\/\/www.koraykey.com\/?p=632","title":{"rendered":"Linux \u0130\u015fletim Sistemlerinde Otomatik Veritaban\u0131 Ba\u015flatma ve Durdurma"},"content":{"rendered":"<p><span style=\"font-family: arial,helvetica,sans-serif;\"><a href=\"http:\/\/www.koraykey.com\/wp-content\/uploads\/LinuxAll.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-797\" alt=\"LinuxAll\" src=\"http:\/\/www.koraykey.com\/wp-content\/uploads\/LinuxAll.jpg\" width=\"250\" height=\"250\" srcset=\"https:\/\/www.koraykey.com\/wp-content\/uploads\/LinuxAll.jpg 250w, https:\/\/www.koraykey.com\/wp-content\/uploads\/LinuxAll-150x150.jpg 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">Bu makalemizde Linux \u0130\u015fletim Sistemleri \u00fczerinde otomatik veritaban\u0131 ba\u015flatma ve durdurma konusunu inceleyece\u011fiz. Veritaban\u0131 ile birlikte Listener Servisi ve Enterprise Manager konsolununda otomatik a\u00e7\u0131l\u0131p kapanmas\u0131n\u0131 sa\u011flayaca\u011f\u0131z.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">Bu \u00f6zellikle sistemimizde kurulu olan veritaban\u0131m\u0131z sunucumuz a\u00e7\u0131ld\u0131\u011f\u0131nda a\u00e7\u0131lacak sunucumuza shutdown veya reboot komutu verdi\u011fimizde kapanacakt\u0131r.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">1. \u00d6ncelikle sistemimizde oracle kullan\u0131c\u0131s\u0131 i\u00e7in &#8220;.bash_profile tan\u0131mlamalar\u0131n\u0131 yap\u0131yoruz. \u00d6rnek olarak bende kurulu olan sistemdeki \u00f6zelliklere g\u00f6re ayarlamalar\u0131 yapt\u0131m. Sizler buradaki de\u011fi\u015fkenleri kendi sisteminize g\u00f6re ayarlaman\u0131z gerekmektedir.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\">--- Oracle kullan\u0131c\u0131s\u0131 ile Home dizinindeyken a\u015fa\u011f\u0131daki gibi\r\n\".bash_profile\" dosyas\u0131n\u0131 a\u00e7\u0131yoruz.\r\n\r\n$ vim .bash_profile\r\n\r\n-- A\u00e7m\u0131\u015f oldu\u011fumuz dosyaya a\u015fa\u011f\u0131daki de\u011fi\u015fkenleri kendi sistemimize g\u00f6re\r\nde\u011fi\u015ftirdikten dosyam\u0131za ekliyoruz. \r\n\r\n# Oracle bash_profile Environment Settings\r\n\r\nTMP=\/tmp; export TMP\r\nTMPDIR=$TMP; export TMPDIR\r\n\r\nORACLE_HOSTNAME=koraykey-db.localdomain; export ORACLE_HOSTNAME\r\nORACLE_UNQNAME=orcl; export ORACLE_UNQNAME\r\nORACLE_BASE=\/u01\/app\/oracle; export ORACLE_BASE\r\nGRID_HOME=\/u01\/app\/11.2.0.3\/grid; export GRID_HOME\r\nDB_HOME=$ORACLE_BASE\/product\/11.2.0.3\/db; export DB_HOME\r\nORACLE_HOME=$DB_HOME; export ORACLE_HOME\r\nORACLE_SID=orcl; export ORACLE_SID\r\nORACLE_TERM=xterm; export ORACLE_TERM\r\nBASE_PATH=\/usr\/sbin:$PATH; export BASE_PATH\r\nPATH=$ORACLE_HOME\/bin:$BASE_PATH; export PATH\r\n\r\nLD_LIBRARY_PATH=$ORACLE_HOME\/lib:\/lib:\/usr\/lib; export LD_LIBRARY_PATH\r\n<span style=\"font-size: 10px;\">CLASSPATH=$ORACLE_HOME\/JRE:$ORACLE_HOME\/jlib:$ORACLE_HOME\/rdbms\/jlib; export CLASSPATH\r\n<\/span>\r\nif [ $USER = \"oracle\" ]; then\r\n  if [ $SHELL = \"\/bin\/ksh\" ]; then\r\n    ulimit -p 16384\r\n    ulimit -n 65536\r\n  else\r\n    ulimit -u 16384 -n 65536\r\n  fi\r\nfi\r\n\r\nalias oraenv='. \/home\/oracle\/.bash_profile'<\/span><\/pre>\n<p><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">2. \u0130\u015fletim Sistemi ba\u015flang\u0131c\u0131nda \u00e7al\u0131\u015facak servis dosyam\u0131z\u0131 haz\u0131rl\u0131yoruz.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\">-- root kullan\u0131c\u0131s\u0131na ge\u00e7i\u015f yap\u0131yoruz.\r\n\r\n$ su - root \r\nPassword: \r\n# vim \/etc\/init.d\/dbora\r\n\r\n-- Ard\u0131ndan a\u015fa\u011f\u0131daki de\u011fi\u015fiklikleri a\u00e7m\u0131\u015f oldu\u011fumuz \"\/etc\/init.d\/dbora\"\r\ndosyas\u0131nda yap\u0131yoruz.\r\n\r\n#!\/bin\/sh\r\n# chkconfig: 345 99 10\r\n# description: Oracle auto start-stop script.\r\n#\r\n# Set ORA_OWNER to the user id of the owner of the \r\n# Oracle database software.\r\n\r\nORA_OWNER=oracle\r\n\r\ncase \"$1\" in\r\n    'start')\r\n        # Start the Oracle databases:\r\n        # The following command assumes that the oracle login \r\n        # will not prompt the user for any values\r\n          <span style=\"font-size: 8px;\">su - $ORA_OWNER -c \"\/home\/oracle\/scripts\/startup.sh &gt;&gt; \/home\/oracle\/scripts\/startup_shutdown.log 2&gt;&amp;1\"\r\n<\/span>        touch \/var\/lock\/subsys\/dbora\r\n        ;;\r\n    'stop')\r\n        # Stop the Oracle databases:\r\n        # The following command assumes that the oracle login \r\n        # will not prompt the user for any values\r\n         <span style=\"font-size: 8px;\">   su - $ORA_OWNER -c \"\/home\/oracle\/scripts\/shutdown.sh &gt;&gt; \/home\/oracle\/scripts\/startup_shutdown.log 2&gt;&amp;1\"\r\n<\/span>        rm -f \/var\/lock\/subsys\/dbora\r\n        ;;\r\nesac<\/span><\/pre>\n<p><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">3. Dosya \u00fczerindeki g\u00fcvenli\u011fi ayarl\u0131yoruz.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\"># chmod 750 \/etc\/init.d\/dbora<\/span><\/pre>\n<p><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">4.\u00a0Ba\u015flang\u0131\u00e7ta \u00e7al\u0131\u015fmas\u0131 i\u00e7in chkconfig katman\u0131na ekliyoruz.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\"># chkconfig --add dbora<\/span><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">5. \u015eimdi dbora dosyas\u0131nda bahsetti\u011fimiz a\u00e7\u0131l\u0131\u015f ve kapan\u0131\u015f scriptlerini olu\u015fturaca\u011f\u0131m\u0131z dizine koyaca\u011f\u0131z. Bununla beraber a\u00e7\u0131l\u0131\u015f ve kapan\u0131\u015fta \u00e7al\u0131\u015fmas\u0131 gereken komutlar\u0131 bu dosyalar\u0131m\u0131z\u0131n i\u00e7in yazaca\u011f\u0131z. Bununla beraber dosyalar\u0131m\u0131za &#8220;oracle&#8221; kullan\u0131c\u0131s\u0131n\u0131n eri\u015febilmesi i\u00e7in gerekli ayarlar\u0131 yapaca\u011f\u0131z.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\"># mkdir -p \/home\/oracle\/scripts\r\n# chown oracle.oinstall \/home\/oracle\/scripts<\/span><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">6. Art\u0131k ba\u015flang\u0131\u00e7 ve kapan\u0131\u015f scriptlerimizi olu\u015fturabiliriz.\u00a0Burada kullan\u0131lan DB parametresini kendi sistemimize g\u00f6re ayarlamam\u0131z gerekmektedir.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\">-- Ba\u015flang\u0131\u00e7 Scriptimizi olu\u015fturuyoruz.\r\n\r\n# vim \/home\/oracle\/scripts\/startup.sh\r\n\r\n-- A\u00e7m\u0131\u015f oldu\u011fumuz dosyaya a\u015fa\u011f\u0131daki sat\u0131rlar\u0131 giriyoruz.\r\n\r\n#!\/bin\/bash\r\n\r\nexport ORACLE_SID=orcl\r\nORAENV_ASK=NO\r\n. oraenv\r\nORAENV_ASK=YES\r\n\r\n# Start Listener\r\nlsnrctl start\r\n\r\n# Start Database\r\nsqlplus \/ as sysdba &lt;&lt; EOF\r\nSTARTUP;\r\nEXIT;\r\nEOF\r\n\r\n# Start Enterprise Manager\r\nemctl start dbconsole\r\n\r\n-- Kapan\u0131\u015f Scriptimizi olu\u015fturuyoruz.\r\n\r\n# vim \/home\/oracle\/scripts\/shutdown.sh\r\n\r\n-- A\u00e7m\u0131\u015f oldu\u011fumuz dosyaya a\u015fa\u011f\u0131daki sat\u0131rlar\u0131 giriyoruz.\r\n\r\n#!\/bin\/bash\r\n\r\nexport ORACLE_SID=orcl\r\nORAENV_ASK=NO\r\n. oraenv\r\nORAENV_ASK=YES\r\n\r\n# Stop Enterprise Manager\r\nemctl stop dbconsole\r\n\r\n# Stop Listener\r\nlsnrctl stop\r\n\r\n# Stop Database\r\nsqlplus \/ as sysdba &lt;&lt; EOF\r\nSHUTDOWN IMMEDIATE;\r\nEXIT;\r\nEOF<\/span><\/pre>\n<p><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">7. Bu i\u015flemden sonra scriptlerimizin sahiplik ve g\u00fcvenlik ayarlar\u0131n\u0131 yapaca\u011f\u0131z.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\"># chmod u+x \/home\/oracle\/scripts\/startup.sh \/home\/oracle\/scripts\/shutdown.sh\r\n# <\/span><span style=\"font-family: courier new,courier; font-size: 12px;\">chown oracle.oinstall \/home\/oracle\/scripts\/startup.sh <span style=\"font-size: 10px;\">\/home\/oracle\/scripts\/shutdown.sh<\/span><\/span><\/pre>\n<p><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">8. Yapacaklar\u0131m\u0131z bu kadar art\u0131k servislerimizi test edebiliriz.<\/span><\/p>\n<pre class=\"brush: bash; gutter: false; first-line: 1\"><span style=\"font-family: courier new,courier; font-size: 12px;\"># service dbora start\r\n# service dbora stop<\/span><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">Bu makalemizde uygulanan ad\u0131mlar Oracle Enterprise Linux 6.4 \u00fczerinde Oracle 11g R2 (11.2.0.3.0) veritaban\u0131nda test edilmi\u015ftir.<\/span><\/p>\n<p><span style=\"font-family: arial,helvetica,sans-serif; font-size: 12px;\">Ba\u015fka bir\u00a0makalede g\u00f6r\u00fc\u015fmek dile\u011fiyle&#8230;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bu makalemizde Linux \u0130\u015fletim Sistemleri \u00fczerinde otomatik veritaban\u0131 ba\u015flatma ve durdurma konusunu inceleyece\u011fiz. Veritaban\u0131 ile birlikte Listener Servisi ve Enterprise Manager konsolununda otomatik a\u00e7\u0131l\u0131p kapanmas\u0131n\u0131 sa\u011flayaca\u011f\u0131z. Bu \u00f6zellikle sistemimizde kurulu olan veritaban\u0131m\u0131z sunucumuz a\u00e7\u0131ld\u0131\u011f\u0131nda a\u00e7\u0131lacak sunucumuza shutdown veya reboot komutu &hellip; <a href=\"https:\/\/www.koraykey.com\/?p=632\">Okumaya devam et <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,8],"tags":[46,21,290,20,19,360,359,45],"class_list":["post-632","post","type-post","status-publish","format-standard","hentry","category-oracle","category-unix-linux","tag-database-startup-script","tag-h-koray-gunduz","tag-halil-koray-gunduz","tag-koray-gunduz","tag-koraykey","tag-oracle-database-otomatik-baslatma","tag-oracle-otomatik-baslatma","tag-otomatik-veritabani-baslatma-ve-durdurma"],"_links":{"self":[{"href":"https:\/\/www.koraykey.com\/index.php?rest_route=\/wp\/v2\/posts\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.koraykey.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.koraykey.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.koraykey.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.koraykey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=632"}],"version-history":[{"count":0,"href":"https:\/\/www.koraykey.com\/index.php?rest_route=\/wp\/v2\/posts\/632\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.koraykey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.koraykey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.koraykey.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}