Todd

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            65 隨筆 :: 0 文章 :: 24 評論 :: 0 Trackbacks

          啟動數據庫實例,分為兩步:第一步,啟動監聽;第二步,啟動數據庫實例。
           
          一、如何啟動數據庫實例
             1.進入到sqlplus啟動實例
          [oracle@redhat ~]$ su - oracle                                 --“切換到oracle用戶”
          Password:
          [oracle@redhat ~]$ lsnrctl start                               --“打開監聽”
          LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-OCT-2009 19:06:40
          Copyright (c) 1991, 2005, Oracle.  All rights reserved.
          Starting /home/oracle/product/10g/bin/tnslsnr: please wait...
          TNSLSNR for Linux: Version 10.2.0.1.0 - Production
          System parameter file is /home/oracle/product/10g/network/admin/listener.ora
          Log messages written to /home/oracle/product/10g/network/log/listener.log
          Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
          Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=redhat)(PORT=1522)))
          Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
          STATUS of the LISTENER
          ------------------------
          Alias                     LISTENER
          Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
          Start Date                14-OCT-2009 19:06:40
          Uptime                    0 days 0 hr. 0 min. 0 sec
          Trace Level               off
          Security                  ON: Local OS Authentication
          SNMP                      OFF
          Listener Parameter File   /home/oracle/product/10g/network/admin/listener.ora
          Listener Log File         /home/oracle/product/10g/network/log/listener.log
          Listening Endpoints Summary...
            (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
            (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=redhat)(PORT=1522)))
          Services Summary...
          Service "PLSExtProc" has 1 instance(s).
            Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
          The command completed successfully
          [oracle@redhat ~]$ sqlplus /nolog                                --“進入到sqlplus”
          SQL*Plus: Release 10.2.0.1.0 - Production on Wed Oct 14 19:06:45 2009
          Copyright (c) 1982, 2005, Oracle.  All rights reserved.
          SQL> conn /as sysdba                                              --“連接到sysdba”
          Connected to an idle instance.
          SQL> startup                                                     --“啟動數據庫實例”
          ORACLE instance started.
          Total System Global Area  285212672 bytes
          Fixed Size      1218968 bytes
          Variable Size     88082024 bytes
          Database Buffers   188743680 bytes
          Redo Buffers      7168000 bytes
          Database mounted.
          Database opened.
          SQL> shutdown immediate                                          --“關閉數據庫實例”
          Database closed.
          Database dismounted.
          ORACLE instance shut down.
          SQL> exit
          Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
          With the Partitioning, OLAP and Data Mining options
          [oracle@redhat ~]$ lsnrctl stop                                 --“關閉監聽”
          LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-OCT-2009 19:08:06
          Copyright (c) 1991, 2005, Oracle.  All rights reserved.
          Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
          The command completed successfully
           
             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                                   --“啟動監聽”
          LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-OCT-2009 19:44:53
          Copyright (c) 1991, 2005, Oracle.  All rights reserved.
          Starting /home/oracle/product/10g/bin/tnslsnr: please wait...
          TNSLSNR for Linux: Version 10.2.0.1.0 - Production
          System parameter file is /home/oracle/product/10g/network/admin/listener.ora
          Log messages written to /home/oracle/product/10g/network/log/listener.log
          Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
          Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=redhat)(PORT=1522)))
          Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
          STATUS of the LISTENER
          ------------------------
          Alias                     LISTENER
          Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
          Start Date                14-OCT-2009 19:44:53
          Uptime                    0 days 0 hr. 0 min. 0 sec
          Trace Level               off
          Security                  ON: Local OS Authentication
          SNMP                      OFF
          Listener Parameter File   /home/oracle/product/10g/network/admin/listener.ora
          Listener Log File         /home/oracle/product/10g/network/log/listener.log
          Listening Endpoints Summary...
            (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
            (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=redhat)(PORT=1522)))
          Services Summary...
          Service "PLSExtProc" has 1 instance(s).
            Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
          The command completed successfully
          [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                              --“關閉監聽”
          LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-OCT-2009 19:45:33
          Copyright (c) 1991, 2005, Oracle.  All rights reserved.
          Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
          The command completed successfully
           
          二、如何使數據庫實例和linux系統一起啟動
          在/etc/rc.d/rc.local中加入如下語句即可實現同系統啟動實例:
          su - oracle -c "lsnrctl start"
          su - oracle -c "dbstart" 



          posted on 2011-04-18 16:05 Todd 閱讀(805) 評論(0)  編輯  收藏 所屬分類: DB
          主站蜘蛛池模板: 东方市| 乐昌市| 方山县| 都江堰市| 平塘县| 四子王旗| 年辖:市辖区| 南皮县| 遂昌县| 彭州市| 手机| 涟水县| 泰宁县| 鹤山市| 崇仁县| 大安市| 镇沅| 乌兰县| 鹤庆县| 河源市| 松阳县| 海兴县| 遂溪县| 虹口区| 桃园县| 老河口市| 富锦市| 兴义市| 石林| 方正县| 封丘县| 沿河| 徐汇区| 永州市| 西盟| 青铜峡市| 镇宁| 庆城县| 咸阳市| 类乌齐县| 绥江县|