Home > Database > Mysql Tutorial > body text

物化视图测试手册

WBOY
Release: 2016-06-07 17:39:15
Original
817 people have browsed it

《物化视图测试手册》场合:数据变化小,查询出数据还要2次利用,需要数据双向同步的场合视图:就是一条sql语句,每次查询时都要重新生成执行计划,重新执行,非

(

############################################################################################

select*fromALL_MVIEWS;


select*fromUSER_MVIEW_ANALYSIS;


1.


insertintosino_person_addressvalues(seq_sino_person_address.nextval,123,to_date('2013-04-0812:12:12','yyyy-mm-ddhh24:mi:ss'),'110','test_report',111,'beijing

xicheng','100100','1',123,1,'1000',0);


insertintosino_person_addressvalues(seq_sino_person_address.nextval,123,to_date('2013-04-0912:12:12','yyyy-mm-ddhh24:mi:ss'),'120','test_report2',121,'beijing

xicheng','100200','2',123,1,'1002',2);


insertintosino_person_addressvalues(seq_sino_person_address.nextval,123,to_date('2013-04-1012:12:12','yyyy-mm-ddhh24:mi:ss'),'130','test_report3',131,'beijing

xicheng','100300','3',123,1,'1003',3);

commit

###################################################################################################


2.


selectowner,table_name,tablespace_name,statusfromdba_tableswheretable_namein('SINO_LOAN_APPLY');

updateSINO_LOAN_APPLYsetsorgcode='1000'whereiid=858;


execdbms_mview.refresh('mv_sino_loan_compact','c');

execdbms_mview.refresh('mv_sino_loan_compact','f');


execdbms_mview.refresh('mv_sino_loan_apply','c');

execdbms_mview.refresh('mv_sino_loan_apply','f');


execdbms_mview.refresh('mv_sino_loan_spec_trade','c');

execdbms_mview.refresh('mv_sino_loan_spec_trade','f');


execdbms_mview.refresh('mv_sino_loan','c');

execdbms_mview.refresh('mv_sino_loan','f');


execdbms_mview.refresh('mv_sino_loan_guarantee','c');

execdbms_mview.refresh('mv_sino_loan_guarantee','f');


execdbms_mview.refresh('mv_sino_loan_investor','c');

execdbms_mview.refresh('mv_sino_loan_investor','f');

###############################################################################

execdbms_mview.refresh('mv_sino_person_employment','c');

execdbms_mview.refresh('mv_sino_person_employment','f');


execdbms_mview.refresh('mv_sino_person_address','c');

execdbms_mview.refresh('mv_sino_person_address','f');


execdbms_mview.refresh('mv_sino_person_certification','c');

execdbms_mview.refresh('mv_sino_person_certification','f');


execdbms_mview.refresh('mv_sino_person','c');

execdbms_mview.refresh('mv_sino_person','f');


3.ipbcstatenumber(1)

sino_person_certification

sino_person

sino_person_address

sino_person_employment

sino_person_address_his

sino_person_employment_his

sino_person_his


sino_loan

sino_loan_compact

sino_loan_spec_trade

sino_loan_guarantee

sino_loan_investor

sino_loan_apply




################################################################################




##################################################################################



4.


dbms_output.put_line('JobNumberis'||to_char(job_num));

commit;

end;

/


dbms_output.put_line('JobNumberis'||to_char(job_num));

commit;

end;

/

Job作业唯一编号

Log_user提交作业的用户

What作业执行的存储过程

Last_date最后一次成功运行作业的日期

Last_sec最后一次成功运行作业的时间

Next_date下一次运行作业日期

Next_sec下一次运行作业时间

Failures执行失败次数,当执行job出现错误时,Oracle将其记录在日志里,失败次数每次自动加1,加到16之后Oracle就不在执行它了

Broken是否是异常作业,当执行失败次数达到16时,Oracle就将该job标志为broken。此后,Oracle不再继续执行它,直到用户调用过程dbms_job.broken,重新设置为notbroken,或强制调用dbms_job.run来重新执行它。Y标示作业中断,以后不会运行,N表示作业正常,可以运行

运行作业
begin
dbms_job.run(:job_num);job_num是存储job编号的变量
end;

查询作业状态

SQL>selectjob,log_user,what,last_date,last_sec,next_date,next_sec,failures,brokenfromuser_jobs;

JOBLOG_USERWHATLAST_DATELAST_SECNEXT_DATENEXT_SECFAILURESBROKEN

-------------------------------------------------------------------------------------------------------------

1SINOJFSpro_refresh_all_mviews;2013-4-26111:27:382013-4-27110:00:000N

Job作业唯一编号

Log_user提交作业的用户

What作业执行的存储过程

Last_date最后一次成功运行作业的日期

Last_sec最后一次成功运行作业的时间

Next_date下一次运行作业日期

Next_sec下一次运行作业时间

Failures执行失败次数,当执行job出现错误时,Oracle将其记录在日志里,失败次数每次自动加1,加到16之后Oracle就不在执行它了

Broken是否是异常作业,当执行失败次数达到16时,Oracle就将该job标志为broken。此后,Oracle不再继续执行它,直到用户调用过程dbms_job.broken,重新设置为notbroken

或强制调用dbms_job.run来重新执行它。Y标示作业中断,以后不会运行,N表示作业正常,可以运行


删除作业

begin
dbms_job.remove(:job_num);
end;

修改作业

dbms_job.remove(jobno);删除job号

例executedbms_job.remove(1);

######################################################################

dbms_job.what(jobno,what);修改执行的存储过程

dbms_job.next_date(job,next_date)修改下次执行的时间

例execdbms_job.next_date(46,sysdate+2/(24*60));46作业号

#####################################################################

dbms_job.interval(job,interval):修改间隔时间

例execdbms_job.interval(46,sysdate+3/(24*60));

######################################################################
dbms_job.broken(job,true)中断job

例execdbms_job.broken(46,true);46作业号execdbms_job.broken(2,true)BROKEN=Y

#######################################################################

dbms_job.broken(job,false,next_date)next_date:下次执行时间,,如果不填则马上启动job

例execdbms_job.broken(46,false);启动jobexecdbms_job.broken(2,false);BROKEN=N

########################################################################

dbms_job.run(jobno);运行作业

例子executedbms_job.run(1);


请点击下载


Leonarding

2013.08.29

北京&autumn

分享技术~成就梦想

Blog

本文出自 “leonarding Blog” 博客,请务必保留此出处

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template