Materialized view rebuild to change size of column

We have changed the size of a varchar2 column in an OLTP table... The matte view in the warehouse pointing to this table/column complains... Is there an argument to 'rebuild' for materialized views in Oracle as I've seen in other databases? Or should I remove mast view create view Matt, create indexes and collect the tablestats to get it to pick up the new size of the column.

The following statement compiles the matte view but does not pick up the new size and the matte view guard Plains.
alter materialized view sms_ar.mv_sufficiency compile;
I tried to put the argument of the 'reconstruction' on it but could not operate.

Hi Mark,

What is

SQL> create table t(x varchar2(5))
Table created.

SQL> create materialized view mv
as
  select x from t
Materialized View created.

SQL> alter table t modify x varchar2(10)
Table altered.

SQL> desc t
TABLE t
 Name                                      Null?    Type
 ----------------------------------------- -------- -----------
 X                                                  VARCHAR2(10)

SQL> desc mv
TABLE mv
 Name                                      Null?    Type
 ----------------------------------------- -------- -----------
 X                                                  VARCHAR2(5)

SQL> alter materialized view mv modify x varchar2(10)
Materialized View altered.

SQL> desc mv
TABLE mv
 Name                                      Null?    Type
 ----------------------------------------- -------- -----------
 X                                                  VARCHAR2(10)

Concerning
Peter

Tags: Database

