Views Creation

Please write me the steps to create the materilized views.I have five views to be created as materilized views.I want to place them in DBMS_REFRESH to get refreshed together.
I want to do refresh  of views in every two hours.
Thx in advance.
pooja74Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tony_HaslerCommented:
I am not sure what you want.  There are a lot of options for materialized views.  For instance, the following is a modified example of an aggregate view from the Oracle documentation.  You can then refresh it by using the DBMS_REFRESH package.

Is it the DBMS_REFRESH package that you need help on?  If not could you be more specific about what you want, and I can perhaps give you the SQL.

CREATE MATERIALIZED VIEW sales_mv
   BUILD IMMEDIATE
   REFRESH COMPLETE ON DEMAND
   AS SELECT t.calendar_year, p.prod_id,
      SUM(s.amount_sold) AS sum_sales
      FROM times t, products p, sales s
      WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
      GROUP BY t.calendar_year, p.prod_id;

0
pooja74Author Commented:
Thx for the reply ,But please include the syntax also  the clause for refresh of the view  in every two hours also.
Thx
0
EladlaCommented:
The syntax is:

Create materialized view [view name]
refresh fast next sysdate + 1/12
as
select ...
from ...
where ...

this will do a fast refresh every two H`s, starting from two H`s after view creation.
0
pooja74Author Commented:
Thx please send me the syntax for creation of group in dbms_refresh and using dbms_refesh for the group.And when we are using dbms_refresh we should use use refresh fast next sysdate + 1/12  in view or not.And if we not using then what is the syntax for creation of  materilaized view with dbms_refresh.
This is urgent please reply.
Thx in advance.,
0
EladlaCommented:
http://www.dbasupport.com/oracle/ora9i/ManRefreshMViews2.shtml

Here is the full syntax plus examples of the dbms_refresh procedure.

As for the view creation, if you don`t want it to do an automatic refresh, just omit the refresh clause and use the dbms_refresh to do it manualy.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.