Linux下啟動Oracle


轉載請注明來源:http://blog.csdn.net/loongshawn/article/details/51162196

1、啟動oracle的步驟

Linux下啟動oracle分為以下兩步:

  • 1.1、啟動lsnrctl監聽。
  • 1.2、啟動數據庫實例。

2、啟動oracle監聽

首先登陸服務器,切換到oracle用戶。

[admin@dataserver ~]$ su - oracle 密碼: [oracle@dataserver ~]$
  • 1
  • 2
  • 3

這里寫圖片描述

接下來,檢查oracle監聽器運行狀態,通過lsnrctl status命令查看。

[oracle@dataserver ~]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-4月 -2016 14:39:39 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 2: No such file or directory Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=30.85.227.24)(PORT=1521))) TNS-12543: TNS:destination host unreachable TNS-12560: TNS:protocol adapter error TNS-00513: Destination host unreachable Linux Error: 113: No route to host Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=30.85.227.23)(PORT=1521))) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refused [oracle@dataserver ~]$ exit 

上述反饋的結果即為oracle監聽沒有啟動,下面執行啟動監聽,通過命令lsnrctl start,結果如下:

[oracle@dataserver ~]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-4月 -2016 14:51:06 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/dataserver/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=30.85.227.24)(PORT=1521))) TNS-12545: Connect failed because target host or object does not exist TNS-12560: TNS:protocol adapter error TNS-00515: Connect failed because target host or object does not exist Linux Error: 99: Cannot assign requested address Listener failed to start. See the error message(s) above... [oracle@dataserver ~]$ 

這里寫圖片描述 
上述反饋為監聽啟動失敗,是因為其監聽的IP30.85.227.24,並非服務器的IP,所以需要調整這個IP為服務器當前的IP。

在oracle用戶下,進入目錄/u01/app/oracle/product/11.2.0/dbhome_1/network/admin,修改listener.ora文件。注意這個目錄因具體服務器而異。 
這里寫圖片描述

listener.ora文件打開,內容如下,調整其中的HOST IP即可。

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ORCL) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = ORCL) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 30.85.227.28)(PORT = 1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 30.85.227.23)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /u01/app/oracle 

調整完監聽IP后,重啟監聽器,執行lsnrctl start,

[oracle@dataserver admin]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-4月 -2016 15:09:15 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/dataserver/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=30.85.227.28)(PORT=1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=30.85.227.23)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 15-4月 -2016 15:09:15 Uptime 0 days 0 hr. 0 min. 5 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/dataserver/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=30.85.227.28)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=30.85.227.23)(PORT=1521))) Services Summary... Service "ORCL" has 1 instance(s). Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@dataserver admin]$ 

 

至此,oracle監聽器啟動成功!

這里寫圖片描述

3、啟動oracle實例

以system用戶身份登陸oracle

[oracle@dataserver admin]$ sqlplus /nolog SQL*Plus: Release 11.2.0.1.0 Production on 星期五 4月 15 15:23:04 2016 Copyright (c) 1982, 2009, Oracle. All rights reserved. SQL> conn as sysdba Enter user-name: system Enter password: Connected to an idle instance. 

然后啟動實例,通過startup命令:

SQL> startup
ORACLE instance started.

Total System Global Area 4.0620E+10 bytes Fixed Size 2216024 bytes Variable Size 2.3354E+10 bytes Database Buffers 1.7180E+10 bytes Redo Buffers 84054016 bytes Database mounted. Database opened. SQL> 

這里寫圖片描述

4、關閉oracle實例

通過shutdown命令關閉oracle實例。

SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM