Skip Headers

Oracle9i Supplied PL/SQL Packages and Types Reference
Release 2 (9.2)

Part Number A96612-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

DBMS_WM , 2 of 2


Summary of DBMS_WM Subprograms

Table 80-1 DBMS_WM Subprograms  
Subprogram Description

AlterSavepoint Procedure

Modifies the description of a savepoint.

AlterWorkspace Procedure

Modifies the description of a workspace.

BeginDDL Procedure

Starts a DDL (data definition language) session for a specified table.

BeginResolve Procedure

Starts a conflict resolution session.

CommitDDL Procedure

Commits DDL (data definition language) changes made during a DDL session for a specified table, and ends the DDL session.

CommitResolve Procedure

Ends a conflict resolution session and saves (makes permanent) any changes in the workspace since BeginResolve was executed.

CompressWorkspace Procedure

Deletes removable savepoints in a workspace and minimizes the Workspace Manager metadata structures for the workspace.

CompressWorkspaceTree Procedure

Deletes removable savepoints in a workspace and all its descendant workspaces. It also minimizes the Workspace Manager metadata structures for the affected workspaces, and eliminates any redundant data that might arise from the deletion of the savepoints.

CopyForUpdate Procedure

Allows LOB columns (BLOB, CLOB, or NCLOB) in version-enabled tables to be modified.

CreateSavepoint Procedure

Creates a savepoint for the current version.

CreateWorkspace Procedure

Creates a new workspace in the database.

DeleteSavepoint Procedure

Deletes a savepoint and associated rows in version-enabled tables.

DisableVersioning Procedure

Deletes all support structures that were created to enable the table to support versioned rows.

DropReplicationSupport Procedure

Deletes replication support objects that had been created by the GenerateReplicationSupport procedure.

EnableVersioning Procedure

Version-enables a table, creating the necessary structures to enable the table to support multiple versions of rows.

FreezeWorkspace Procedure

Restricts access to a workspace and the ability of users to make changes in the workspace.

GenerateReplicationSupport Procedure

Creates necessary structures for multimaster replication of Workspace Manager objects, and starts the master activity for the newly created master group.

GetConflictWorkspace Function

Returns the name of the workspace on which the session has performed the SetConflictWorkspace procedure.

GetDiffVersions Function

Returns the names of the (workspace, savepoint) pairs on which the session has performed the SetDiffVersions operation.

GetLockMode Function

Returns the locking mode for the current session, which determines whether or not access is enabled to versioned rows and corresponding rows in the previous version.

GetMultiWorkspaces Function

Returns the names of workspaces visible in the multiworkspace views for version-enabled tables.

GetOpContext Function

Returns the context of the current operation for the current session.

GetPrivs Function

Returns a comma-delimited list of all privileges that the current user has for the specified workspace.

GetSessionInfo Procedure

Retrieves information about the current workspace and session context.

GetWorkspace Function

Returns the current workspace for the session.

GotoDate Procedure

Goes to a point at or near the specified date and time in the current workspace.

GotoSavepoint Procedure

Goes to the specified savepoint in the current workspace.

GotoWorkspace Procedure

Moves the current session to the specified workspace.

GrantSystemPriv Procedure

Grants system-level privileges (not restricted to a particular workspace) to users and roles. The grant_option parameter enables the grantee to then grant the specified privileges to other users and roles.

GrantWorkspacePriv Procedure

Grants workspace-level privileges to users and roles. The grant_option parameter enables the grantee to then grant the specified privileges to other users and roles.

IsWorkspaceOccupied Function

Checks whether or not a workspace has any active sessions.

LockRows Procedure

Controls access to versioned rows in a specified table and to corresponding rows in the parent workspace.

MergeTable Procedure

Applies changes to a table (all rows or as specified in the WHERE clause) in a workspace to its parent workspace.

MergeWorkspace Procedure

Applies all changes in a workspace to its parent workspace, and optionally removes the workspace.

RecoverAllMigratingTables Procedure

Attempts to complete the migration process on all tables that were left in an inconsistent state after the Workspace Manager migration procedure failed.

RecoverMigratingTable Procedure

Attempts to complete the migration process on a table that was left in an inconsistent state after the Workspace Manager migration procedure failed.

RefreshTable Procedure

Applies to a workspace all changes made to a table (all rows or as specified in the WHERE clause) in its parent workspace.

RefreshWorkspace Procedure

Applies to a workspace all changes made in its parent workspace.

RelocateWriterSite Procedure

Makes one of the nonwriter sites the new writer site in a Workspace Manager replication environment. (The old writer site becomes one of the nonwriter sites.)

RemoveWorkspace Procedure

Discards all row versions associated with a workspace and deletes the workspace.

RemoveWorkspaceTree Procedure

Discards all row versions associated with a workspace and its descendant workspaces, and deletes the affected workspaces.

ResolveConflicts Procedure

Resolves conflicts between workspaces.

RevokeSystemPriv Procedure

Revokes (removes) system-level privileges from users and roles.

RevokeWorkspacePriv Procedure

Revokes (removes) workspace-level privileges from users and roles for a specified workspace.

RollbackDDL Procedure

Rolls back (cancels) DDL changes made during a DDL session for a specified table, and ends the DDL session.

RollbackResolve Procedure

Quits a conflict resolution session and discards all changes in the workspace since BeginResolve was executed.

RollbackTable Procedure

Discards all changes made in the workspace to a specified table (all rows or as specified in the WHERE clause).

RollbackToSP Procedure

Discards all changes made in a workspace to version-enabled tables since a specified savepoint.

