Parameter DBMS_METADATA. GET_DDL out of materialized views

Hi all.
My version of Oracle's 10g.

I am extracting DDL for all database objects using the DBMS_METADATA package. I use SET_TRANSFORM_PARAM to configure the output because I need a sql code simple, without information about the attributes of storage spaces, storage and segment. Everything works well except when I work with mviews object types. I can't remove the information about the attributes of the tablespace, storage or segment for materialized views.

I would like to know if there is a problem related to this topic. Or there is something missing in my code?

I tried to specify the type of object such as another parameter on DBMS_METADATA. SET_TRANSFORM_PARAM but not work too.
The only parameter transform that works very well with materialized views is the SQLTERMINATOR.

------
See how I did:

declare
CLOB vDDL;
Start
DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA. SESSION_TRANSFORM 'STORAGE', FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA. SESSION_TRANSFORM, 'TABLESPACE', FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA. SESSION_TRANSFORM, "SEGMENT_ATTRIBUTES", FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA. SESSION_TRANSFORM 'SQLTERMINATOR', TRUE);

Select dbms_metadata.get_ddl ('MATERIALIZED_VIEW', 'MV_STO020', 'HIS117_CHECK') in vDDL FROM DUAL;
dbms_output.put_line (vDDL);
end;
-------
and how the output is:

CREATE A MATERIALIZED VIEW 'HIS117_CHECK '. "" MV_STO020 ".
PCTFREE 10 BUNCH OF ORGANIZATION PCTUSED 40 INITRANS MAXTRANS 255 NOCOMPRESS LOGGING 1
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
TABLESPACE "TS_HIS117".
IMMEDIATE CONSTRUCTION
USING INDEX
REFRESH THE STRENGTH TO DEMAND
WITH A KEY PRIMARY WITH THE HELP OF DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE THE QUERY REWRITING
IN SELECT
STO020_MOVEMENT_LOG_ID STO020_MOVEMENT_LOG_ID
STO020_QUANTITY STO020_QUANTITY
STO020_DATE STO020_DATE
STO020_BEFORE_BALANCE STO020_BEFORE_BALANCE
STO011_PRODUCT_MOVEMENT_ID STO011_PRODUCT_MOVEMENT_ID
ADM082_PRODUCT_ID ADM082_PRODUCT_ID
ADM089_PRODUCT_PRESENTATION_ID ADM089_PRODUCT_PRESENTATION_ID
STO010_MOVEMENT_TYPE_ID STO010_MOVEMENT_TYPE_ID
STO001_STOCK_ID STO001_STOCK_ID
STO001_TARGET_STOCK_ID STO001_TARGET_STOCK_ID
STO003_PRODUCT_LOT_ID STO003_PRODUCT_LOT_ID
SYS010_USER_ID SYS010_USER_ID
EIR001_MPI EIR001_MPI
ADM056_MEDICAL_ATTENTION_ID ADM056_MEDICAL_ATTENTION_ID
ADM094_USE_UNIT_ID ADM094_USE_UNIT_ID
Of
STO020_MOVEMENT_LOG;

Thank you in advance!

Published by: lucporto on 08/28/2012 07:26

The LONG data type conversion is explained on http://asktom.oracle.com if you use the search feature.
I could not find real pointers to your original question it.

Tags: Database

