無法使用串連串聯接資料庫ORA-01034&ORA-27101

來源:互聯網
上載者:User

無法使用串連串聯接資料庫ORA-01034&ORA-27101

作業系統是linux as5,資料庫是10g,在重啟機器後,使用@connecct_string的方式無法串連上資料庫,只能使用使用者/密碼的方式。

事後總結了下:這個問題是發生在刪除已有資料之後,再重新建立了2個資料庫的情況下,如果你也做過類似操作,基本上是同一個問題。

錯誤如下:
SQL> conn system/test@orcl
ERROR:
ORA-01034: Oracle not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
檢查了環境環境變數,查看了監聽狀態和執行個體狀態都是正常的。
[oracle@localhost ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

export TMP=/tmp;
export TMPDIR=$TMP;
export ORACLE_BASE=/usr/oracle;
export ORACLE_HOME=/usr/oracle/product/10.2.0/db_1;
export ORACLE_SID=ORCL;
export ORACLE_TERM=xterm;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin:/sbin:/usr/bin:/usr/sbin;
umask 022
[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 31-OCT-2011 11:57:36

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                31-OCT-2011 11:43:36
Uptime                    0 days 0 hr. 14 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /usr/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /usr/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.4)(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@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Oct 31 11:57:39 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

SQL> conn system/test
Connected.
SQL> conn system/test@orcl
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory


Warning: You are no longer connected to ORACLE.

到網路上搜尋了下,發現設定了下local_listener即可。

SQL> conn /as sysdba
Connected.
SQL> show parameter local_listener;
SQL> show parameter local;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
local_listener                 string
log_archive_local_first          boolean     TRUE

SQL> alter system set local_listener='(ADDRESS =(PROTOCOL=TCP)(HOST=192.168.2.4)(PORT=1521)(SID=ORCL))';

System altered.

SQL> alter system register;

System altered.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost admin]$ sqlplus system/test@orcl

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Oct 31 12:13:17 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
-The End-

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.