CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle Multiversioning
Version 11.1
 
General
The Multi-Version Concurrency model is the single most important concept to understand about Oracle and how it works. The underlying mechanisms are the control files, system change numbers (SCN), and how Oracle utilizes ROLLBACK/UNDO segments.
First Available version 4.0
 
Demo

SQL*Plus Demo
CREATE TABLE mvcc_test AS
SELECT * FROM all_objects
WHERE SUBSTR(object_name,1,1) BETWEEN 'A' AND 'W';

SELECT COUNT(*) FROM mvcc_test;

variable x REFCURSOR

BEGIN
  OPEN :x FOR
  SELECT COUNT(*) FROM mvcc_test;
END;
/

DELETE FROM mvcc_test WHERE rownum < 20001;

COMMIT;

SELECT COUNT(*) FROM mvcc_test;

variable y REFCURSOR

BEGIN
  OPEN :y FOR
  SELECT COUNT(*) FROM mvcc_test;
END;
/

DELETE FROM mvcc_test;

COMMIT;

SELECT COUNT(*) FROM mvcc_test;

print x
print y

DROP TABLE mvcc_test PURGE;

CREATE TABLE mvcc_test AS
SELECT * FROM all_objects
WHERE SUBSTR(object_name,1,1) BETWEEN 'A' AND 'W';

SELECT COUNT(*) FROM mvcc_test;

variable z REFCURSOR

set timing on

BEGIN
  OPEN :z FOR
  SELECT * FROM mvcc_test;
END;
/

set timing off

DELETE FROM mvcc_test;

COMMIT;

SELECT COUNT(*) FROM mvcc_test;

print z
Try the same demo substituting TRUNCATE for DELETE and COMMIT
 
Related Topics
DBMS_FLASHBACK
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [206 users online]    © 2010 psoug.org