| ORA-01031,ORA-06512 dbms_session.set_context error [message #290237] |
Fri, 28 December 2007 02:53  |
krishna_900 Messages: 10 Registered: June 2005 |
Junior Member |

|
|
Hi All,
my senario is i have created a context from schema 'Schema1' using "accessed globally" option and created on package to set the values for conext. It is working fine.
When i deploy the same package on schema2 (remember the context is on schema1) and try to execute it on schema2 then it is giving me the following error. any help will be much appreciated.
attached the test package for reference.
Connected to:
Oracle Database 10g Release 10.2.0.1.0 - Production
SQL> exec krishna_pkg.MyProcedure
BEGIN krishna_pkg.MyProcedure; END;
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_SESSION", line 90
ORA-06512: at "LGE2008DEV.KRISHNA_PKG", line 6
ORA-06512: at line 1
|
|
|
|
|
|
|
|
|
|
| Re: ORA-01031,ORA-06512 dbms_session.set_context error [message #290318 is a reply to message #290302] |
Fri, 28 December 2007 06:17   |
Frank Messages: 7730 Registered: March 2000 |
Senior Member |
|
|
Another option is to make the context-name variable in the code. Set it in one single place and refer to that constant.
In cases where you want to share database-instances, you can rename one of the contexts, without having to alter too much code.
The associative array will cause PLSQL/SQL context switches, whereas it seems that calls to sys_context don't.
Bummer... why can I come up with this solution only for someone else??
[Updated on: Fri, 28 December 2007 06:18]
|
|
|
| Re: ORA-01031,ORA-06512 dbms_session.set_context error [message #290326 is a reply to message #290318] |
Fri, 28 December 2007 06:47  |
krishna_900 Messages: 10 Registered: June 2005 |
Junior Member |

|
|
Yep. That’s the way for me.
I will be declaring one constant on a common package or current package specification and then change it to a variable method. I have tested it and it works fine.
One more method i have thought to avoid hard coding is to prefix schema name to context variable in runtime. But userenv gives only username not schema name where package has been deployed?? Since there will be multiple database user accessing the same package this logic will not work??
Thanks a lot for support mates.
Krishna
|
|
|