My favorites | Sign in
Project Logo
                
Search
for
Updated Jul 10, 2009 by chet.justice
ddl_contions  
conditions when DDL can be performed

Conditions when DDL can be performed

  1. PMDV_CONTEXT is set.
  2. ORA_LOGIN_USER (trigger attribute) is NULL (background process).
  3. ORA_DICT_OBJ_OWNER = SYS.
    1. Oracle by default does not allow you to create objects (as anything buy SYS) in the SYS schema. The assumption is that this mechanism is working correctly.

An example of SYS performing DDL when the user is not SYS, is below:

WITH test
AS
(
  SELECT /*+ materialize */ 1 one
  FROM DUAL
)
SELECT one
FROM test;

With the materialize hint, Oracle is told to create a temporary table to story the results of the query. Here is the explain plan from the statement above:

Plan hash value: 1232236660

-------------------------------------------------------------------------------------------------------
| Id  | Operation		   | Name		      | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT	   |			      |     1 |     3 |     4	(0)| 00:00:01 |
|   1 |  TEMP TABLE TRANSFORMATION |			      |       |       | 	   |	      |
|   2 |   LOAD AS SELECT	   |			      |       |       | 	   |	      |
|   3 |    FAST DUAL		   |			      |     1 |       |     2	(0)| 00:00:01 |
|   4 |   VIEW			   |			      |     1 |     3 |     2	(0)| 00:00:01 |
|   5 |    TABLE ACCESS FULL	   | SYS_TEMP_0FD9D6601_ECF5D |     1 |    13 |     2	(0)| 00:00:01 |
-------------------------------------------------------------------------------------------------------

Here's the explain plan for the same statement without the materialize hint:

Plan hash value: 1388734953

-----------------------------------------------------------------
| Id  | Operation	 | Name | Rows	| Cost (%CPU)| Time	|
-----------------------------------------------------------------
|   0 | SELECT STATEMENT |	|     1 |     2   (0)| 00:00:01 |
|   1 |  FAST DUAL	 |	|     1 |     2   (0)| 00:00:01 |
-----------------------------------------------------------------

Sign in to add a comment
Hosted by Google Code