Re: ORA-12154 - (DBD: login failed)

Christopher Jones <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
You possibly need to bring your 10g client up to date with patches so authentication succeeds; I've seen similar things in the past.  But, in general, 
why use 10g client if you are connecting to 12c?  You may as well use the 12c client.

I forget whether 8i used service names or only the old "SID" names, but check you are using the correct tnsnames.ora syntax if you have upgraded the 
oracle client.

Chris

On 9/08/2016 1:36 AM, Mani, Arunkumar (BMS - India GDC) wrote:
>
> I'll probably explain it with a piece of code and output, so everybody can explain the problem I face clearly.
>
> If you look at 2 codes, the only change is I modified 8i client with 10g client. After that it couldnÂ’t resolve the TNS connection string.
>
> _Perl code with 8i client - works:_
>
> #!/usr/local/bin/perl
>
> #use DBI
>
> #use strict;
>
> use strict;
>
> use lib '/u01/home/oracle/admin/site/lib/perl';
>
> use DBI;
>
> $ENV{ORACLE_HOME} = '/u01/home/oracle/product/8.1.7.4';
>
> $ENV{TNS_ADMIN} = '/home/httpd/cgi-bin/oradba';
>
> my $sid = "ECLD.WORLD";
>
> my $usr = "mania2";
>
> my $pas = "blah";
>
> my $dbh = DBI->connect("dbi:Oracle:tns:$sid", $usr, $pas) or die $DBI::errstr;
>
> Output:
>
> bash-2.03$ ./perl_testing1.pl
>
> DBI->connect(tns:ECLD.WORLD) failed: ORA-01017: invalid username/password; logon denied (DBD: login failed) at ./perl_testing1.pl line 14
>
> ORA-01017: invalid username/password; logon denied (DBD: login failed) at ./perl_testing1.pl line 14.
>
> bash-2.03$
>
> _Perl code with 10g client - not working:_
>
> #!/usr/local/bin/perl
>
> #use DBI
>
> #use strict;
>
> use strict;
>
> use lib '/u01/home/oracle/admin/site/lib/perl';
>
> use DBI;
>
> $ENV{ORACLE_HOME} = '/u01/home/oracle/product/10.2.0';
>
> $ENV{TNS_ADMIN} = '/home/httpd/cgi-bin/oradba';
>
> my $sid = "ECLD.WORLD";
>
> my $usr = "mania2";
>
> my $pas = "blah";
>
> my $dbh = DBI->connect("dbi:Oracle:tns:$sid", $usr, $pas) or die $DBI::errstr;
>
> Output:
>
> bash-2.03$ ./perl_testing1.pl
>
> DBI->connect(tns:ECLD.WORLD) failed: ORA-12154: TNS:could not resolve the connect identifier specified (DBD: login failed) at ./perl_testing1.pl line 14
>
> ORA-12154: TNS:could not resolve the connect identifier specified (DBD: login failed) at ./perl_testing1.pl line 14.
>
> bash-2.03$
>
> Arunkumar Mani
>
> ITO Service Delivery Consultant
>
> Database Engineering, BMS Account
>
> [email protected]
>
> +91 80 338 59305  Office
>
> +91 74062 71026  Mobile
>
> Bangalore, Karnataka/India
>
> hpe.com
>
> -----Original Message-----
> From: Howard, Chris [mailto:[email protected]]
> Sent: Monday, August 8, 2016 7:55 PM
> To: Mani, Arunkumar (BMS - India GDC) <[email protected]>; Nelson, Erick <[email protected]>; [email protected]; 
> [email protected]
> Subject: RE: ORA-12154 - (DBD: login failed)
>
> ORACLE_HOME not defined correctly?
>
> (I would test by printing out all ENV from within script)
>
> -----Original Message-----
>
> From: Mani, Arunkumar (BMS - India GDC) [mailto:[email protected]]
>
> Sent: Monday, August 08, 2016 5:38 AM
>
> To: Nelson, Erick; [email protected] <mailto:[email protected]>; [email protected] <mailto:[email protected]>
>
> Subject: RE: ORA-12154 - (DBD: login failed)
>
> Instead of @<tns_string>, we define the connection string in TWO_TASK, and it still looks for tnsnames.ora or sqlnet.ora for resolution and it fails.
>
> Arunkumar Mani
>
> ITO Service Delivery Consultant
>
> Database Engineering, BMS Account
>
> [email protected] <mailto:[email protected]>
>
> +91 80 338 59305  Office
>
> +91 74062 71026  Mobile
>
> Bangalore, Karnataka/India
>
> hpe.com
>
> -----Original Message-----
>
> From: Nelson, Erick [mailto:[email protected]]
>
> Sent: Monday, August 8, 2016 5:01 PM
>
> To: Mani, Arunkumar (BMS - India GDC) <[email protected] <mailto:[email protected]>>; [email protected] 
> <mailto:[email protected]>; [email protected] <mailto:[email protected]>
>
> Subject: Re: ORA-12154 - (DBD: login failed)
>
> Did you try TWO_TASK env var ?
>
> <http://www.orafaq.com/wiki/TWO_TASK>
>
> <http://www.orafaq.com/wiki/TWO_TASK>
>
> Erick Nelson
>
> Cell 858-740-6523
>
> Home 760-930-0461
>
> From: "Mani, Arunkumar (BMS - India GDC)" <[email protected]<mailto:[email protected] 
> <mailto:[email protected]%3cmailto:[email protected]>>>
>
> Date: Monday, August 8, 2016 at 1:14 AM
>
> To: "[email protected]<mailto:[email protected]> <mailto:[email protected]%3cmailto:[email protected]%3e>" 
> <[email protected]<mailto:[email protected] <mailto:[email protected]%3cmailto:[email protected]>>>, 
> "[email protected]<mailto:[email protected]> <mailto:[email protected]%3cmailto:[email protected]%3e>" 
> <[email protected]<mailto:[email protected] <mailto:[email protected]%3cmailto:[email protected]>>>
>
> Subject: RE: ORA-12154 - (DBD: login failed)
>
> All were done earlier. The problem is perl doesn't recognize my sqlnet.ora or tnsnames.ora, though I define TNS_ADMIN correctly in the script.
>
> Note: This was working when we used Oracle 8 client.
>
> Arunkumar Mani
>
> ITO Service Delivery Consultant
>
> Database Engineering, BMS Account
>
> [email protected]<mailto:[email protected] <mailto:[email protected]%3cmailto:[email protected]>>
>
> +91 80 338 59305  Office
>
> +91 74062 71026  Mobile
>
> Bangalore, Karnataka/India
>
> hpe.com
>
> [hpesm_pri_grn_pos_email_011116]
>
> From: [email protected]<mailto:[email protected] <mailto:[email protected]%3cmailto:[email protected]>> 
> [mailto:[email protected]]
>
> Sent: Thursday, August 4, 2016 8:53 PM
>
> To: Mani, Arunkumar (BMS - India GDC) <[email protected]<mailto:[email protected] 
> <mailto:[email protected]%3cmailto:[email protected]>>>; [email protected]<mailto:[email protected] 
> <mailto:[email protected]%3cmailto:[email protected]>>
>
> Subject: Re: ORA-12154 - (DBD: login failed)
>
> Testing: Manually, try connecting to DB using current .ora file content.
>
> Solution:  update .ora file with right
>
> Ip:
>
> Port:
>
> Sid/service name:
>
> Regards,
>
> Mustafa
>
> +44-7440 56 12 32
>
> ________________________________
>
> From: Mani, Arunkumar (BMS - India GDC) <[email protected]<mailto:[email protected] 
> <mailto:[email protected]%3cmailto:[email protected]>>>
>
> Sent: Thursday, August 4, 2016 8:41 PM
>
> To: [email protected]<mailto:[email protected] <mailto:[email protected]%3cmailto:[email protected]>>
>
> Subject: ORA-12154 - (DBD: login failed)
>
> ** This mail has been sent from an external source **
>
> Hi,
>
> We have a perl script which is used to connect to all our target databases ( close to 1000) and fetch the user related information and inturn 
> compare it with our enterprise directory which is used to clear the inactive users periodically. This was a very old script and it was using Oracle 
> 8i client. Since most of our systems were upgraded to 12c, 8i client is not compatible with 12c - so we had to update the perl script to use 10g 
> client instead. After we did that, we are not able to connect to any databases and getting below errors. The script exclusively sets TNS_ADMIN to 
> point to right sqlnet.ora.
>
> Need your help to fix this.
>
> ORA-12154: TNS:could not resolve the connect identifier specified (DBD: login failed)
>
> Perl Version:
>
> bash-2.03$ /usr/local/bin/perl -v
>
> This is perl, version 5.005_03 built for sun4-solaris
>
> Copyright 1987-1999, Larry Wall
>
> Perl may be copied only under the terms of either the Artistic License or the
>
> GNU General Public License, which may be found in the Perl 5.0 source kit.
>
> Complete documentation for Perl, including FAQ lists, should be found on
>
> this system using `man perl' or `perldoc perl'.  If you have access to the
>
> Internet, point your browser at 
> http://www.perl.com/<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.perl.com_&d=DQMFAg&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=XVdbSsalndF6Pso7F3PaPinBlO0uj660yZz1dCC7f50&s=4T41gcmdGOE5ioZTOKH4mMqv5ld3DywufUS-mMAEJJ0&e 
> <http://www.perl.com/%3chttps:/urldefense.proofpoint.com/v2/url?u=http-3A__www.perl.com_&d=DQMFAg&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=XVdbSsalndF6Pso7F3PaPinBlO0uj660yZz1dCC7f50&s=4T41gcmdGOE5ioZTOKH4mMqv5ld3DywufUS-mMAEJJ0&e>=>, 
> the Perl Home Page.
>
> bash-2.03$
>
> Arunkumar Mani
>
> ITO Service Delivery Consultant
>
> Database Engineering, BMS Account
>
> [email protected]<mailto:[email protected] <mailto:[email protected]%3cmailto:[email protected]>>
>
> +91 80 338 59305  Office
>
> +91 74062 71026  Mobile
>
> Bangalore, Karnataka/India
>
> hpe.com
>
> [hpesm_pri_grn_pos_email_011116]
>
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and 
> may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or 
> copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be 
> transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for 
> any damage caused by any virus transmitted by this email. 
> www.wipro.com<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.wipro.com&d=DQMFAg&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=XVdbSsalndF6Pso7F3PaPinBlO0uj660yZz1dCC7f50&s=dUH-HRnqB7yNm3kH29c3AMMoVTecSxAnMRCMHKVwLG0&e 
> <http://www.wipro.com%3chttps:/urldefense.proofpoint.com/v2/url?u=http-3A__www.wipro.com&d=DQMFAg&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=XVdbSsalndF6Pso7F3PaPinBlO0uj660yZz1dCC7f50&s=dUH-HRnqB7yNm3kH29c3AMMoVTecSxAnMRCMHKVwLG0&e>=>
>

-- 
http://twitter.com/ghrd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.