Mar 26, 2009

Oracle Wokspace 3

To Refresh workspace

begin
dbms_wm.gotoworkspace('B_focus_9');
dbms_wm.refreshworkspace('B_focus_9');
end;

But if there are conflicts refreshworkspace will result an error

ORA-20056: conflicts detected for workspace: 'B_focus_9' in table: 'USER.TEST'

LIVE WORKSPACE CANNOT BE REFRESHED

The two rows that changed in both the LIVE and the 'B_focus_9' workspace create a conflict. These conflicts can be seen from the view Test_conf. But first go to the 'B_focus_9' workspace. The conflicts are not visible in this view while being in the LIVE workspace.

--------------------------
To Resolve this conflicts

SELECT * FROM test_conf ORDER BY wm_workspace;

begin
dbms_wm.gotoworkspace('B_focus_9');
dbms_wm.beginresolve('B_focus_9');
dbms_wm.resolveconflicts('B_focus_9','TEST',null/*where clause*/,'PARENT');
commit;
end;

begin
dbms_wm.commitresolve('B_focus_9');
end;

SELECT * FROM test_conf ORDER BY wm_workspace;

After resolving this conflict the workspace can be refreshed

begin
dbms_wm.refreshworkspace('B_focus_9');
end;


Merge Workspace


begin
dbms_wm.mergeworkspace('B_focus_9');
end;


When B_focus_9 workspace is merged into the LIVE workspace. A merge is the opposite of a refresh : it updates the parent workspace (LIVE) with the changes made to the merged workspace (B_focus_9). Where as refresh operation updates the refreshing workspace.
---------------------------------

After MergeWorkspace See Difference


begin
dbms_wm.gotoworkspace('B_focus_1');
end;

select * from test order by one




begin
dbms_wm.gotoworkspace('B_focus_9');
end;

select * from test order by one




begin
dbms_wm.gotoworkspace('LIVE');
end;

select * from test order by one



Here parent workspace (LIVE) was updated by merged workspace (B_focus_9) .

----------------

No comments: