DBMS Unit-6 | Database Transaction | Databases

Pages 35
Views 4
of 35
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Description
Concept Of Transaction Management ‡ ‡ In simple SQL query, the SQL command (DML, DDL etc) sent to server and executed one after another In place of sending one by one SQL command to server we can combine multiple operations that are logically similar and send to server as a single logical unit. Eg. Transferring Rs 100 from one account to another ± Withdraw Rs. 100 from account_1 ± Deposit Rs. 100 from account_2 Collection of multiple operations that form a single logical unit is called as transa
Transcript
  Concept Of Transaction Management  In simple SQL query, the SQL command (DML, DDL etc) sent to server and executed one afteranother  In place of sending one by one SQL command to server we can combine multiple operations thatare logically similar and send to server as a single logical unit. Eg. Transferring Rs 100 from oneaccount to another  ± Withdraw Rs. 100 from account_1  ± Deposit Rs. 100 from account_2  Collection of multiple operations that form a single logical unit is called as transaction  A transaction is a sequence of one or more SQL statements that combined together to form a singlelogical unit of work  Types of operations in transactions  ± Read This operation transfers one data item from the database memory to a local buffer of the transaction that executed the read operation. EgData Selection/Retrieval Language  SELECT * FROM STUDENTS  ± Write This operation transfers one data item from the local buffer of the transaction thatexecuted the write back to the database. Eg. Data Manipulation Language (DML)  UPDATE STUDENT SET NAME=RAVI WHERE SID=102  Information processing in DBMS is divided into individual, indivisible operational logical units calledtransactions  Transactions are one of the mechanisms for managing changes to the database  A transaction is a series of small database operations that together form a single large operation  Application programs use transactions to execute sequences of operations when it is important thatall operations are successfully completed  Concept Of Transaction Management  During the money transfer between two bank accounts it isunacceptable for the operation that updates the secondaccount to fail.  This would lead to transferred money being lost as it wouldbe withdrawn from one account but not inserted in thesecond account  ± BEGIN TRANSACTION transfer  UPDATE accountsSET balance=balance-100WHERE account=A  UPDATE accountsSET balance=balance+100WHERE account=B  If no errors then COMMIT transaction  Else ROLLBACK transaction  End If   ± END TRANSACTION transfer  Transaction Structure And Boundaries  The transactions consists of all SQL operations executed between thebegin transaction and end transaction  A transaction is started by issuing a BEGIN TRANSACTION command. Oncethis command is executed the DBMS starts monitoring the transaction. Alloperations are executed after a BEGIN TRANSACTION command and aretreated as a single large operation  When transaction is completed it must either be committed by executinga COMMIT command or rolled back by executing a ROLLBACK command  Until a transaction commits or rolls back the database system remainsunchanged to other users of the system. Therefore the transaction canmake as many changes as it wishes but none of the updates are reflectedin the database until the transaction completes or fails  A transaction that is successful and has encountered no errors iscommitted that is all changes to the database are made permanent andbecome visible to other users of the database  A transaction that is unsuccessful and has encountered some type of errors is rolled back that is all changes to the database are undone and thedatabase remains unchanged by transaction  The DBMS guarantees that all the operations in the transaction eithercomplete or fail. When a transaction fails all its operations are undone andthe database is returned to the state it was in before the transactionstarted  Need Of Transaction  A database management system (DBMS) should be able to survive in a system failure conditionsthat is if a DBMS is having a system failure then it should be possible to restart the system and theDBMS without losing any of information contained in the database  Modern DBMS should not loose data because of system failure  A DBMS must manage the data in the database so that as users change the data it does notbecome corrupt and unavailable  Computer systems fail to work correctly for many of below reasons  ± Software Errors Are normally the mistakes in the logic of the program code. Egwhen thevalue of a variable is set to an incorrect value  ± Hardware Errors They occur when a component of the computer fails for ega disc drive  ± Communication Errors In large systems programs may access data stored at numerouslocations on a network. The communication links between sites on the network can fail towork  ± Conflicting Programs When a system executes more than one program at the same time theprogram may access and change the same data for egmany users may have access to be oneset of data  Transaction processing is designed to maintain a database in a consistent state  It ensures that any operations carried out on the system that is interdependent  Transactions are either completed successfully or all aborted successfully  Transaction processing is meant for concurrent execution and recovery from possible system failurein a DBMS
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x