• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

What is a "versioned table"?

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
2 Solutions
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

AtropaAuthor Commented:
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?
What you probably heard of is "Flashback Version" available since Oracle 10.1: http://www.oracle.com/technology/pub/articles/10gdba/week1_10gdba.html

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

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.
AtropaAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now