Let's do a little test.
-- Lets begin with enabling versioningRead the Oracle documentation for workspaces.
-- and creating the new workspace
HALI@spinner1> exec dbms_wm.enableversioning('t1');
PL/SQL procedure successfully completed.
HALI@spinner1> exec dbms_wm.createworkspace('test');
PL/SQL procedure successfully completed.
-- Don't forget to actually switch to your new ws
HALI@spinner1> exec dbms_wm.gotoworkspace('test');
PL/SQL procedure successfully completed.
HALI@spinner1> select * from t1;
ID NAME
---------- ----------
1 test
2 test2
-- Ok, lets update the table and insert a new row
OPS$HLINDEN@spinner1> insert into t1(id,name) values(3,'test 3');
1 row created.
OPS$HLINDEN@spinner1> update t1 set name='test 2' where id=2;
1 row updated.
-- Note that we actually commit the data.
OPS$HLINDEN@spinner1> commit;
Commit complete.
HALI@spinner1> select * from t1;
ID NAME
---------- ----------
1 test
2 test 2
3 test 3
-- Now we switch bake to the LIVE data.
HALI@spinner1> exec dbms_wm.gotoworkspace('LIVE');
PL/SQL procedure successfully completed.
-- And the live data is unchanged at this point.
HALI@spinner1> select * from t1;
ID NAME
---------- ----------
1 test
2 test2
-- But we are happy with our updated data and want
-- our changed to be the added to the live workspace.
HALI@spinner1> exec dbms_wm.mergetable('test','t1');
PL/SQL procedure successfully completed.
HALI@spinner1> select * from t1;
ID NAME
---------- ----------
1 test
2 test 2
3 test 3
-- Don't forget to clean up after the operation.
HALI@spinner1> exec dbms_wm.removeworkspace('test');
PL/SQL procedure successfully completed.
HALI@spinner1> exec dbms_wm.disableversioning('t1');
PL/SQL procedure successfully completed.
No comments:
Post a Comment