Subject: | Can´t connect to remoteserver with several dbinstances |
My System
SuSE Linux 8.0 with kernel 2.4.18-64GB-SMP, Oracle 8.1.7, perl 5.6.1, DBD::Oracle 1.12, DBI 1.20
I tried to connect to another host with the same configuration trough DBD::Oracle without tnsnames.ora. On the remote System there are two instances. The first with SID=elwiso, the other with SID=pub. Connecting to elwiso everything works fine, but connection to pub i got an error "ORA-12545: Connect failed because target host or object does not exist (DBD ERROR: OCIServerAttach)"
Next i tried to connect with tnsnames.ora and everything worked fine. After a few tests i found this:
In tnsnames.ora for every service there is the tag (SID=XXX)(SERVER=DEDICATED, so i tried to understand Oracle.pm how to configure connection without using tnsnames.ora and found in line 201
'$dbname = "(DESCRIPTION=$addrs(CONNECT_DATA=(SID=$sid)))";'
Next i changed it to '$dbname = "(DESCRIPTION=$addrs(CONNECT_DATA=(SID=$sid)(SERVER=$dbname{SERVER})))";
'
Now it´s possible to use connection string like
"dbi:Oracle:host=$host;sid=$sid;server=$servertype" and everything works find. Ignoring server is also no problem. Next i compared DBD::Oracle 1.12 with DBD::Oracle 1.16 and i think the changes must also be done there, but I can´t test it here, cause this version doesn´t work on my hosts.