search
HomeDatabaseMysql Tutorial 物化视图测试手册

《物化视图测试手册》场合:数据变化小,查询出数据还要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
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
Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

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.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

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]

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]

See all articles

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)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version