Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: sqlplus from a perl script is giving ORA-12545 error.
pdqd_at_rediffmail.com said...
> Hi Friends,
> -
> Using a perl script i am running 'sqlplus' command(sqlplus
> <dbuid>/<dbpasswd>@DB1 @oracle.sql ). I get the following error
> message...
> -
> ORA-12545: Connect failed because target host or object does not exist
> -
> But I don't think there could be any connection problem (and also the
> database manager is up and running) because i can run the same command
> mannually from the shell.
> Could someone pls suggest what could be causing the above error.
> -
> Thanks and Regards,
> Parimal.
>
I don't know whether you're facing the same problem I face when I write
a shell script that will be run by cron, but it's worth a look. Because
cron doesn't execute my .profile, the Oracle environment does not get
set and so it can't find the tnsnames.ora to resolve the DB1 alias.
Put a couple of debug print statements in your perl script to see if ORACLE_HOME and ORACLE_SID are set prior to your sqlplus command. You might also need to set SQLPATH for perl to find your oracle.sql file.
-- /Karsten DBA > retired > DBAReceived on Tue May 13 2003 - 10:56:28 CDT