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
MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQL: String Data Types and ENUMs?MySQL: String Data Types and ENUMs?May 13, 2025 am 12:05 AM

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

MySQL BLOB: how to optimize BLOBs requestsMySQL BLOB: how to optimize BLOBs requestsMay 13, 2025 am 12:03 AM

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Adding Users to MySQL: The Complete TutorialAdding Users to MySQL: The Complete TutorialMay 12, 2025 am 12:14 AM

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

Mastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMay 12, 2025 am 12:12 AM

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

MySQL: String Data Types and Indexing: Best PracticesMySQL: String Data Types and Indexing: Best PracticesMay 12, 2025 am 12:11 AM

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

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 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools