Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: contexts: getting DDL
>> How to get DDL for contexts?
I was just playing with these...
As user LOG4PLSQL:
select * from all_context
/
NAMESPACE SCHEMA PACKAGE ------------------------------ ------------------------------ ------------------------------ MY_CONTEXT LOG4PLSQL MY_CONTEXT_PKG1 rows selected
select owner, object_name, object_type from all_objects where object_name like 'MY_CONTEXT' /
OWNER OBJECT_NAME OBJECT_TYPE ------------------------------ ------------------------------ ------------------- SYS MY_CONTEXT CONTEXT1 rows selected
Note that the ALL_CONTEXT view doesn't list contexts until they are activated (when a session calls the specified package to set an attribute in a namespace). Meanwhile note also that the context object is owned by SYS even though it was created (in my case) by LOG4PLSQL.
The best source of information is the DBA_CONTEXT view
select * from dba_context
/
NAMESPACE SCHEMA PACKAGE TYPE ------------------------------ ------------------------------ ------------------------------ ---------------------- REGISTRY$CTX SYS DBMS_REGISTRY_SYS ACCESSED LOCALLY DR$APPCTX CTXSYS DRIXMD ACCESSED LOCALLY MY_CONTEXT LOG4PLSQL MY_CONTEXT_PKG ACCESSED LOCALLY3 rows selected
You should be able to reconstruct your contexts by querying this view and presumably skipping the first two:
select 'create or replace context '||namespace|| ' using '||schema||'.'||package|| ' '||type||';' sqlcmd
Regards Nigel
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Jul 05 2006 - 06:45:59 CDT
![]() |
![]() |