Question

I have a rails app, using oracle for database.

I used to run it using oracle virtualbox and Oracle Developer Day kit on my old machine. The pack provided by oracle included Oracle database 11g Now I have a new laptop, need to reinstall everything, which went well, but now oracle pack 'OTN dev day' uses oracle database 12g.

And after setting everything up the exact same way, I run into this error while testing my connection via 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>'

In my VM, if I check the listener I've got everything working fine:

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

Is there any significant changes between 12 and 11? Or did I miss something while installing?

Thanks in advance!

Was it helpful?

Solution 2

Turns out I had the VM misconfigured, and my listener was not properly defined. If it happens to you to, here is how I fixed it:

In the virtual box app preferences > Network. Click Host-only Networks. Add one, keep all the default.

Set up the network as below:

Adapter 1: 
  - Bridge Adapter
  - en0: Wi-Fi
  - Premicious mode: deny
Adapter @:
  - Host-only Adapter
  - vboxnet0
  - Allow All

On the server, check that the connection using the one line command:

$> sqlplus system/oracle@orcl

After the installation of the gem below, you should be abe to connect using the following:

OCI8.new('me', 'mypassword', '//localhost:1521/orcl')

Also, it happened after some time that the server size avoid the launch of the db, block a migration or makes the restart of the server buggy, if you face that, try to go in the following directory on the server: /u01/app/oracle/oradata/ORCL/datafile/ and look for a .tmp file very big (10G), destroy it and restart the server.

OTHER TIPS

Generally for ora-12537 you should get a stack of error messages. The previous error messages are more important, it looks like ruby suppresses them (not good).

Did you disable the firewall on the machine?

Otherwise post the listener.ora, sqlnet.ora and protocol.ora files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top