Oracle Working Mechanism Okcan Yasin Saygili
Who am i? Okcan Yasin Saygili Free consultant and Instructor Oracle ACE Oracle RAC SIG Turkey Chair Founding member of TROUG
Contact http://friendfeed.com/yasinsaygili http://twitter.com/yasinsaygili http://www.facebook.com/ysnsygl
Start with blog
http://www.oracle.com/technetwork/database/express-edition/overview/index.html
Best Resources and Practise about Oracle Transaction
Agenda Introduction Commit Rollback Savepoint Concurrency Consistency Deadlocks Conclusion
Introduction As DBA said ,database is not purpose,database is a tool , we will see better with real time testting. First of all ,we can see Database mechanism about oracle background.
Basic Architecture
Commit You can write on the system ,you can write plsql command on the database but Commit is require for Developer. If you look for first looking İf you use on the system.This is end of change.
Transaction
SQL> UPDATE hr.employees SET salary=salary; 107 rows updated. SQL> SELECT XID, STATUS FROM V$TRANSACTION; XID STATUS ---------------- ---------------- 0800090033000000 ACTIVE SQL> ROLLBACK; Rollback complete. SQL> SELECT XID FROM V$TRANSACTION; no rows selected
Rollback .Before you created or made something on the system,you can easily recovery with this command depends on system is relax with this command.
SQL> UPDATE hr.employees SET last_name=last_name; 107 rows updated. SQL> SELECT XID, STATUS FROM V$TRANSACTION; XID STATUS ---------------- ---------------- 0900050033000000 ACTIVE
Savepoint Sometimes you coded on the system ,you need mark somewhere ,you can use this command. If you use back system ,you can use “rollback to “ command.
Concurrency If you see one side This is several users access the data at same time.This is basic definition for concurrency.Certainly this system protect with locking method.Such as When two user access to any data,System imply locking method for ranking.
Lock Types DML locks (data locks) DDL locks (dictionary locks) Oracle Internal Locks/Latches Oracle Distributed Locks Oracle Parallell Cache Management Locks (references:www.indiana.edu/~dbateam/Documents/oracle_locking.ppt)
Simple Touch Redo = Every Oracle database has a set of (two or more) redo log files. The redo log records all changes made to data, including both uncommitted and committed changes. In addition to the online redo logs Oracle also stores archive redo logs. All redo logs are used in recovery situations. Rollback = More specifically rollback segments. Rollback segments store the data as it was before changes were made. This is in contrast to the redo log which is a record of the insert/update/deletes. Undo = Rollback segments. They both are really one in the same. Undo data is stored in the undo tablespace. Undo is helpful in building a read consistent view of data. (references:http://www.squaredba.com/redo-vs-rollback-vs-undo-131.html)
Consistency simple touch 2 Data consistency ,if you change some thing on data , changes something by specific users and other users.
Deadlock Two or more user will wait for data locked such as two or more transaction will may deadlock.
Deadlock
Conclusion Oracle is not complicate structrue .However ,you must learn base of architecture.When you learned structure,it will be better for user.
References http://www.ceturk.com/images/cncpt025-410x300.gif http://tonguc.wordpress.com/2010/11/28/troug-2010-ceturk-oracle-gunu-etkinligi-sunumum/ http://www.ceturk.com/veri-tabani/oracle/h-tonguc-yilmaz-oracle-transaction-management-sunumu-videosu.html http://tonguc.wordpress.com/2007/02/25/oracle-best-practices-part-2/ http://www.bhatipoglu.com/entry/26/when-a-transaction-begins http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/transact.htm#g11401 www.indiana.edu/~dbateam/Documents/oracle_locking.ppt http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c21cnsis.htm