Skip to Main Content
  • Questions
  • Create Context results to ora-01031 insufficient privileges when run using dbms_Sql

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Dennis.

Asked: February 02, 2017 - 9:20 pm UTC

Last updated: June 11, 2019 - 5:42 am UTC

Version: 11.2.0.3

Viewed 1000+ times

You Asked

I have DB user "test" that has create any context privilege.

I create a context using the command below

CREATE OR REPLACE CONTEXT apex_ctx using kvs_apex_ctx accessed globally

I created the package kvs_apex_ctx and context works fine.

If my DB restarted the context is gone and I have to manually run the create context again.

Is this normal?

To resolve this issue I run a simple procedure dbms_sql to create the context but I'm getting the privilege error.

I searched this and it seems like this is the only privilege you need and its granted directly to the user.

Thanks!

and Connor said...

The *context* is persistent. You can run aquery:

select * from dba_context

to validate this.

The *values* in the context are not persistent across a db restart. You can think of context information as like "global variables" in memory. Bounce the database and that memory is cleared.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thank for the great info.

Dennis Ching, February 03, 2017 - 3:27 pm UTC

very helpful
Chris Saxon
February 03, 2017 - 4:13 pm UTC

Glad it helped

Persistence of Contexts

Sabine, June 07, 2019 - 2:15 pm UTC

Hi Connor,

you mentioned persistence of contexts.
I wasn't able to find it in the docs.
Does it apply to all types of contexts?

Thanks in advance,
Sabine


Connor McDonald
June 11, 2019 - 5:42 am UTC

As in the definition is persistent, ie, its an object.

The values in a context as session duration unless that context is defined as "accessed globally". Then multiple sessions can see (its a shared resource)

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library