RollbackWorkspace Procedure

Discards all changes made in the workspace to version-enabled tables.

SetConflictWorkspace Procedure

Determine whether or not conflicts exist between a workspace and its parent.

SetDiffVersions Procedure

Finds differences in values in version-enabled tables for two savepoints and their common ancestor (base). It modifies the contents of the differences views that describe these differences.

SetLockingOFF Procedure

Disables Workspace Manager locking for the current session.

SetLockingON Procedure

Enables Workspace Manager locking for the current session.

SetMultiWorkspaces Procedure

Makes the specified workspace or workspaces visible in the multiworkspace views for version-enabled tables.

SetWoOverwriteOFF Procedure

Disables the VIEW_WO_OVERWRITE history option that had been enabled by the EnableVersioning or SetWoOverwriteON procedure, changing the option to VIEW_W_OVERWRITE (with overwrite).

SetWoOverwriteON Procedure

Enables the VIEW_WO_OVERWRITE history option that had been disabled by the SetWoOverwriteOFF procedure.

SetWorkspaceLockModeOFF Procedure

Disables Workspace Manager locking for the specified workspace.

SetWorkspaceLockModeON Procedure

Enables Workspace Manager locking for the specified workspace.

SynchronizeSite Procedure

Brings the local site (the old writer site) up to date in the Workspace Manager replication environment after the writer site was moved using the RelocateWriterSite procedure.

UnfreezeWorkspace Procedure

Enables access and changes to a workspace, reversing the effect of FreezeWorkspace.

UnlockRows Procedure

Enables access to versioned rows in a specified table and to corresponding rows in the parent workspace.


Note:

Most Workspace Manager subprograms are procedures, but a few are functions. Most functions have names starting with Get (such as the GetConflictWorkspace Function and GetWorkspace Function).

In this chapter, the term procedures is often used to refer generally to both procedures and functions.


AlterSavepoint Procedure

Modifies the description of a savepoint.

Syntax

DBMS_WM.AlterSavepoint(
   workspace      IN VARCHAR2,
   sp_name        IN VARCHAR2,
   sp_description IN VARCHAR2);

Parameters

Table 80-2 AlterSavepoint Procedure Parameters  
Parameter Description
workspace

Name of the workspace in which the savepoint was created. The name is case sensitive.

sp_name

Name of the savepoint. The name is case sensitive.

sp_description

Description of the savepoint.

Usage Notes

To see the current description of the savepoint, examine the DESCRIPTION column value for the savepoint in the ALL_WORKSPACE_SAVEPOINTS metadata view, which is described in Oracle9i Application Developer's Guide - Workspace Manager.

An exception is raised if the user is not the workspace owner or savepoint owner or does not have the WM_ADMIN_ROLE role.

Examples

The following example modifies the description of savepoint SP1 in the NEWWORKSPACE workspace.

