Maison >base de données >tutoriel mysql >无法使用连接串连接数据库ORA-01034ORA-27101

无法使用连接串连接数据库ORA-01034ORA-27101

WBOY
WBOYoriginal
2016-06-07 17:07:33851parcourir

操作系统是linux as5,数据库是10g,在重启机器后,使用@connecct_string的方式无法连接上数据库,只能使用用户/密码的方式。

操作系统是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-

linux

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn