3

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?

  • 1
    Did you set your ORACLE_HOME and TNS_ADMIN environment variables correct for the Administrator that run the scheduler? – Marco Nov 25 '15 at 13:19
  • No. I understand Oracle for Windows takes those values from windows registry. So I do not set environment variables ever. Also, considering that only-tables export works fine, it seems that mentioned values are not a problem? – SargeAnt Nov 25 '15 at 17:00
  • I'll try that, anyway, too. The trouble is that computer is not available easily, so I go for tries about once a week So I also wonder: if it says "TNS:permission denied" - then if I somehow make it without TNS, could that be a solution? And is there a way to do this export without TNS? – SargeAnt Nov 25 '15 at 17:07
  • Yes, there apparenty is a way to work with database on the same computer without TNS. The straight forward way is to set ORACLE_SID environment variable and call exp.exe without specifying database. I'll try that – SargeAnt Nov 26 '15 at 11:00
  • I'm guessing when you run normally you are running as a user that is a member of the ORADBA group, which can login into the database without supplying a password. When it runs from schedule it runs as a different user. Is this the case? – Colin 't Hart Dec 2 '15 at 14:58
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.