【发布时间】:2016-04-21 10:29:42
【问题描述】:
我正在尝试使用 Ruby on Rails Rake 命令迁移到 Oracle 数据库。我的database.yml 文件包含以下内容:
development:
adapter: oracle
database: album_development
sid: orc1
username: system
password: root
在我的电脑上我设置了ORACLE_SID=orcl.
当我运行 Rake,migrate 时,我收到以下错误:
rake aborted!
The driver encountered an error: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
您能否告诉我是否需要修改我的listener.ora 文件才能使其正常工作?我的listener.ora文件如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = Lenovo-PC)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
lsnrctl Status 命令的输出如下:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.2.0.2.0 - Production
Start Date 21-APR-2016 11:14:15
Uptime 0 days 0 hr. 7 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\listener.ora
Listener Log File C:\oraclexe\app\oracle\diag\tnslsnr\Lenovo-PC\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Lenovo-PC)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Lenovo-PC)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully
任何人都可以帮助/提出建议吗?
【问题讨论】:
-
您是否尝试过连接到 xe 而不是 orcl 例如 sid: xe
-
是的,我用 sid: xe 试过了,也不行
-
错别字 orc1 \ orcl ???
-
orc1 或 orcl 都不起作用
标签: ruby-on-rails oracle rake tns