Presentation is loading. Please wait.

Presentation is loading. Please wait.

DCL – Data Control Language

Similar presentations


Presentation on theme: "DCL – Data Control Language"— Presentation transcript:

1 DCL – Data Control Language
DCL languages are used to control the user access to the database, tables etc. Data Control Language (DCL) statements. Some examples: GRANT - gives user's access privileges to database REVOKE - withdraw access privileges given with the GRANT command

2 Grant GRANT provides the privileges to the users on the database objects. The privileges could be select, delete, update and insert on the tables and views.

3 Privilege_name is the level of access given to the users
Privilege_name is the level of access given to the users. Some of the access rights are ALL, DELETE, UPDATE, INSERT, EXECUTE and SELECT. Object_name is the name of a database object like TABLE, VIEW, PROCEDURE, FUNCTION, PACKAGE and SEQUENCE. User_name is the name of the user to whom an access is being granted. WITH GRANT OPTION - allows a user to grant access rights to other users. i.e.; usually grants are given by the user who has created the database objects. But with this option, the users who have got the access rights can also provide the grants and access other tables/views. GRANT privilege_name ON object_name TO user_name WITH GRANT OPTION]; GRANT SELECT, INSERT ON STUDENT TO Amrita;

4 REVOKE removes the privileges given on the database objects
REVOKE removes the privileges given on the database objects. We can remove all the privileges or remove one or more privileges from the objects. REVOKE INSERT ON STUDENT FROM Amrita

5 TCL Transaction Control (TCL) statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.

6 ROLLBACK - restore database to original since the last COMMIT
COMMIT - save work done SAVEPOINT - identify a point in a transaction to which you can later roll back ROLLBACK - restore database to original since the last COMMIT

7

8

9

10

11 Transaction A transaction is a set of changes that must all be made together. It is a program unit whose execution may or may not change the contents of a database.

12 Example Suppose a bank employee transfers Rs 500 from A's account to B's account. This very simple and small transaction involves several low-level tasks.

13

14

15 Active − In this state, the transaction is being executed
Active − In this state, the transaction is being executed. This is the initial state of every transaction. Partially Committed − When a transaction executes its final operation, it is said to be in a partially committed state. Failed − A transaction is said to be in a failed state if any of the checks made by the database recovery system fails. A failed transaction can no longer proceed further. Aborted − If any of the checks fails and the transaction has reached a failed state, then the recovery manager rolls back all its write operations on the database to bring the database back to its original state where it was prior to the execution of the transaction. Transactions in this state are called aborted. The database recovery module can select one of the two operations after a transaction aborts Re-start the transaction Kill the transaction Committed − If a transaction executes all its operations successfully, it is said to be committed. All its effects are now permanently established on the database system.

16 ACID Properties A transaction in a database system must maintain
Atomicity Consistency Isolation Durability

17 Atomicity − This property states that a transaction must be treated as an atomic unit, that is, either all of its operations are executed or none.

18 Consistency − The database must remain in a consistent state after any transaction. No transaction should have any adverse effect on the data residing in the database.

19 Durability − The database should be durable enough to hold all its latest updates even if the system fails or restarts. If a transaction updates a chunk of data in a database and commits, then the database will hold the modified data.

20 Isolation − In a database system where more than one transaction are being executed simultaneously and in parallel, the property of isolation states that all the transactions will be carried out and executed as if it is the only transaction in the system. No transaction will affect the existence of any other transaction.


Download ppt "DCL – Data Control Language"

Similar presentations


Ads by Google