昊天

物化视图脚本

/*==============================================================*/
/* 需要用user1账号执行下面的授权                                */
/*==============================================================*/ 
grant select any table to user;
grant create materialized view to user;
grant on commit refresh to user;  

/*==============================================================*/
/* 需要用sys账号执行下面的授权                                  */
/*==============================================================*/ 
grant exempt access policy to user;
grant exempt access policy to user;
grant exempt access policy to user;

drop materialized view log on AAA;
create materialized view log on AAA with primary key

drop materialized view AAA;
create materialized view AAA 
refresh fast 
on commit as 
select bindid, merchantid, userid, bindtime, bindtype, username, gsmsn
  
from AAA t;
  
drop materialized view log on DDD;
create materialized view log on DDD with primary key

drop materialized view BBB;
create materialized view  BBB
refresh fast 
on commit as 
select MERCHANTID,
       COMPANYNAME,
       ORGANIZATION
  
from DDD t; 
  
drop materialized view log on BBB;
drop materialized view log on CCC;
drop materialized view log on CCC;
create materialized view log on BBB WITH rowid ,SEQUENCE (userid,timinalid,ACCOUNTNO,IMSI,REGDATE,NICKNAME,SEX,INVALID,ISACTIVE,USERTYPE,STATUS,BIZTYPE,ACTIVEDATE,SIGNATURE,PHOTOID,CITYID,CARID,USERPHOTO,USERCARPHOTO,MOBILENO,EMAIL,LOGINDAYS,LASTLOGINDATE,USERSTATUS,LATELYCITY,LATELYCITYDATE) INCLUDING NEW VALUES;
create materialized view log on CCC WITH rowid ,SEQUENCE (IDENTIFYCARD,CARNUMBER,FDJNUMBER,FOURSSHOP,DELIVERDATE,BIRTHDATE,ADDRESS,MILEAGE,MILEAGETIME) INCLUDING NEW VALUES;
create materialized view log on CCC WITH rowid ,SEQUENCE (DEVICEID,IMSI,ISSUEMONTH,ICCID,SIMPHONE,GSMSN,DEVICESN,CURVER,DEVICETYPE,IS3GNET,IMSITYPE,TERMINALINFO,RATEID,CARDSTATUS) INCLUDING NEW VALUES;

drop materialized view DDD;
create materialized view DDD
refresh fast 
on commit as 
select a.rowid arowid,
       a.USERID,
       a.ACCOUNTNO,
       b.rowid browid,       
       b.USERNAME,
       c.rowid crowid,       
       c.DEVICEID 
  
from BBB a ,CCC b,CCC c 
 
where a.userid = b.userid(+
   
and a.timinalid = c.terminalid(+);
  
 
 
create index INDEX_DDD on DDD(merchantid)
  tablespace SSS
  pctfree 
10
  initrans 
2
  maxtrans 
255
  storage
  (
    initial 5M
    minextents 
5
    maxextents unlimited
  ); 
  
 
create index INDEX_AAA on AAA(userid)
  tablespace SSS
  pctfree 
10
  initrans 
2
  maxtrans 
255
  storage
  (
    initial 5M
    minextents 
5
    maxextents unlimited
  ); 
    
 
create index INDEX_BBB on BBB(merchantid)
  tablespace SSS
  pctfree 
10
  initrans 
2
  maxtrans 
255
  storage
  (
    initial 10M
    minextents 
5
    maxextents unlimited
  ); 
  

 
create index INDEX_CCC on CCC(userid)
  tablespace SSS
  pctfree 
10
  initrans 
2
  maxtrans 
255
  storage
  (
    initial 10M
    minextents 
5
    maxextents unlimited
  ); 

posted on 2012-06-15 14:51 昊天 阅读(289) 评论(0)  编辑  收藏 所属分类: oracle


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2012年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

统计

留言簿(1)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