oracle中dbms_并发和由于DBMS中的并发导致的问题
oracle中dbms
并發(fā) (Concurrency)
The ability of a database system which handles simultaneously or a number of transactions by interleaving parts of the actions or the overlapping this is called concurrency of the system.
數(shù)據(jù)庫(kù)系統(tǒng)通過(guò)交織部分操作或重疊操作來(lái)同時(shí)處理或處理大量事務(wù)的能力稱(chēng)為系統(tǒng)并發(fā)性。
并發(fā)優(yōu)勢(shì) (Advantages of concurrency)
The good is to serve many users and provides better throughput by sharing resources.
這樣做的好處是可以為許多用戶提供服務(wù),并通過(guò)共享資源提供更好的吞吐量。
Reduced waiting time response time or turn around time.
減少等待時(shí)間的響應(yīng)時(shí)間或周轉(zhuǎn)時(shí)間。
Increased throughput or resource utilization
吞吐量或資源利用率提高
If we run only one transaction at a time than the acid property is sufficient but it is possible that when multiple transactions are executed concurrently than database may become inconsistent.
如果我們一次只運(yùn)行一個(gè)事務(wù),那么酸屬性就足夠了,但是當(dāng)同時(shí)執(zhí)行多個(gè)事務(wù)時(shí),數(shù)據(jù)庫(kù)可能會(huì)變得不一致。
Overlapping with the input-output activity with CPU also makes the response time better.
與CPU的輸入輸出活動(dòng)重疊也可以提高響應(yīng)時(shí)間。
But interleaving of instruction between transaction may also lead to many problems due to which concurrency control is required.
但是事務(wù)之間的指令交織也可能導(dǎo)致許多問(wèn)題,由于這些問(wèn)題需要并發(fā)控制。
并發(fā)問(wèn)題 (Problems due to concurrency)
There are many which may occur due to concurrency,
由于并發(fā),可能發(fā)生許多情況,
1) Dirty read problem
1)臟讀問(wèn)題
If a transaction reads an uncommitted temporary value written by some other transaction than it is called dirty read problem. In this one transaction read a data item updated by another uncommitted transaction that may be future be aborted or failed. In such cases, the read value disappears from the database upon abort this is turned on dirty read the reading transaction end with incorrect results.
如果一個(gè)事務(wù)讀取了由其他事務(wù)寫(xiě)入的未提交的臨時(shí)值,則稱(chēng)為臟讀取問(wèn)題。 在此事務(wù)中,讀取由另一個(gè)未提交的事務(wù)更新的數(shù)據(jù)項(xiàng),該數(shù)據(jù)項(xiàng)將來(lái)可能會(huì)中止或失敗。 在這種情況下,讀取值在中止時(shí)會(huì)從數(shù)據(jù)庫(kù)中消失,這將導(dǎo)致臟讀取中的讀取事務(wù)結(jié)束,并且結(jié)果不正確。
Example
例
T1 T2R(A)W(A)R(A)The values of item x which is read by T2 is called dirty read data because this data can be created by a transactions that has not been committed yet.
T2讀取的項(xiàng)x的值稱(chēng)為臟讀取數(shù)據(jù),因?yàn)樵摂?shù)據(jù)可以由尚未提交的事務(wù)創(chuàng)建。
2) Loss update problem/ write - write problem
2)丟失更新問(wèn)題/寫(xiě)-寫(xiě)問(wèn)題
This problem occur when two transactions access the same data item and have their operations interleaved in a way that makes the value of some database items incorrect.
當(dāng)兩個(gè)事務(wù)訪問(wèn)相同的數(shù)據(jù)項(xiàng)并以某種使某些數(shù)據(jù)庫(kù)項(xiàng)的值不正確的方式交錯(cuò)操作時(shí),會(huì)發(fā)生此問(wèn)題。
If there are two write operations of the different transaction on some data values and in between them there are no read operations then the second write over the first .consider the schedule below,
如果不同事務(wù)在某些數(shù)據(jù)值上有兩次寫(xiě)操作,并且在它們之間沒(méi)有讀操作,則在第一個(gè)上進(jìn)行第二次寫(xiě)操作。請(qǐng)考慮以下時(shí)間表,
Example
例
T1 T2R(A)W(A)W(A)Here is a blind write that means write without a read. Here the changes made by transaction T1 are lost which is updated by a transaction T2.
這是盲寫(xiě),表示寫(xiě)而沒(méi)有讀。 此處,事務(wù)T1所做的更改會(huì)丟失,而事務(wù)T2會(huì)對(duì)其進(jìn)行更新。
3) Unrepeatable and phantom read problem
3)不可重復(fù)的幻像讀取問(wèn)題
When a transaction cannot repeat the read instructions because the variable is deleted by some other transaction then this problem is called phantom read problem. In this problem at different instances of time a transaction read gives different values it is because data item might have been updated by another transaction.
當(dāng)某個(gè)事務(wù)由于該變量被其他事務(wù)刪除而無(wú)法重復(fù)讀取指令時(shí),此問(wèn)題稱(chēng)為幻像讀取問(wèn)題。 在此問(wèn)題中,在不同的時(shí)間實(shí)例下,事務(wù)讀取給出不同的值是因?yàn)閿?shù)據(jù)項(xiàng)可能已被另一個(gè)事務(wù)更新。
This causes a problem while execution of some aggregate by a transaction and due to changes in the values of the data item by another transaction it leads to incorrect results. When a transaction read values of data item twice and another transaction's updates data item in between then the results of two read operations will differ.
這在事務(wù)執(zhí)行某些聚合時(shí)會(huì)引起問(wèn)題,并且由于另一事務(wù)在數(shù)據(jù)項(xiàng)的值更改中會(huì)導(dǎo)致錯(cuò)誤的結(jié)果。 當(dāng)一個(gè)事務(wù)兩次讀取數(shù)據(jù)項(xiàng)的值,而在兩次事務(wù)之間更新另一個(gè)數(shù)據(jù)項(xiàng)的更新時(shí),兩次讀取操作的結(jié)果將有所不同。
Example
例
T1 T2R(A) R(A)Delete(A) R(A)4) Incorrect summary problem
4)錯(cuò)誤的匯總問(wèn)題
When one of the transactions is checking on aggregate summary function while other transactions are updating then this problem is called incorrect summary problem. The aggregate functions may calculate some values before they updated and others after they are updated.
當(dāng)其中一個(gè)事務(wù)正在檢查匯總摘要功能而其他事務(wù)正在更新時(shí),此問(wèn)題稱(chēng)為不正確的摘要問(wèn)題。 聚合函數(shù)可以在更新之前計(jì)算某些值,而在更新之后計(jì)算其他值。
時(shí)間表 (Schedule)
A schedule contains two or more transaction or one after another. All the instructions of each individual transaction will appear in the schedule contact switching can be done but we cannot change the order of execution.
時(shí)間表包含兩個(gè)或多個(gè)事務(wù)或一個(gè)接一個(gè)。 每個(gè)交易的所有指令都將出現(xiàn)在時(shí)間表中,可以進(jìn)行聯(lián)系切換,但是我們不能更改執(zhí)行順序。
時(shí)間表類(lèi)型 (Types of schedule )
Schedule can be classified into mainly two types,
時(shí)間表主要可以分為兩種類(lèi)型,
Serial schedule
序列時(shí)間表
if the schedule runs only one transaction at a time and can start other transaction after computing the first than it is called serial schedule. If there are n schedules than ! n different schedules are possible.
如果計(jì)劃一次僅運(yùn)行一個(gè)事務(wù),并且可以在計(jì)算第一個(gè)事務(wù)之后啟動(dòng)另一個(gè)事務(wù),則稱(chēng)為串行計(jì)劃。 如果有n個(gè)時(shí)間表,則比! n可能有不同的時(shí)間表。
Non-serial/concurrent schedule
非連續(xù)/并發(fā)時(shí)間表
A schedule is said to be non-serial schedule if we start executing other transactions before computing the first one. A schedule in which sequence of instructions of transactions appear in the same order as they appear in individual transactions but the instructions may be interleaved with the instructions of different transactions i.e. concurrent execution of transaction takes place.
如果我們?cè)谟?jì)算第一個(gè)事務(wù)之前開(kāi)始執(zhí)行其他事務(wù),則該調(diào)度被稱(chēng)為非串行調(diào)度。 一種時(shí)間表,在該時(shí)間表中,交易的指令序列以與在單個(gè)交易中出現(xiàn)的順序相同的順序出現(xiàn),但是指令可以與不同交易的指令交錯(cuò),即發(fā)生交易的同時(shí)執(zhí)行。
翻譯自: https://www.includehelp.com/dbms/concurrency-and-problem-due-to-concurrency.aspx
oracle中dbms
總結(jié)
以上是生活随笔為你收集整理的oracle中dbms_并发和由于DBMS中的并发导致的问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: mysql怎样查表的模式_mysql常用
- 下一篇: 北航计算机学院博士机试考试题,北航201