Refresh TYPES are COMPLETE/FAST/ON COMMIT/ON DEMAND
Couple of things you should do to make a mview to refresh in parallel:
1.) Alter the master table to make sure it allows parallelism:
alter table
To check
select degree from dba_tables where table_name='
2.) When you create the mview log (incase of FAST refresh mviews), create it with a parallel clause:
create materialized view log on
OR
Incase of existing mviews:
alter materialized view log on
3.) When you create the mview, create it with a parallel clause:
create materialized view
OR
create materialized view
Or
Incase of existing mviews:
alter table
alter materialized view
Lastly while executing the refresh:
EXECUTE DBMS_MVIEW.REFRESH(LIST=>'
This should make your mview refresh in parallel. With the above example the mview should run with parallel degree 4.
PS: Make sure that parallel is enabled for your database, check parameters:
PARALLEL_MAX_SERVERS
PARALLEL_EXECUTION_MESSAGE_SIZE
PARALLEL_ADAPTIVE_MULTI_USER
PARALLEL_AUTOMATIC_TUNING
Make sure that the above parameter are set to allow any parallelism to work.
Sample values for these parameters:
SQL> show parameter PARALLEL_MAX_SERVERS
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
parallel_max_servers integer 120
SQL> show parameter PARALLEL_EXECUTION_MESSAGE_SIZE
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
parallel_execution_message_size integer 16384
SQL> show parameter PARALLEL_ADAPTIVE_MULTI_USER
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
parallel_adaptive_multi_user boolean TRUE
SQL> show parameter PARALLEL_AUTOMATIC_TUNING
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
parallel_automatic_tuning boolean FALSE
Note:
1.) Replace
2.) Replace
3.) Replacedblink with the name of the database link.
Tuesday, November 30, 2010
How to refresh MVIEW in parallel
Posted by Apun Hiran at 7:33 AM 2 Comments
Labels: alter mview, alter table, mview, oracle, parallel, parallelism
Wednesday, November 17, 2010
Import Error: IMP-00032: SQL statement exceeded buffer length
While trying to import a big table with 1000s of partitions I got error:
IMP-00032: SQL statement exceeded buffer length
IMP-00008: unrecognized statement in the export file:
MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "TEST_PART_1" NOLOGGING COMPRESS, PARTITION "TEST_NOV_1" VALUES LESS THAN (2010112806) PCTFREE 0 PCTUSED 40...
The table was exported simiply with:
exp system/oracle file=tab.dmp tables=table_part
While run import:
imp system/oracle file=tab.dmp fromuser=scott touser=tiger
I got the above error.
I tried various combination of parameter buffer i.e.
imp system/oracle file=tab.dmp fromuser=scott touser=tiger buffer=1000000 commit=y
etc, but still got the error. So I wanted to know whats the value required for buffer.
Solution:
In the source database we need to run:
SQL> select dbms_lob.getlength (dbms_metadata.get_ddl('TABLE','table_part','SCOTT')) "SQL_LENGTH" from dual;
SQL_LENGTH
----------
3886502
The above output gives the value of buffer we need to have atleast to run the import, so I used:
imp system/o1ympic file=tabs.dmp log=tabs.log fromuser=SCOTT touser=TIGER commit=y ignore=Y buffer=44886502
This solved the problem.
Metalink Note: 846397.1
Posted by Apun Hiran at 12:06 AM 2 Comments