ORA-12060: During Mview Creation
Failing in creating materialized view between two databases with different characterset
Source Database:
SQL> select * from nls_database_parameters@link1 where PARAMETER='NLS_CHARACTERSET';
PARAMETER VALUE
------------------------------ ------------------------------
NLS_CHARACTERSET WE8MSWIN1252
Target Database:
SQL> select * from nls_database_parameters where PARAMETER='NLS_CHARACTERSET';
PARAMETER VALUE
------------------------------ ------------------------------
NLS_CHARACTERSET AL32UTF8
Creating the Materialized View:
Create materialized view SCOTT.ttab1
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)
TABLESPACE "MVTBS"
PARALLEL 4
BUILD IMMEDIATE
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
START WITH sysdate+0 NEXT SYSDATE+6/24
USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS select * from SCOTT.stab1@link1;
Received Error with ORA-01555, after sometime while creating the materialized view and the materialized view creation got failed.
To use the PREBUILT Table option, take an export backup of that table in the source database and import it in target database and then tried to recreate the mview with PREBUILT TABLE option:
create materialized view SCOTT.ttab1 ON PREBUILT TABLE
refresh fast with primary key for update
as
select col1,col2 from SCOTT.stab1@link1;
Which failed with:
Col1,
*
ERROR at line 6:
ORA-12060: shape of prebuilt table does not match definition query
Use "WITH REDUCED PRECISION" for col mis-match.
create materialized view SCOTT.ttab1 ON PREBUILT TABLE WITH REDUCED PRECISION
refresh fast with primary key for update
as
select col1,col2 from SCOTT.stab1@link1;
Failed Again:
create materialized view SCOTT.ttab1 ON PREBUILT TABLE WITH REDUCED PRECISION
*
ERROR at line 1:
ORA-12060: shape of prebuilt table does not match definition query
Remove "with primary key for update"
create materialized view SCOTT.ttab1 ON PREBUILT TABLE WITH REDUCED PRECISION
refresh fast on demand
as
select col1,col2 from SCOTT.stab1@link1;
Materialized view created.
Failing in creating materialized view between two databases with different characterset
Source Database:
SQL> select * from nls_database_parameters@link1 where PARAMETER='NLS_CHARACTERSET';
PARAMETER VALUE
------------------------------ ------------------------------
NLS_CHARACTERSET WE8MSWIN1252
Target Database:
SQL> select * from nls_database_parameters where PARAMETER='NLS_CHARACTERSET';
PARAMETER VALUE
------------------------------ ------------------------------
NLS_CHARACTERSET AL32UTF8
Creating the Materialized View:
Create materialized view SCOTT.ttab1
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)
TABLESPACE "MVTBS"
PARALLEL 4
BUILD IMMEDIATE
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
START WITH sysdate+0 NEXT SYSDATE+6/24
USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS select * from SCOTT.stab1@link1;
Received Error with ORA-01555, after sometime while creating the materialized view and the materialized view creation got failed.
To use the PREBUILT Table option, take an export backup of that table in the source database and import it in target database and then tried to recreate the mview with PREBUILT TABLE option:
create materialized view SCOTT.ttab1 ON PREBUILT TABLE
refresh fast with primary key for update
as
select col1,col2 from SCOTT.stab1@link1;
Which failed with:
Col1,
*
ERROR at line 6:
ORA-12060: shape of prebuilt table does not match definition query
Use "WITH REDUCED PRECISION" for col mis-match.
create materialized view SCOTT.ttab1 ON PREBUILT TABLE WITH REDUCED PRECISION
refresh fast with primary key for update
as
select col1,col2 from SCOTT.stab1@link1;
Failed Again:
create materialized view SCOTT.ttab1 ON PREBUILT TABLE WITH REDUCED PRECISION
*
ERROR at line 1:
ORA-12060: shape of prebuilt table does not match definition query
Remove "with primary key for update"
create materialized view SCOTT.ttab1 ON PREBUILT TABLE WITH REDUCED PRECISION
refresh fast on demand
as
select col1,col2 from SCOTT.stab1@link1;
Materialized view created.