Linux下啟動Oracle資料庫執行個體

來源:互聯網
上載者:User

Linux下啟動Oracle資料庫執行個體,分為兩步:第一步,啟動監聽;第二步,啟動資料庫執行個體。
 
 一、如何啟動資料庫執行個體
    1.進入到sqlplus啟動執行個體
  su - oracle                                --“切換到oracle使用者”
 lsnrctl start                              --“開啟監聽”
 sqlplus /nolog                                --“進入到sqlplus”
 SQL> conn /as sysdba                                            --“串連到sysdba”
 Connected to an idle instance.
 SQL> startup                                                    --“啟動資料庫執行個體”
 SQL> shutdown immediate                                        --“關閉資料庫執行個體”
 SQL> exit
 [oracle@RedHat ~]$ lsnrctl stop                                --“關閉監聽”
    2.用dbstart和dbshut啟動和關閉資料庫執行個體
 
 先啟動監聽 lsnrctl start
 啟動執行個體  dbstart
 
 使用dbstart命令啟動資料庫比較方便,但是在linux上安裝好oracle之後,第一次使用dbstart命令可能會報如下錯誤:
 
 ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
 Usage: /u01/app/oracle/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME
 
原因:
 dbstart和dbshut指令檔中ORACLE_HOME_LISTNER的設定有問題,分別開啟兩個檔案找到:用vi編輯dbstart,ORACLE_HOME_LISTNER=$1,修改為
 ORACLE_HOME_LISTNER=$ORACLE_HOME
 
 
 然後儲存退出,此時再運行dbstart,已經不報錯了,但是沒有任何反應,ps一下進程,沒有oracle的進程,說明oracle執行個體沒有正常啟動。
 
 此時的原因是在/etc/oratab的設定問題,我們vi一下,發現
 zgz:/home/oracle/product/10g:N
 最後設定的是"N"(我的環境中只有一個執行個體,因此只有一行配置語句),我們需要把“N”修改為“Y”。
 
 以上的工作做好之後,dbstart就可以正常使用了:
 
 [oracle@redhat bin]$ lsnrctl start                                  --“啟動監聽”
 [oracle@redhat bin]$ dbstart                                  --“啟動資料庫執行個體”
 Processing Database instance "zgz": log file /home/oracle/product/10g/startup.log
 [oracle@redhat bin]$ dbshut                                    --“關閉資料庫執行個體”
 [oracle@redhat bin]$ lsnrctl stop                              --“關閉監聽”
 
 二、如何使資料庫執行個體和linux系統一起啟動
 在/etc/rc.d/rc.local中加入如下語句即可實現同系統啟動執行個體:
 su - oracle -c "lsnrctl start"
 su - oracle -c "dbstart"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.