Oracle – Resolving ORA-12546: TNS: Permission Denied on Windows Task Scheduler

jobsoraclewindows

I am trying to export all objects of specific oracle user by executing a batch file through Windows Task Scheduler:

exp.exe myuser/pass@dbname owner=myuser log=mylog.txt

The Oracle 11.2.0.4 x64 and the database are on that same Windows7 Pro machine

The task starts OK. That is to mean that no wrong user or password issues are there. But when task is started by schedule, it says in the log:

ORA-12546: TNS:permission denied

When task is started manually, under same user as the scheduled user (this user is member of Administrators group and ora_dba group, by the way), it works fine and export is done. The task is scheduled with an "Execute with highest privileges" check-box in task properties, so I don't see why there is difference between the "by schedule" and "manual" task start.

I've read a lot on "ORA-12546: TNS:permission denied" on stackoverflow site, but all topics are concerning Linux. I tried to set read and execute permissions on c:\app\oracle, where my Oracle is installed. Actually, Administrators already by default had all permissions on that directory, so it did not make any difference

I noticed that export of tables, however, works fine even in the task started by schedule:

exp.exe myuser/pass@dbname tables=mytable1,mytable2 log=mylog.txt

At any rate, the oracle user “myuser” has oracle rights to export entire database

Problem:
Only-tables are exported fine, but with «owner=myuser» export key I get «TNS:permission denied», and only if Windows scheduled task is started by schedule, while manually started task does everything OK. How do I make it export all, and by schedule?

Best Answer

The problem lies somewhere deep in windows permissions. Those are messing somehow with Oracle TNS system. I still do not know the right way and what exactly those permissions are, but the problem is solved for now, by means of bypassing TNS, as self-suggested previously:

set ORACLE_SID=dbname exp.exe myuser/pass owner=myuser log=mylog.txt

This works, no error