我有一个 Rails 应用程序,使用 oracle 作为数据库。
我曾经在我的旧机器上使用 oracle virtualbox 和 Oracle Developer Day 工具包运行它。oracle 提供的包包括 Oracle 数据库 11g 现在我有一台新笔记本电脑,需要重新安装所有东西,一切顺利,但现在 oracle 包“OTN 开发日”使用的是 oracle 数据库 12g。
在以完全相同的方式设置完所有内容后,我在通过 oci8 测试连接时遇到了这个错误:
1.9.3-p327 :001 > require 'oci8'
=> false
1.9.3-p327 :002 > c= OCI8.new('me', 'mypassword', '//localhost:1521/orcl')
OCIError: ORA-12537: TNS:connection closed
from oci8.c:267:in oci8lib_191.bundle
from (irb):2:in `new'
from (irb):2
from /Users/stephanethomas/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
from /Users/stephanethomas/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
from /Users/stephanethomas/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.14/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
在我的虚拟机中,如果我检查监听器,我一切正常:
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 09-MAR-2014 20:26:17
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 09-MAR-2014 19:56:48
Uptime 0 days 0 hr. 29 min. 28 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/12.1.0/dbhome_1/log/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=80))(PROTOCOL_STACK=(PRESENTATION=HTTP)(SESSION=RAW)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=21))(PROTOCOL_STACK=(PRESENTATION=FTP)(SESSION=RAW)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pdb1" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
12和11之间有什么重大变化吗?或者我在安装时错过了什么?
提前致谢!