1. 程式人生 > >sqldeveloper錯誤集錦(不定期更新)

sqldeveloper錯誤集錦(不定期更新)

1、先看oracle的監聽和oracle的服務是否都啟動了。啟動oracle監聽:輸入lsnrctl start,回車即啟動監聽 2、檢視oracle的sid叫什麼(echo $ORACLE_SID),比如建立資料庫的時候,例項名叫“prod”,那麼先手工設定一下oralce的sid,cmd命令視窗中,set ORACLE_SID=prod 3、 再輸入sqlplus /nolog,回車 再輸入 conn / as sysdba;回車 4、再輸入startup,回車.這步是啟動oracle服務。如果startup啟動被告知已經啟動了,可以先輸入shutdown immediate;等shutdown結束之後,再輸入startup。 5、 過幾秒鐘等命令執行完成,就能連線了。這個時候,可以輸入"select * from user_tables;"測試一下,看是否有查詢結果。 6、出現ORA-01034和ORA-27101的原因是多方面的:主要是oracle當前的服務不可用, shared memory realm does not exist,是因為oracle沒有啟動或沒有正常啟動,共享記憶體並沒有分配給當前例項. 所以,通過設定例項名,再用作業系統身份驗證的方式,啟動資料庫。 這樣資料庫就正常啟動了,就不會報ORA-01034和ORA-27101兩個啟動異常了。

[[email protected] admin]$ sqlplus system/[email protected]
SQL*Plus: Release 11.2.0.6.0 - Production on Tue Aug 10 11:05:04 2010
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
對於這個問題第一印象,可能會覺得沒有足夠的記憶體空間,來建立共享記憶體段
1.首先檢查核心引數設定以及alert.log 檔案
fs.file-max = 6553600
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
檢視後都沒有問題,主機有足夠的記憶體,資料庫也已經在啟動狀態:
SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
2.之後發現在報錯之後,繼續輸入使用者名稱和密碼確可以登陸
Enter user-name: system
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
3.檢視sqlnet.log日誌
[
[email protected]
log]$ pwd /u01/app/product/11.1.0/db_1/network/log [[email protected] log]$ cat sqlnet.log Directory does not exist for read/write [/u01/app/product/11.1.0/db_1/log] [/u01/app/product/11.1.0/db_1/log/diag/clients] *********************************************************************** Fatal NI connect error 12541, connecting to: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.201.1.134)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=Oracle8)(CID=(
[email protected]
)(HOST=localhost)(USER=oracle)))) VERSION INFORMATION: TNS for Linux: Version 11.1.0.6.0 - Production TCP/IP NT Protocol Adapter for Linux: Version 11.1.0.6.0 - Production Time: 05-AUG-2010 18:30:51 Tracing not turned on. Tns error struct: ns main err code: 12541 TNS-12541: TNS:no listener ns secondary err code: 12560 nt main err code: 511 TNS-00511: No listener nt secondary err code: 111 nt OS err code: 0 *********************************************************************** 提示找不到listener...... 4.檢查listener是否配置正確 [[email protected] alert]$ cat /u01/app/product/11.1.0/db_1/network/admin/listener.ora # listener.ora Network Configuration File: /u01/app/product/11.1.0/db_1//network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (ORACLE_HOME = /u01/app/product/11.1.0/db_1) (SID_NAME = siebtest) ) ) LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.201.1.134)(PORT = 1521)) ) [[email protected] ~]$ tnsping test Used parameter files: /u01/app/product/11.1.0/db_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.201.1.134)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = siebtest))) OK (0 msec) listener 配置沒有問題。。。 5.由於例項已經在啟動的狀態,這時候考慮到例項註冊的問題 SQL> show parameter local_listener NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ local_listener string 發現local_listener沒有值。。。。。 6.設定local_listener引數 SQL> alter system set local_listener='(ADDRESS =(PROTOCOL=TCP)(HOST=10.201.1.134)(PORT=1521)(SID=siebtest))'; System altered. SQL> alter system register; System altered. 7.再次登陸成功 [[email protected] alert]$ sqlplus system/[email protected] SQL*Plus: Release 11.1.0.6.0 - Production on Tue Aug 10 12:51:11 2010 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> 總結: 如果LOCAL_LISTENER丟失,會導致自動例項註冊失敗,資料庫例項不會識別Listener,當Listener連線 資料庫例項的時候,由於Listener沒有註冊,導致了 ORA-27101: shared memory realm does not exist. --------------------- 作者:獨家記憶0408 來源:CSDN 原文:https://blog.csdn.net/u013519551/article/details/53485342 版權宣告:本文為博主原創文章,轉載請附上博文連結!