Real Scenario: Development team ran the Job and the job failed with below error
ORA-01031: insufficient privileges
Logs were created for the failed job; but there were no trace for which object it failed.
By looking at the error we cant say which object is lacking grants so I started my journey as doing simple check(Checking Grants on Objects) but since schema was big and the job logs didn't mention for which object it failed; it was very difficult to trace out the root cause of the issue.
Finally, I came up with the idea by tracing the ORA errors at database level(you may use for session level as well).
As a sys user I fired below command
alter system set events '1031 trace name errorstack level 3';
Once you execute this command as SYS/SYSTEM, anytime ORA-1031 is issued by any application, the oracle db alert log will record this error with a full path of trace and rather a trace file will be generated in trace directory to give more details about the error.
So going forward I asked dev team to run the Job again and parallel I checked alert log. What wonder I got the trace file and the culprit statement.
So I provided necessary grants and then asked to ran the job again and finally it passed successfully.
Note: You can put any ORA error code in this command by removing the 0 prefix from the error code.
No comments:
Post a Comment