What is a "versioned table"?

Posted on 2007-03-30
Last Modified: 2013-12-19
Could someone tell what a versioned table is/does?  I just have never come across this in all my years around databases etc.  Is this something that MS SQL Server (where all my experiance comes from, big surprise eh?) does not offer and yet another reason why Oracle is so much more better gooderer than MS SQL?

Thnx for your help in advance...a
Question by:Atropa

Expert Comment

ID: 18826605
I think this is related to Oracle Workspace Manager

Oracle9i Workspace Manager is a new feature of Oracle9i that transparently and securely versions relational content in place with no changes to application SQL (DML), while permitting simultaneous read and write access to the same production data.

Subject:       Frequently Asked Questions for Oracle Workspace Manager
        Doc ID:       Note:156963.1

Subject:       What's the impact of Enabling Version Support?
        Doc ID:       Note:197188.1


Author Comment

ID: 18826662
Umm, thnx(?).  Remember I said I am a MS SQL type person so you lost me once you said "Versions relationsal content in place with no changes to application SQL"

So is another "copy" of the table made and the old one stored as a temp table so you can roll back changes at a latter date?  Is it like Begin / Commit Transaction on major steroids?  Is there ever a problem with not having the current "version" of a table?

What if two apps "version" a table at close to / at the same time?  How are your certain to get the current version?  Am I on the right track with these questions?

Accepted Solution

Tayger earned 250 total points
ID: 18827125
What you probably heard of is "Flashback Version" available since Oracle 10.1:

In general it allows the DBA/developer/user to kinda rollback the data status back to a certain date. Example

Record A at 12th of January looks like
Customer     Orders
-----------      ---------
J. Smith        3

Then J. Smith does one more order at 5th February. The record looks like:
Customer     Orders
-----------      ---------
J. Smith        4

Now The chief comes to you and asks: How many orders made John Smith till the end of 31th of January? Your answer might be: Erm, errr, hmmm, .... between 0 and 4?
What your chief wanted to hear is: 3
By versioning that table you store the information when and how a record in the table has changed.  I dont know any other DB than Oracle 10.1 that support this feature by default. Maybe some other do. If not  you have to version the table yourself als DBA or developer. There are now many different ways to do it, depending how you need it. The most simple (but not most perfomed) way is f.e. to copy every changed record into a similar looking table including a timestamp (when the record has changed). The difference between two records will show you then WHAT has changed.
Versioning is used a lot in DWH environment.

Hope I could help


Assisted Solution

ramumorla earned 250 total points
ID: 18834717
Every time a change is made to a version-enabled table a new row is created to reflect the change,
with all new rows being stored in the same tablespace. Since only changed rows are stored,
the storage overhead is minimized. The topmost workspace is always used to create a new workspace,
irrespective of where it is in the workspace heirachy. A table can be version-enabled using:

EXEC DBMS_WM.EnableVersioning('SCOTT.EMP');

This will rename the SCOTT.EMP table to SCOTT.EMP_LT and create a view called SCOTT_EMP.
The view uses instead-of triggers to perform all operations against the version enabled table. This hides alot of the
versioning mechanism from the users.

The SCOTT.EMP_LT table has the following additional columns:

NEXTVER             VARCHAR2(500)
DELSTATUS           NUMBER(38)
LTLOCK              VARCHAR2(100)

These are used to store the current version, next version, delete status and lock status respectively.

An additional parameter HIST can be used to track changes to the table via a view called _HIST. The default is no history.
The VIEW_W_OVERWRITE parameter shows only the most recent change to a row.
The VIEW_NO_OVERWRITE parameter shows all modifications to a row.

Author Comment

ID: 18836808
Thank you both for the details.  That is an awesome feature for sure and I can definately see where the benefit comes from.  Thanks again...a

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to recover a database from a user managed backup

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question