Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lecture 5 Transactions and Security. 2 zTransactions SAVEPOINT ROLLBACK COMMIT zSecurity GRANT REVOKE Topics.

Similar presentations


Presentation on theme: "1 Lecture 5 Transactions and Security. 2 zTransactions SAVEPOINT ROLLBACK COMMIT zSecurity GRANT REVOKE Topics."— Presentation transcript:

1 1 Lecture 5 Transactions and Security

2 2 zTransactions SAVEPOINT ROLLBACK COMMIT zSecurity GRANT REVOKE Topics

3 3 Transactions zA transaction is a DML (Data Manipulation Language) operation which changes the database from one consistent state into another.

4 4 Transactions zOracle starts a transaction with the first SQL statement after a COMMIT, ROLLBACK or connection to the database. zOracle ends a transaction with a COMMIT, ROLLBACK or disconnection from the database.

5 5 Transactions zUntil changes are committed (made permanent) yYou can see the changes when the table is queried but, yOthers cannot see them when they query query your tables and, yYou can roll them back (discard them) if you change your mind or need to correct a mistake

6 6 Transactions zOracle issues an implicit COMMIT before and after any DDL (Data Definition Language - CREATE, ALTER, DROP) SQL statement.

7 7 Transactions zThere are a number of commands to help manage transactions ySAVEPOINT savepoint yROLLBACK [TO [SAVEPOINT] savepoint] yCOMMIT

8 8 Creating a table called ‘BONUS’ (note the way the table has been created and had rows inserted in one operation) results

9 9 Mistake as the managers are already in the table Making the ‘mistake’

10 10 NOTE: ONCE YOU COMMIT CHANGES YOU CANNOT ROLL THEM BACK

11 11 Security zObject Privileges yTables, Views, etc zSystem Privileges yTablespace, User

12 12 Grant zGRANT is used to manage security. For instance, the DBA creates new and manages users with GRANT: GRANT TO [IDENTIFIED BY ;

13 13 Grant zPrivileges yCONNECT allows logging on to the database yRESOURCE create database objects yDBA god

14 14 Grant zGRANT can be used to grant other users access to objects owned by us GRANT ON object TO ; PUBLIC generic username used to describe all the users of the database

15 15

16 16 Grant zObject privileges: yALTER yDELETE yINDEX yINSERT ySELECT yUPDATE yALL

17 17 Grant zGRANT SELECT ON myemp TO pddf1; GRANT UPDATE ON myemp TO PUBLIC;

18 18 Synonyms zIf pddf1 made the myemp table PUBLIC for SELECT, we would have to refer to it as SELECT * FROM pddf1.myemp; zAllows us to refer to another's table

19 19 Allows different users to Create tables with the same name

20 20 Synonyms zTo make referring to other users tables easier, we can place a [PUBLIC] SYNONYM on the table (we would need the appropriate privilege). The DBA can do this for us (for PUBLIC): CREATE PUBLIC SYNONYM pub_emp FOR pddf1.myemp;

21 21

22 22 Synonyms zTo remove a synonym, we drop it (or rather the DBA does): DROP PUBLIC SYNONYM pub_emp;

23 23 Revoke zPrivileges can be revoked: Users can be removed: REVOKE CONNECT, RESOURCE FROM pddf1;

24 24 Revoke zAccess to tables can be stopped: REVOKE SELECT ON myemp FROM pddf1;

25 25 Summary zTransactions ySAVEPOINT yROLLBACK yCOMMIT zSecurity yGRANT yREVOKE


Download ppt "1 Lecture 5 Transactions and Security. 2 zTransactions SAVEPOINT ROLLBACK COMMIT zSecurity GRANT REVOKE Topics."

Similar presentations


Ads by Google