Similar Questions

  • DBMS_METADATA. GET_DDL / materialized view

    I can use something like "select dbms_metadata.get_ddl (< object_Type >, < object_Name >) of double" to get the ddl for tables, views, etc. ; However, this doesn't seem to work for me now for the 11.1.0.7.0 version. What should I do to recover the ddl of a materialized view?

    Œuvres:

    SELECT dbms_metadata.get_ddl('MATERIALIZED_VIEW', 'V_CUSTOMER')
    FROM dual;
    

    Does not work:

    SELECT dbms_metadata.get_ddl('MATERIALIZED VIEW', 'V_CUSTOMER')
    FROM dual;
    

    Even for the other types-word-2: "PACKAGE_BODY" is correct, and "BODY of PACKAGE" is not correct.

    Edited by: CharlesRoos May 21, 2010 05:16

  • Materialized view DDL

    I try to get the DDL for all materialized views in the database.
    I am using under sql, but somehow, it does not understand it and gives me errors as follows:

    SELECT DBMS_METADATA. GET_DDL ('MATERIALIZED VIEW', 'MV_NAME'), FROM DBA_OBJECTS;
    or
    SELECT dbms_metadata.get_ddl (OBJECT_TYPE, OBJECT_NAME, OWNER) IN DBA_OBJECTS
    WHERE
    OBJECT_TYPE AS "MATERIALIZED VIEW.

    Gives me error like below:
    ERROR:
    ORA-31600: entry invalid value MATERIALIZED VIEW for the OBJECT_TYPE parameter in GET_DDL function
    ORA-06512: at "SYS." Dbms_metadata", line 2682
    ORA-06512: at "SYS." Dbms_metadata", line 2733
    ORA-06512: at "SYS." Dbms_metadata", line 4333
    ORA-06512: at line 1

    Is there anyway I can get DDL for all the materialized view... ?
    Anyhelp is appreciated.
    JP

    Hi, the valid object types do not have spaces, according to [this table | http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10577/d_metada.htm#BGBIEDIA].

    Try this:

    SELECT owner, object_name, object_type, dbms_metadata.get_ddl(replace(OBJECT_TYPE, ' ', '_'), OBJECT_NAME,OWNER)
      FROM DBA_OBJECTS
     WHERE OBJECT_TYPE = 'MATERIALIZED VIEW'
    

    I didn't really take a broad look to check on each type of object, but this should work for at least materialized views. If this does work for other specific types you want, you may need to use decode or an expression box.

  • Moving all the newspapers and Materialized View at the schema level using the data pump in

    Hi Experts,

    Please help me on how I can exp/imp all materialized views andMV logs (as are some MVs) only the full scheme of other databases. I want to exclude everything else.

    Concerning
    -Samar-

    Using DBMS_METADATA. Create the following SQL script:

    SET FEEDBACK OFF
    SET SERVEROUTPUT ON FORMAT WORD_WRAPPED
    SET TERMOUT OFF
    SPOOL C:\TEMP\MVIEW.SQL
    DECLARE
        CURSOR V_MLOG_CUR
          IS
            SELECT  DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW_LOG',LOG_TABLE) DDL
              FROM  USER_MVIEW_LOGS;
        CURSOR V_MVIEW_CUR
          IS
            SELECT  DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW',MVIEW_NAME) DDL
              FROM  USER_MVIEWS;
    BEGIN
        DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);
        FOR V_REC IN V_MLOG_CUR LOOP
          DBMS_OUTPUT.PUT_LINE(V_REC.DDL);
        END LOOP;
        FOR V_REC IN V_MVIEW_CUR LOOP
          DBMS_OUTPUT.PUT_LINE(V_REC.DDL);
        END LOOP;
    END;
    /
    SPOOL OFF
    

    In my case the script is saved as C:\TEMP\MVIEW_GEN. SQL. Now I will create a journal mview and mview in schema SCOTT and run the script above:

    SQL> CREATE MATERIALIZED VIEW LOG ON EMP
      2  /
    
    Materialized view log created.
    
    SQL> CREATE MATERIALIZED VIEW EMP_MV
      2  AS SELECT * FROM EMP
      3  /
    
    Materialized view created.
    
    SQL> @C:\TEMP\MVIEW_GEN
    SQL> 
    

    Run the C:\TEMP\MVIEW_GEN script. SQL generated a C:\TEMP\MVIEW queue. SQL:

      CREATE MATERIALIZED VIEW LOG ON "SCOTT"."EMP"
     PCTFREE 10 PCTUSED 30 INITRANS
    1 MAXTRANS 255 LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1
    MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "USERS" 
    
    WITH PRIMARY KEY EXCLUDING NEW VALUES;
    
      CREATE MATERIALIZED VIEW "SCOTT"."EMP_MV" ("EMPNO", "ENAME", "JOB", "MGR",
    "HIREDATE", "SAL", "COMM", "DEPTNO")
      ORGANIZATION HEAP PCTFREE 10 PCTUSED 40
    INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576
    MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE
    "USERS"
      BUILD IMMEDIATE
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
    
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE
    DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "USERS"
      REFRESH FORCE ON
    DEMAND
      WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
      USING ENFORCED
    CONSTRAINTS DISABLE QUERY REWRITE
      AS SELECT "EMP"."EMPNO"
    "EMPNO","EMP"."ENAME" "ENAME","EMP"."JOB" "JOB","EMP"."MGR"
    "MGR","EMP"."HIREDATE" "HIREDATE","EMP"."SAL" "SAL","EMP"."COMM"
    "COMM","EMP"."DEPTNO" "DEPTNO" FROM "EMP" "EMP";
                                   
    

    Now, you can run this on the database. You may need to adjust the tablespace and storage clauses. Or you can add more DBMS_METADATA. SET_TRANSFORM_PARAM calls to C:\TEMP\MVIEW_GEN. SQL to force DBMS_METADATA not to include the tablespace or / and the terms of storage.

    SY.

  • Another question about dbms_metadata.get_ddl

    Hello

    Recorded in as 'sys as sysdba' I tried to get the DDL for the EMP table in the SCOTT schema. Here is the output I got:
      1* select scott.dbms_metadata.get_ddl('TABLE', 'EMP') from dual
    SQL> /
    select scott.dbms_metadata.get_ddl('TABLE', 'EMP') from dual
           *
    ERROR at line 1:
    ORA-00904: "SCOTT"."DBMS_METADATA"."GET_DDL": invalid identifier
    Remove the reference to SCOTT, we get another error (no surprise):
    ORA-31603: object "EMP" of type TABLE not found in schema "SYS"
    Question: How the ADMINISTRATOR bring the DDL for a table without having to sign in as a user that owns the schema?

    Thank you

    John.

    He must inform the owner of this object when running DBMS_METADATA of SYS.

    If we describe DBMS_METADATA

    FUNCTION GET_DDL RETURNS CLOB
     Argument Name                  Type                    In/Out Default?
     ------------------------------ ----------------------- ------ --------
     OBJECT_TYPE                    VARCHAR2                IN
     NAME                           VARCHAR2                IN
     SCHEMA                         VARCHAR2                IN     DEFAULT
     VERSION                        VARCHAR2                IN     DEFAULT
     MODEL                          VARCHAR2                IN     DEFAULT
     TRANSFORM                      VARCHAR2                IN     DEFAULT
    

    So there must be another SCHEMA parameter when running DBMS_METADATA of SYS.

  • How to get the text of the materialized view?

    Hello

    How to get test (query) of materialized view?

    Thank you

    With
    the value of 10000 long
    set pages 0
    DBMS_METADATA. GET_DDL ('MATERIALIZED_VIEW', 'MV_EMP', 'SCOTT');

    Of course replace view_name and owner.

  • ORA-12028: type of materialized view is not supported by the main site

    Hi guys!

    We face a problem these days about the materialized view.

    We have upgraded database version 9.2.0.7 directly to 10.2.0.5 (RHEL4 x 86) on the same host. Database uses the driver dg4odbc to connect with remote SQL Server 2012 through data binding called MIKSERI. Our developer team would like to have replicated SQL server table data side Oracle using the materialized view.

    They created Materialized view, but it is not at all to refresh the data. I tried to study a little bit, and whenever I try to change the view anyway I hit error:

    ORA-12028: view type is not supported by the master site materialized @ 'MIKSERI '.

    ORA-06512: at line 22

    I looked at the solutions proposed and discovered that it is maybe the compatible database parameter, so I changed from previous 9.2.0.0.0 to 10.2.0.1.0 but still no luck. Just to emphasize this database is of course different clone of production to a different database, with db name retained and other parameters, but on another host computer and listening port. I even try to change global name, but still no luck.

    Main problem is that refresh the work does not at all. To be more precise, we have created MV on the side of the Oracle and FULL Refresh should be done every 3 minutes. MV uses HS db link to the sql server database.

    During the creation of MV, we can see currently given to sql server, but the problem is that we cannot do MV to refresh every 3 minutes. When I try to change MV and put the refresh interval I get above error.

    Any kind of help would be greatly appreciated,

    Thank you

    I found the reason why my MV update jobs failed, job_queue_processes parameter was equal to 0. I change this setting and now works fine.

    Thank you for your time!

  • Materialized views Refresh method and refresh option

    Hi Experts,

    According to the docs, If the MV contains the following, MV is considered complex. I wonder is there any view data dictionary that indicates the type of MV? Because is very easy to the candidate a complex type mv. Because many queries contains the properties below.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28326/repmview.htm#i52501

    http://docs.Oracle.com/CD/B28359_01/server.111/b28313/basicmv.htm

    Specifically, a materialized view is considered complex if the materialized view definition query contains:

    • A CONNECT BY clause
    • An INTERSECT , MINUS , or UNION ALL operation
    • he DISTINCT or UNIQUE keyword
    • In some cases, an aggregate function, although it is possible to have an aggregation function in the query definition and always have a simple materialized view
    • In some cases, joins other than those in a subquery, although it is possible to have joins in the definition to interrogate and still have a simple materialized view
    • In some cases, a UNION operation


    After that I kept going to read that I learned that when a VM is created, the refresh mode is specified according to the type of the MV. That means, using ON-DEMAND refresh mode is widespread. The documentation mentions that there isa also refresh option. My question is, is it possible to specify

    ON REQUEST and FAST together?

    Also, what are the differences between FULL and FAST. Ends truncate the table and fill it up again?

    ON COMMIT

    Refresh product automatically when a transaction which changed one of the paintings of the materialized view's retail is committed. This can be specified as the materialized view is quickly updatable (in other words, not complex). The ON COMMIT privilege is required to use this mode.

    ON DEMAND

    Refresh occurs when a user manually executes one of the procedures available refresh contained in the DBMS_MVIEW package ( REFRESH , REFRESH_ALL_MVIEWS , REFRESH_DEPENDENT ).

    COMPLETE

    Refreshes and recalculating the materialized view query definition.

    FAST

    Applies incremental changes to refresh the materialized view using the information recorded in the papers of the materialized view, or an SQL * Loader direct-path access or a partition maintenance operation.

    FORCE

    Applies FAST update if possible; otherwise, it applies COMPLETE Refresh.

    NEVER

    Indicates that the materialized view will not be updated with updating mechanisms.

    Select * from version of v$.

    Oracle Database 11 g Release 11.2.0.4.0 - 64 bit Production

    Thank you

    Çaglar wrote:

    ...

    Also, what are the differences between FULL and FAST. Ends truncate the table and fill it up again?

    ...

    Thank you

    I just want to answer the truncated question. Seems that nobody covered that yet.

    Answer: It depends.

    If you do a full refresh, then the default is to use ATOMIC_REFRESH = TRUE.

    This means that the update is done via an insert, delete , and ... Select.

    You can change it to ATOMIC_REFRESH = FALSE (parameter dbms_mview.refresh).

    This means that is a TRUNCATE and insert a ... Select with APPEND peak (path direct insert).

    Refresh if Atomic = FALSE is considerably faster than the default. Also way less Archives of newspapers are written.

    The downside is however that, during the update the MV is empty, is no longer an atomar operation!

    See also Oracle documentation: http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_mview.htm#i997194

  • Problem with a complete refresh materialized view when using rownum

    Hi all

    I had a problem with rownum when complete using Refresh

    I use rownum when you create the materialized view, and this is the generation properly. But the question was when I even refreshing, rownum was not get sorted in ascending order.

    anyone encountered this scenario

    rownum is determined as the line came out, also "order by rownum" does absolutely nothing.

    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/pseudocolumns009.htm

  • tabletop pre-constructed - materialized view Refresh

    Hi all

    Please help me to learn how to work with the materialized on pre-constructed table view.

    I created the table predefined:

    CREATE TABLE 'MISS '. "" TMP003 ".

    (

    "ITEM_ID" NUMBER (10.0)

    ) ;

    I created a materialized on predefined table view:

    CREATE A MATERIALIZED VIEW "MISS." "' TMP003 ' ('ITEM_ID')

    ON PREBUILT TABLE

    AS SOME "COST_DETAIL_ITEMS". "' ITEM_ID ' 'ITEM_ID' TO 'MISS '. "COST_DETAIL_ITEMS"@EFLP2. EFLATBED.COM 'COST_DETAIL_ITEMS ';

    I checked the amount of lines to the original source object:

    SELECT count (1) you cnt OF 'MISS '. "COST_DETAIL_ITEMS"@EFLP2. EFLATBED.COM 'COST_DETAIL_ITEMS ';

    CNT

    -----

    61047571

    I checked the amount of lines to the object of my result:

    Select count (1) cnt of 'MISS '. "" TMP003 ".

    CNT

    ----------

    0

    I tried to update the object with the result:

    DBMS_MVIEW exec. REFRESH('RATER.) TMP003');

    anonymous block filled

    I checked the amount of lines to my profitability after trying to update:

    Select count (1) cnt of 'MISS '. "" TMP003 ".

    CNT

    ----------

    0

    Please help me understand how to refresh my result object properly.

    Thank you.

    You will need to start by filling out the basic pre-built using table create table in select

    concerning

    Pravin

  • The Materialized View - ORA-12052: is unable to fast refresh materialized view

    Hello

    I was hitting my head all day trying to create materialized views. I have made some progress, but have hit a brick wall, unfortunately!

    Basically, I have been invited to take a view and see if I can get the benefits of performance by transforming all or part of it in materialized views. Because the underlying tables of the config is updated quite frequently, I want to fast refresh materialized views on commit. However, when I try to create a materialized view containing an outer join in an aggregated materialized view table, I get ORA-12052: is unable to fast refresh materialized view.

    I went through the documentation and also Rob van Wijkvery useful series of blogs on the topic (especially http://rwijk.blogspot.co.uk/2009/09/fast-refreshable-materialized-view.html) but have not found anything that matches. Maybe I missed something somewhere along the line, or maybe I'm asking just something completely impossible?

    My db is 11.2.0.2.

    Here's the test scripts, I've worked with that:

    drop materialized view test1_test2_mv;
    Drop materialized view test2 journal;
    drop table test2;
    Drop materialized view test1_mv newspaper;
    drop materialized view test1_mv;
    Drop materialized view test1 journal;
    drop table test1;

    create table test1 (identification number,
    type varchar2 (10),
    number of Val,
    update_time date,
    constraint t1_pk primary key (id, type, val));

    Insert into test1
    Select 1, 'a', 1001, sysdate - 10/24 Union double all the
    Select 1, 'b', 1003, sysdate - 9/24 Union double all the
    Select 1, 'c', 1002, sysdate - 8/24 Union double all the
    Select 1, had ', 1004, sysdate - 7/24 Union double all the
    Select 1, 'e', 1005, sysdate - 6/24 Union double all the
    Select 1, 'c', 1006, sysdate - 5/24 Union double all the
    Select 2, 'a', 1002, sysdate - 4/24 Union double all the
    Select 2, 'b', 1005, sysdate - 3/24 Union double all the
    Select 3, 'a', 1001, sysdate - 2/24 Union double all the
    Select 3, 'c', 1006, sysdate - 1/24 Union double all the
    Select 3, 'e', 1008, sysdate - 2/24 Union double all the
    Select option 4, has ', 1004, sysdate - 3/24 Union double all the
    Select 5, 'b', 1002, sysdate - 4/24 Union double all the
    Select 5, 'g', 1001, sysdate - 5/24 Union double all the
    Select 6, 'h', 1004, sysdate - 6/24 Union double all the
    Select 7, 'b', 1007, sysdate - 7/24 Union double all the
    Select 7, had ', 1001, sysdate - 8/24 double;

    commit;

    Select * from test1;


    CREATE MATERIALIZED VIEW LOG ON test1
    WITH rowid, primary key (update_time)
    including the new values;


    Test1_mv CREATE MATERIALIZED VIEW
    IMMEDIATE CONSTRUCTION
    COOL OFF QUICKLY ON COMMIT
    Did YOU SELECT id,
    MAX (case when type = "there" end of val) THAT col_a,.
    MAX (case when type = 'b', then val end) AS col_b,.
    MAX (case when type = 'c' then end val) AS col_c,.
    MAX (case when type = ' then end of val) AS col_d,
    MAX (update_time) AS update_time
    OF test1
    WHERE TYPE in ('a',
    « b »,
    « c »,
    a ')
    GROUP BY id;

    CREATE MATERIALIZED VIEW LOG ON test1_mv
    WITH rowid
    including the new values;


    create table test2 (identification number,
    col2 number,
    COL3 varchar2 (10),
    number of COL4,
    constraint t2_pk primary key (id));

    Insert into test2
    Select 1, 1, 'bob', 1 double Union all
    Select 2, 1, "sue", 1 double Union all
    Select 3, 1, 'tom', 1 double Union all
    Select 4, 1, 'jay', 1 double Union all
    Select 5, 1, 'art', 1 double Union all
    Select 6, 1, 'kay', 1 double Union all
    Select 7, 1, 'max', 1 double Union all
    Select 8, 1, 'tim', 1 double Union all
    Select 9, 1, "liz", 1 from dual;

    commit;


    CREATE MATERIALIZED VIEW LOG ON test2
    WITH rowid, primary key
    including the new values;


    Test1_test2_mv CREATE MATERIALIZED VIEW
    IMMEDIATE CONSTRUCTION
    COOL OFF QUICKLY ON COMMIT
    LIKE SOME t2.rowid,.
    T1.ID,
    T1.col_a,
    T1.col_b,
    T1.col_c,
    T1.col_d,
    T1.update_time,
    T2.col2,
    T2. COL3
    OF test1_mv t1,.
    Test2 t2
    WHERE (+) t1.id = t2.id; -symbol of outer join is not correctly displayed on the forums without space, grr!

    ORA-12052: is unable to fast refresh materialized view TEST1_TEST2_MV

    Y at - it any way I can get the materialized view fast refresh on commit or I asking the impossible?

    Add t1.rowid:

    SQL > CREATE MATERIALIZED VIEW test1_test2_mv

    2 BUILD IMMEDIATE

    3 QUICK REFRESH YOU COMMIT

    4 AS t2.rowid SELECT rid2,

    5 t1.rowid rid1,

    6 t1.id

    T1.col_a 7,.

    T1.col_b 8,.

    T1.col_c 9,.

    T1.col_d 10,

    T1.update_time 11,

    T2.col2 12,

    13 t2.col3

    14 OF test1_mv t1,

    15 test2 T2

    16 WHERE t1.id = t2.id

    17.

    Materialized view created.

    SQL > select * from test1_test2_mv

    2.

    RID2 RID1 ID COL_A, COL_B, COL_C COL_D UPDATE_TIME COL2 COL3

    ------------------ ------------------ ---------- ---------- ---------- ---------- ---------- ------------------- ---------- ----------

    AAAYB6AANAAAANDAAA AAAYB/AANAAAAN/AAA 1 1001 1003 1006 1004 25 / 06 / 2014 12:54:16 1 bob

    AAAYB6AANAAAANDAAB AAAYB/AANAAAAN/AAB 2 1002 1005 25 / 06 / 2014 1 sue 14:54:16

    AAAYB6AANAAAANDAAC AAAYB/AANAAAAN/AAC 3 1001 1006 25 / 06 / 2014 16:54:16 1 tom

    AAAYB/AANAAAAN/AAD AAAYB6AANAAAANDAAD 4 1004 25/06/2014 14:54:16 1 jay

    AAAYB6AANAAAANDAAE AAAYB / AANAAAAN / AAE 5 1002 2014/06/25 13:54:16 1 art

    AAAYB6AANAAAANDAAF AAAYB/AANAAAAN/AAG 7 1007 1009 25 / 06 / 2014 10:54:16 max 1

    AAAYB/AANAAAAN/AAH                                                                                                        1 tim

    AAAYB/AANAAAAN/AAF                                                                                                        1 kay

    AAAYB/AANAAAAN/AAI                                                                                                        1 liz

    9 selected lines.

    SQL > update of test2

    2 set col3 = "fly."

    3 where id = 7

    6 m

    1 line update.

    SQL > validation

    2.

    Validation complete.

    SQL > select * from test1_test2_mv

    2.

    RID2 RID1 ID COL_A, COL_B, COL_C COL_D UPDATE_TIME COL2 COL3

    ------------------ ------------------ ---------- ---------- ---------- ---------- ---------- ------------------- ---------- ----------

    AAAYB6AANAAAANDAAA AAAYB/AANAAAAN/AAA 1 1001 1003 1006 1004 25 / 06 / 2014 12:54:16 1 bob

    AAAYB6AANAAAANDAAB AAAYB/AANAAAAN/AAB 2 1002 1005 25 / 06 / 2014 1 sue 14:54:16

    AAAYB6AANAAAANDAAC AAAYB/AANAAAAN/AAC 3 1001 1006 25 / 06 / 2014 16:54:16 1 tom

    AAAYB/AANAAAAN/AAD AAAYB6AANAAAANDAAD 4 1004 25/06/2014 14:54:16 1 jay

    AAAYB6AANAAAANDAAE AAAYB / AANAAAAN / AAE 5 1002 2014/06/25 13:54:16 1 art

    AAAYB/AANAAAAN/AAH                                                                                                        1 tim

    AAAYB/AANAAAAN/AAF                                                                                                        1 kay

    AAAYB/AANAAAAN/AAI                                                                                                        1 liz

    AAAYB6AANAAAANDAAF AAAYB/AANAAAAN/AAG 7 1007 1009 25 / 06 / 2014 10:54:16 1 rob

    9 selected lines.

  • Do not to use the materialized view

    I wonder if we've already created a materialized view, can we prefer not to use this point of view, materialized for a query? I want to say can we determine if a query uses MV and other queries don't use MV?  Thank you.

    Hello Indra,

    I'm not completely sure about that, but you can read (with examples) concerning the indications- NO_REWRITE and REWRITE

    Text over the doc links:

    Council of REWRITING:

    The REWRITE Council instructs the optimizer to rewrite a query regarding the materialized views when possible, regardless of cost. Use the REWRITE trick with or without a display list. If you use REWRITE with a view list and the list contains an eligible materialized view, then Oracle uses this view regardless of its cost.

    Tip NO_REWRITE:

    The NO_REWRITE Council tells the optimizer to disable the rewrite of the query to the query block, of the substitution of the definition of the parameter QUERY_REWRITE_ENABLED .

    Be aware! -The NOREWRITE suspicion has been deprecated. Use the NO_REWRITE hint instead.

    Read here: setting QUERY_REWRITE_ENABLED

    -Nordine

  • Refresh the Materialized View constructed from an external table commit?

    Is it possible to create a materialized with Refresh view on commit built from an external table?

    I think the answer is "no, because there is no way for the outer table report to the view materialized it has been changed," but I would like to be sure before I tell my client who has requested the opportunity to do this (or, Alternatively, to learn how Oracle hoops I have to cross in order to operate).

    I can create a Refresh on demand, it is not a question of not having the necessary permissions to create the materialized view itself.

    No, you can't. The outer table is not modified in a transactional way and there no materialized view logs, so there is no event to hang in and no delta to apply.

    However, you can use dbms_scheduler observer file that will ask for the presence of a file and load the data in a table or refresh a materialized view based on the external table.

    Justin

  • Materialized view - Alter

    Hello gurus,


    How to alter a materialized view question him with out droping? give me a small example




    Kind regards
    A friend :)

    You reference 10.1 documentation. Please see the latest version 11.2

    A MV query cannot be changed. The MV should be deleted and rebuilt.
    (think about it... How do you change a MV as the query on what is built is changed and/or columns are added/removed)?

    The documentation that you reference says:
    Use the ALTER MATERIALIZED VIEW statement to alter a materialized view existing in one or more of the following ways:

    To change its storage features

    To change its refresh, mode or time method

    To change its structure to make it another type of materialized view

    To enable or disable the query rewriting.

    Hemant K Collette

  • Reg: Package code to refresh materialized views

    I'm new to pl/sql packages and procedures.i want it running for execution of informatica mappings that takes 0 and 1 gives when it is run successfully

    create or replace the BODY of PACKAGE as pkg_refresh_mv
    procedure prc_mv (p_mv_name varchar2) is
    Start
    dbms_mview. Refresh (p_mv_name);
    end prc_mv;

    procedure refresh_all_mv (proc_response IN OUT number) is


    Start
    dbms_mview. Refresh ("' materialized view", "C");
    dbms_mview. Refresh ("' materialized view", "C");

    proc_response: = 1;
    exception
    while others then
    proc_response: = 0;
    end refresh_all_mv;
    end pkg_refresh_mv;

    When I run this code I get the following errors


    PLS-00201: identifier 'PKG_REFRESH_MV' must be declared.
    PLS-00304: impossible to compile 'PKG_REFRESH_MV' body without its specification

    what needs to be changed


    Thank you

    try this one:

    CREATE OR REPLACE PACKAGE pkg_refresh_mv
    AS
       PROCEDURE prc_mv (p_mv_name VARCHAR2);
       PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER);
    END pkg_refresh_mv;
    /
    
    CREATE OR REPLACE PACKAGE BODY pkg_refresh_mv
    AS
       PROCEDURE prc_mv (p_mv_name VARCHAR2)
       IS
       BEGIN
          dbms_mview.refresh (p_mv_name);
       END prc_mv;
    
       PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER)
       IS
       BEGIN
          dbms_mview.refresh ('materialized view', 'C');
          dbms_mview.refresh ('materialized view', 'C');
    
          proc_response := 1;
       EXCEPTION
          WHEN OTHERS
          THEN
             proc_response := 0;
       END refresh_all_mv;
    END pkg_refresh_mv;
    /
    