EXECUTE DBMS_WM.AlterSavepoint (`NEWWORKSPACE', 'SP1', 'First set of changes for 
scenario');

AlterWorkspace Procedure

Modifies the description of a workspace.

Syntax

DBMS_WM.AlterWorkspace(
   workspace              IN VARCHAR2,
   workspace_description  IN VARCHAR2);

Parameters

Table 80-3 AlterWorkspace Procedure Parameters  
Parameter Description
workspace

Name of the workspace. The name is case sensitive.

workspace_description

Description of the workspace.

Usage Notes

To see the current description of the workspace, examine the DESCRIPTION column value for the savepoint in the ALL_WORKSPACES metadata view, which is described in Oracle9i Application Developer's Guide - Workspace Manager.

An exception is raised if the user is not the workspace owner or does not have the WM_ADMIN_ROLE role.

Examples

The following example modifies the description of the NEWWORKSPACE workspace.

EXECUTE DBMS_WM.AlterWorkspace (`NEWWORKSPACE', 'Testing proposed scenario B');

BeginDDL Procedure

Starts a DDL (data definition language) session for a specified table.

Syntax

DBMS_WM.BeginDDL(
   table_name  IN VARCHAR2);

Parameters

Table 80-4 BeginDDL Procedure Parameters  
Parameter Description
table_name

Name of the version-enabled table. The name is not case sensitive.

Usage Notes

This procedure starts a DDL session, and it creates a special table whose name is the same as table_name but with _LTS added to the table name. After calling this procedure, you can perform one or more DDL operations on the table or any indexes or triggers that are based on the table, and then call either the CommitDDL Procedure or RollbackDDL Procedure.

In addition to creating the special <table-name>_LTS table, the procedure creates other objects:

For detailed information about performing DDL operations related to version-enabled tables and about DDL operations on version-enabled tables in an Oracle replication environment, see Oracle9i Application Developer's Guide - Workspace Manager.

An exception is raised if one or more of the following apply:

Examples

The following example begins a DDL session, adds a column named COMMENTS to the COLA_MARKETING_BUDGET table by using the special table named COLA_MARKETING_BUDGET_LTS, and ends the DDL session by committing the change.

EXECUTE DBMS_WM.BeginDDL('COLA_MARKETING_BUDGET');
ALTER TABLE cola_marketing_budget_lts ADD (comments VARCHAR2(100));
EXECUTE DBMS_WM.CommitDDL('COLA_MARKETING_BUDGET');

BeginResolve Procedure

Starts a conflict resolution session.

Syntax

DBMS_WM.BeginResolve(
   workspace  IN VARCHAR2);

Parameters

Table 80-5 BeginResolve Procedure Parameters  
Parameter Description
workspace

Name of the workspace. The name is case sensitive.

Usage Notes

This procedure starts a conflict resolution session. While this procedure is executing, the workspace is frozen in 1WRITER mode, as explained in Oracle9i Application Developer's Guide - Workspace Manager.

After calling this procedure, you can execute the ResolveConflicts Procedure as needed for various tables that have conflicts, and then call either the CommitResolve Procedure or RollbackResolve Procedure. For more information about conflict resolution, see Oracle9i Application Developer's Guide - Workspace Manager.

An exception is raised if one or more of the following apply:

Examples

The following example starts a conflict resolution session in Workspace1.

EXECUTE  DBMS_WM.BeginResolve ('Workspace1');

CommitDDL Procedure

Commits DDL (data definition language) changes made during a DDL session for a specified table, and ends the DDL session.

Syntax

DBMS_WM.CommitDDL(
   table_name           IN VARCHAR2
   [, ignore_last_error IN BOOLEAN DEFAULT FALSE]);

Parameters

Table 80-6 CommitDDL Procedure Parameters  
Parameter Description
table_name

Name of the version-enabled table. The name is not case sensitive.

ignore_
last_error

A Boolean value (TRUE or FALSE).

TRUE ignores the last error, if any, that occurred during the previous call to the CommitDDL procedure. Information about the last error is stored in the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS metadata views, which are described in Oracle9i Application Developer's Guide - Workspace Manager. (See the Usage Notes for more information.)

FALSE (the default) does not ignore the last error, if any, that occurred during the previous call to the CommitDDL procedure.

Usage Notes

This procedure commits changes that were made to a version-enabled table and to any indexes, triggers, and referential integrity constraints based on the version-enabled table during a DDL session. It also deletes the special <table-name>_LTS table that had been created by the BeginDDL Procedure.

For detailed information about performing DDL operations related to version-enabled tables and about DDL operations on version-enabled tables in an Oracle replication environment, see Oracle9i Application Developer's Guide - Workspace Manager.

If a call to the CommitDDL procedure fails, the table is left in an inconsistent state. If this occurs, you should try to fix the cause of the error. Examine the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS metadata views to see the SQL statement and error message. For example, the CommitDDL procedure might have failed because the tablespace was not large enough to add a column. Fix the cause of the error, and then call the CommitDDL procedure again with the default ignore_last_error parameter value of FALSE. However, if the call still fails and you cannot fix the cause of the error, and if you are sure that it is safe and appropriate to ignore this error, then you have the option to ignore the error by calling the CommitDDL procedure with the ignore_last_error parameter value of TRUE. Note that you are responsible for ensuring that it is safe and appropriate to ignore the error.

An exception is raised if one or more of the following apply:

Some invalid DDL operations also cause an exception when CommitDDL procedure is called. (See Oracle9i Application Developer's Guide - Workspace Manager for information about DDL operations that are supported.)

Examples

The following example begins a DDL session, adds a column named COMMENTS to the COLA_MARKETING_BUDGET table by using the special table named COLA_MARKETING_BUDGET_LTS, and ends the DDL session by committing the change.

EXECUTE DBMS_WM.BeginDDL('COLA_MARKETING_BUDGET');
ALTER TABLE cola_marketing_budget_lts ADD (comments VARCHAR2(100));
EXECUTE DBMS_WM.CommitDDL('COLA_MARKETING_BUDGET');

CommitResolve Procedure

Ends a conflict resolution session and saves (makes permanent) any changes in the workspace since the BeginResolve Procedure was executed.

Syntax

DBMS_WM.CommitResolve(
   workspace  IN VARCHAR2);

Parameters

Table 80-7 CommitResolve Procedure Parameters  
Parameter Description
workspace

Name of the workspace. The name is case sensitive.

Usage Notes

This procedure ends the current conflict resolution session (started by the BeginResolve Procedure), and saves all changes in the workspace since the start of the conflict resolution session. Contrast this procedure with the RollbackResolve Procedure, which discards all changes.

For more information about conflict resolution, see Oracle9i Application Developer's Guide - Workspace Manager.

An exception is raised if one or more of the following apply:

Examples

The following example ends the conflict resolution session in Workspace1 and saves all changes.

EXECUTE  DBMS_WM.CommitResolve ('Workspace1');

CompressWorkspace Procedure

Deletes removable savepoints in a workspace and minimizes the Workspace Manager metadata structures for the workspace. (Removable savepoints are explained in Oracle9i Application Developer's Guide - Workspace Manager.)

Syntax

DBMS_WM.CompressWorkspace(
   workspace                   IN VARCHAR2,
   compress_view_wo_overwrite  IN BOOLEAN
   [, firstSP                  IN VARCHAR2 DEFAULT NULL
   [, secondSP                 IN VARCHAR2 DEFAULT NULL] ]
   [, auto_commit              IN BOOLEAN DEFAULT TRUE]);

or

DBMS_WM.CompressWorkspace(
   workspace                   IN VARCHAR2
   [, firstSP                  IN VARCHAR2 DEFAULT NULL
   [, secondSP                 IN VARCHAR2 DEFAULT NULL] ]
   [, auto_commit              IN BOOLEAN DEFAULT TRUE]);

Parameters

Table 80-8 CompressWorkspace Procedure Parameters  
Parameter Description
workspace

Name of the workspace. The name is case sensitive.

compress_
view_wo_
overwrite

A Boolean value (TRUE or FALSE).

TRUE causes history information between the affected savepoints to be deleted even if VIEW_WO_OVERWRITE was specified when versioning was enabled.

FALSE causes history information (between the affected savepoints) for a table not to be deleted if VIEW_WO_OVERWRITE was specified when versioning was enabled. (If VIEW_WO_OVERWRITE was not specified for a table, history information for the table is deleted regardless of the parameter value.) FALSE is assumed if the procedure format without this parameter is used.

firstSP

First savepoint. Savepoint names are case sensitive.

If only workspace and firstSP are specified, all removable savepoints between workspace creation and firstSP (but not including firstSP) are deleted.

If workspace, firstSP, and secondSP are specified, all removable savepoints from firstSP (and including firstSP if it is a removable savepoint) to secondSP (but not including secondSP) are deleted.

If only workspace is specified (no savepoints), all removable savepoints in the workspace are deleted.

secondSP

Second savepoint. All removable savepoints from firstSP (and including firstSP if it is a removable savepoint) to secondSP (but not including secondSP) are deleted.

However, if secondSP is LATEST, all removable savepoints from firstSP (and including firstSP if it is a removable savepoint) to the end of the workspace are deleted.

Savepoint names are case sensitive.

auto_
commit

A Boolean value (TRUE or FALSE).

TRUE (the default) causes the operation to be executed as an autonomous database transaction that will be committed when it finishes.

FALSE causes the operation to be executed as part of the caller's open database transaction (if one exists). If there is no open database transaction, the operation is executed in a new database transaction. In either case, the caller is responsible for committing the transaction. For more information, see Oracle9i Application Developer's Guide - Workspace Manager.

Usage Notes

You can compress a workspace when the explicit savepoints (all or some of them) in the workspace are no longer needed. The compression operation is useful for the following reasons:

While this procedure is executing, the current workspace is frozen in NO_ACCESS mode, as explained in Oracle9i Application Developer's Guide - Workspace Manager.

A workspace cannot be compressed if there are any sessions in the workspace (except for the LIVE workspace), or if any user has executed a GotoDate Procedure operation or a GotoSavepoint Procedure operation specifying a savepoint in the workspace.

If the procedure format without the compress_view_wo_overwrite parameter is used, a value of FALSE is assumed for the parameter.

For information about VIEW_WO_OVERWRITE and other history options, see the information about the EnableVersioning Procedure.

An exception is raised if the user does not have the privilege to access and merge changes in workspace.

To compress a workspace and all its descendant workspaces, use the CompressWorkspaceTree Procedure.

Examples

The following example compresses NEWWORKSPACE.

EXECUTE DBMS_WM.CompressWorkspace (`NEWWORKSPACE');

The following example compresses NEWWORKSPACE, deleting all explicit savepoints between the creation of the workspace and the savepoint SP1.

EXECUTE DBMS_WM.CompressWorkspace (`NEWWORKSPACE', 'SP1');

The following example compresses NEWWORKSPACE, deleting the explicit savepoint SP1 and all explicit savepoints up to but not including SP2.

EXECUTE DBMS_WM.CompressWorkspace (`NEWWORKSPACE', 'SP1', 'SP2');

The following example compresses B_focus_1, accepts the default values for the firstSP and secondSP parameters (that is, deletes all explicit savepoints), and specifies FALSE for the auto_commit parameter.

EXECUTE DBMS_WM.CompressWorkspace ('B_focus_1', auto_commit => FALSE);

CompressWorkspaceTree Procedure

Deletes removable savepoints in a workspace and all its descendant workspaces. (Removable savepoints are explained in Oracle9i Application Developer's Guide - Workspace Manager.) It also minimizes the Workspace Manager metadata structures for the affected workspaces, and eliminates any redundant data that might arise from the deletion of the savepoints.

Syntax

DBMS_WM.CompressWorkspaceTree(
   workspace                      IN VARCHAR2
   [, compress_view_wo_overwrite  IN BOOLEAN DEFAULT FALSE]
   [, auto_commit                 IN BOOLEAN DEFAULT TRUE]);

Parameters

Table 80-9 CompressWorkspaceTree Procedure Parameters  
Parameter Description
workspace

Name of the workspace. The name is case sensitive.

compress_
view_wo_
overwrite

A Boolean value (TRUE or FALSE).

TRUE causes history information to be deleted even if VIEW_WO_OVERWRITE was specified when versioning was enabled.

FALSE (the default) causes history information for a table not to be deleted if VIEW_WO_OVERWRITE was specified when versioning was enabled. (If VIEW_WO_OVERWRITE was not specified for a table, history information for the table is deleted regardless of the parameter value.)

auto_
commit

A Boolean value (TRUE or FALSE).

TRUE (the default) causes the operation to be executed as an autonomous database transaction that will be committed when it finishes.

FALSE causes the operation to be executed as part of the caller's open database transaction (if one exists). If there is no open database transaction, the operation is executed in a new database transaction. In either case, the caller is responsible for committing the transaction. For more information, see Oracle9i Application Developer's Guide - Workspace Manager.

Usage Notes

You can compress a workspace and all its descendant workspaces when the explicit savepoints in the affected workspaces are no longer needed (for example, if you will not need to go to or roll back to any of these savepoints). For an explanation of database workspace hierarchy, see Oracle9i Application Developer's Guide - Workspace Manager.

The compression operation is useful for the following reasons:

While this procedure is executing, the current workspace is frozen in NO_ACCESS mode, as explained in Oracle9i Application Developer's Guide - Workspace Manager.

A workspace cannot be compressed if there are any sessions in the workspace (except for the LIVE workspace), or if any user has executed a GotoDate Procedure operation or a GotoSavepoint Procedure operation specifying a savepoint in the workspace.

An exception is raised if the user does not have the privilege to access and merge changes in workspace.

If the CompressWorkspaceTree operation fails in any affected workspace, the entire operation is rolled back, and no workspaces are compressed.

To compress a single workspace (deleting all explicit savepoints or just some of them), use the CompressWorkspace Procedure.

Examples

The following example compresses NEWWORKSPACE and all its descendant workspaces.

EXECUTE DBMS_WM.CompressWorkspaceTree (`NEWWORKSPACE');

The following example compresses NEWWORKSPACE and all its descendant workspaces, accepts the default value for the compress_view_wo_overwrite parameter, and specifies FALSE for the auto_commit parameter.

EXECUTE DBMS_WM.CompressWorkspaceTree ('B_focus_1', auto_commit => FALSE);

CopyForUpdate Procedure

Allows LOB columns (BLOB, CLOB, or NCLOB) in version-enabled tables to be modified. Use this procedure only if a version-enabled table has any LOB columns.

Syntax

DBMS_WM.CopyForUpdate(
   table_name       IN VARCHAR2,
   [, where_clause  IN VARCHAR2 DEFAULT '']);

Parameters

Table 80-10 CopyForUpdate Procedure Parameters  
Parameter Description
table_name

Name of the table containing one or more LOB columns. The name is not case sensitive.

where_clause

The WHERE clause (excluding the WHERE keyword) identifying the rows affected. Example: 'department_id = 20'

Only primary key columns can be specified in the WHERE clause. The WHERE clause cannot contain a subquery.

If where_clause is not specified, all rows in table_name are affected.

Usage Notes

This procedure is intended for use only with version-enabled tables containing one or more large object (LOB) columns. The CopyForUpdate procedure must be used because updates performed using the DBMS_LOB package do not fire INSTEAD OF triggers on the versioning views. Workspace Manager creates INSTEAD OF triggers on the versioning views to implement the copy-on-write semantics. (For non-LOB columns, you can directly perform the update operation, and the triggers work.)

Examples

The following example updates the SOURCE_CLOB column of TABLE1 for the document with DOC_ID = 1.

  Declare 
    clob_var 
  Begin
     /* This procedure copies the LOB columns if necessary, that is, 
        if the row with doc_id = 1 has not been versioned in the 
        current version */
     dbms_wm.copyForUpdate('table1', 'doc_id = 1');

     select source_clob into clob_var
     from   table1
     where  doc_id = 1 for update;

     dbms_lob.write(clob_var,<amount>, <offset>, buff);

  End;

CreateSavepoint Procedure

Creates a savepoint for the current version.

Syntax

DBMS_WM.CreateSavepoint(
   workspace       IN VARCHAR2,
   savepoint_name  IN VARCHAR2
   [, description  IN VARCHAR2 DEFAULT NULL]
   [, auto_commit  IN BOOLEAN DEFAULT TRUE]);

Parameters

Table 80-11 CreateSavepoint Procedure Parameters  
Parameter Description
workspace

Name of the workspace in which to create the savepoint. The name is case sensitive.

savepoint_name

Name of the savepoint to be created. The name is case sensitive.

description

Description of the savepoint to be created.

auto_commit

A Boolean value (TRUE or FALSE).

TRUE (the default) causes the operation to be executed as an autonomous database transaction that will be committed when it finishes.

FALSE causes the operation to be executed as part of the caller's open database transaction (if one exists). If there is no open database transaction, the operation is executed in a new database transaction. In either case, the caller is responsible for committing the transaction. For more information, see Oracle9i Application Developer's Guide - Workspace Manager.

Usage Notes

There are no explicit privileges associated with savepoints; any user who can access a workspace can create a savepoint in the workspace.

This procedure can be performed while there are users in the workspace; there can be open database transactions.

While this procedure is executing, the current workspace is frozen in READ_ONLY mode, as explained in Oracle9i Application Developer's Guide - Workspace Manager.

An exception is raised if one or more of the following apply:

Examples

The following example creates a savepoint named Savepoint1 in the NEWWORKSPACE workspace.

EXECUTE DBMS_WM.CreateSavepoint ('NEWWORKSPACE', 'Savepoint1');

CreateWorkspace Procedure

Creates a new workspace in the database.

Syntax

DBMS_WM.CreateWorkspace(
   workspace       IN VARCHAR2
   [, description  IN VARCHAR2 DEFAULT NULL]
   [, auto_commit  IN BOOLEAN DEFAULT TRUE]);

or

DBMS_WM.CreateWorkspace(
   workspace       IN VARCHAR2,
   isrefreshed     IN BOOLEAN
   [, description  IN VARCHAR2 DEFAULT NULL]
   [, auto_commit  IN BOOLEAN DEFAULT TRUE]);

Parameters

Table 80-12 CreateWorkspace Procedure Parameters  
Parameter Description
workspace

Name of the workspace. The name is case sensitive, and it must be unique (no other workspace of the same name).

isrefreshed

A Boolean value (TRUE or FALSE).

TRUE causes the workspace to be continually refreshed. In a continually refreshed workspace, changes made in the parent workspace are automatically applied to the workspace after a merge or rollback operation in the parent workspace. That is, you do not need to call the RefreshWorkspace Procedure to apply the changes. See the Usage Notes for more information about continually refreshed workspaces.

FALSE causes the workspace not to be continually refreshed. To refresh the workspace, you must call the RefreshWorkspace Procedure.

If you use the syntax without the isrefreshed parameter, the workspace is not continually refreshed.

description

Description of the workspace.

auto_commit

A Boolean value (TRUE or FALSE).

TRUE (the default) causes the operation to be executed as an autonomous database transaction that will be committed when it finishes.

FALSE causes the operation to be executed as part of the caller's open database transaction (if one exists). If there is no open database transaction, the operation is executed in a new database transaction. In either case, the caller is responsible for committing the transaction. For more information, see Oracle9i Application Developer's Guide - Workspace Manager.

Usage Notes

The new workspace is a child of the current workspace. If the session has not explicitly entered a workspace, it is in the LIVE database workspace, and the new workspace is a child of the LIVE workspace. For an explanation of database workspace hierarchy, see Oracle9i Application Developer's Guide - Workspace Manager.

An implicit savepoint is created in the current version of the current workspace. (The current version does not have to be the latest version in the current workspace.) For an explanation of savepoints (explicit and implicit), see Oracle9i Application Developer's Guide - Workspace Manager.

While this procedure is executing, the current workspace is frozen in READ_ONLY mode, as explained in Oracle9i Application Developer's Guide - Workspace Manager.

This procedure does not implicitly go to the workspace created. To go to the workspace, use the GotoWorkspace Procedure.

The following rules apply to continually refreshed workspaces (isrefreshed value of TRUE):

An exception is raised if one or more of the following apply:

Examples

The following example creates a workspace named NEWWORKSPACE in the database.

EXECUTE DBMS_WM.CreateWorkspace ('NEWWORKSPACE');

DeleteSavepoint Procedure

Deletes a savepoint and associated rows in version-enabled tables.

Syntax

DBMS_WM.DeleteSavepoint(
   workspace                      IN VARCHAR2,
   savepoint_name                 IN VARCHAR2)
   [, compress_view_wo_overwrite  IN BOOLEAN DEFAULT FALSE]
   [, auto_commit                 IN BOOLEAN DEFAULT TRUE]);

Parameters

Table 80-13 DeleteSavepoint Procedure Parameters  
Parameter Description
workspace

Name of the workspace in which the savepoint was created. The name is case sensitive.

savepoint_name

Name of the savepoint to be deleted. The name is case sensitive.

compress_view_
wo_overwrite

A Boolean value (TRUE or FALSE).

TRUE causes history information to be deleted even if VIEW_WO_OVERWRITE was specified when versioning was enabled.

FALSE (the default) causes history information for a table not to be deleted if VIEW_WO_OVERWRITE was specified when versioning was enabled. (If VIEW_WO_OVERWRITE was not specified for a table, history information for the table is deleted regardless of the parameter value.)

auto_commit

A Boolean value (TRUE or FALSE).

TRUE (the default) causes the operation to be executed as an autonomous database transaction that will be committed when it finishes.

FALSE causes the operation to be executed as part of the caller's open database transaction (if one exists). If there is no open database transaction, the operation is executed in a new database transaction. In either case, the caller is responsible for committing the transaction. For more information, see Oracle9i Application Developer's Guide - Workspace Manager.

Usage Notes

You can delete a savepoint when it is no longer needed (for example, you will not need to go to it or roll back to it).

Deleting a savepoint is useful for the following reasons:

While this procedure is executing, the current workspace is frozen in NO_ACCESS mode, as explained in Oracle9i Application Developer's Guide - Workspace Manager.

To delete a savepoint, you must have the WM_ADMIN_ROLE role or be the owner of the workspace or the savepoint.

This procedure cannot be executed if there are any sessions with an open database transaction, or if any user has executed a GotoDate Procedure operation or a GotoSavepoint Procedure operation specifying a savepoint in the workspace.

An exception is raised if one or more of the following apply:

Examples

The following example deletes a savepoint named Savepoint1 in the NEWWORKSPACE workspace.

EXECUTE DBMS_WM.DeleteSavepoint ('NEWWORKSPACE', 'Savepoint1');

DisableVersioning Procedure

Deletes all support structures that were created to enable the table to support versioned rows.

Syntax

DBMS_WM.DisableVersioning(
   table_name           IN VARCHAR2
   [, force             IN BOOLEAN DEFAULT FALSE]
   [, ignore_last_error IN BOOLEAN DEFAULT FALSE]);

Parameters

Table 80-14 DisableVersioning Procedure Parameters  
Parameter Description
table_name

Name of the table, or a comma-delimited list of names of tables related by multilevel referential integrity constraints. (Multilevel referential integrity constraints are explained in Oracle9i Application Developer's Guide - Workspace Manager.) Table names are not case sensitive.

force

A Boolean value (TRUE or FALSE).

TRUE forces all data in workspaces other than LIVE to be discarded before versioning is disabled.

FALSE (the default) prevents versioning from being disabled if table_name was modified in any workspace other than LIVE and if the workspace that modified table_name still exists.

ignore_
last_error

A Boolean value (TRUE or FALSE).

TRUE ignores the last error, if any, that occurred during the previous call to the DisableVersioning procedure. Information about the last error is stored in the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS metadata views, which are described in Oracle9i Application Developer's Guide - Workspace Manager. (See the Usage Notes for more information.)

FALSE (the default) does not ignore the last error, if any, that occurred during the previous call to the DisableVersioning procedure.

Usage Notes

This procedure is used to reverse the effect of the EnableVersioning Procedure. It deletes the Workspace Manager infrastructure (support structures) for versioning of rows, but does not affect any user data in the LIVE workspace. The workspace hierarchy and any savepoints still exist, but all rows are the same as in the LIVE workspace. (If there are multiple versions in the LIVE workspace of a row in the table for which versioning is disabled, only the most recent version of the row is kept.)

If a call to the DisableVersioning procedure fails, the table is left in an inconsistent state. If this occurs, you should try to fix the cause of the error (examine the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS metadata views to see the SQL statement and error message), and then call the DisableVersioning procedure again with the default ignore_last_error parameter value of FALSE. However, if the call still fails and you cannot fix the cause of the error, and if you are sure that it is safe and appropriate to ignore this error, then you have the option to ignore the error by calling the DisableVersioning procedure with the ignore_last_error parameter value of TRUE. Note that you are responsible for ensuring that it is safe and appropriate to ignore the error.

Some causes for the failure of the DisableVersioning procedure include the following:

The DisableVersioning operation fails if the force value is FALSE and any of the following apply:

Only the owner of a table or a user with the WM_ADMIN_ROLE role can disable versioning on the table.

Tables that are version-enabled and users that own version-enabled tables cannot be deleted. You must first disable versioning on the relevant table or tables.

An exception is raised if the table is not version-enabled.

If you want to disable versioning on a table in an Oracle replication environment, see Oracle9i Application Developer's Guide - Workspace Manager for guidelines and other information.

Examples

The following example disables the EMPLOYEE table for versioning.

EXECUTE DBMS_WM.DisableVersioning ('employee');

The following example disables the EMPLOYEE table for versioning and ignores the last error that occurred during the previous call to the DisableVersioning procedure.

EXECUTE DBMS_WM.DisableVersioning ('employee', ignore_last_error => true);

The following example disables the EMPLOYEE, DEPARTMENT, and LOCATION tables (which have multilevel referential integrity constraints) for versioning.

EXECUTE DBMS_WM.DisableVersioning('employee,department,location');

DropReplicationSupport Procedure

Deletes replication support objects that had been created by the GenerateReplicationSupport Procedure.

Syntax

DBMS_WM.DropReplicationSupport();

Parameters

None.

Usage Notes

To use this procedure, you must understand how replication applies to Workspace Manager objects, as explained in Oracle9i Application Developer's Guide - Workspace Manager. You must also understand the major Oracle replication concepts and techniques, which are documented in Oracle9i Replication and Oracle9i Replication Management API Reference.

You must execute this procedure as the replication administrator user at the writer site.

This procedure drops replication support for any version-enabled tables at the nonwriter sites; however, it does not version-disable any version-enabled tables.

Examples

The following example drops replication support that had previously been enabled using the GenerateReplicationSupport Procedure.

DBMS_WM.DropReplicationSupport();

EnableVersioning Procedure

Version-enables a table, creating the necessary structures to enable the table to support multiple versions of rows.

Syntax

DBMS_WM.EnableVersioning(
   table_name  IN VARCHAR2
   [, hist     IN VARCHAR2 DEFAULT 'NONE']);

Parameters

Table 80-15 EnableVersioning Procedure Parameters  
Parameter Description
table_name

Name of the table, or a comma-delimited list of names of tables related by multilevel referential integrity constraints. (Multilevel referential integrity constraints are explained in Oracle9i Application Developer's Guide - Workspace Manager.) The length of a table name must not exceed 25 characters. The name is not case sensitive.

hist

History option, for tracking modifications to table_name. Must be one of the following values:

NONE: No modifications to the table are tracked. (This is the default.)

VIEW_W_OVERWRITE: The with overwrite (W_OVERWRITE) option. A view named <table_name>_HIST (described in Oracle9i Application Developer's Guide - Workspace Manager) is created to contain history information, but it will show only the most recent modifications to the same version of the table. A history of modifications to the version is not maintained; that is, subsequent changes to a row in the same version overwrite earlier changes. (The CREATETIME column of the <table_name>_HIST view contains only the time of the most recent update.)

VIEW_WO_OVERWRITE: The without overwrite (WO_OVERWRITE) option. A view named <table_name>_HIST (described in Oracle9i Application Developer's Guide - Workspace Manager) is created to contain history information, and it will show all modifications to the same version of the table. A history of modifications to the version is maintained; that is, subsequent changes to a row in the same version do not overwrite earlier changes.

Usage Notes

The table that is being version-enabled must have a primary key defined.

Only the owner of a table or a user with the WM_ADMIN role can enable versioning on the table.

Tables that are version-enabled and users that own version-enabled tables cannot be deleted. You must first disable versioning on the relevant table or tables.

Tables owned by SYS cannot be version-enabled.

An exception is raised if one or more of the following apply:

If the table is version-enabled with the VIEW_WO_OVERWRITE hist option specified, this option can later be disabled and re-enabled by calling the SetWoOverwriteOFF Procedure and SetWoOverwriteON Procedures.

The history option enables you to log and audit modifications.

The history option affects the behavior of the GotoDate Procedure. See the Usage Notes for that procedure.

If you want to version-enable a table in an Oracle replication environment, see Oracle9i Application Developer's Guide - Workspace Manager for guidelines and other information.

Current notes and restrictions include the following:

Examples

The following example enables versioning on the EMPLOYEE table.

EXECUTE DBMS_WM.EnableVersioning('employee');

The following example enables versioning on the EMPLOYEE, DEPARTMENT, and LOCATION tables, which have multilevel referential integrity constraints.

EXECUTE DBMS_WM.EnableVersioning('employee,department,location');

FreezeWorkspace Procedure

Restricts access to a workspace and the ability of users to make changes in the workspace.

Syntax

DBMS_WM.FreezeWorkspace(
   workspace        IN VARCHAR2
   [, freezemode    IN VARCHAR2 DEFAULT 'NO_ACCESS']
   [, freezewriter  IN VARCHAR2 DEFAULT NULL] 
   [, force         IN BOOLEAN DEFAULT FALSE]);

or

DBMS_WM.FreezeWorkspace(
   workspace        IN VARCHAR2,
   session_duration IN BOOLEAN
   [, freezemode    IN VARCHAR2 DEFAULT 'NO_ACCESS']
   [, freezewriter  IN VARCHAR2 DEFAULT NULL] 
   [, force         IN BOOLEAN DEFAULT FALSE]);

Parameters

Table 80-16 FreezeWorkspace Procedure Parameters  
Parameter Description
workspace

Name of the workspace. The name is case sensitive.

session_
duration

A Boolean value (TRUE or FALSE).

TRUE causes the workspace to be unfrozen when the session that called the FreezeWorkspace procedure disconnects from the database. This value is valid for all freeze modes.

FALSE causes the workspace not to be unfrozen when the session that called the FreezeWorkspace procedure disconnects from the database.

freezemode

Mode for the frozen workspace. Must be one of the following values:

NO_ACCESS: No sessions are allowed in the workspace. (This is the default.)

READ_ONLY: Sessions are allowed in the workspace, but no write operations (insert, update, delete) are allowed.

1WRITER: Sessions are allowed in the workspace, but only one user (see the freezewriter parameter) is allowed to perform write operations (insert, update, delete).

1WRITER_SESSION: Sessions are allowed in the workspace, but only the database session (as opposed to the database user) that called the FreezeWorkspace procedure is allowed to perform write operations (insert, update, delete). The workspace is unfrozen after the session that called the FreezeWorkspace procedure disconnects from the database.

WM_ONLY: Only Workspace Manager operations are permitted. No sessions can directly modify data values or perform queries involving table data; however, child workspaces can be merged into the workspace, and savepoints can be created in the workspace.

freezewriter

The user that is allowed to make changes in the workspace. Can be specified only if freezemode is 1WRITER. The default is USER (the current user).

force

A Boolean value (TRUE or FALSE).

TRUE forces the workspace to be frozen even if it is already frozen. For example, this value lets you freeze the workspace with a different freezemode parameter value without having first to call the UnfreezeWorkspace Procedure.

FALSE (the default) prevents the workspace from being frozen if it is already frozen.

Usage Notes

If you specify the procedure syntax that does not include the session_duration parameter, it is equivalent to specifying FALSE for that parameter: that is, the workspace is not unfrozen when the session that called the FreezeWorkspace procedure disconnects from the database.

The operation fails if one or more of the following apply:

If freezemode is READ_ONLY or 1WRITER, the workspace cannot be frozen if there is an active database transaction.

You can freeze a workspace only if one or more of the following apply:

The LIVE workspace can be frozen only if freezemode is READ_ONLY or 1WRITER.

To reverse the effect of FreezeWorkspace, use the UnfreezeWorkspace Procedure.

Examples

The following example freezes the NEWWORKSPACE workspace.

EXECUTE DBMS_WM.FreezeWorkspace ('NEWWORKSPACE');

GenerateReplicationSupport Procedure

Creates necessary structures for multimaster replication of Workspace Manager objects, and starts the master activity for the newly created master group.

Syntax

DBMS_WM.GenerateReplicationSupport(
   mastersites          IN VARCHAR2,
   groupname            IN VARCHAR2
   [, groupdescription  IN VARCHAR2 DEFAULT 'Replication Group for OWM']);

Parameters

Table 80-17 GenerateReplicationSupport Procedure Parameters  
Parameter Description
mastersites

Comma-delimited list of nonwriter site names (database links) to be added to the Workspace Manager replication environment. Do not include the local site (the writer site) in the list.

groupname

Name of the master group to be created. This group will appear as a regular replication master group, and it can be managed from all the Oracle replication interfaces, including Oracle Enterprise Manager.

groupdescription

Description of the new master group. The default is Replication Group for OWM.

Usage Notes

To use this procedure, you must understand how replication applies to Workspace Manager objects, as explained in Oracle9i Application Developer's Guide - Workspace Manager. You must also understand the major Oracle replication concepts and techniques, which are documented in Oracle9i Replication and Oracle9i Replication Management API Reference.

You must execute this procedure as the replication administrator user at the writer site.

Before executing this procedure, ensure that the following are true:

This procedure performs the following operations:

To drop replication support for the Workspace Manager environment, use the DropReplicationSupport Procedure.

Examples

The following example generates replication support for the Workspace Manager environment at a hypothetical company.

DBMS_WM.GenerateReplicationSupport(
    mastersites       =>  `BACKUP-SITE1.ACME.COM, BACKUP-SITE2.ACME.COM');
    groupname         =>  `OWM-GROUP',
    groupdescription  =>  `OWM Replication group for Acme Corp.');

GetConflictWorkspace Function

Returns the name of the workspace on which the session has performed the SetConflictWorkspace Procedure.

Format

DBMS_WM.GetConflictWorkspace() RETURN VARCHAR2;

Parameters

None.

Usage Notes

If the SetConflictWorkspace Procedure has not been executed, the name of the current workspace is returned.

Examples

The following example displays the name of the workspace on which the session has performed the SetConflictWorkspace Procedure.

SELECT DBMS_WM.GetConflictWorkspace FROM DUAL;

GETCONFLICTWORKSPACE                                                            
-----------------------------------------------------------------------------
B_focus_2  

GetDiffVersions Function

Returns the names of the (workspace, savepoint) pairs on which the session has performed the SetDiffVersions Procedure operation.

Format

DB