Similar Questions

  • Constraints foreign key in materialized views can be changed (approx 1-master)

    I have a system which consists of a master database and a bunch of materialized view sites homogeneous. 10.2.0.4 all around. Main server is Windows Server 2003. all remote nodes are Windows XP. All materialized views are editable. There are only 20 or two tables (materialized views). Users enter data in the system at the level of the remote nodes via an application.

    There are data integrity constraints in the database on the main site. In the hunt for replication errors, I discovered that the integrity constraints do not exist in the context of the remote node. Then, sometimes, that users can enter data not valid that main site integrity constraints disallow, producing errors of replication on the master site. For a test I then implemented manually some of the constraints on a remote node using the java Enterprise Manager UI. Constraints have behaved as expected, as far as I can tell.

    My ultimate goal is to implement, on all sites of the materialized view, the current constraints of the integrity of the main site, so that entering data at remote sites is governed by the integrity constraints.

    I looked briefly package DBMS_REPCAT subprograms. Nothing jumped out at me.

    I started to collect the DDL (ALTER TABLE... ADD CONSTRAINT...) I could run each site through SQL * more sheet calculation.

    Then I thought that maybe I could use sqldeveloper to run the DDL but when I open the relevant schema to the level of the remote nodes, the actual tables are not shown, only the USLOG$ _... things. Materialized views are shown - but they do not have a constraints tab.

    After some time in the manuals, I decided that I have a good knowledge of what I see; and that's why I'm not sure I'm running in the right direction.

    I will summarize two questions:

    (1) what is the best way for me to apply constraints of integrity of the master site existing in materialized views can be changed on all nodes?

    (2) why I can see and work on the tables on the remote nodes via the EM java, but don't can't see them via sqldeveloper, logged in with the same account twice?

    P.S. It is possible for me to delete and re-create all databases and the views materialized on all remote nodes. It is not a high volume system, and there are windows of time during which I can do these things if necessary. I don't expect a structural change to the database, so I don't need to be able to spread future changes, just make things sync'd up now.

    Published by: Clark October 10, 2008 11:38

    Hi Clark,.
    you are right THAT FK on mviews can cause many problems during refresh. I mentioned on delete cascade, but delete the null value or remove restricted can cause problem too. You cannot complete with active reftesh FK referencing MV PK.

    Because you cannot control the mviews refresh a refresh Group, that the problems I described before can occur.
    You have to my view of these possibilities:
    1 / move Ref. integrity check from the DB to the logic of the application
    2 / use triggers to maintain ref.integrity check DB
    3 / mutlimaster user instead of mviews replication

    But none of them have their more and less.
    1 / + FK is checked - take some time, any other manipulation of data through the application can break rules FK
    2 / + FK is cheked on DB level - you write triggers, lower performance, changing disorders tables
    3 / + FK is chedked at the DB level, - all the data is replicated on the table plan (for MV, you can define where cluase for replication mutlimaster not), with more than two masters, it is difficult to define the replication conflict resolition method that convert in the last time.

    Last post:
    I my case I use this "thing":
    Because our request has not been managed in environment 24 x 7 I wrote my own routine to refresh.
    This routine that follows:
    1 / disable necessary FK
    2 / call dbms_refresh.refresh to perform the refresh of the refresh Group
    3 / activate FK disabled in step 1 with the novalidate
    Refresh the jobs was launched at night.

  • type a materialized view foreign key constraint?

    Hello.

    I have a materialized view that flows into a single column 'A' two different columns of different tables of a remote database.

    I also have a table that has a column 'B', whose values must exist in the column 'A' of the materialized view.

    So it's like defining a constraint foreign key of a table to a view, but this is not possible.

    Is it possible to do?

    I saw some triggers that verify the existence of the 'A' value before insertion in 'B', but this fails when a value is changed or deleted in 'A'

    Any suggestions?

    Thank you very much.

    Published by: user7029403 on 18-ene-2013 03:57

    There is no problem of definition of a primary key on a materialized view and then reference it with a foreign key. It works for me:

    create database link l1 connect to scott identified by tiger using 'orcl';
    create materialized view mv1 as select deptno||dname as a from dept@l1;
    alter table mv1 add constraint mv1pk primary key (a);
    alter table dept add (fkcol as (deptno||dname));
    alter table dept add constraint deptfk foreign key (fkcol) references mv1;
    

    I don't know there is a more elegant solution than to use a virtual column, which seemed the best way to get around the concatenation of two columns in a single

  • How to understand where are the data in a materialized view, coming from

    HI: when I run select NAME, OWNER of dba_mview_refresh_times, I see a number of materialized views. How can I find more information on this view it's source data and fields. The source in a different database table has changed. But the view on my database where the materialized view has not changed. I want to confirm origin of data in this view

    TIA
    Ravi

    Take a look at the column of the QUERY to the DBA_MVIEWS view.

  • Instead of trigger on a Materialized view?

    Hello

    We write INSTEAD OF trigger on the materialized view?

    Piyush

    peeyushgehlot wrote:
    When we refresh materialized, view view full is truncated and new records get inserted, it is on the books and we can do service work, but when the incremental refresh is done, this trigger will run I don't know.

    I'm not sure that I am. A complete refresh will cause insert triggers (line level and the table, before and after) fire for each row of the materialized view. An additional update will cause insert, update, and delete triggers (line level and the table, before and after) in the fire for each changed row. It may be of course, updates that do not actually change the data depending on how one defines the materialized view, and how changes should be handled.

    Justin

  • By creating the Materialized view all size changes to columns

    I'm creatine a materialized view based on the table in a different database.
    The table on which the created materialized view (database table) is to have the size of CHAR (1 byte) column. But in Materialized view this size columns showing as CHAR (3 bytes).

    Could u please help me.., why this is happening?

    Thank you
    Sachin

    Sachin thombare wrote:
    I'm creatine a materialized view based on the table in a different database.
    The table on which the created materialized view (database table) is to have the size of CHAR (1 byte) column. But in Materialized view this size columns showing as CHAR (3 bytes).

    Could u please help me.., why this is happening?

    Thank you
    Sachin

    Hello
    Do both the database involved in this have defined different character.
    If Yes, then this is a known behavior.

    Concerning
    Anurag Tibrewal.

  • What is the best way to change a column type in the materialized view?

    Hello my dear friends,.

    I want to change a column type in a materialized view. VARCHAR2 NUMBER, so what do you recommend? What is the best way to do it?

    Thank you

    You can not change the data type of the column while there are data in the MV, so you might as well give up and recreate the MV with a TO_CHAR() around the column in question in the application of MV to get the data exactly as you want (be sure to include an appropriate format mask). That said, I'm fighting to think reasonable grounds to make such a change.

  • Change the definition of the materialized view while maintaining access for users uninteruupted

    Hello

    We have a system report and the need to change the report definition mv access - like to do it without interruption.

    Is this possible?

    the sql behind mv was change picks up so column of another table.

    Have you heard but not used for dbms_redefinition tables

    Thank you

    It is built in the Oracle solution for this one, where you can edit the definition WITHOUT interruption. You can drop the materialized view existing with the clause "save table" and rebuilt the view materialized on 'predefined table'. I googled this example for you

    create materialized view mv1 as select dept , count(*) as cnt from scott.emp;

    We want to change the statement so that only dept more 5 will be calculated

    drop materialized view mv1 preserve table;
    

    Notice that PRESERVE TABLE clause - mv1 table is not droped - single layer mview.

    desc mv1
    

    now, we create the mview with a different query on top of the existing table

    create materialized view mv1 on prebuilt table as  select dept , count(*) as cnt from scott.emp where dept > 5;
    

    Notice that on prebuilt table the mview uses the existing object clause.

    exec dbms_mview.refresh_mview('mv1');
    

    http://StackOverflow.com/questions/18085894/redefine-MATERIALIZED-view-with-no-downtime

    http://Arup.blogspot.com/2009/01/ultra-fast-MV-alteration-using-prebuilt.html

  • change the source tables in the materialized view

    If I change the name of the source table in a materialized view, I have to delete and recreate the MV? For example, My MV uses a table from a DBlink. Instead I want to physically copy the table in the schema, and then create the MV using the local table, then change MV to use the remote table and I expect to start refreshing the MV for incremental data. Can I do it?

    No, you can't.  Oracle has no way of knowing that the modified table (name) is identical to the original table.

    Hemant K Collette

  • How do I know how much the number of materialized view columns

    How do I know how much the number of materialized view columns

    Thank you

    Gopal

    Best to include the owner too if you use all_tab_columns

    Select count (*)

    from all_tab_columns

    where owner = "."

    and table_name = "."

  • ORA-00957 double Materialized View name column (UPDATE: do not answer)

    Hi all.  I get this error when you try to create a materialized view.  I have several other MV I've created without problem, but I can not find the catch here, can anyone help?.  I can't find the duplicates. The only double I was although entered in the function Pipeline_Code and the column being called a column. To check, I have renamed the latter and still make me this question.

    Any help would be greatly appreciated.


    Thank you!

    The request is below:

    CREATE THE MV_TEST_STATION MATERIALIZED VIEW

    COMPLETE REFRESH

    START WITH TO_DATE (20-SEP-2013 00:00:00 "," dd-mon-yyyy hh24:mi:ss')

    NEXT (SYSDATE + 12/24)

    AS

    SELECT T.TEST_STATION_ID,

    -(SELECT TEST_STATION_TYPE. DESCRIPTION

    -FROM TEST_STATION_TYPE

    -WHERE TEST_STATION. TEST_STATION_TYPE =

    -TEST_STATION_TYPE. TEST_STATION_TYPE)

    -AS TEST_STATION_TYPE,

    TST. DESCRIPTION AS TEST_STATION_TYPE,

    T.SURVEY,

    T.STATUS,

    T.STATION,

    () F_TRUESTATION2

    T.STATION,

    T.PIPELINE_CODE,

    F_REROUTE_CODE (T.STATION,

    T.PIPELINE_CODE))

    AS TRUE_STATION,

    T.REQUIRED,

    --(SÉLECTIONNEZ PIPELINE_CODES.) PIPELINE_CODE_DESCRIPTION

    -FROM PIPELINE_CODES

    -WHERE TEST_STATION. PIPELINE_CODE = PIPELINE_CODES. PIPELINE_CODE)

    - AS PIPELINE_CODE.

    PC. PIPELINE_CODE_DESCRIPTION AS PC_PIPELINE_CODE,

    T.INSTALL_DATE,

    COMMENT BY T.FUNCTIONAL,

    TSR. TEST_STATION_READING_ID,

    TSR. TEST_DATE,

    TSR. SURVEYOR,

    TSR. ON_VOLTS,

    TSR. ON_BG,

    TSR. ON_AG,

    TSR. METER_UTC,

    TSR. METER_ID,

    TSR. IO_BG,

    TSR. IO_AG,

    TSR. INSTANT_OFF_VOLTS,

    TSR. FUNCTIONAL_DAMAGE_OUT,

    TSR. FUNCTIONAL_DAMAGE_IN,

    TSR. COSEMETIC_DAMAGE_OUT,

    TSR. COSEMETIC_DAMAGE_IN,

    TSR.COMMENTS,

    TSR. CASING_ON,

    TSR. CASING_OFF,

    TSR. CASING,

    TSR. CALIBRATION_DUE_DATE,

    TSR. ANODE_AMPS_ON,

    TSR. ANODE_AMPS_OFF,

    TSR. ANODE

    OF TEST_STATION T

    INNER JOIN TEST_STATION_TYPE ON T.TEST_STATION_TYPE = TST TST. TEST_STATION_TYPE

    INNER JOIN PIPELINE_CODES ON T.PIPELINE_CODE = PC PC. PIPELINE_CODE

    INNER JOIN TEST_STATION_READING ON T.TEST_STATION_ID = TSR TSR. TEST_STATION_ID

    WHERE T.TEST_STATION_ID = TSR. TEST_STATION_ID

    You have two COMMENTS:

    COMMENT BY T.FUNCTIONAL,

    ...

    TSR.COMMENTS,

  • Create Materialized View ORA-01723: columns of length zero are not allowed

    I am trying to create a materialized view that derives from a column of a function and I get: ORA-01723: columns null are not allowed.

    I use 10 gr 2 with the following definition (simple version):

    CREATE MATERIALIZED VIEW ACES
    SELECT
    function_name (column_name) alias_de_colonne
    FROM table_name;

    I even tried to cast it as below:

    CREATE MATERIALIZED VIEW ACES
    SELECT
    Cast (function_name (column_name) AS VARCHAR2 (200)) alias_de_colonne
    FROM table_name;

    My function has an exception to return a value, even if no value are.

    I looked everywhere for the solution. Someone at - there a way around this problem? I really need my function to calculate the column because it has business rules that I can't join in my definition of the materialized view. My only hope around this is to insert values into a table and then create a materialized table view, I don't want to do that if someone has a solution around this.

    Any help would be greatly appreciated.

    Thank you

    Kyle

    Published by: Kyle Miller on April 19, 2011 08:28

    Have you tried to create a table with the correct structure and then by creating the view materialized, based on the predefined table as described here...

    http://www.oaktable.NET/content/ultra-fast-MV-alteration-using-prebuilt-table-option

    ?

    See you soon

    Ben

  • need help on the name of the column in double materialized view ORA-00957

    I have a query, long enough and several (8ways) joins.

    When I run it as a SQL query, it is fine.

    When I add create materialized, view myViewName it errors with
    ORA-00957: duplicate column name.

    How is there is no problem when executing the SQL statement, and how to fix this?

    Thank you.

    Hello

    Columns in a query do not need a unique name:

    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    D D
    - -
    X X
    

    At least not in SQL * Plus; other front ends might oppose it.
    In previous versions of Oracle, subqueries (such as online views) does not need to have unique names, but you've got an error if you tried to reference a non-unique column (and it is unnecessary to have the column if never reference you).

    Columns in a table or a view need unique names:

    CREATE OR REPLACE VIEW view_x
    AS
    SELECT     dummy
    ,     dummy
    FROM     dual;
    
    ,     dummy
          *
    ERROR at line 4:
    ORA-00957: duplicate column name
    
  • Create table works, create materialized view only - long column names?

    Hello.

    I have no probs creating a table as well: -.
    CREATE TABLE blah
    (
    DEVICE_ID
    )
    in select
    "Device_ID" AS DEVICE_ID
    "of"sum" Device"@ed_link_3
    where "Device_ID" < 5;


    But when I try to create a materialized view:
    Blah1 CREATE MATERIALIZED VIEW
    (
    DEVICE_ID
    )
    < various materialized view parms >
    in select
    "Device_ID" AS DEVICE_ID
    "of"sum" Device"@ed_link_3
    where "Device_ID" < 5;

    It fails with errors: -.
    ORA-04052: error occurred when searching to the top of the remote object Aggregate.Device@ED_LINK_3
    ORA-01948: length of the name of the identifier (31) exceeds maximum (30)

    Is there a way to get around this?
    Is the problem with the columns of the remote table of device, which I do NOT need to import to have column names that are longer than 30 characters?

    For now, I want only the Device_ID column which is a simple 9 characters long.

    Oh, and the remote database is MySQL.
    I'm uncomfortable with the < parms of materialized view > as they work fine when I choose a different remote table with only short column names.

    Thank you.

    To my knowledge, you have the option
    (a) create view (with shortened column names or only with desired columns if they are already less than 30 char limit) side of mysql
    (b) use dbms_passthrough to force the analysis to be done on mysql (as in the example provided by SY here use dbms_passthrough to create a view )
    However, I prefer to stick to one), because with dbms_passtrhough, you retrieve row by row.

    Best regards

    Maxim

  • Is there a way to change the motion of a materialized view?

    Hello

    I use Oracle 10.2.0.
    I created a materialized with option as a Force refresh view. I want to make changes to the underlying query of the materialized view that joins a few other tables. Please advice if I can change the query of the mview.

    Kind regards
    Naveen.

    Naveen Kumar C wrote:
    I want to know if there is a way to change the query without dropping the existing and recreate it.

    No, it isn't.

Maybe you are looking for