Maybe you are looking for

  • Satellite A30 - ERROR 22

    I AM TRYING TO REPLACE THE HARD DRIVE I HAD A 30 GB AND I REPLACED WITH A 40 GB IT IS EXACTLY THE SAME SIZE AND MADE BY TOSHIBA, BUT WHEN THE PC IS TURNED ON I GET THE MESSAGE... GRUB LOADING STAGE 1.5 GRUB LOADING PLEASE WAIT... ERROR 22 I DON'T KNO

  • I want to know if graphics PNY GeForce GTX 650 VCGGTX6501XPB compatible with desktop video card Aspire M3450?

    Hello I have an Acer Aspire M3450 Office (processor Quad-Core AMD FX (tm) - 4100 (4 CPUs), ~3.6GHz) and intend to install a card PNY GeForce GTX 650 video VCGGTX6501XPB (1 GB GDDR5, PCI-Express 3.0(x16), 1 x Dual-link DVI - D, 1 x Dual-link DVI - I,

  • LightScribe on Windows 8.1

    When I try to install the Lightscribe Template Labeler on a 8.1 Windows machine I get a message saying something like the "operating system is not sufficient for Lightscribe.  Is there any solution for this?  Running the Windows compatibility mode or

  • Computer has a period when you do something

    I don't know how to describe it. But when I move my mouse, it makes small jumps, it is not smooth. Also, I watch videos, it's as if there is a slight delay, as everyone has a lisp and repeat things.* original title - my computer seems to have a hiccu

  • audiobooks on the sansa clip +.

    I just got a sansa clip MP3 player +.  I joined audible.com and downloaded a book on my computer.  I thought that it was downloaded on my sansa.  Where are the files in the menu of the sansa? Help!  I'm not tech saavy.