2014-07-21 96 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 然後註冊您的監聽器。修改系統寄存器