Home Database Mysql Tutorial 物化视图测试手册

物化视图测试手册

Jun 07, 2016 pm 05:39 PM

《物化视图测试手册》场合:数据变化小,查询出数据还要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” 博客,请务必保留此出处

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys? How do you represent relationships using foreign keys? Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns? How do you create indexes on JSON columns? Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles