![fedora 15、oracle 11:无法使用 sqlplus 登录](https://linux22.com/image/2309/fedora%2015%E3%80%81oracle%2011%EF%BC%9A%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%20sqlplus%20%E7%99%BB%E5%BD%95.png)
所以昨天我正在与导入cx_Oracle终于成功了。但是,我无法连接到数据库。所以我检查了 sqlplus 以了解是否可以连接到我的 Oracle 数据库。我已经使用配置期间设置的密码尝试了 SYS 和 SYSTEM 以及 SCOTT/TIGER,但没有任何帮助,而且我总是遇到相同的错误。这是打印的内容:
[gruszczy@gruszczy-laptop matches]$ sqlplus
SQL*Plus: Release 11.2.0.2.0 Beta on Sat Jun 11 12:33:48 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: sys
Enter password:
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
Enter user-name: system
Enter password:
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
Enter user-name: scott
Enter password:
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
您知道什么可能没有设置吗?我在 Google 上找到了信息,我需要在 ORACLE_HOME 和 ORACLE_SID 设置中没有尾部斜杠。我已经做了这两件事:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=XE
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
我是否做错了什么或者我需要设置更多的东西?
编辑
我的 tnsnames.ora:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gruszczy-laptop)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
编辑
我尝试执行建议的操作并得到以下结果:
$ sudo su - oracle
$ -bash-4.2$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Beta on Sat Jun 11 21:47:15 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=gruszczy-laptop)(PORT=1521))'
SQL> Disconnected
-bash-4.2$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Beta on 11-JUN-2011 21:47:43
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
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=gruszczy-laptop)(PORT=1521)))
这并没有告诉我任何事情,我也不知道这一切应该如何配置。我以前从未需要进行过这样的设置。通常,在我尝试做任何事情之前,我都会使用“启动数据库”应用程序启动数据库。
答案1
看起来你的数据库没有启动。与连接
sqlplus / as sysdba
然后发出startup
命令。
还要确保侦听器已启动并正在运行lsnrctl status
(lsnrctl start
如果它未运行)。
答案2
配置文件中条目的/
末尾是否有尾随?ORACLE_HOME
listener.ora
如果是这样,请将其删除。