2014-07-21 97 views
5

我在Linux机器上安装了Oracle Database 11gR2以及Oracle Grid Infrastructure,然后创建了orcl数据库。监听器不支持服务

我一直能够使用SQL * Plus或OEM连接到我的数据库。但最近,我在输入命令lsnrctl status时遇到了问题,所以我无法连接到数据库。

listener.ora文件:

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora 
# Generated by Oracle configuration tools. 
LISTENER = 
    (DESCRIPTION_LIST = 
    (DESCRIPTION = 
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) 
     (ADDRESS = (PROTOCOL = TCP)(HOST = pc.company.com)(PORT = 1521)) 
    ) 
) 
ADR_BASE_LISTENER = /u01/app/oracle 

我的tnsnames.ora文件:

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora 
# Generated by Oracle configuration tools. 

ORCL = 
    (DESCRIPTION = 
    (ADDRESS = (PROTOCOL = TCP)(HOST = pc.company.com)(PORT = 1521)) 
    (CONNECT_DATA = 
     (SERVER = DEDICATED) 
     (SERVICE_NAME = orcl.example.com) 
    ) 
) 

当输入lsnrctl status,我得到如下:

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-JUL-2014 03:35:48 

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) 
STATUS of the LISTENER 
------------------------ 
Alias      LISTENER 
Version     TNSLSNR for Linux: Version 11.2.0.1.0 - Production 
Start Date    21-JUL-2014 03:25:58 
Uptime     0 days 0 hr. 9 min. 50 sec 
Trace Level    off 
Security     ON: Local OS Authentication 
SNMP      OFF 
Listener Log File   /u01/app/oracle/diag/tnslsnr/pc151/listener/alert/log.xml 
Listening Endpoints Summary... 
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=pc.company.com)(PORT=1521))) 
The listener supports no services 
The command completed successfully 

WHE ñ打字sqlplus/as sysdba然后startup,我得到这个:

ORA-01078: failure in processing system parameters 
ORA-01565: error in identifying file '+DATA/orcl/spfileorcl.ora' 
ORA-17503: ksfdopn:2 Failed to open file +DATA/orcl/spfileorcl.ora 
ORA-29701: unable to connect to Cluster Synchronization Service 

而且srvctl start database命令无法启动数据库太多。

oratab文件如下:

#Backup file is /u01/app/oracle/product/11.2.0/dbhome_1/srvm/admin/oratab.bak.pc150 line added by Agent 
# 

# This file is used by ORACLE utilities. It is created by root.sh 
# and updated by the Database Configuration Assistant when creating 
# a database. 

# A colon, ':', is used as the field terminator. A new line terminates 
# the entry. Lines beginning with a pound sign, '#', are comments. 
# 
# Entries are of the form: 
# $ORACLE_SID:$ORACLE_HOME:<N|Y>: 
# 
# The first and second fields are the system identifier and home 
# directory of the database respectively. The third filed indicates 
# to the dbstart utility that the database should , "Y", or should not, 
# "N", be brought up at system boot time. 
# 
# Multiple entries with the same $ORACLE_SID are not allowed. 
# 
# 
+ASM:/u01/app/oracle/product/11.2.0/grid:N 
orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N   # line added by Agent 
+0

您的数据库是否正在运行?它在注册之前不会出现在服务列表中,如果可以的话它会在启动时执行,并且如果它不能,它会一直尝试。如果它已经启动 - 你可以使用SQL * Plus本地连接 - 你有'local_listener' init参数集吗?并且'pc.company.com'解析为您电脑的实际IP地址(即您没有使用DHCP)? –

+0

我的数据库没有运行不幸,我没有使用dhcp。我有一个静态IP地址。 – Simo03

回答

15

数据库启动时与听众注册其服务名称(S)。如果它不能这样做,那么它会定期再次尝试 - 所以如果侦听器在数据库之后启动,那么在识别服务之前可能会有一段延迟。

如果数据库没有运行,但没有任何东西会注册该服务,因此您不应该期望收听者知道它 - lsnrctl statuslsnrctl services不会报告尚未注册的服务。

您可以在没有侦听器的情况下启动数据库;从Oracle帐户并使用ORACLE_HOMEORACLE_SIDPATH集,你可以这样做:

sqlplus /nolog 

然后从SQL * Plus提示符:

connect/as sysdba 
startup 

或者通过网格基础设施,从电网账户,使用srvctl start database command

srvctl start database -d db_unique_name [-o start_options] [-n node_name] 

你可能想看看数据库是否设置为自动启动中您的oratab文件,并取决于您使用的是否应自动启动。如果你期望它正在运行,而不是,或者你试图启动它,它不会出现,那么这是一个完全不同的情况 - 你需要看看错误消息,警报日志,可能跟踪文件等,以确切地知道为什么它不会启动,如果你不能解决它,也许问数据库管理员而不是堆栈溢出。


如果数据库无法看到+DATA那么ASM可能没有运行;你可以see how to start that here;或使用srvctl start asm。正如文档所述,确保你是从网格家中,而不是数据库家中完成的。

+0

通过发出srvctl start asm无法启动asm!我的listener.ora文件位于网格首页,而不是数据库主页,是否正常? – Simo03

+1

是的,这是正常的。请将您从ASM开始获得的错误添加到问题中。你从网格家开始ASM,对吧?可能值得关注ASM状态和磁盘状态,具体取决于错误是什么。 –

0

您需要重新配置您的tnsnames.ora,以便在侦听器能够选择新的主机名后指向您的主机名 。之后检查您的监听器状态lsnrctl状态并启动监听器lsnrctl start 然后注册您的监听器。修改系统寄存器