1 先看oracle的監(jiān)聽(tīng)和oracle的服務(wù)是否都啟動(dòng)了,。啟動(dòng)oracle監(jiān)聽(tīng):
cmd的命令行窗口下,,輸入lsnrctl start,,回車即啟動(dòng)監(jiān)聽(tīng),。
2 查看oracle的sid叫什么,,比如創(chuàng)建數(shù)據(jù)庫(kù)的時(shí)候,實(shí)例名叫“abc”,,那么先手工設(shè)置一下oralce的sid,,cmd命令窗口中,set
ORACLE_SID=abc
3 再輸入sqlplus /nolog,回車
再輸入 conn / as sysdba;回車
4 再輸入startup,,回車.這步是啟動(dòng)oracle服務(wù),。如果startup啟動(dòng)被告知已經(jīng)啟動(dòng)了,可以先輸入shutdown
immediate,;等shutdown結(jié)束之后,,再輸入startup。
5 過(guò)幾秒鐘等命令運(yùn)行完成,,就能連接了,。這個(gè)時(shí)候,可以輸入"select * from
user_tables;"測(cè)試一下,,看是否有查詢結(jié)果,。
6 出現(xiàn)ORA-01034和ORA-27101的原因是多方面的:主要是oracle當(dāng)前的服務(wù)不可用,shared memory
realm does not
exist,,是因?yàn)閛racle沒(méi)有啟動(dòng)或沒(méi)有正常啟動(dòng),,共享內(nèi)存并沒(méi)有分配給當(dāng)前實(shí)例.所以,通過(guò)設(shè)置實(shí)例名,,再用操作系統(tǒng)身份驗(yàn)證的方式,,啟動(dòng)數(shù)據(jù)庫(kù)。這樣數(shù)據(jù)庫(kù)就正常啟動(dòng)了,,就不會(huì)報(bào)ORA-01034和ORA-27101兩個(gè)啟動(dòng)異常了,。
-------------------------------------------------------------------------------------------
今天在測(cè)試庫(kù)上遇到了ORA-27101的錯(cuò)誤,當(dāng)通過(guò)客戶端連接到db時(shí)返回如下:
[oracle@bluerin admin]$ sqlplus system/oracle@test
SQL*Plus: Release 11.1.0.6.0 - Production on Tue Aug 10 11:05:04
2010
Copyright (c) 1982, 2007,
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
對(duì)于這個(gè)問(wèn)題第一印象,,可能會(huì)覺(jué)得沒(méi)有足夠的內(nèi)存空間,,來(lái)創(chuàng)建共享內(nèi)存段
1.首先檢查內(nèi)核參數(shù)設(shè)置以及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
查看后都沒(méi)有問(wèn)題,主機(jī)有足夠的內(nèi)存,,數(shù)據(jù)庫(kù)也已經(jīng)在啟動(dòng)狀態(tài):
SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
2.之后發(fā)現(xiàn)在報(bào)錯(cuò)之后,,繼續(xù)輸入用戶名和密碼確可以登陸
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日志
[oracle@bluerin log]$ pwd
/u01/app/product/11.1.0/db_1/network/log
[oracle@bluerin 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=(PROGRAM=java@localhost)(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是否配置正確
[oracle@bluerin 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))
)
[oracle@bluerin ~]$ 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 配置沒(méi)有問(wèn)題。,。,。
5.由于實(shí)例已經(jīng)在啟動(dòng)的狀態(tài),這時(shí)候考慮到實(shí)例注冊(cè)的問(wèn)題
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
local_listener string
發(fā)現(xiàn)local_listener沒(méi)有值,。,。。。,。
6.設(shè)置local_listener參數(shù)
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.再次登陸成功
[oracle@bluerin alert]$ sqlplus system/oracle@test
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>
總結(jié):
如果LOCAL_LISTENER丟失,,會(huì)導(dǎo)致自動(dòng)實(shí)例注冊(cè)失敗,數(shù)據(jù)庫(kù)實(shí)例不會(huì)識(shí)別Listener,當(dāng)Listener連接
數(shù)據(jù)庫(kù)實(shí)例的時(shí)候,,由于Listener沒(méi)有注冊(cè),,導(dǎo)致了 ORA-27101: shared memory realm does not
exist.
|