RedHat 5上安装oracle 11gR2,在sqlplus中连接数据库时报错,listener was not given*

1、详细报错“
SQL> conn sys/system@ora11g
ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

2、我不确认我当时安装数据库时数据库名是不是ora11g
3、监听启动打印:
bash-3.1$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-DEC-2012 03:51:52
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /home/oracle/oracle_base/software_location/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /home/oracle/oracle_base/software_location/network/admin/listener.ora
Log messages written to /home/oracle/oracle_base/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 24-DEC-2012 03:51:54
Uptime 0 days 0 hr. 0 min. 4 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/oracle_base/software_location/network/admin/listener.ora
Listener Log File /home/oracle/oracle_base/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
4、listener.ora文件内容,可放大查看

5、tnsnames.ora内容,可放大查看

第1个回答  2013-01-06
sqlplus / as sysdba
select name from v$database; /*查询实例名*/
如果不是ora11g需要修改监听文件。

你的tnsnames.ora这个文件里根本就是空的,要配置。
第2个回答  2012-12-27
1.应该是没有在tnsnames.ora文件中配置你得这个数据库连接字符。

2.看看服务有没有启动。
你可以通过tnsping ora11g
来看下你得这个连接字符串有没有被正确的解析。
第3个回答  2013-01-05
在数据库本地服务器连接时不需要走监听,sys用户也不用密码
conn / as sysdba

如果是远程连数据库,或者希望通过监听连接数据库,需要配置tnsnames.ora文件。
第4个回答  2013-01-07
tns没有配置,你netca配置下tns就好了
相似回答