Workspace Manager Developers Guide
Workspace Manager Developers Guide
Workspace Manager Developers Guide
21
F31316-01
November 2020
Oracle Database Workspace Manager Developer's Guide, 21
F31316-01
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software,
any programs embedded, installed or activated on delivered hardware, and modifications of such programs)
and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government
end users are "commercial computer software" or "commercial computer software documentation" pursuant
to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such,
the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works,
and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs
embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle
computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the
license contained in the applicable contract. The terms governing the U.S. Government’s use of Oracle cloud
services are defined by the applicable contract for such services. No other rights are granted to the U.S.
Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc,
and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered
trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not
be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
Contents
Preface
Audience xvi
Documentation Accessibility xvi
Related Documents xvi
Conventions xvii
iii
1.7 Bulk Loading into Version-Enabled Tables 1-33
1.8 DDL Operations Related to Version-Enabled Tables 1-34
1.9 Constraint Support with Workspace Manager 1-37
1.9.1 Referential Integrity Support 1-37
1.9.1.1 Locking with DML Operations on Tables with Referential Integrity
Constraints 1-39
1.9.2 Unique Constraints 1-40
1.9.3 SET NULL Constraints 1-41
1.10 Triggers on Version-Enabled Tables 1-41
1.11 Virtual Private Database Considerations 1-41
1.12 Support for Table Synonyms 1-42
1.13 Materialized View Support 1-42
1.14 Spatial and Graph Topology Support 1-42
1.14.1 Locking Considerations with Topologies 1-43
1.14.2 Additional Considerations with Topologies 1-44
1.15 Workspace Manager Reserved Words and Characters 1-44
1.16 DBMS_WM Subprogram Categories 1-44
1.16.1 Table Management Subprograms 1-45
1.16.2 Workspace Management Subprograms 1-46
1.16.3 Savepoint Management Subprograms 1-47
1.16.4 Privilege Management Subprograms 1-48
1.16.5 Lock Management Subprograms 1-48
1.16.6 Conflict Management Subprograms 1-48
1.16.7 Bulk Load Support Subprograms 1-49
1.17 Simplified Examples Using Workspace Manager 1-49
1.17.1 Example: Marketing Budget Options 1-50
1.17.2 Example: Warehouse Expansion Options 1-53
iv
3 Workspace Manager Valid Time Support
3.1 Valid Time Support: Introduction and Example 3-2
3.2 WM_PERIOD Data Type 3-3
3.3 Valid Time Constants 3-4
3.4 API Features for Valid Time Support 3-4
3.5 Operators for Valid Time Support 3-5
3.5.1 WM_CONTAINS 3-6
3.5.2 WM_EQUALS 3-7
3.5.3 WM_GREATERTHAN 3-8
3.5.4 WM_INTERSECTION 3-8
3.5.5 WM_LDIFF 3-9
3.5.6 WM_LESSTHAN 3-10
3.5.7 WM_MEETS 3-11
3.5.8 WM_OVERLAPS 3-12
3.5.9 WM_RDIFF 3-12
3.6 Queries and DML Operations with Valid Time Support 3-13
3.6.1 Queries 3-14
3.6.2 Data Manipulation (DML) Operations 3-14
3.6.2.1 Update Operations 3-14
3.6.2.2 Insert Operations 3-16
3.7 Constraint Management for Valid Time Support 3-16
3.7.1 Referential Integrity Constraints 3-16
3.7.2 Unique Constraints 3-17
3.8 Locking with Valid Time Support 3-17
3.9 Static Data Dictionary Views Affected by Valid Time Support 3-17
3.9.1 xxx_CONF Views and Valid Time Support 3-17
3.9.2 xxx_DIFF Views and Valid Time Support 3-18
3.9.3 xxx_HIST Views and Valid Time Support 3-18
3.9.4 xxx_LOCK Views and Valid Time Support 3-18
3.9.5 xxx_MW Views and Valid Time Support 3-18
3.10 Adding Valid Time Support to an Existing Table 3-18
3.11 Merging and Refreshing Workspaces for Tables with Valid Time Support 3-19
v
4.4 AlterSavepoint 4-8
4.5 AlterVersionedTable 4-9
4.6 AlterWorkspace 4-12
4.7 BeginBulkLoading 4-13
4.8 BeginDDL 4-15
4.9 BeginResolve 4-16
4.10 ChangeWorkspaceType 4-17
4.11 CommitBulkLoading 4-18
4.12 CommitDDL 4-21
4.13 CommitResolve 4-23
4.14 CompressWorkspace 4-24
4.15 CompressWorkspaceTree 4-28
4.16 CopyForUpdate 4-32
4.17 CopyWorkspace 4-33
4.18 CreateSavepoint 4-34
4.19 CreateWorkspace 4-35
4.20 Delete_Topo_Geometry_Layer 4-37
4.21 DeleteSavepoint 4-38
4.22 DisableVersioning 4-40
4.23 EnableVersioning 4-43
4.24 Export 4-46
4.25 Export_Schemas 4-49
4.26 FindRICSet 4-52
4.27 FreezeWorkspace 4-53
4.28 GetBulkLoadVersion 4-55
4.29 GetConflictWorkspace 4-57
4.30 GetDiffVersions 4-57
4.31 GetLockMode 4-58
4.32 GetMultiWorkspaces 4-58
4.33 GetOpContext 4-59
4.34 GetOriginalDDL 4-60
4.35 GetPhysicalTableName 4-61
4.36 GetPrivs 4-62
4.37 GetSessionInfo 4-62
4.38 GetSystemParameter 4-64
4.39 GetValidFrom 4-64
4.40 GetValidTill 4-65
4.41 GetVersion 4-66
4.42 GetWMMetadataSpace 4-66
4.43 GetWorkspace 4-67
4.44 GotoDate 4-67
vi
4.45 GotoSavepoint 4-69
4.46 GotoWorkspace 4-70
4.47 GrantGraphPriv 4-71
4.48 GrantPrivsOnPolicy 4-72
4.49 GrantSystemPriv 4-73
4.50 GrantWorkspacePriv 4-75
4.51 Import 4-76
4.52 Import_Schemas 4-79
4.53 Initialize_After_Import 4-81
4.54 IsWorkspaceOccupied 4-82
4.55 LockRows 4-83
4.56 MergeTable 4-85
4.57 MergeWorkspace 4-87
4.58 Move_Proc 4-89
4.59 PurgeTable 4-90
4.60 RecoverAllMigratingTables 4-91
4.61 RecoverFromDroppedUser 4-92
4.62 RecoverMigratingTable 4-93
4.63 RefreshTable 4-95
4.64 RefreshWorkspace 4-96
4.65 RemoveAsParentWorkspace 4-97
4.66 RemoveDeferredWorkspaces 4-98
4.67 RemoveUserDefinedHint 4-99
4.68 RemoveWorkspace 4-100
4.69 RemoveWorkspaceTree 4-101
4.70 RenameSavepoint 4-103
4.71 RenameWorkspace 4-103
4.72 ResolveConflicts 4-104
4.73 RevokeGraphPriv 4-106
4.74 RevokeSystemPriv 4-108
4.75 RevokeWorkspacePriv 4-109
4.76 RollbackBulkLoading 4-110
4.77 RollbackDDL 4-111
4.78 RollbackResolve 4-112
4.79 RollbackTable 4-113
4.80 RollbackToSP 4-114
4.81 RollbackWorkspace 4-116
4.82 SetCaptureEvent 4-117
4.83 SetCompressWorkspace 4-118
4.84 SetConflictWorkspace 4-119
4.85 SetDiffVersions 4-120
vii
4.86 SetLockingOFF 4-122
4.87 SetLockingON 4-122
4.88 SetMultiWorkspaces 4-124
4.89 SetSystemParameter 4-125
4.90 SetTriggerEvents 4-126
4.91 SetValidTime 4-128
4.92 SetValidTimeFilterOFF 4-128
4.93 SetValidTimeFilterON 4-129
4.94 SetWMValidUpdateModeOFF 4-130
4.95 SetWMValidUpdateModeON 4-130
4.96 SetWoOverwriteOFF 4-131
4.97 SetWoOverwriteON 4-132
4.98 SetWorkspaceLockModeOFF 4-132
4.99 SetWorkspaceLockModeON 4-133
4.100 UnfreezeWorkspace 4-135
4.101 UnlockRows 4-136
4.102 UseDefaultValuesForNulls 4-138
viii
5.22 DBA_WM_VERSIONED_TABLES 5-17
5.23 DBA_WM_VT_ERRORS 5-18
5.24 DBA_WORKSPACE_PRIVS 5-18
5.25 DBA_WORKSPACE_SAVEPOINTS 5-18
5.26 DBA_WORKSPACE_SESSIONS 5-18
5.27 DBA_WORKSPACES 5-18
5.28 ROLE_WM_PRIVS 5-20
5.29 USER_MP_GRAPH_WORKSPACES 5-20
5.30 USER_MP_PARENT_WORKSPACES 5-21
5.31 USER_REMOVED_WORKSPACES 5-21
5.32 USER_WM_CONS_COLUMNS 5-21
5.33 USER_WM_CONSTRAINTS 5-21
5.34 USER_WM_IND_COLUMNS 5-21
5.35 USER_WM_IND_EXPRESSIONS 5-21
5.36 USER_WM_LOCKED_TABLES 5-22
5.37 USER_WM_MODIFIED_TABLES 5-22
5.38 USER_WM_POLICIES 5-22
5.39 USER_WM_PRIVS 5-22
5.40 USER_WM_RIC_INFO 5-22
5.41 USER_WM_TAB_TRIGGERS 5-23
5.42 USER_WM_VERSIONED_TABLES 5-23
5.43 USER_WM_VT_ERRORS 5-23
5.44 USER_WORKSPACE_PRIVS 5-23
5.45 USER_WORKSPACE_SAVEPOINTS 5-23
5.46 USER_WORKSPACES 5-23
5.47 WM_COMPRESS_BATCH_SIZES 5-23
5.48 WM_COMPRESSIBLE_TABLES 5-24
5.49 WM_EVENTS_INFO 5-24
5.50 WM_INSTALLATION 5-25
5.51 xxx_CONF Views 5-25
5.52 xxx_DIFF Views 5-26
5.53 xxx_HIST Views 5-28
5.54 xxx_LOCK Views 5-28
5.55 xxx_MW Views 5-29
ix
B Workspace Manager Error Messages
Glossary
Index
x
List of Figures
1-1 Workspace Tree 1-5
1-2 Savepoints 1-6
1-3 Multiparent Workspace in a Workspace Hierarchy 1-11
xi
List of Tables
1-1 Freeze Results of Procedures 1-9
1-2 Name Length Guidelines for Workspace Manager 1-12
1-3 Workspace Manager Lock Modes and Data Modification Ability 1-17
1-4 Operations and Incompatible Freeze Modes for Workspace Types 1-20
1-5 Workspace Manager Privileges 1-24
1-6 Workspace Manager System Parameters 1-26
1-7 Workspace Manager Reserved Words and Characters 1-44
1-8 Table Management Subprograms 1-45
1-9 Workspace Management Subprograms 1-46
1-10 Savepoint Management Subprograms 1-47
1-11 Privilege Management Subprograms 1-48
1-12 Lock Management Subprograms 1-48
1-13 Conflict Management Subprograms 1-49
1-14 Bulk Loading Support Subprograms 1-49
2-1 Workspace Manager Events 2-2
2-2 Workspace Manager Event Parameters 2-2
2-3 AQ Administrative Views for Workspace Manager 2-4
3-1 Constants for Valid Time Support 3-4
3-2 API Features for Valid Time Support 3-4
3-3 validTill Values and Intersection Result from Merge or Refresh Operation 3-19
4-1 Add_Topo_Geometry_Layer Procedure Parameters 4-5
4-2 AddAsParentWorkspace Procedure Parameters 4-6
4-3 AddUserDefinedHint Procedure Parameters 4-7
4-4 AlterSavepoint Procedure Parameters 4-8
4-5 AlterVersionedTable Procedure Parameters 4-9
4-6 AlterWorkspace Procedure Parameters 4-12
4-7 BeginBulkLoading Procedure Parameters 4-13
4-8 BeginDDL Procedure Parameters 4-15
4-9 BeginResolve Procedure Parameters 4-17
4-10 ChangeWorkspaceType Procedure Parameters 4-17
4-11 CommitBulkLoading Procedure Parameters 4-19
4-12 CommitDDL Procedure Parameters 4-21
4-13 CommitResolve Procedure Parameters 4-23
4-14 CompressWorkspace Procedure Parameters 4-24
4-15 CompressWorkspaceTree Procedure Parameters 4-29
xii
4-16 CopyForUpdate Procedure Parameters 4-32
4-17 CopyWorkspace Procedure Parameters 4-33
4-18 CreateSavepoint Procedure Parameters 4-34
4-19 CreateWorkspace Procedure Parameters 4-35
4-20 Delete_Topo_Geometry_Layer Procedure Parameters 4-37
4-21 DeleteSavepoint Procedure Parameters 4-38
4-22 DisableVersioning Procedure Parameters 4-41
4-23 EnableVersioning Procedure Parameters 4-43
4-24 Export Procedure Parameters 4-46
4-25 Export_Schemas Procedure Parameters 4-50
4-26 FindRICSet Procedure Parameters 4-52
4-27 FreezeWorkspace Procedure Parameters 4-54
4-28 GetBulkLoadVersion Function Parameters 4-56
4-29 GetOriginalDDL Procedure Parameters 4-60
4-30 GetPhysicalTableName Function Parameters 4-61
4-31 GetPrivs Function Parameters 4-62
4-32 GetSessionInfo Procedure Parameters 4-63
4-33 GetSystemParameter Procedure Parameters 4-64
4-34 GotoDate Procedure Parameters 4-67
4-35 GotoSavepoint Procedure Parameters 4-69
4-36 GotoWorkspace Procedure Parameters 4-70
4-37 GrantGraphPriv Procedure Parameters 4-71
4-38 GrantPrivsOnPolicy Procedure Parameters 4-73
4-39 GrantSystemPriv Procedure Parameters 4-73
4-40 GrantWorkspacePriv Procedure Parameters 4-75
4-41 Import Procedure Parameters 4-77
4-42 Import_Schemas Procedure Parameters 4-79
4-43 Initialize_After_Import Procedure Parameters 4-81
4-44 IsWorkspaceOccupied Function Parameters 4-82
4-45 LockRows Procedure Parameters 4-83
4-46 MergeTable Procedure Parameters 4-85
4-47 MergeWorkspace Procedure Parameters 4-87
4-48 Move_Proc Procedure Parameters 4-89
4-49 PurgeTable Procedure Parameters 4-90
4-50 RecoverAllMigratingTables Procedure Parameters 4-92
4-51 RecoverFromDroppedUser Procedure Parameters 4-93
4-52 RecoverMigratingTable Procedure Parameters 4-94
xiii
4-53 RefreshTable Procedure Parameters 4-95
4-54 RefreshWorkspace Procedure Parameters 4-96
4-55 RemoveAsParentWorkspace Procedure Parameters 4-98
4-56 RemoveWorkspace Procedure Parameters 4-99
4-57 RemoveUserDefinedHint Procedure Parameters 4-100
4-58 RemoveWorkspace Procedure Parameters 4-101
4-59 RemoveWorkspaceTree Procedure Parameters 4-102
4-60 RenameSavepoint Procedure Parameters 4-103
4-61 RenameWorkspace Procedure Parameters 4-104
4-62 ResolveConflicts Procedure Parameters 4-104
4-63 RevokeGraphPriv Procedure Parameters 4-107
4-64 RevokeSystemPriv Procedure Parameters 4-108
4-65 RevokeWorkspacePriv Procedure Parameters 4-109
4-66 RollbackBulkLoading Procedure Parameters 4-110
4-67 RollbackDDL Procedure Parameters 4-111
4-68 RollbackResolve Procedure Parameters 4-112
4-69 RollbackTable Procedure Parameters 4-113
4-70 RollbackToSP Procedure Parameters 4-115
4-71 RollbackWorkspace Procedure Parameters 4-116
4-72 SetCaptureEvent Procedure Parameters 4-117
4-73 SetCompressWorkspace Procedure Parameters 4-118
4-74 SetConflictWorkspace Procedure Parameters 4-119
4-75 SetDiffVersions Procedure Parameters 4-120
4-76 SetLockingON Procedure Parameters 4-123
4-77 SetMultiWorkspaces Procedure Parameters 4-124
4-78 SetSystemParameter Procedure Parameters 4-125
4-79 SetTriggerEvents Procedure Parameters 4-126
4-80 SetValidTime Procedure Parameters 4-128
4-81 SetValidTimeFilterON Procedure Parameters 4-129
4-82 SetWorkspaceLockModeOFF Procedure Parameters 4-133
4-83 SetWorkspaceLockModeON Procedure Parameters 4-134
4-84 UnfreezeWorkspace Procedure Parameters 4-136
4-85 UnlockRows Procedure Parameters 4-136
4-86 UseDefaultValuesForNulls Procedure Parameters 4-138
5-1 Columns in the xxx_CONF Views 5-25
5-2 Columns in the xxx_DIFF Views 5-27
5-3 Columns in the xxx_HIST Views 5-28
xiv
5-4 Columns in the xxx_LOCK Views 5-29
5-5 Columns in the xxx_MW Views 5-29
xv
Preface
Preface
Oracle Database Workspace Manager Developer's Guide describes Oracle
Workspace Manager, often referred to as Workspace Manager, which enables
applications to create workspaces and group different versions of table row values
in different workspaces.
• Audience
• Documentation Accessibility
• Related Documents
• Conventions
Audience
Oracle Database Workspace Manager Developer's Guide is intended for application
designers and developers. It is assumed that you have some experience programming
in PL/SQL.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the
Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup?
ctx=acc&id=docacc.
Related Documents
For more information about using this product in a development environment, see the
following documents:
• Oracle Call Interface Programmer's Guide
• Oracle Database Concepts
• Oracle Database PL/SQL Language Reference
xvi
Preface
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code
in examples, text that appears on the screen, or text that you enter.
xvii
Part I
Conceptual and Usage Information
This document has three parts:
• Part I provides conceptual and usage information about Workspace Manager.
• Reference Information provides reference information about the Workspace
Manager PL/SQL API (DBMS_WM package) and static data dictionary views.
• Supplementary Information provides supplementary information (appendixes and
a glossary).
Part I is organized for efficient learning about Workspace Manager. It covers basic
concepts and techniques first, and proceeds to more advanced material (such as
Workspace Manager events and valid time support). Part I contains the following
chapters:
• Introduction to Workspace Manager
Oracle Workspace Manager, often referred to as Workspace Manager, provides an
infrastructure that enables applications to create workspaces and group different
versions of table row values in different workspaces.
• Workspace Manager Events
Certain applications may be interested in knowing what Workspace Manager
operations are being performed and may want to take some actions based on
that. Several types of Workspace Manager operations can be captured as events.
• Workspace Manager Valid Time Support
This chapter describes the support for valid time, also known as effective dating,
with version-enabled tables.
1
Introduction to Workspace Manager
Oracle Workspace Manager, often referred to as Workspace Manager, provides an
infrastructure that enables applications to create workspaces and group different
versions of table row values in different workspaces.
Users are permitted to create new versions of data to update, while maintaining a copy
of the old data. The ongoing results of the activity are stored persistently, assuring
concurrency and consistency.
Applications that can benefit from Workspace Manager typically do one or more of the
following operations:
• Manage a collection of updates and insertions as a unit before incorporating them
into production data
You can review changes and roll back undesirable ones before making the
changes public. Until you make the changes public, they are invisible to other
users of the database, who will access only the regular production data. You
can organize the changes in a simple set of workspaces or in a complex
workspace hierarchy. A typical example might be a life sciences application in
which Workspace Manager supports the discovery and quality assurance (QA)
processes by managing a collection of updates before they are merged with the
production data.
• Support a collaborative development effort
A team can share access to a collection of updates and insertions for a
collaborative project. Workspace privileges control access to a workspace and
its operations, and you can restrict workspace access to single-writer, read-only, or
no access. Workspace locks prevent update conflicts between projects in separate
workspaces. A typical example might be an application to design an engineering
project, in which multiple subprojects are concurrently developed in separate
workspaces.
• Use a common data set to create multiple scenarios for what-if analyses or
multiple editions of data for publication
You can organize changes in workspaces to view them in the context of the
whole database, but without requiring that you actually copy data between tables.
Different users can make simultaneous changes to the same row, and you can
detect and resolve conflicts. A typical example might be a telecommunications
application in which you create multiple cell phone coverage scenarios to find the
optimal design.
• Keep a history of changes to data
You can navigate workspaces and row versions to view the database as
of a particular milestone or point in time. You can roll back changes to a
row or table in a workspace to a milestone. A typical example might be a
land information management application where Workspace Manager supports
regulatory requirements by maintaining a history of all changes to land parcels.
1-1
Chapter 1
Note:
Workspace Manager is installed by default in the Oracle seed database and
any database created using the Database Configuration Assistant (DBCA).
To use Workspace Manager in any other Oracle database, you must
first perform the installation procedure described in Installing Workspace
Manager with Custom Databases.
1-2
Chapter 1
Workspace Manager Overview
1-3
Chapter 1
Workspace Manager Overview
1-4
Chapter 1
Workspace Manager Overview
LIVE workspace
Workspace1 Workspace4
See also Design Issue: Savepoint or Child Workspace? for a discussion of design
issues in deciding whether to create a child workspace or a savepoint for certain
needs
1-5
Chapter 1
Workspace Manager Overview
SPa
SPd LIVE workspace
SPb
SP1 Workspace1 SPe Workspace4
SPc
SP2
Workspace2 SP3 Workspace3 SP4 Workspace5
Workspace Manager uses the name LATEST to designate a logical savepoint that
refers to the latest version in the workspace. LATEST is often the default when a
savepoint is an optional parameter for a DBMS_WM subprogram (procedure or function).
1-6
Chapter 1
Workspace Manager Overview
from the parent workspace (for example, the production data). If you want to set
up an independent environment for a scenario, and if regular users in the parent
workspace do not need access to this scenario's data, you probably want to create a
child workspace instead of simply creating a savepoint in the parent workspace.
Note:
You cannot roll back to a savepoint if any implicit savepoints were
created since the specified savepoint, unless you first merge or remove
the descendent workspaces that caused the implicit savepoints to be
created. For example, referring to the figure in Using Savepoints, the
user in Workspace1 cannot roll back to savepoint SP1 until Workspace3
(which caused implicit savepoint SPc to be created) is merged or
removed.
A workspace cannot be rolled back when it has open database transactions. Rollback
of a workspace leaves behind the workspace structure for future use; only the
data in the workspace is deleted. (To completely remove a workspace, use the
RemoveWorkspace procedure, as described in Removing Workspaces.)
1-7
Chapter 1
Workspace Manager Overview
The base row is the currently visible row at the time of the first update or delete
operation in the child workspace. In the case of an insert operation, the base row does
not exist, except if the inserted row was previously deleted in an ancestor version of
a parent workspace, the base row is that deleted row. The parent row is the currently
visible row in the parent workspace at the time of the conflict resolution, and the
child row is the currently visible row in the child workspace at the time of the conflict
resolution.
Absence of data is not a conflict. In these cases, you can use the xxx_DIFF view
(described in xxx_DIFF Views) to detect a change in one workspace when there is no
row or no change to the row in the other workspace.
The general process for resolving conflicts is as follows:
1. Use the GotoWorkspace or SetConflictWorkspace procedure to set the workspace
conflict context for the session.
2. Examine the xxx_CONF views (described in xxx_CONF Views) to see what
conflicts exist.
3. Execute the BeginResolve procedure.
4. Execute the ResolveConflicts procedure as often as needed: once for each
affected combination of table and workspace.
5. After resolving all conflicts, execute one of the following procedures:
• CommitResolve if you want to make permanent all changes from the
preceding step. (However, the changes are not made permanent in the
database until you perform a standard database commit operation and
execute the MergeWorkspace or RefreshWorkspace procedure, as described
in the next step.)
• RollbackResolve to discard all changes from the preceding step. (If you
discard all changes, do not perform the next step.)
6. Perform a standard database commit operation and execute the MergeWorkspace
or RefreshWorkspace procedure.
1-8
Chapter 1
Workspace Manager Overview
1-9
Chapter 1
Workspace Manager Overview
the Workspace Manager operation and then automatically commits it, and then
returns to the calling transaction's context and continues with that transaction.
Workspace Manager (DBMS_WM) subprograms that operate in this way have an optional
auto_commit parameter, which has a default value of TRUE.
1-10
Chapter 1
Workspace Manager Overview
LIVE workspace
Workspace1 Workspace4
1-11
Chapter 1
Workspace Manager Overview
Workspace Manager provides the following static data dictionary views (described
in Workspace Manager Static Data Dictionary Views ) to store information about
multiparent workspaces:
• USER_MP_GRAPH_WORKSPACES and ALL_MP_GRAPH_WORKSPACES
contain information about multiparent graph workspaces.
• USER_MP_PARENT_WORKSPACES and ALL_MP_PARENT_WORKSPACES
contain information about parent workspaces of multiparent leaf workspaces.
1-12
Chapter 1
Workspace Manager Overview
Workspace Manager does not support SQL MERGE statement (any use), or the
RETURNING clause with INSERT or UPDATE statements, on version-enabled tables.
The RETURNING clause restriction is caused by the fact that Workspace Manager
creates views with INSTEAD OF triggers on version-enabled tables, and Oracle
Database does not support the RETURNING clause on views that have INSTEAD OF
triggers defined on them.
1-13
Chapter 1
Workspace Manager Overview
However, if Example 1-1 is executed for a table that has the VIEW_W_OVERWRITE or
NONE history option, then the xxx_HIST views (see xxx_HIST Views) will contain only
a single row for each savepoint, because the row version is overridden by subsequent
DML operations within the same savepoint. For example:
select salary, commission, wm_workspace, wm_optype from EMP_HIST where empno =
100;
1-14
Chapter 1
Session Context Information for Workspace Manager
Example 1-1 Row Versions Created After Implicit and Explicit Savepoints
execute dbms_wm.GotoWorkspace('LIVE') ;
insert into EMP(empno, salary, commission) values (100, 0, 0) ;
update EMP set salary = 10000 ;
update EMP set commission = 1000 ;
commit ;
execute dbms_wm.GotoWorkspace('LIVE') ;
update EMP set salary = 30000, commission = 3000 ;
commit ;
1-15
Chapter 1
Lock Management with Workspace Manager
context is automatically set to LATEST when the session enters the workspace
(using the GotoWorkspace procedure).
• A savepoint name: The session is currently set to a savepoint in the workspace.
The session cannot see changes as they are made in the latest version of the
workspace, but instead sees a static view of the data as of the savepoint creation
time. The session context is set to the savepoint name after a call to the GotoDate
procedure.
• An instant (a point in time): The session is currently set to a specific point in
time. The session cannot see changes as they are made in the latest version of
the workspace, but instead sees a static view of the data as of the specific time.
The session context is set to an instant after a call to the GotoDate procedure.
(The exact time point depends on the history option for tracking modifications, as
set by the EnableVersioning procedure or modified by the SetWoOverwriteOFF or
SetWoOverwriteON procedure.)
You can retrieve information about the session context by using the GetSessionInfo
procedure. Retrieving this information can be useful if you need to know where a
session is (workspace and context) -- for example, after you performed a combination
of GotoWorkspace, GotoSavepoint, and GotoDate operations.
1-16
Chapter 1
Lock Management with Workspace Manager
parent version of the row, thus protecting the row from conflicts. The benefit of
shared locks over exclusive locks is that all users in the workspace where the row
is locked can access the row for changes. An ideal use for this kind of lock is on
a row that needs to have no conflicts with its parent, but that needs to be changed
by a collection of users participating in a group project. Note that shared locking
must be individually enabled for each session in the workspace.
Workspace-exclusive locks and version-exclusive locks are forms of exclusive locking
that control which users can and cannot change data values, but (unlike exclusive
locking) they do not prevent conflicts from occurring. Workspace-exclusive locks
lock rows such that only the user that set the lock can change the values in the
current workspace; however, other users in other workspaces can change the values.
Version-exclusive locks lock rows such that only the user that set the lock can
change the values (and that user can be in any workspace); no other users (in any
workspace) can change the values.
The following table indicates, for a row locked by a specific user in a specific
workspace, which users in which workspaces can and cannot modify the row. For
example, the first two entries in this table mean that when a shared (S) lock is placed
on a row, any user in the workspace in which the row was locked can modify the row,
but any user in a workspace different from the workspace in which the row was locked
cannot modify the row.
Table 1-3 Workspace Manager Lock Modes and Data Modification Ability
Locking a row does not affect workspace merge, refresh, and rollback operations, but
it affects what can be done with the row after these operations. You can control these
workspace operations by using workspace privileges, calling the FreezeWorkspace
procedure, and checking the workspace xxx_LOCK view or views (described in
xxx_LOCK Views) before performing the operations.
1-17
Chapter 1
Lock Management with Workspace Manager
The xxx_LOCK static data dictionary views (described in xxx_LOCK Views) contain
information about locks in each version-enabled table.
For information about Workspace Manager locking with DML operations on tables
with referential integrity constraints, see Locking with DML Operations on Tables with
Referential Integrity Constraints.
• Exclusive Locking and Row Versions
• Locks Taken for Workspace Manager Operations
• Version 0 of the row is locked, preventing any update of the row from any
workspace until the row is unlocked.
• The lock can be placed from workspace W1 (or a descendent workspace of W1)
because version 0 is the current physical row for the workspace.
• When a user in workspace W1 updates the row, a new row (version 2) is created
that is visible only from workspace W1 and any of its child workspaces.
However, if the row is not locked in the LIVE workspace and if a user in workspace
W1 updates the row and then places an exclusive lock on the row, a user in the LIVE
workspace can update the row. Specifically:
• A new row (version 2) is created that is visible only from workspace W1 and any of
its child workspaces.
• Version 2 of the row is locked. No user in workspace W1 other than the user that
placed the lock, or no user in any child workspace of W1, can update the row or
create a new version of the row.
• Version 0 of the row in the LIVE workspace is not locked. If a user in the LIVE
workspace or a sibling workspace of W1 updates the row, a new version (version 1)
of the row is created. (Version 0 is not locked because it is no longer the current
version of the row for users in workspace W1; rather, version 2 is the current
version of the row in that workspace.)
In other words, an exclusive lock after an update does not lock previous versions of
the row in workspaces above the locking workspace in the workspace tree or in other
branches of the workspace tree.
1-18
Chapter 1
Lock Management with Workspace Manager
1-19
Chapter 1
Lock Management with Workspace Manager
Table 1-4 Operations and Incompatible Freeze Modes for Workspace Types
1-20
Chapter 1
Lock Management with Workspace Manager
Table 1-4 (Cont.) Operations and Incompatible Freeze Modes for Workspace Types
1-21
Chapter 1
Lock Management with Workspace Manager
Table 1-4 (Cont.) Operations and Incompatible Freeze Modes for Workspace Types
1-22
Chapter 1
Lock Management with Workspace Manager
Table 1-4 (Cont.) Operations and Incompatible Freeze Modes for Workspace Types
1-23
Chapter 1
Privilege Management with Workspace Manager
Table 1-4 (Cont.) Operations and Incompatible Freeze Modes for Workspace Types
Privilege Description
ACCESS_WORKSPACE Allows the user to go to a specified workspace.
ACCESS_WORKSPACE or ACCESS_ANY_WORKSPACE privilege
is needed for all other privileges.
ACCESS_ANY_WORKSPACE Allows the user to go to any workspace.
ACCESS_WORKSPACE or ACCESS_ANY_WORKSPACE privilege
is needed for all other privileges.
CREATE_WORKSPACE Allows the user to create a child workspace in a specified
workspace.
1-24
Chapter 1
System Parameters for Workspace Manager
Privilege Description
CREATE_ANY_WORKSPACE Allows the user to create a child workspace in any
workspace.
FREEZE_WORKSPACE Allows the user to freeze and unfreeze a specified
workspace.
FREEZE_ANY_WORKSPACE Allows the user to freeze and unfreeze any workspace.
GRANTPRIV_WORKSPACE Allows the user to grant privileges on the workspace to
other users.
GRANTPRIV_ANY_WORKSPACE Allows the user to grant privileges on any workspace to
other users.
MERGE_WORKSPACE Allows the user to merge the changes in a specified
workspace to its parent workspace.
MERGE_ANY_WORKSPACE Allows the user to merge the changes in any workspace to
its parent workspace.
REMOVE_WORKSPACE Allows the user to remove a specified workspace.
REMOVE_ANY_WORKSPACE Allows the user to remove any workspace.
ROLLBACK_WORKSPACE Allows the user to roll back the changes in a specified
workspace.
ROLLBACK_ANY_WORKSPACE Allows the user to roll back the changes in any workspace.
WM_ADMIN Provides the user with all Workspace Manager-related
privileges with the grant option.
Each privilege can be granted with or without the grant option. The grant option
allows the user to which the privilege is granted to grant the privilege to other users.
The WM_ADMIN system privilege has all Workspace Manager privileges with the grant
option. By default, the WM_ADMIN system privilege is granted to WM_ADMIN_ROLE. This
role is in turn granted to the database administrator (DBA role). Thus, after you
decide which users should be granted which privileges, either have the DBA grant
the privileges, or have the DBA grant the WM_ADMIN_ROLE role to one or more selected
users and have these users grant the privileges.
The GrantWorkspacePriv and GrantSystemPriv procedures are used to grant
workspace-level privileges and system-level privileges, respectively.
The RevokeWorkspacePriv and RevokeSystemPriv procedures are used to revoke
workspace-level privileges and system-level privileges, respectively. These procedures
require that the user have sufficient privilege to revoke the specified privilege from the
specified user. The user that granted a privilege can revoke it.
1-25
Chapter 1
System Parameters for Workspace Manager
parameters. The only way to set Workspace Manager system parameters is to use the
SetSystemParameter procedure, described in DBMS_WM Package: Reference .
To set a system parameter, use the SetSystemParameter procedure. To get the
current setting for a system parameter, use the GetSystemParameter procedure. Both
procedures are described in DBMS_WM Package: Reference.
The following table lists the Workspace Manager system parameters.
1-26
Chapter 1
System Parameters for Workspace Manager
1-27
Chapter 1
System Parameters for Workspace Manager
1-28
Chapter 1
System Parameters for Workspace Manager
1-29
Chapter 1
System Parameters for Workspace Manager
1-30
Chapter 1
Import and Export Considerations
1-31
Chapter 1
Import and Export Considerations
If the dump file does not include the WMSYS schema, you can specify
table_exists_action=append if the version-enabled tables being imported do not
yet exist or are empty. (In general, dump files generated by Oracle Database
release 10.2 or later will not include the WMSYS schema, while dump files
generated by earlier releases will include the WMSYS schema.)
The dump files must be from compatible versions of Workspace Manager. In
general, any dump file created with VERSION=12 is capable of being supported.
• If you are using Data Pump Import, the dump file must have been created using
Data Pump Export.
• The REMAP_SCHEMA capability in Data Pump Import utility is not supported with
version-enabled databases.
• Workspace Manager no longer supports using the original Import and Export
utilities for this mode.
Do not use the SYS schema when performing Workspace Manager import or export
operations.
You can perform a limited (as opposed to full) export and import that includes all
schemas related to version-enabled tables and workspaces, as well as any Workspace
Manager metadata, but excludes all other schemas, as follows:
1. Call the Export_Schemas procedure to generate a dump file with the necessary
objects and data.
2. Call the Import_Schemas procedure. (As with a full database import, Workspace
Manager must already be installed and there must be no existing version-enabled
tables or workspaces other than the LIVE workspace.)
For workspace-level export operations, each version-enabled table can be exported at
the workspace level. Follow these steps to export a version-enabled table from one
database into another database:
1. Call the Export procedure to store all of the data that needs to be exported into
a staging table (for example, t1). The data that is exported can either be all of
the data as seen from a particular workspace, savepoint, or instant, or only the
data that was modified in the particular workspace. See the information about the
Export procedure in DBMS_WM Package: Reference for more details.
Note:
Tables with valid time support (that is, with a column named WM_VALID
of type WM_PERIOD) are not supported with the Export procedure.
(Valid time support is explained in Workspace Manager Valid Time
Support.)
1-32
Chapter 1
Bulk Loading into Version-Enabled Tables
3. Import the staging table (for example, t1), using the Oracle Data Pump Import
utility or the original Import utility, into the destination database.
4. If you are importing into a version-enabled table, call the Import procedure to
move the data from the staging table to the version-enabled table, specifying the
workspace where the data resided on the source database and the workspace into
which the data should be stored.
The structure of the staging table must match that of the version-enabled table.
By default, all enabled constraints must be validated before the import procedure
successfully completes.
Note:
For exporting or importing version-enabled topologies, see also the Usage
Notes for the relevant DBMS_WM procedures, including Export_Schemas
and Initialize_After_Import.
The line in the control file for bulk loading into the version-enabled table should be
changed to:
Load data into table departments_LT (name, loc)
1-33
Chapter 1
DDL Operations Related to Version-Enabled Tables
Note:
In versions of Workspace Manager before 12.1, it was necessary
to include the wm_version column. This column is now automatically
populated by Workspace Manager, and an error will be generated if
you populate it explicitly. This ensures that all the bulk-loaded rows will
be tagged with the appropriate version, and that the other Workspace
Manager-specific columns for these rows will have null values.
If the table was version-enabled with the history option, create and retire times
can be bulk loaded into the wm_createtime and wm_retiretime columns of
<table_name>_LT.
3. Complete the bulk loading process by calling either the CommitBulkLoading
procedure to commit the bulk loading changes or the RollbackBulkLoading
procedure to roll back the bulk loading changes.
If you commit the bulk loading changes, Workspace Manager ensures that the data
is updated in the required workspace and version. By default, the bulk-loaded data
is checked for each unique or referential constraint defined on the table, and any
bulk-loaded rows that are in violation of any constraints are moved to a discards table
specified as a parameter to the CommitBulkLoading procedure. If you specified to
check for duplicates (that is, records in the data to be bulk loaded that have the same
values in the primary key columns), for any duplicate records only the record with the
lowest ROWID value is loaded into the table, and the rest are moved to the discards
table.
The following restrictions apply to bulk loading with version-enabled tables in the
current release:
• Bulk loading into a table with a self-referential integrity constraint is not allowed.
• Bulk loading into a workspace, other than LIVE, that has continually refreshed child
workspaces is not allowed.
• Only the owner of a table or a user with the WM_ADMIN system privilege can bulk
load into a version-enabled table.
• The user that is bulk loading the version-enabled table must have the INSERT
privilege for <table_name>_LT.
• User-defined triggers on version-enabled tables are not executed during bulk
loading.
• Session locking mode is not enforced for the bulk-loaded rows. Use the LockRows
procedure to lock these rows.
1-34
Chapter 1
DDL Operations Related to Version-Enabled Tables
EMPLOYEES that has been version-enabled, you cannot simply enter a statement in the
form ALTER TABLE EMPLOYEES ADD (column-name data-type).
The reason for these requirements is to ensure that Workspace Manager versioning
metadata is updated to reflect the DDL changes. Therefore, DDL operations affecting
a version-enabled table must be preceded by a call to the BeginDDL procedure, and
must be concluded by a call to either the CommitDDL or RollbackDDL procedure.
The BeginDDL procedure creates an empty temporary table with a name in the form
<table-name>_LTS (the S standing for skeleton). The actual DDL statement must
specify the name of the temporary <table-name>_LTS table, and must not specify
the <table-name> or <table-name>_LT name. The CommitDDL and RollbackDDL
procedures delete the temporary <table-name>_LTS table.
Note:
An exception to this procedure is adding valid time support to an
existing version-enabled table. To add valid time support, use the
AlterVersionedTable procedure, as explained in Adding Valid Time Support
to an Existing Table.
1-35
Chapter 1
DDL Operations Related to Version-Enabled Tables
EXECUTE DBMS_WM.CommitDDL('COLA_MARKETING_BUDGET');
1-36
Chapter 1
Constraint Support with Workspace Manager
1-37
Chapter 1
Constraint Support with Workspace Manager
Note that if the child table is already version-enabled when you want to add
the referential integrity constraint, you must alter the child table's special <table-
name>_LTS table while using BeginDDL and CommitDDL. For example:
• The foreign key in a child table must refer to the primary key in the parent table.
(See the examples in the preceding item.)
• Primary key values in the parent table cannot be updated. For example, if
DEPARTMENT is the parent table and EMPLOYEE is the child table, you cannot change
the department ID of a department.
• Multilevel referential integrity constraints are permitted on version-enabled tables.
For example, the table EMPLOYEE(emp_id, dept_id) could have the constraint
that the department ID must exist in the table DEPARTMENT(dept_id, dept_name,
loc_id); and the table DEPARTMENT(dept_id, dept_name, loc_id) could have
the constraint that the location ID must exist in the table LOCATION(loc_id,
loc_name). However, all tables that are involved in multilevel referential integrity
constraints must be version-enabled and version-disabled together, unless all
the referential integrity constraints involved have the Restrict rule. If all the
constraints involved have the Restrict rule, you can version-enable the tables
either all together or one at a time with child tables preceding their parent
tables. The table names must be passed as a comma-delimited list to the
EnableVersioning and DisableVersioning procedures.
Workspace Manager uses the static data dictionary views ALL_WM_RIC_INFO and
USER_WM_RIC_INFO (described in Workspace Manager Static Data Dictionary
Views ) to hold information pertinent to referential integrity support.
If you need to add, drop, enable, or disable a referential integrity constraint that
involves two tables, it is more convenient if you perform the operation before version-
enabling the tables. However, you can add, drop, enable, or disable a referential
integrity constraint that involves a version-enabled table if you follow these steps:
1-38
Chapter 1
Constraint Support with Workspace Manager
1. If the parent table has been version-enabled, begin a DDL session specifying the
parent table.
2. Begin a DDL session specifying the child table.
3. Alter the <table-name>_LTS table for the child table to add the foreign key
constraint. If a version-enabled table is the referenced table, specify <table-
name>_LTS for the parent table. (See DDL Operations Related to Version-
Enabled Tables for information about <table-name>_LTS tables and performing
DDL operations on version-enabled tables.)
4. Commit the DDL changes specifying the child table.
5. If the parent table has been version-enabled, commit the DDL changes specifying
the parent table.
Example 1-3 adds a foreign key constraint. Assume that the EMPLOYEE and DEPARTMENT
tables are version-enabled and are defined as follows:
EMPLOYEE(emp_id number primary key, dept_id number)
DEPARTMENT(dept_id number primary key, dept_name varchar2(30))
If you are in a DDL session (that is, if you have called the BeginDDL procedure), you
cannot add, drop, enable, or disable a referential integrity constraint that involves two
tables if one table is version-enabled and the other is not version-enabled. Both tables
must be version-enabled.
• Locking with DML Operations on Tables with Referential Integrity Constraints
1-39
Chapter 1
Constraint Support with Workspace Manager
Note:
For general information about locking performed by Workspace Manager,
including explanations of shared and exclusive locks, see Lock Management
with Workspace Manager.
Multiple sessions can simultaneously perform either of the following, but not both of
the following, DML operations simultaneously:
• Insert operations or update operations affecting the foreign key column on the
child table
• Delete operations on the parent table
Multiple sessions can simultaneously perform any of the following Workspace
Manager operations simultaneously:
• Use the MergeTable procedure to apply changes to a child table or parent table in
different workspaces.
• Use the MergeTable procedure to apply changes to a child table in one
workspace, and insert or update the child table in another workspace.
• Use the MergeTable procedure to apply changes to a parent table in one
workspace, and delete from the parent table in another workspace.
One session will be blocked until the other session finishes in the following situations:
• A session tries to merge changes to a child table in one workspace, and another
session tries to merge changes to the parent table in another workspace.
• A session tries to merge changes to a child table in one workspace, and another
session tries to delete from the parent table.
• A session tries to merge changes to a parent table in one workspace, and another
session tries to insert into a child table or change a value in the foreign key of a
child table.
1-40
Chapter 1
Triggers on Version-Enabled Tables
Workspace Manager uses the following static data dictionary views (described in
Workspace Manager Static Data Dictionary Views ) to hold information pertinent to
support for unique constraints:
• ALL_WM_CONSTRAINTS and USER_WM_CONSTRAINTS contain information
about columns in unique constraints on version-enabled tables.
• ALL_WM_CONS_COLUMNS and USER_WM_CONS_COLUMNS contain
information about constraints on version-enabled tables.
• ALL_WM_IND_COLUMNS and USER_WM_IND_COLUMNS contain information
about indexes used for enforcing unique constraints on version-enabled tables.
• ALL_WM_IND_EXPRESSIONS and USER_WM_IND_EXPRESSIONS contain
information about functional expressions on functional unique indexes on version-
enabled tables.
1-41
Chapter 1
Support for Table Synonyms
1-42
Chapter 1
Spatial and Graph Topology Support
enable any topology tables, you must version-enable all tables associated with the
topology. To do so, you must specify the topology name as the table_name parameter
to the EnableVersioning procedure, and you must specify the isTopology parameter
as TRUE. For example:
EXECUTE DBMS_WM.EnableVersioning(table_name => 'xyz_topo', isTopology => TRUE);
The preceding example version-enables the xyz_topo topology; that is, it version-
enables all feature tables associated with the xyz_topo topology, as well as
the XYZ_TOPO_NODE$, XYZ_TOPO_FACE$, XYZ_TOPO_EDGE$, XYZ_TOPO_RELATION$, and
XYZ_TOPO_HISTORY$ tables.
The preceding example puts version locks on all the rows of the specified topology
contained in the specified window. To edit the elements of a topology in a workspace
(including the LIVE workspace), follow these steps:
1. Invoke the LockRows procedure to put version locks on all the elements of the
topology contained in a window of interest.
2. Invoke the Oracle Spatial and Graph Topology Java client loadWindow method for
the same window of interest.
1-43
Chapter 1
Workspace Manager Reserved Words and Characters
The subprograms can be logically grouped into the categories described in this
section.
1-44
Chapter 1
DBMS_WM Subprogram Categories
Note:
Most Workspace Manager subprograms are procedures, but a few are
functions. (A function returns a value; a procedure does not return a value.)
Most functions have names starting with Get (such as GetConflictWorkspace
and CreateSavepoint ).
Procedure Description
EnableVersioning Version-enables a table, creating the necessary structures to
enable the table to support multiple versions of rows.
DisableVersioning Deletes all support structures that were created to enable the
table to support versioned rows.
SetWoOverwriteOFF Disables the VIEW_WO_OVERWRITE history option that was
enabled by the EnableVersioning or SetWoOverwriteON
procedure, changing the option to VIEW_W_OVERWRITE (with
overwrite).
SetWoOverwriteON Enables the VIEW_WO_OVERWRITE history option that was
disabled by the SetWoOverwriteOFF procedure.
BeginDDL Starts a DDL (data definition language) session for a specified
table.
CommitDDL Commits DDL changes made during a DDL session for a
specified table, and ends the DDL session.
RollbackDDL Rolls back (cancels) DDL changes made during a DDL session
for a specified table, and ends the DDL session.
RecoverAllMigratingTables Attempts to complete the migration process on a table that
was left in an inconsistent state after the Workspace Manager
migration procedure failed.
1-45
Chapter 1
DBMS_WM Subprogram Categories
Procedure Description
RecoverAllMigratingTables Attempts to complete the migration process on all tables that
were left in an inconsistent state after the Workspace Manager
migration procedure failed.
CopyForUpdate Allows LOB columns (BLOB, CLOB, or NCLOB) in version-
enabled tables to be modified.
Export Exports data from a version-enabled table (all rows, or as
limited by any combination of several parameters) to a staging
table.
Import Imports data from a staging table (all rows, or as limited by any
combination of several parameters) into a version-enabled table
in a specified workspace.
Procedure Description
CreateWorkspace Creates a new workspace in the database.
GotoWorkspace Moves the current session to the specified workspace.
SetDiffVersions Finds differences in values in version-enabled tables for two
savepoints and their common ancestor (base). It creates rows
in the differences views describing these differences.
GetDiffVersions Returns the names of the (workspace, savepoint) pairs on which
the session has performed the SetDiffVersions operation.
MergeTable Applies changes to a table (all rows or as specified in the WHERE
clause) in a workspace to its parent workspace.
MergeWorkspace Applies all changes in a workspace to its parent workspace, and
optionally removes the workspace.
RollbackWorkspace Discards all data changes made in the workspace to version-
enabled tables.
RollbackTable Discards all changes made in the workspace to a specified table
(all rows or as specified in the WHERE clause).
RollbackToSP Discards all data changes made in the workspace to version-
enabled tables since the specified savepoint.
RefreshTable Applies to a workspace all changes made to a table (all rows or
as specified in the WHERE clause) in its parent workspace.
RefreshWorkspace Applies to a workspace all changes made in its parent
workspace.
AlterWorkspace Modifies the description of a workspace.
ChangeWorkspaceType Changes a workspace that is not continually refreshed to be
continually refreshed.
1-46
Chapter 1
DBMS_WM Subprogram Categories
Procedure Description
RemoveWorkspace Discards all row versions associated with a workspace and
deletes the workspace.
RemoveWorkspaceTree Discards all row versions associated with a workspace and its
descendant workspaces, and deletes the affected workspaces.
FreezeWorkspace Restricts access to a workspace and the ability of users to make
changes in the workspace.
UnfreezeWorkspace Enables access and changes to a workspace, reversing the
effect of the FreezeWorkspace procedure.
CompressWorkspace Deletes removable savepoints in a workspace, and minimizes
the Workspace Manager metadata structures for the workspace.
CompressWorkspaceTree 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.
IsWorkspaceOccupied Checks whether or not a workspace has any active sessions.
CreateSavepoint Returns the current workspace for the session.
SetMultiWorkspaces Makes the specified workspace or workspaces visible in the
multiworkspace views for version-enabled tables.
GetMultiWorkspaces Returns the names of workspaces visible in the multiworkspace
views for version-enabled tables.
GetOpContext Returns the context of the current operation for the current
session.
AddAsParentWorkspace Adds a workspace as a parent workspace to a child workspace
in a multiparent workspace environment.
RemoveAsParentWorkspac Removes a workspace as a parent workspace in a multiparent
e workspace environment.
Procedure Description
CreateSavepoint Creates a savepoint for the current version.
GotoSavepoint Goes to the specified savepoint in the current workspace.
GotoDate Goes to a point at or near the specified date and time in the current
workspace.
GetSessionInfo Retrieves information about the current workspace and session
context; useful for finding the session's current savepoint or instant
in time.
AlterSavepoint Modifies the description of a savepoint.
1-47
Chapter 1
DBMS_WM Subprogram Categories
Procedure Description
DeleteSavepoint Deletes a savepoint and associated rows in version-enabled tables.
Procedure Description
GrantWorkspacePriv Grants workspace-level privileges to users, roles, or PUBLIC.
RevokeWorkspacePriv Revokes workspace-level privileges from users and roles.
GrantSystemPriv Grants privileges on all workspaces to users, roles, or PUBLIC.
RevokeSystemPriv Revokes system-level privileges from users and roles.
GetPrivs Returns a comma-delimited list of all privileges that the current user
has for the specified workspace.
Procedure Description
SetLockingON Enables Workspace Manager locking for the current session.
SetLockingOFF Disables Workspace Manager locking for the current session.
SetWorkspaceLockModeON Enables Workspace Manager locking for the specified
workspace.
SetWorkspaceLockModeOFF Disables Workspace Manager locking for the specified
workspace.
GetLockMode 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.
LockRows Controls access to versioned rows in a specified table and to
corresponding rows in the parent workspace.
UnlockRows Enables access to versioned rows in a specified table and to
corresponding rows in the parent workspace.
1-48
Chapter 1
Simplified Examples Using Workspace Manager
Procedure Description
SetConflictWorkspace Determines whether or not conflicts exist between a workspace and
its parent workspace.
GetConflictWorkspace Returns the name of the workspace on which the session has
performed the SetConflictWorkspace procedure.
BeginResolve Starts a conflict resolution session.
ResolveConflicts Resolves conflicts between workspaces.
CommitResolve Ends a conflict resolution session and saves (makes permanent) any
changes in the workspace since the BeginResolve procedure was
executed.
RollbackResolve Quits a conflict resolution session and discards all changes in the
workspace since the BeginResolve procedure was executed.
Procedure Description
GetBulkLoadVersion Returns a version number to be specified when you call the
BeginBulkLoading procedure.
BeginBulkLoading Starts the bulk loading process for a version-enabled table.
CommitBulkLoading Ends the bulk loading process for a version-enabled table by
committing the bulk load changes.
RollbackBulkLoading Rolls back changes made to a version-enabled table during a
bulk load operation.
1-49
Chapter 1
Simplified Examples Using Workspace Manager
---------------------------------------------------------------------------
-- CREATE AND POPULATE DATA TABLE --
---------------------------------------------------------------------------
CONNECT wm_developer
-- Enter password when prompted.
1-50
Chapter 1
Simplified Examples Using Workspace Manager
2.0
);
INSERT INTO cola_marketing_budget VALUES(
2,
'cola_b',
'Baker',
1.5
);
INSERT INTO cola_marketing_budget VALUES(
3,
'cola_c',
'Chen',
1.5
);
INSERT INTO cola_marketing_budget VALUES(
4,
'cola_d',
'Davis',
3.5
);
COMMIT;
---------------------------------------------------------------------------
-- CREATE WORKSPACES --
---------------------------------------------------------------------------
-- Create workspaces for the following scenario: a major marketing focus
-- for the cola_b product. Managers and budget amounts for each
-- product can change, but the total marketing budget cannot grow.
--
-- One scenario (B_focus_1) features a manager with more expensive
-- plans (which means more money taken from other products' budgets).
-- The other scenario (B_focus_2) features a manager with less expensive
-- plans (which means less money taken from other products' budgets).
--
-- Two workspaces (B_focus_1 and B_focus_2) are created as child workspaces
-- of the LIVE database workspace.
---------------------------------------------------------------------------
-- WORK IN FIRST WORKSPACE --
---------------------------------------------------------------------------
-- Enter the B_focus_1 workspace and change the cola_b manager to Beasley and
-- raise the cola_b budget amount by 1.5 to bring it to 3.0. Reduce all other
-- products' budget amounts by 0.5 to stay within the overall budget.
1-51
Chapter 1
Simplified Examples Using Workspace Manager
---------------------------------------------------------------------------
-- CREATE ANOTHER SCENARIO IN SECOND WORKSPACE --
---------------------------------------------------------------------------
-- Enter the B_focus_2 workspace and change the cola_b manager to Burton and
-- raise the cola_b budget amount by 0.5 to bring it to 2.0. Reduce only the
-- cola_d amount by 0.5 to stay within the overall budget.
-- Discard this scenario; roll back to row values at the time savepoint
-- B_focus_2_SP1 was created. First, though, get out of the workspace
-- so it can be rolled back (no users in it).
1-52
Chapter 1
Simplified Examples Using Workspace Manager
---------------------------------------------------------------------------
-- SELECT SCENARIO AND UPDATE DATABASE --
---------------------------------------------------------------------------
-- Assume that you have decided to adopt the scenario of the second
-- workspace (B_focus_2) using that workspace's current values.
-- Unfreeze the first workspace and remove it to discard any changes there.
EXECUTE DBMS_WM.UnfreezeWorkspace ('B_focus_1');
EXECUTE DBMS_WM.RemoveWorkspace ('B_focus_1');
---------------------------------------------------------------------------
-- DISABLE VERSIONING --
---------------------------------------------------------------------------
-- Disable versioning on the table because you are finished testing scenarios.
-- Set force parameter to TRUE if you want to force the disabling even
-- if changes were made in a non-LIVE workspace.
1-53
Chapter 1
Simplified Examples Using Workspace Manager
-- Create rows for new locations, since a valid location ID is needed for each
-- proposed new warehouse.
INSERT INTO hr.locations VALUES
(4000, '123 Any Street', '01234', 'Town A', 'MA', 'US');
INSERT INTO hr.locations VALUES
(4100, '456 Some Street', '01235', 'Town B', 'MA', 'US');
INSERT INTO hr.locations VALUES
(4200, '789 Other Street', '01236', 'Town C', 'MA', 'US');
INSERT INTO hr.locations VALUES
(4300, '1 Yetanother Street', '01237', 'Town D', 'MA', 'US');
---------------------------------------------------------------------------
-- CREATE AND VERSION-ENABLE THE DATA TABLE --
---------------------------------------------------------------------------
CONNECT wm_developer
-- Enter password when prompted.
set echo on
set serveroutput on
------------------------------------------------------------------------
-- CREATE AND USE WORKSPACES --
------------------------------------------------------------------------
-- The company has decided that it needs additional warehouse space.
-- It wants to consider two scenarios: a single large warehouse in Town A,
-- and two smaller warehouses in Town B and Town C that together offer more
-- total storage capacity. There are potential advantages and disadvantages
-- to each scenario, and financial and legal issues to be resolved with each.
--
-- Later, the company decides that it might need even more warehouse
-- space under each scenario, so it wants to consider the same additional
-- warehouse in each scenario.
1-54
Chapter 1
Simplified Examples Using Workspace Manager
-- Set up the first scenario: Go to the large_warehouse workspace and first add
-- one row for a warehouse.
COMMIT;
-- Create a savepoint so that you can, if necessary, roll back to the point
-- before the extra warehouse was added.
EXECUTE DBMS_WM.CreateSavepoint ('large_warehouse', 'large_warehouse_add_wh');
1-55
Chapter 1
Simplified Examples Using Workspace Manager
COMMIT;
-- Freeze this workspace to prevent any changes until the workspace is unfrozen.
-- However, first go to the LIVE workspace, because a workspace cannot be frozen
-- if any users (including you) are in it.
EXECUTE DBMS_WM.GotoWorkspace ('LIVE');
EXECUTE DBMS_WM.FreezeWorkspace ('large_warehouse');
COMMIT;
-- Create a savepoint so that you can, if necessary, roll back to the point
-- before the extra warehouse was added.
EXECUTE DBMS_WM.CreateSavepoint ('smaller_warehouses',
'smaller_warehouses_add_wh');
1-56
Chapter 1
Simplified Examples Using Workspace Manager
COMMIT;
---------------------------------------------------------------------------
-- SELECT A SCENARIO, AND APPLY IT --
---------------------------------------------------------------------------
-- Later, the company makes its decisions:
-- 1. Add two smaller warehouses.
-- 2. Do not add the extra warehouse (that is, no third new warehouse).
-- Consequently, you need to discard the first scenario (large_warehouse
-- workspace) completely, discard the warehouse addition in the second
-- scenario (roll back to smaller_warehouses_add_wh savepoint), and
-- apply the second scenario.
-- Unfreeze the first workspace and remove it to discard any changes there.
EXECUTE DBMS_WM.UnfreezeWorkspace ('large_warehouse');
EXECUTE DBMS_WM.RemoveWorkspace ('large_warehouse');
-- Rollback the workspace for the second scenario to the savepoint created
-- before the extra warehouse was added.
EXECUTE DBMS_WM.RollbackToSP ('smaller_warehouses', 'smaller_warehouses_add_wh');
-- The OE.WAREHOUSES table now has the desired data (two additional warehouses
-- from the smaller_warehouses scenario). Display the IDs and names just to be
-- sure.
SELECT warehouse_id, warehouse_name FROM oe.warehouses
ORDER BY warehouse_id;
-- Disable versioning on the table because you are finished testing scenarios.
-- Set the force parameter to TRUE to force disabling even though changes
-- were made in a non-LIVE workspace. You must also version-disable
-- the other tables previously version-enabled (along with OE.WAREHOUSES).
-- Clean up by deleting the rows that were added to the OE.WAREHOUSES table.
DELETE FROM oe.warehouses WHERE warehouse_id >= 10;
1-57
Chapter 1
Simplified Examples Using Workspace Manager
The SELECT statement near the end of Example 1-5 displays the IDs and names of
warehouses in the OE.WAREHOUSES table, including the newly added warehouses in
Town B and Town C, as shown in the following example:
SELECT warehouse_id, warehouse_name FROM oe.warehouses
ORDER BY warehouse_id;
WAREHOUSE_ID WAREHOUSE_NAME
------------ -----------------------------------
1 Southlake, Texas
2 San Francisco
3 New Jersey
4 Seattle, Washington
5 Toronto
6 Sydney
7 Mexico City
8 Beijing
9 Bombay
10 Town B
11 Town C
1-58
2
Workspace Manager Events
Certain applications may be interested in knowing what Workspace Manager
operations are being performed and may want to take some actions based on that.
Several types of Workspace Manager operations can be captured as events.
Workspace Manager provides a framework for communicating these events
asynchronously to the interested applications. The applications can then take some
actions based on the event. Some scenarios in which events can be used include the
following:
• An application wants to be notified whenever a workspace is merged to LIVE so
that it can refresh its data.
• Workspace data needs to be archived whenever a new savepoint is created.
The Workspace Manager event framework is built on the Oracle Advanced
Queuing (AQ) capability. Messaging features provided by AQ, such as asynchronous
notification, persistence, propagation, access control, history, and rule-based
subscription, can be used for Workspace Manager events.
Workspace Manager creates a multiconsumer queue where events are enqueued.
The relevant information about the event, such as the type of event, the user and
workspace that triggered the event, and the name of the versioned table, is initialized
in the event payload and enqueued. Applications can subscribe to these events,
optionally specifying a rule for their subscriptions. Only the events that satisfy the
rule will be applicable to the subscriber. Subscribers can get event notification in
variety of ways, such as listening for the events in the queue, registering a callback for
notification, or explicitly dequeuing events from the queue.
Because events are communicated asynchronously to the other applications, the
performance of the workspace operation generating the event is not affected.
Note:
To use Workspace Manager events in an application, you must understand
the relevant AQ concepts and techniques described in Oracle Database
Advanced Queuing User's Guide.
2-1
Chapter 2
List of Workspace Manager Events
Event Occurs
TABLE_MERGE_W_REMOVE_DATA When MergeTable is invoked with
remove_data set to TRUE.
TABLE_MERGE_WO_REMOVE_DATA When MergeTable is invoked with
remove_data set to FALSE.
TABLE_REFRESH When RefreshTable is invoked.
TABLE_ROLLBACK When RollbackTable is invoked.
WORKSPACE_COMPRESS When CompressWorkspace or
CompressWorkspaceTree is invoked.
WORKSPACE_CREATE When CreateWorkspace is invoked.
WORKSPACE_MERGE_W_REMOVE When MergeWorkspace is invoked with
remove_workspace set to TRUE.
WORKSPACE_MERGE_WO_REMOVE When MergeWorkspace is invoked with
remove_workspace set to FALSE.
WORKSPACE_REFRESH When RefreshWorkspace is invoked.
WORKSPACE_REMOVE When RemoveWorkspace or
RemoveWorkspaceTree is invoked.
WORKSPACE_ROLLBACK When RollbackWorkspace is invoked.
WORKSPACE_VERSION When a new version is created in the
workspace as a result of the creation of an
explicit or implicit savepoint. (Savepoints are
described in Using Savepoints.)
2-2
Chapter 2
ALLOW_CAPTURE_EVENTS System Parameter
2-3
Chapter 2
AQ Operations and Workspace Manager Events
AQ creates some views for the queue that can be used for administrative purposes.
Table 2-3 describes the views of interest to developers of Workspace Manager
applications.
2-4
Chapter 2
AQ Operations and Workspace Manager Events
-- Grant privilege to SCOTT to dequeue events. (As an alternative, you could use
-- DBMS_AQADM.GRANT_QUEUE_PRIVILEGE to grant the DEQUEUE privilege on
-- WMSYS.WM$EVENT_QUEUE.)
exec DBMS_AQADM.GRANT_SYSTEM_PRIVILEGE('DEQUEUE_ANY','SCOTT') ;
connect scott
-- Enter password when prompted.
DECLARE
subscriber sys.aq$_agent;
BEGIN
subscriber := sys.aq$_agent('MERGE_LISTENER', NULL, NULL);
dbms_aqadm.add_subscriber(
queue_name => 'WMSYS.WM$EVENT_QUEUE',
subscriber => subscriber,
rule => 'tab.user_data.event_name = ''WORKSPACE_MERGE_WO_REMOVE''
and tab.user_data.parent_workspace_name = ''LIVE''');
END;
/
2-5
Chapter 2
AQ Operations and Workspace Manager Events
connect scott
-- Enter password when prompted.
set serveroutput on
DECLARE
qlist dbms_aq.aq$_agent_list_t;
agent_w_msg sys.aq$_agent;
listen_timeout exception;
pragma exception_init(listen_timeout, -25254);
BEGIN
qlist(0) := sys.aq$_agent('MERGE_LISTENER', 'WMSYS.WM$EVENT_QUEUE', NULL);
BEGIN
DBMS_AQ.LISTEN(
agent_list => qlist,
wait => 30,
agent => agent_w_msg);
dbms_output.put_line(agent_w_msg.name) ;
EXCEPTION
when listen_timeout THEN
null;
END;
END;
/
2-6
Chapter 2
AQ Operations and Workspace Manager Events
• aq_tm_processes = 1
• job_queue_processes = 2
Example 2-5 registers for a callback to receive asynchronous notification of events.
Example 2-5 Receiving Asynchronous Notification of Events
rem =====================================================
rem Example of how to register for a callback to the event
rem queue on behalf of a subscriber. Subscriber has already
rem been defined in previous section. The callback is
rem invoked by the AQ framework whenever an event satisfying the
rem rule for the subscriber occurs. The minimum values for
rem the following init.ora parameters should be set as follows.
rem aq_tm_processes = 1
rem job_queue_processes = 2
rem The user SCOTT must have sufficient privileges.
rem ===========================================================
CONNECT scott
-- Enter password when prompted.
BEGIN
dopt.consumer_name := 'MERGE_LISTENER';
dopt.wait := 30;
dopt.msgid := descr.msg_id;
dbms_aq.dequeue(
queue_name => 'WMSYS.WM$EVENT_QUEUE',
dequeue_options => dopt,
message_properties => mprop,
payload => event,
msgid => deq_msgid);
2-7
Chapter 2
AQ Operations and Workspace Manager Events
event.aux_params(1).name, event.aux_params(1).value,
event.aux_params(2).name … and so on. The number of
parameters can be accessed using event.aux_params.count
when aux_params is not null.
*/
END;
/
rem ==================================================
rem Register a callback for the event
rem Queue name and subscriber name have to be specified
rem while registering for a callback
rem ==================================================
DECLARE
reginfo1 sys.aq$_reg_info;
reginfolist sys.aq$_reg_info_list;
BEGIN
reginfo1 := sys.aq$_reg_info('WMSYS.WM$EVENT_QUEUE:MERGE_LISTENER',1,'plsql://
scott.event_callback?PR=1',HEXTORAW('FF'));
reginfolist := sys.aq$_reg_info_list(reginfo1);
sys.dbms_aq.register(reginfolist, 1);
COMMIT;
END;
/
2-8
3
Workspace Manager Valid Time Support
This chapter describes the support for valid time, also known as effective dating, with
version-enabled tables.
It contains the following major sections:
• Valid Time Support: Introduction and Example
Some applications need to store data with an associated time range that indicates
the validity of the data. That is, each record is valid only within the time range
associated with the record.
• WM_PERIOD Data Type
The WM_PERIOD data type is used to specify a valid time range for the session or
workspace, and for a row in a version-enabled table.
• Valid Time Constants
The following table lists constants that can be used in the validFrom and
validTill timestamps of a WM_PERIOD specification.
• API Features for Valid Time Support
The following table lists DBMS_WM subprograms that are devoted to valid time
support or that have parameters related to valid time support.
• Operators for Valid Time Support
Workspace Manager provides relationship checking operators and set operators
that accept two time period parameters and that can be used to apply valid time
filters in a query.
• Queries and DML Operations with Valid Time Support
This section describes some behaviors and considerations for queries and data
manipulation language (insert, update, and delete) operations related to valid time
support.
• Constraint Management for Valid Time Support
This section describes considerations related to valid time support that affect
referential integrity constraints and unique constraints.
• Locking with Valid Time Support
If a row in a version-enabled table with valid time support is locked, it is
automatically locked for its entire valid time period. There is no way to lock a
row for a specified time period.
• Static Data Dictionary Views Affected by Valid Time Support
This section describes the effect on valid time support on Workspace Manager
static data dictionary views.
• Adding Valid Time Support to an Existing Table
You can add valid time support to an existing version-enabled table.
• Merging and Refreshing Workspaces for Tables with Valid Time Support
When tables that have valid time support are merged or refreshed, you can
determine the resulting rows by considering the distinct cases when there is an
intersection between rows for the same primary key value.
3-1
Chapter 3
Valid Time Support: Introduction and Example
3-2
Chapter 3
WM_PERIOD Data Type
);
INSERT INTO employees VALUES(
'Baxter',
40000,
WMSYS.WM_PERIOD(TO_DATE('01-01-2000', 'MM-DD-YYYY'), DBMS_WM.UNTIL_CHANGED)
);
COMMIT;
The validFrom date is inclusive, and the validTill period is exclusive; that is, the
valid date range starts on the validFrom date and extends up to but not including the
validTill date.
The wm_period_map member function enables ordering (sorting) and the use of
DISTINCT on columns of type WM_PERIOD.
3-3
Chapter 3
Valid Time Constants
Example 3-3 inserts a row that is valid from 01-Jan-2003 until it is changed.
Example 3-3 Inserting a Row Valid for a Time Range
INSERT INTO employees VALUES(
'Baxter',
40000,
WMSYS.WM_PERIOD(TO_DATE('01-01-2003', 'MM-DD-YYYY'), DBMS_WM.UNTIL_CHANGED)
);
If you want the valid time range to be stored in views created on tables with valid
time support, using two columns of type TIMEZONE WITH TIMESTAMP instead of a single
column of type WM_VALID, you can set the Workspace Manager system parameter
USE_SCALAR_TYPES_FOR_VALIDTIME to ON, as explained in System Parameters for
Workspace Manager.
Constant Explanation
DBMS_WM.MIN_TIME The minimum (earliest) timestamp value supported by
Workspace Manager. Currently the beginning of the day on 01-
Jan in the year -4712 (4712 BCE).
DBMS_WM.MAX_TIME The maximum (latest) timestamp value supported by Workspace
Manager. Currently the end of the day (11:59.999999000 pm) on
31-Dec-9999.
DBMS_WM.UNTIL_CHAN A timestamp that is treated as DBMS_WM.MAX_TIME until a
GED subsequent modification overrides the value.
3-4
Chapter 3
Operators for Valid Time Support
3-5
Chapter 3
Operators for Valid Time Support
• WM_INTERSECTION returns the intersection of the two periods, that is, the time
range common to both periods.
• WM_LDIFF returns the difference between the two periods on the left (that is,
earlier in time).
• WM_RDIFF returns the difference between the two periods on the right (that is,
later in time).
You can use the relationship checking operators as alternatives to using the
wm_valid.validFrom and wm_valid.validTill attributes of the row. For example, the
following two queries, which select data valid on 01-Jan-1991, are equivalent:
SELECT * FROM employees e WHERE WM_CONTAINS (e.wm_valid,
WMSYS.WM_PERIOD(TO_DATE('01-01-1991', 'MM-DD-YYYY'),
TO_DATE('01-02-1991', 'MM-DD-YYYY')) = 1;
SELECT * from employees e
WHERE e.wm_valid.validFrom <= TO_DATE('01-01-1991', 'MM-DD-YYYY')
AND e.wm_valid.validTill > TO_DATE('01-03-1991', 'MM-DD-YYYY');
The rest of this section contains additional information about each operator. The
operators are listed in alphabetical order.
• WM_CONTAINS
• WM_EQUALS
• WM_GREATERTHAN
• WM_INTERSECTION
• WM_LDIFF
• WM_LESSTHAN
• WM_MEETS
• WM_OVERLAPS
• WM_RDIFF
3.5.1 WM_CONTAINS
The WM_CONTAINS operator checks if the first period contains the second period.
WM_CONTAINS(p1, p2) returns 1 only if the period p1 contains the period p2; otherwise,
it returns 0.
For example:
WM_CONTAINS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1985', 'MM-DD-YYYY'),
TO_DATE('01-01-1988', 'MM-DD-YYYY'))) = 1
WM_CONTAINS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1985', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY'))) = 0
3-6
Chapter 3
Operators for Valid Time Support
Example 3-4 returns all rows in the EMPLOYEES table that were valid on 01-Jan-1995
(that is, where the WM_VALID column value contains the period for 01-Jan-1995).
NAME SALARY
---------------- ----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
Adams 30000
WM_PERIOD('01-JAN-1990 12:00:00 -04:00', '01-JAN-2005 12:00:00 -04:00')
3.5.2 WM_EQUALS
The WM_EQUALS operator checks if the first period is equal to (that is, the same as)
the second period. WM_CONTAINS(p1, p2) returns 1 only if the period p1 is equal to the
period p2; otherwise, it returns 0.
For example:
WM_EQUALS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY'))) = 1
WM_EQUALS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1985', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY'))) = 0
Example 3-5 returns all rows in the EMPLOYEES table that are valid from 01-Jan-1990
until 01-Jan-2005 (that is, where the WM_VALID column value is equal to that period).
NAME SALARY
---------------- ----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
Adams 30000
WM_PERIOD('01-JAN-1990 12:00:00 -04:00', '01-JAN-2005 12:00:00 -04:00')
3-7
Chapter 3
Operators for Valid Time Support
3.5.3 WM_GREATERTHAN
The WM_GREATERTHAN operator checks if the first period is greater than (that is,
occurs after) the second period. WM_CONTAINS(p1, p2) returns 1 only if the entire
period p1 is later than the period p2; otherwise, it returns 0.
For example:
WM_GREATERTHAN(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1970', 'MM-DD-YYYY'),
TO_DATE('01-01-1980', 'MM-DD-YYYY'))) = 1
WM_GREATERTHAN(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1970', 'MM-DD-YYYY'),
TO_DATE('01-01-1981', 'MM-DD-YYYY'))) = 0
Example 3-6 returns all rows in the EMPLOYEES table that are valid only after
01-Jan-2001 (that is, where the WM_VALID column timestamps are both after 01-
Jan-2001).
Example 3-6 WM_GREATERTHAN Operator
SELECT * FROM employees e
WHERE WM_GREATERTHAN(e.wm_valid,
wm_period(TO_DATE('01-01-2001', 'MM-DD-YYYY'),
TO_DATE('01-02-2001', 'MM-DD-YYYY'))) = 1;
NAME SALARY
---------------- ----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
Coleman 50000
WM_PERIOD('01-JAN-2003 12:00:00 -04:00', '31-DEC-9999 12:00:00 -04:00')
3.5.4 WM_INTERSECTION
The WM_INTERSECTION operator returns the intersection of the two periods, that
is, the period common to both specified periods. WM_INTERSECTION(p1, p2) returns a
period that is the intersection of periods p1 and p2.
3-8
Chapter 3
Operators for Valid Time Support
The following example returns a null value, because there is no intersection of the
periods:
WM_INTERSECTION(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1992', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY')))
Example 3-7 returns, for each row in the EMPLOYEES table, the employee name and the
period in which the WM_PERIOD column value intersects the period on 01-Jan-1995.
NAME
----------------
WM_INTERSECTION(E.WM_VALID,WM_PERIOD(TO_DATE('01-01-1995','MM-DD-
--------------------------------------------------------------------------------
Adams
WM_PERIOD('01-JAN-1995 12:00:00 -04:00', '02-JAN-1995 12:00:00 -04:00')
Baxter
Coleman
As you can see in the output of Example 3-7, only Adams has a row that is valid on
01-Jan-1995.
3.5.5 WM_LDIFF
The WM_LDIFF operator returns the difference between the two periods on the left
(that is, earlier in time). WM_LDIFF(p1, p2) returns a period that is the difference
between periods p1 and p2 on the left.
3-9
Chapter 3
Operators for Valid Time Support
TO_DATE('01-01-1985', 'MM-DD-YYYY'),
TO_DATE('01-01-1988', 'MM-DD-YYYY')))
The following example returns a null value because p1.validFrom is greater than
p2.validFrom:
WM_LDIFF(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1975', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY')))
The following example returns a null value because p2 is completely outside (in this
case, later than) p1:
WM_LDIFF(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1992', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY')))
Example 3-8 returns, for each row in the EMPLOYEES table, the employee name and the
period in which the WM_PERIOD column value is different on the left from 01-Jan-1995.
NAME
----------------
WM_LDIFF(E.WM_VALID,WM_PERIOD(TO_DATE('01-01-1995','MM-DD-YYYY'),
--------------------------------------------------------------------------------
Adams
WM_PERIOD('01-JAN-1990 12:00:00 -04:00', '01-JAN-1995 12:00:00 -04:00')
Baxter
Coleman
As you can see in the output of Example 3-8, only Adams has a row that is valid during
the period of difference on the left.
3.5.6 WM_LESSTHAN
The WM_LESSTHAN operator checks if the first period is less than (that is, occurs
before) the second period. WM_CONTAINS(p1, p2) returns 1 only if the entire period p1
is less than the period p2; otherwise, it returns 0.
For example:
WM_LESSTHAN(
WM_PERIOD(
3-10
Chapter 3
Operators for Valid Time Support
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1991', 'MM-DD-YYYY'),
TO_DATE('01-01-1992', 'MM-DD-YYYY'))) = 1
WM_LESSTHAN(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1989', 'MM-DD-YYYY'),
TO_DATE('01-01-1992', 'MM-DD-YYYY'))) = 0
Example 3-9 returns all rows in the EMPLOYEES table that are valid only before
01-Jan-2010 (that is, where the WM_VALID column timestamps are both before 01-
Jan-2001).
Example 3-9 WM_LESSTHAN Operator
SELECT * FROM employees e
WHERE WM_LESSTHAN(e.wm_valid,
wm_period(TO_DATE('01-01-2010', 'MM-DD-YYYY'),
TO_DATE('01-02-2010', 'MM-DD-YYYY'))) = 1;
NAME SALARY
---------------- ----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
Adams 30000
WM_PERIOD('01-JAN-1990 12:00:00 -04:00', '01-JAN-2005 12:00:00 -04:00')
3.5.7 WM_MEETS
The WM_MEETS operator checks if the end of the first period is the start of the
second period. WM_MEETS(p1, p2) returns 1 only if p1.validTill = p2.validFrom;
otherwise, it returns 0.
For example:
WM_MEETS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1990', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY'))) = 1
WM_MEETS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1992', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY'))) = 0
Example 3-10 returns all rows in the EMPLOYEES table that are valid only if the ending
timestamp of the valid date period is the same as the start of the period from 01-
Jan-2005 until 01-Jan-2006 (that is, if WM_VALID.validTill is equal to the start of the
specified period).
3-11
Chapter 3
Operators for Valid Time Support
NAME SALARY
---------------- ----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
Adams 30000
WM_PERIOD('01-JAN-1990 12:00:00 -04:00', '01-JAN-2005 12:00:00 -04:00')
3.5.8 WM_OVERLAPS
The WM_OVERLAPS operator checks if two periods overlap. WM_OVERLAPS(p1, p2)
returns 1 if the periods p1 and p2 overlap; otherwise, it returns 0.
For example:
WM_OVERLAPS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1985', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY'))) = 1
WM_OVERLAPS(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1970', 'MM-DD-YYYY'),
TO_DATE('01-01-1980', 'MM-DD-YYYY'))) = 0
Example 3-11 returns all rows in the EMPLOYEES table whose valid date range overlaps
the period from 01-Jan-1990 until 01-Jan-2000.
Example 3-11 WM_OVERLAPS Operator
SELECT * FROM employees e
WHERE WM_OVERLAPS(e.wm_valid,
wm_period(TO_DATE('01-01-1990', 'MM-DD-YYYY'),
TO_DATE('01-01-2000', 'MM-DD-YYYY'))) = 1;
NAME SALARY
---------------- ----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
Adams 30000
WM_PERIOD('01-JAN-1990 12:00:00 -04:00', '01-JAN-2005 12:00:00 -04:00')
3.5.9 WM_RDIFF
The WM_RDIFF operator returns the difference between the two periods on the
right (that is, later in time). WM_RDIFF(p1, p2) returns a period that is the difference
between periods p1 and p2 on the right.
3-12
Chapter 3
Queries and DML Operations with Valid Time Support
The following example returns a null value because p1.validTill is less than
p2.validTill:
WM_RDIFF(
WM_PERIOD(
TO_DATE('01-01-1980', 'MM-DD-YYYY'),
TO_DATE('01-01-1990', 'MM-DD-YYYY')),
WM_PERIOD(
TO_DATE('01-01-1975', 'MM-DD-YYYY'),
TO_DATE('01-01-1995', 'MM-DD-YYYY')))
Example 3-12 returns, for each row in the EMPLOYEES table, the employee name
and the period in which the WM_PERIOD column value is different on the right from
01-Jan-1995.
Example 3-12 WM_RDIFF Operator
SELECT e.name, WM_RDIFF(e.wm_valid,
wm_period(TO_DATE('01-01-1995', 'MM-DD-YYYY'),
TO_DATE('01-02-1995', 'MM-DD-YYYY')))
FROM employees e;
NAME
----------------
WM_RDIFF(E.WM_VALID,WM_PERIOD(TO_DATE('01-01-1995','MM-DD-YYYY'),
--------------------------------------------------------------------------------
Adams
WM_PERIOD('02-JAN-1995 12:00:00 -04:00', '01-JAN-2005 12:00:00 -04:00')
Baxter
Coleman
WM_PERIOD('01-JAN-2003 12:00:00 -04:00', '31-DEC-9999 12:00:00 -04:00')
As you can see in the output of Example 3-12, only Adams and Coleman have rows
that are valid during the period of difference on the right.
3-13
Chapter 3
Queries and DML Operations with Valid Time Support
3.6.1 Queries
All queries issued against a version-enabled table with valid time support take
into account the current session's valid time setting (set using the SetValidTime or
SetValidTimeFilterON procedure). Unless the query specifies otherwise (for example,
by using one of the valid time support operators described in Operators for Valid Time
Support), each query displays all rows from the underlying table having a valid time
range that overlaps the session valid time or valid time filter, and that satisfy the other
conditions of the query.
By default (that is, if the SetValidTime procedure has not been invoked in the session
or if it was invoked with no parameters), all rows that are valid at the current time are
considered valid, and the valid time period is considered to be from the current time
forward without limit.
3-14
Chapter 3
Queries and DML Operations with Valid Time Support
-- for Baxter.
-- First, set valid time to the intended range for Baxter's raise.
EXECUTE DBMS_WM.SetValidTime(TO_DATE('01-01-2003', 'MM-DD-YYYY'),
DBMS_WM.UNTIL_CHANGED);
-- Give Baxter a raise, effective 01-Jan-2003 until changed.
UPDATE employees SET salary = 45000 WHERE name = 'Baxter';
The update operation in Example 3-13 modifies the WM_VALID value of the existing row
and creates a new row with the new salary value and the WM_VALID value reflecting the
session valid time range, as shown by the following statements:
-- Set valid time to encompass virtually all time.
EXECUTE DBMS_WM.SetValidTime(TO_DATE('01-01-1900', 'MM-DD-YYYY'),
TO_DATE('01-02-9999', 'MM-DD-YYYY'));
NAME SALARY
---------------- ----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
Baxter 45000
WM_PERIOD('01-JAN-2003 12:00:00 -04:00', NULL)
Baxter 40000
WM_PERIOD('01-JAN-2000 12:00:00 -04:00', '01-JAN-2003 12:00:00 -04:00')
A sequenced delete operation deletes the portion of a row that falls within the session
valid time range; that is, a new row is created in which the WM_VALID period reflects
the current session valid time range, and then that row is deleted. If the UPDATE
statement in Example 3-13 had instead been DELETE FROM employees WHERE name =
'Baxter';, the new row for Baxter, valid from 01-Jan-2003 until changed, would have
been deleted, but any rows for Baxter valid before 01-Jan-2003 would not be affected.
There is no concept of a non-sequenced delete operation; for example, if a valid time
was not set in Example 3-13, a delete operation WHERE name = 'Baxter' would delete
all rows for Baxter.
Sequenced update and delete operations are enabled when a table is version-
enabled with valid time support or when valid time support is added to a
version-enabled table. However, you can disable support for sequenced update
and delete operations (as well as for nonsequenced update operations) by using
the SetWMValidUpdateModeOFF procedure, and you can re-enable support by
using the SetWMValidUpdateModeON procedure. (Both procedures are described in
DBMS_WM Package: Reference .)
A nonsequenced update operation occurs when you specify a change to the
WM_VALID column in the UPDATE statement. In a nonsequenced update operation,
no additional row is created, and the WM_VALID column value of the updated row or
rows reflects what you specified in the UPDATE statement. You must ensure that a
nonsequenced update operation will not result in multiple rows with the same primary
key value being valid in the period specified in the UPDATE statement; otherwise, the
update fails because of a primary key constraint violation.
If the UPDATE statement in Example 3-13 had been a nonsequenced update
operation, the result would have been only one row for Baxter: the existing row would
have had the salary set to 45000 and the WM_VALID column set to the period specified
in the UPDATE statement.
3-15
Chapter 3
Constraint Management for Valid Time Support
To make the statement in Example 3-14 succeed, first change the WM_VALID.ValidTill
attribute for the Coleman row to a timestamp reflecting 01-Jan-2004 or an earlier date.
3-16
Chapter 3
Locking with Valid Time Support
If either or both tables in a referential integrity constraint are not version-enabled with
valid time support, valid time periods are ignored in enforcing the constraint.
3-17
Chapter 3
Adding Valid Time Support to an Existing Table
For a version-enabled table with valid time support, a column named WM_VALID, of type
WM_PERIOD, is added to the xxx_CONF view, to indicate the time period during which
the row is valid. A column named WM_CONFLICTPERIOD, of type WM_PERIOD, is also
added to the view, to indicate the overlapping period of the rows for which conflicts
were detected.
3-18
Chapter 3
Merging and Refreshing Workspaces for Tables with Valid Time Support
Example 3-15 creates a table named MY_TABLE, version-enables it without valid time
support, and then adds valid time support. After the valid time support is added, the
WM_VALID column contains the default valid time period.
ID
----------
1
ID
----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
1
WM_PERIOD('09-JUN-2003 10:04:13 -04:00', NULL)
Table 3-3 validTill Values and Intersection Result from Merge or Refresh
Operation
3-19
Chapter 3
Merging and Refreshing Workspaces for Tables with Valid Time Support
Table 3-3 (Cont.) validTill Values and Intersection Result from Merge or Refresh
Operation
For all cases in Table 3-3, any non-intersecting portion of the target row is left
unchanged. When there is no overlapping row in the target workspace, then no special
consideration needs to be made; the row is merged or refreshed as is without any
additional changes.
3-20
Part II
Reference Information
This document has three parts:
• Conceptual and Usage Information provides conceptual and usage information
about Workspace Manager.
• Part II provides reference information about the Workspace Manager PL/SQL API
(DBMS_WM package) and static data dictionary views.
• Supplementary Information provides supplementary information (appendixes and
a glossary).
Part II contains the following chapters with reference information:
• DBMS_WM Package: Reference
Workspace Manager includes PL/SQL subprograms (procedures and functions), in
a package named DBMS_WM, that perform the available features of the product. This
chapter provides reference information on each subprogram.
• Workspace Manager Static Data Dictionary Views
Workspace Manager creates and maintains static data dictionary views to hold
information about such things as version-enabled tables, workspaces, savepoints,
users, privileges, locks, and conflicts.
4
DBMS_WM Package: Reference
Workspace Manager includes PL/SQL subprograms (procedures and functions), in
a package named DBMS_WM, that perform the available features of the product. This
chapter provides reference information on each subprogram.
Note:
Most Workspace Manager subprograms are procedures, but a few are
functions. (A function returns a value; a procedure does not return a value.)
Most functions have names starting with Get (such as GetConflictWorkspace
and GetWorkspace).
Note:
When executing a DBMS_WM procedure from another procedure, the
privilege checks take into account whether the procedure has definer's rights
or the rights of the database user whose privileges are currently active.
• Add_Topo_Geometry_Layer
• AddAsParentWorkspace
• AddUserDefinedHint
• AlterSavepoint
4-1
Chapter 4
• AlterVersionedTable
• AlterWorkspace
• BeginBulkLoading
• BeginDDL
• BeginResolve
• ChangeWorkspaceType
• CommitBulkLoading
• CommitDDL
• CommitResolve
• CompressWorkspace
• CompressWorkspaceTree
• CopyForUpdate
• CopyWorkspace
• CreateSavepoint
• CreateWorkspace
• Delete_Topo_Geometry_Layer
• DeleteSavepoint
• DisableVersioning
• EnableVersioning
• Export
• Export_Schemas
• FindRICSet
• FreezeWorkspace
• GetBulkLoadVersion
• GetConflictWorkspace
• GetDiffVersions
• GetLockMode
• GetMultiWorkspaces
• GetOpContext
• GetOriginalDDL
• GetPhysicalTableName
• GetPrivs
• GetSessionInfo
• GetSystemParameter
• GetValidFrom
• GetValidTill
• GetVersion
4-2
Chapter 4
• GetWMMetadataSpace
• GetWorkspace
• GotoDate
• GotoSavepoint
• GotoWorkspace
• GrantGraphPriv
• GrantPrivsOnPolicy
• GrantSystemPriv
• GrantWorkspacePriv
• Import
• Import_Schemas
• Initialize_After_Import
• IsWorkspaceOccupied
• LockRows
• MergeTable
• MergeWorkspace
• Move_Proc
• PurgeTable
• RecoverAllMigratingTables
• RecoverFromDroppedUser
• RecoverMigratingTable
• RefreshTable
• RefreshWorkspace
• RemoveAsParentWorkspace
• RemoveDeferredWorkspaces
• RemoveUserDefinedHint
• RemoveWorkspace
• RemoveWorkspaceTree
• RenameSavepoint
• RenameWorkspace
• ResolveConflicts
• RevokeGraphPriv
• RevokeSystemPriv
• RevokeWorkspacePriv
• RollbackBulkLoading
• RollbackDDL
• RollbackResolve
4-3
Chapter 4
Add_Topo_Geometry_Layer
• RollbackTable
• RollbackToSP
• RollbackWorkspace
• SetCaptureEvent
• SetCompressWorkspace
• SetConflictWorkspace
• SetDiffVersions
• SetLockingOFF
• SetLockingON
• SetMultiWorkspaces
• SetSystemParameter
• SetTriggerEvents
• SetValidTime
• SetValidTimeFilterOFF
• SetValidTimeFilterON
• SetWMValidUpdateModeOFF
• SetWMValidUpdateModeON
• SetWoOverwriteOFF
• SetWoOverwriteON
• SetWorkspaceLockModeOFF
• SetWorkspaceLockModeON
• UnfreezeWorkspace
• UnlockRows
• UseDefaultValuesForNulls
4.1 Add_Topo_Geometry_Layer
Adds a topology geometry layer from a version-enabled feature table to a topology.
Format
DBMS_WM.Add_Topo_Geometry_Layer(
topology IN VARCHAR2,
table_name IN VARCHAR2,
column_name IN VARCHAR2,
tg_layer_type IN VARCHAR2);
4-4
Chapter 4
AddAsParentWorkspace
Parameters
Parameter Description
Topology to which to add the topology geometry layer containing the
topology
topology geometries in the specified column. The topology must have
been created using the SDO_TOPO.CREATE_TOPOLOGY procedure.
Name of the topology geometry layer table containing the column
table_name
specified in column_name.
Usage Notes
This procedure has the same format and meaning as the
SDO_TOPO.ADD_TOPO_GEOMETRY_LAYER procedure, which is documented in
Oracle Spatial and Graph Topology Data Model and Network Data Model Graph
Developer's Guide. However, you must use DBMS_WM.Add_Topo_Geometry_Layer,
and not SDO_TOPO.ADD_TOPO_GEOMETRY_LAYER, to add a topology geometry
layer from a version-enabled feature table to a topology. For information about
Workspace Manager support for topologies, see Spatial and Graph Topology Support.
The first call to this procedure for a given topology creates the <topology-
name>_RELATION$ table, which is described in Oracle Spatial and Graph Topology
Data Model and Network Data Model Graph Developer's Guide.
An exception is raised if topology, table_name, or column_name does not exist, if
topology or table_name is not version-enabled, or if tg_layer_type is not one of the
supported values.
Examples
The following example adds a topology geometry layer to the CITY_DATA topology. The
topology geometry layer consists of polygon geometries in the FEATURE column of the
LAND_PARCELS table.
EXECUTE DBMS_WM.Add_Topo_Geometry_Layer('CITY_DATA', 'LAND_PARCELS', 'FEATURE',
'POLYGON');
4.2 AddAsParentWorkspace
Adds a workspace as a parent workspace to a child workspace in a multiparent
workspace environment.
Syntax
DBMS_WM.AddAsParentWorkspace(
workspace IN VARCHAR2,
parent_workspace IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE);
4-5
Chapter 4
AddAsParentWorkspace
Parameters
Parameter Description
Name of the workspace to which to add the parent workspace. The
workspace
name is case-sensitive.
Usage Notes
This procedure is part of the support for the multiparent workspaces feature, which is
described in Multiparent Workspaces. If workspace has only one parent workspace,
this procedure makes workspace a multiparent workspace. If workspace is already a
multiparent workspace, this procedure adds another parent workspace to workspace.
Examples
The following example adds Workspace4 as a parent workspace of Workspace3. (See
the hierarchy illustration in Multiparent Workspaces.)
-- Allow multiparent workspaces. (Required for AddAsParentWorkspace)
EXECUTE DBMS_WM.SetSystemParameter ('ALLOW_MULTI_PARENT_WORKSPACES', 'ON');
-- Make Workspace3 multiparent by adding Workspace4 as a parent.
EXECUTE DBMS_WM.AddAsParentWorkspace ('Workspace3', 'Workspace4');
4-6
Chapter 4
AddUserDefinedHint
4.3 AddUserDefinedHint
Adds a user-defined hint: that is, modifies (and thus overrides) a default optimizer
hint, with the goal of improving the performance of SQL statements executed by
the DBMS_WM package on a specified version-enabled table or all version-enabled
tables.
Syntax
DBMS_WM.AddUserDefinedHint(
hint_id IN NUMBER,
table_id IN VARCHAR2 DEFAULT NULL,
hint IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
Numeric ID that uniquely identifies the user-defined hint. Must match
hint_id
an existing hint ID used by Workspace Manager for one or more SQL
statements.
Name of the table to which to apply the hint. The name is not case-
table_id
sensitive. If this value is null, the hint is used with all version-enabled
tables for any SQL statements that specify the hint.
The text of the optimizer hint. For an explanation of optimizer hints,
hint
see the chapter about using optimizer hints in Oracle Database SQL
Tuning Guide.
Usage Notes
Use this procedure only if you are dissatisfied with the performance of any DBMS_WM
package operations, and if you know how to use application tracing and SQL optimizer
hints. For information about tracing, see the chapter about application tracing tools in
Oracle Database SQL Tuning Guide.
In the trace output, any SQL statements using the DBMS_WM package that allow a
user-defined hint include one or more comments in the following format:
/* WM$SQL (hint_id) (table_id) */
If you have identified a statement that is performing poorly, and if you know an
optimizer hint that will improve performance, you can use the AddUserDefinedHint
procedure to specify the hint that should be used for the specified hint ID. You can
also indicate whether to use the specified hint associated with the hint ID only for a
specified table, or for all tables.
If you specify the table_id parameter, the specified hint will be used only when SQL
statements that use the hint ID access the specified table, and the default Workspace
Manager-supplied hint will be used with other tables. If the table_id parameter is null,
the specified hint will be used when any DBMS_WM statement use the hint ID.
If the hint parameter specifies an object name (such as an index name), the table_id
parameter must not be null.
4-7
Chapter 4
AlterSavepoint
Any table aliases can be used within user-defined hints; however, standard scoping
rules still apply.
To remove a user-defined hint (that is, to cause the default hint associated with a hint
ID to be used), use the RemoveUserDefinedHint procedure.
Examples
The following example specifies a full table scan on the TABLE1 table and any
associated Workspace Manager infrastructure tables when a SQL statement specifies
hint ID 1101 with the SCOTT.TABLE1 table.
EXECUTE DBMS_WM.AddUSerDefinedHint (1101, 'scott.table1', 'full(t1)');
4.4 AlterSavepoint
Modifies the description of a savepoint.
Syntax
DBMS_WM.AlterSavepoint(
workspace IN VARCHAR2,
sp_name IN VARCHAR2,
sp_description IN VARCHAR2);
Parameters
Paramete Description
r
Name of the workspace in which the savepoint was created. The name is case-
workspace
sensitive.
Name of the savepoint. The name is case-sensitive.
sp_name
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 ALL_WORKSPACE_SAVEPOINTS.
An exception is raised if the user is not the workspace owner or savepoint owner or
does not have the WM_ADMIN system privilege.
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');
4-8
Chapter 4
AlterVersionedTable
4.5 AlterVersionedTable
Alters a version-enabled table to add valid time support, rename a constraint, or
rename an index.
Syntax
DBMS_WM.AlterVersionedTable(
table_name IN VARCHAR2,
alter_option IN VARCHAR2,
parameter_options IN VARCHAR2 DEFAULT NULL,
ignore_last_error IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the version-enabled table to which to add valid time support.
table_name
The name is not case-sensitive.
Usage Notes
Use this procedure to add valid time support, rename a constraint, or rename an index
for an existing version-enabled table. For more information about adding valid time
support, see Adding Valid Time Support to an Existing Table.
If the alter_option value is ADD_VALID_TIME, you can specify none, one, or more of
the following parameter_options keywords:
4-9
Chapter 4
AlterVersionedTable
• validFrom: Starting time period to be set in the WM_VALID column of all existing
rows. The default value is the current timestamp.
• validTill: Ending time period to be set in the WM_VALID column of all existing
rows. The default value is UNTIL_CHANGED.
• fmt: Date format. The default value is 'mmddyyyyhh24miss'. The options are
the same as for the TO_TIMESTAMP_TZ function, which is described in Oracle
Database SQL Language Reference.
• nlsparam: Globalization support options. The options and default are the same as
for the nlsparam argument to the TO_CHAR function for date conversion, which is
described in Oracle Database SQL Language Reference.
If the alter_option value is DDL, the currently supported operations for this procedure
are adding, merging, and splitting table partitions. You must have SYSDBA privileges,
and you must specify the following parameter_options keywords:
• index_owner: The name of the schema that owns the index to be renamed. The
schema name is not case-sensitive.
• index_name: The current name of the index to be renamed. The name is not
case-sensitive.
• new_index_name: The new name for the index. The name is not case-sensitive.
If the name of a constraint or index on a version-enabled table is longer than 26
characters, you must use the AlterVersionedTable procedure if you want to rename
the constraint or index; you cannot use the ALTER TABLE (for a constraint) or
ALTER INDEX (for an index) statement with the RENAME clause. If you use the
AlterVersionedTable procedure, you do not need to include it between calls to the
BeginDDL and CommitDDL procedures.
If the name of the constraint or index on a version-enabled table is 26 or fewer
characters long, you can do either of the following to rename the constraint or index:
use the AlterVersionedTable procedure, or use the ALTER TABLE (for a constraint) or
ALTER INDEX (for an index) statement with the RENAME clause between calls to the
4-10
Chapter 4
AlterVersionedTable
You can use double quotation marks for parameter values within the
parameter_options string. For example, the following two specifications are
semantically identical:
'index_owner=scott, index_name=my_index, new_index_name=my_new_index'
'index_owner="scott", index_name="my_index", new_index_name="my_new_index"'
If a call to the AlterVersionedTable procedure fails, you should try to fix the cause of
the error. Examine the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS static
data dictionary views to see the SQL statement and error message. Fix the cause
of the error, and then call the AlterVersionedTable 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 can ignore the error by calling the AlterVersionedTable
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:
• table_name does not exist.
• alterOptions is not ADD_VALID_TIME.
Examples
The following example creates a table named MY_TABLE, version-enables it without
valid time support, and then adds valid time support. After valid time support is added,
the WM_VALID column contains the default valid time period.
CREATE TABLE my_table (id NUMBER PRIMARY KEY);
EXECUTE DBMS_WM.EnableVersioning ('my_table');
4-11
Chapter 4
AlterWorkspace
ID
----------
1
ID
----------
WM_VALID(VALIDFROM, VALIDTILL)
--------------------------------------------------------------------------------
1
WM_PERIOD('09-JUN-2003 10:04:13 -04:00', NULL)
4.6 AlterWorkspace
Modifies the description of a workspace.
Syntax
DBMS_WM.AlterWorkspace(
workspace IN VARCHAR2,
workspace_description IN VARCHAR2);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
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 ALL_WORKSPACES.
An exception is raised if the user is not the workspace owner or does not have the
WM_ADMIN system privilege.
4-12
Chapter 4
BeginBulkLoading
Examples
The following example modifies the description of the NEWWORKSPACE workspace.
EXECUTE DBMS_WM.AlterWorkspace ('NEWWORKSPACE', 'Testing proposed scenario B');
4.7 BeginBulkLoading
Starts the bulk loading process for a version-enabled table.
Syntax
DBMS_WM.BeginBulkLoading(
table_name IN VARCHAR2,
workspace IN VARCHAR2,
version IN INTEGER DEFAULT NULL,
check_for_duplicates IN BOOLEAN DEFAULT TRUE,
ignore_last_error IN BOOLEAN DEFAULT FALSE,
single_transaction IN BOOLEAN DEFAULT FALSE,
savepoint_name IN DEFAULT LATEST);
Parameters
Parameter Description
Name of the version-enabled table into which data will be bulk
table_name
loaded. The name is not case-sensitive.
4-13
Chapter 4
BeginBulkLoading
Parameter Description
A Boolean value (TRUE or FALSE).
single_transaction
TRUE causes Workspace Manager not to perform an internal
commit operation after each of several steps that it will perform
after you call the CommitBulkLoading procedure, but instead to
perform a commit only after it has performed all the necessary
steps. TRUE also allows queries to be made on the version-
enabled table.
FALSE (the default) causes Workspace Manager to perform an
internal commit operation after each of several steps that it
will perform after you call the CommitBulkLoading procedure,
and it also disallows queries to be made on the table
until a CommitBulkLoading or RollbackBulkLoading operation is
complete.
See the Usage Notes for more information about this parameter.
The version in the workspace in which data will be bulk
savepoint_name
loaded. If specified, must be one of the following: LATEST or
ROOT_VERSION.
LATEST (the default) is the current version in the workspace.
ROOT_VERSION is the root version (version number 0, which is
in the LIVE workspace). The root version is the ancestor of all
other versions, so data in the root version is visible from all
other workspaces (unless non-LIVE workspaces have updated
the data). You can specify ROOT_VERSION only if workspace is
LIVE.
Usage Notes
Before you can begin bulk loading data into a version-enabled table, you must call the
BeginBulkLoading procedure. You must end the bulk loading session by calling either
the CommitBulkLoading procedure (to commit changes made when the data was
loaded) or the RollbackBulkLoading procedure (to roll back changes made when the
data was loaded). For more information about bulk loading with Workspace Manager,
see Bulk Loading into Version-Enabled Tables.
If single_transaction is FALSE (the default), the BeginBulkLoading procedure drops
some internal Workspace Manager views on the table, to prevent DML operations
and certain Workspace Manager operations on the table; however, this also prevents
any queries from being made using the specified version-enabled table. Regardless
of the single_transaction parameter value, and especially if it is FALSE, you should
complete the bulk loading as quickly as possible and at a time when applications
and users will not need to access the table. The value of the single_transaction
parameter must be the same for both the BeginBulkLoading and CommitBulkLoading
procedures for a bulk loading session with a specified table.
A TRUE value for the check_for_duplicates parameter does not cause any existing
data in the version-enabled table to be checked. If an existing row in the version in
which data is being bulk loaded (which could be the latest version of a workspace
or the root version) has the same primary key values as a row in the data to be
bulk loaded, the behavior depends on the history option setting for the table: if
VIEW_WO_OVERWRITE is set, the newly loaded row is chained to the existing row that
4-14
Chapter 4
BeginDDL
has the same primary key values; if VIEW_WO_OVERWRITE is not set, the new data is not
bulk loaded but is instead moved to the discards table.
If a call to the BeginBulkLoading procedure fails, you should try to fix the cause of
the error. Examine the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS static
data dictionary views to see the SQL statement and error message. Fix the cause
of the error, and then call the BeginBulkLoading 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
BeginBulkLoading 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.
If performance is an issue, carefully consider whether or not you need to check
for duplicate records, because a check_for_duplicates value of TRUE (the default)
causes Workspace Manager to perform additional internal processing.
An exception is raised if one or more of the following apply:
• table_name does not exist.
• table_name is not version-enabled.
• The user does not own the table or does not have the WM_ADMIN system privilege.
Examples
The following example starts the bulk load operation into the EMP table in the W1
workspace.
EXECUTE DBMS_WM.BeginBulkLoading ('EMP', 'W1');
4.8 BeginDDL
Starts a DDL (data definition language) session for a specified table.
Syntax
DBMS_WM.BeginDDL(
table_name IN VARCHAR2);
Parameters
Parameter Description
Name of the version-enabled table. The name is not case-sensitive.
table_name
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 or
RollbackDDL procedure.
4-15
Chapter 4
BeginResolve
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');
4.9 BeginResolve
Starts a conflict resolution session.
Syntax
DBMS_WM.BeginResolve(
workspace IN VARCHAR2);
4-16
Chapter 4
ChangeWorkspaceType
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
This procedure starts a conflict resolution session. While this procedure is executing,
the workspace is frozen in 1WRITER mode, as explained in Freezing and Unfreezing
Workspaces.
After calling this procedure, you can execute the ResolveConflicts procedure as
needed for various tables that have conflicts, and then call either the CommitResolve
or RollbackResolve procedure. For more information about conflict resolution, see
Resolving Conflicts Before a Merge or Refresh Operation.
An exception is raised if one or more of the following apply:
• There are one or more open database transactions in workspace.
• The user executing the BeginResolve procedure does not have the privilege to
access workspace and its parent workspace.
Examples
The following example starts a conflict resolution session in Workspace1.
EXECUTE DBMS_WM.BeginResolve ('Workspace1');
4.10 ChangeWorkspaceType
Changes a workspace from not continually refreshed to continually refreshed.
(Continually refreshed workspaces are explained in Continually Refreshed
Workspaces.)
Syntax
DBMS_WM.ChangeWorkspaceType(
workspace IN VARCHAR2,
workspace_type IN VARCHAR2 DEFAULT DBMS_WM.CR_WORKSPACE_TYPE,
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the workspace. The name is case-
workspace
sensitive.
4-17
Chapter 4
CommitBulkLoading
Parameter Description
Must be DBMS_WM.CR_WORKSPACE_TYPE (the
workspace_type
default), for continually refreshed.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of
Workspace Manager Operations.
Usage Notes
For this release, you can only change a workspace that is not continually refreshed
to continually refreshed; you cannot change a continually refreshed workspace to not
continually refreshed.
An exception is raised if one or more of the following occur:
• The user is not the owner of workspace, and the user does not have the WM_ADMIN
system privilege.
• workspace_type is not valid.
• auto_commit is TRUE and an open transaction exists in a parent or child workspace
of any table that needs to be modified.
• The workspace type cannot be changed. For example, the change cannot be
made if the Workspace Manager system parameter CR_WORKSPACE_MODE is set
to PESSIMISTIC_LOCKING, but the NONCR_WORKSPACE_MODE parameter is set to
OPTIMISTIC_LOCKING and there is versioned data in any continually refreshed
workspace.
Examples
The following example changes the NEWWORKSPACE workspace type from not continually
refreshed to continually refreshed.
EXECUTE DBMS_WM.ChangeWorkspaceType ('NEWWORKSPACE');
4.11 CommitBulkLoading
Ends the bulk loading process for a version-enabled table by committing the bulk load
changes.
4-18
Chapter 4
CommitBulkLoading
Syntax
DBMS_WM.CommitBulkLoading(
table_name IN VARCHAR2,
discards_table IN VARCHAR2,
check_for_duplicates IN BOOLEAN DEFAULT TRUE,
enforceUCFlag IN BOOLEAN DEFAULT TRUE,
enforceRICFlag IN BOOLEAN DEFAULT TRUE,
ignore_last_error IN BOOLEAN DEFAULT FALSE,
single_transaction IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the version-enabled table into which data has been
table_name
bulk loaded. The name is not case-sensitive.
Name of the table into which discard records are inserted. The
discards_table
name is not case-sensitive. If the table does not already exist,
it is created.
A Boolean value (TRUE or FALSE). Note: Effective with Release
check_for_duplicates
12.1, this parameter is ignored; the value from the call to the
BeginBulkLoading procedure is used.
TRUE (the default) checks for rows in the data to be bulk loaded
that have the same values in primary key columns. For any
duplicate records, only the record with the lowest ROWID value
is kept in the table, and the rest are moved to the discards
table. See the Usage Notes for more information about this
parameter.
FALSE does not check if any rows in the data to be bulk loaded
have the same values in primary key columns.
A Boolean value (TRUE or FALSE).
enforceUCFlag
TRUE (the default) enforces any unique constraints defined
on to_table, ensuring that the bulk load operation does not
violate any such constraints.
FALSE does not enforce any unique constraints defined on
to_table for the bulk load operation.
A Boolean value (TRUE or FALSE).
enforceRICFlag
TRUE (the default) enforces any referential integrity constraints
defined on to_table, ensuring that the bulk load operation
does not violate any such constraints.
FALSE does not enforce any referential integrity constraints
defined on to_table for the bulk load operation.
4-19
Chapter 4
CommitBulkLoading
Parameter Description
A Boolean value (TRUE or FALSE).
ignore_last_error
TRUE ignores the last error, if any, that occurred during the
previous call to the CommitBulkLoading procedure. Information
about the last error is stored in the USER_WM_VT_ERRORS
and ALL_WM_VT_ERRORS static data dictionary views,
which are described in Workspace Manager Static Data
Dictionary Views . 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 CommitBulkLoading
procedure.
A Boolean value (TRUE or FALSE). Note: Effective with Release
single_transaction
12.1, this parameter is ignored; the value from the call to the
BeginBulkLoading procedure is used.
TRUE causes Workspace Manager not to perform an internal
commit operation after each of several steps that it performs
after you call the CommitBulkLoading procedure, but instead to
perform a commit only after it has performed all the necessary
steps.
FALSE (the default) causes Workspace Manager to perform an
internal commit operation after each of several steps that it
performs after you call the CommitBulkLoading procedure.
The value of this parameter must be the same as when you
called the BeginBulkLoading procedure specifying the table in
table_name.
Usage Notes
For information about the requirements for bulk loading data into version-enabled
tables, see Bulk Loading into Version-Enabled Tables.
This procedure generates versioning metadata for newly loaded data and
synchronizes the newly loaded data with the existing versioned data in the table. It can
also enforce unique and referential constraints on the newly loaded data. It re-creates
all the views that were dropped by the BeginBulkLoading procedure.
A TRUE value for the check_for_duplicates parameter does not cause any existing
data in the version-enabled table to be checked. If an existing row in the version in
which data is being bulk loaded (which could be the latest version of a workspace
or the root version) has the same primary key values as a row in the data to be
bulk loaded, the behavior depends on the history option setting for the table: if
VIEW_WO_OVERWRITE is set, the newly loaded row is chained to the existing row that
has the same primary key values; if VIEW_WO_OVERWRITE is not set, the new data is not
bulk loaded but is instead moved to the discards table.
If a call to the CommitBulkLoading procedure fails, you should try to fix the cause of
the error. Examine the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS static
data dictionary views to see the SQL statement and error message. Fix the cause
of the error, and then call the CommitBulkLoading 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
4-20
Chapter 4
CommitDDL
Examples
The following example commits changes made to the EMP table during a bulk load
operation, and specifies DISCARDS as the table to hold discard records.
EXECUTE DBMS_WM.CommitBulkLoading ('EMP', 'DISCARDS');
4.12 CommitDDL
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,
enforce_unique_constraints IN BOOLEAN DEFAULT FALSE,
enforce_RICs IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the version-enabled table. The name is not case-
table_name
sensitive.
4-21
Chapter 4
CommitDDL
Parameter Description
A Boolean value (TRUE or FALSE).
ignore_last_error
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
static data dictionary views, which are described in
Workspace Manager Static Data Dictionary Views . 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.
A Boolean value (TRUE or FALSE).
enforce_unique_constraints
TRUE enforces any unique constraints defined on
table_name on existing versioned data in the table. This
ensures that the DDL changes do not cause any such
constraints to be violated, but it causes Workspace Manager
to take additional time to perform the operation.
FALSE (the default) does not enforce any unique constraints
defined on table_name on existing versioned data in the
table.
A Boolean value (TRUE or FALSE).
enforce_RICs
TRUE enforces any referential integrity constraints defined on
table_name on existing versioned data in the table. This
ensures that the changes do not cause any such constraints
to be violated, but it causes Workspace Manager to take
additional time to perform the operation.
FALSE (the default) does not enforce any referential integrity
constraints defined on table_name on existing versioned
data in the table.
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 was created by the BeginDDL procedure.
For detailed information about performing DDL operations related to version-enabled
tables, see DDL Operations Related to Version-Enabled Tables.
The enforce_unique_constraints and enforce_RICs parameter settings apply only
to existing versioned data, and do not affect whether or not existing constraints are
enforced for future DML operations on the table.
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 static data dictionary 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
4-22
Chapter 4
CommitResolve
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:
• table_name does not exist or is not version-enabled.
• table_name has a domain index defined on it, and the user has not been directly
granted the CREATE TABLE and CREATE SEQUENCE privileges.
• An open DDL session does not exist for table_name. (That is, the BeginDDL
procedure has not been called specifying this table, or the CommitDDL or
RollbackDDL procedure was already called specifying this table.)
Some invalid DDL operations also cause an exception when CommitDDL procedure is
called. See DDL Operations Related to Version-Enabled Tables 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');
4.13 CommitResolve
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
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
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 Resolving Conflicts Before a Merge
or Refresh Operation.
4-23
Chapter 4
CompressWorkspace
Examples
The following example ends the conflict resolution session in Workspace1 and saves all
changes.
EXECUTE DBMS_WM.CommitResolve ('Workspace1');
4.14 CompressWorkspace
Deletes removable savepoints in a workspace and minimizes the Workspace Manager
metadata structures for the workspace. (Removable savepoints are explained in Using
Savepoints.)
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,
commit_in_batches IN BOOLEAN DEFAULT FALSE,
batch_size IN VARCHAR2 DEFAULT 'PRIMARY_KEY_RANGE',
remove_latest_deleted_rows IN BOOLEAN DEFAULT FALSE);
or
DBMS_WM.CompressWorkspace(
workspace IN VARCHAR2,
firstSP IN VARCHAR2 DEFAULT NULL,
secondSP IN VARCHAR2 DEFAULT NULL,
auto_commit IN BOOLEAN DEFAULT TRUE,
commit_in_batches IN BOOLEAN DEFAULT FALSE,
batch_size IN VARCHAR2 DEFAULT 'PRIMARY_KEY_RANGE',
remove_latest_deleted_rows IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
4-24
Chapter 4
CompressWorkspace
Parameter Description
A Boolean value (TRUE or FALSE).
compress_view_wo_overwrite
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.
First savepoint. Savepoint names are case-sensitive.
firstSP
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.
Second savepoint. All removable savepoints from firstSP
secondSP
(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.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager
Operations.
4-25
Chapter 4
CompressWorkspace
Parameter Description
A Boolean value (TRUE or FALSE).
commit_in_batches
TRUE causes an internal commit operation to be performed
after compression operations on batch_size rows in
version-enabled tables. Periodic commit operations can
be useful or necessary if version-enabled tables have
many rows affected by the compression, which can cause
substantial Oracle database resources (such as rollback
segments and undo tablespaces) to be used. If you specify
TRUE, the auto_commit value must also be TRUE.
FALSE (the default) causes internal commit operations not to
be performed during the compression operation.
Batch size for internal commit operations if
batch_size
commit_in_batches is TRUE; otherwise, the parameter
is ignored. If specified, must be TABLE or
PRIMARY_KEY_RANGE.
TABLE causes an internal commit operation to be performed
after compressing each version-enabled table that needs to
be compressed.
PRIMARY_KEY_RANGE specifies that each table is divided
into batches of different ranges of primary key values,
and an internal commit operation is to be performed
after compressing each batch of rows in each version-
enabled table that needs to be compressed. You
must previously have generated statistics on the first
column of the primary key, such as by using the
DBMS_STATS.GATHER_TABLE_STATS procedure on the
<table_name>_LT table associated with each affected
version-enabled table. See the Usage Notes for more
information. The following example generates histogram
statistics:
EXECUTE DBMS_STATS.GATHER_TABLE_STATS('',
'cola_marketing_budget_lt',
estimate_percent=>50, method_opt=>'FOR COLUMNS
SIZE 50 product_id');
A Boolean value (TRUE or FALSE).
remove_latest_deleted_rows
TRUE causes any LATEST row that has been deleted and that
will not adversely affect conflict resolution to be removed, if
workspace is LIVE. A value of TRUE is ignored for other
workspaces.)
FALSE (the default) causes any LATEST row that has been
deleted to be preserved.
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:
• You can reuse savepoint names after they are deleted. (You cannot create a
savepoint that has the same name as an existing savepoint.)
4-26
Chapter 4
CompressWorkspace
• Less disk storage is used for Workspace Manager structures (fewer table rows,
smaller indexes, less Workspace Manager metadata).
• Because of the reduction in disk space usage, runtime performance for
Workspace Manager operations is improved.
This procedure deletes implicit savepoints only if they do not have any child
dependencies, and the existence of any such non-removable savepoints will not allow
the entire range to be compressed as a single unit. However, you can remove or move
such savepoints by using the RemoveWorkspace or RefreshWorkspace procedure,
respectively.
While this procedure is executing, the current workspace is frozen in NO_ACCESS mode,
as explained in Freezing and Unfreezing Workspaces.
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 operation
or a GotoSavepoint 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.
If you expect to purge a subset of your historical data periodically, such as removing
historical data older than one year, plan to create a savepoint at each expected
deletion point on the day it occurs. For example, if you plan to purge 2005 historical
data when it is a year old, you need to create a savepoint on January 1, 2006. Then,
on January 1, 2007 you can call the CompressWorkspace procedure, specifying the
workspace name and the January 1, 2006 savepoint, to delete all history that occurred
before 2006.
To see if a version-enabled table can be compressed in primary key range batches,
check the value of the BATCH_SIZE column in the WM_COMPRESS_BATCH_SIZES
metadata view, which is described in WM_COMPRESS_BATCH_SIZES.
To specify a batch_size value of PRIMARY_KEY_RANGE, you must first generate
either histogram statistics (for columns of type NUMBER, INTEGER, DATE, TIMESTAMP,
CHAR, or VARCHAR2) or general statistics (for columns of type NUMBER, INTEGER,
DATE, or TIMESTAMP) on the first column of the primary key. The procedure
DBMS_STATS.GATHER_TABLE_STATS generates general statistics. If general but
not histogram statistics are available for columns of type NUMBER, INTEGER, DATE, or
TIMESTAMP, the Workspace Manager system parameter NUMBER_OF_COMPRESS_BATCHES
is used to compute the number of batches when batch_size is specified as
PRIMARY_KEY_RANGE. For more information about statistics, see Oracle Database
Performance Tuning Guide.
If the current version within the specified workspace needs to be compressed,
Workspace Manager attempts to acquire a Shared Sub eXclusive lock of the
workspace. If the lock is not acquired, no error is raised, but the current version is
not compressed. (See Locks Taken for Workspace Manager Operations.)
An exception is raised if auto_commit is TRUE and an open transaction exists, if
the user does not have sufficient privileges on all tables that need to be modified
(including, for example, tables modified by triggers), or if the user does not have the
privilege to access and merge changes in workspace.
4-27
Chapter 4
CompressWorkspaceTree
Examples
The following example compresses NEWWORKSPACE.
EXECUTE DBMS_WM.CompressWorkspace ('NEWWORKSPACE');
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);
4.15 CompressWorkspaceTree
Deletes removable savepoints in a workspace and all its descendant workspaces.
(Removable savepoints are explained in Using Savepoints.) 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,
commit_in_batches IN BOOLEAN DEFAULT FALSE,
batch_size IN VARCHAR2 DEFAULT 'PRIMARY_KEY_RANGE',
remove_latest_deleted_rows IN BOOLEAN DEFAULT FALSE);
4-28
Chapter 4
CompressWorkspaceTree
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
4-29
Chapter 4
CompressWorkspaceTree
Parameter Description
Batch size for internal commit operations if
batch_size
commit_in_batches is TRUE; otherwise, the parameter
is ignored. If specified, must be TABLE or
PRIMARY_KEY_RANGE.
TABLE causes an internal commit operation to be performed
after compressing each version-enabled table that needs to
be compressed.
PRIMARY_KEY_RANGE specifies that each table is divided
into batches of different ranges of primary key values,
and an internal commit operation is to be performed after
compressing each batch of rows in each version-enabled
table that needs to be compressed. You must previously have
generated statistics on the first column of the primary key,
such as by using the DBMS_STATS.GATHER_TABLE_STATS
procedure on the <table_name>_LT table associated with
each affected version-enabled table. See the Usage Notes for
more information. The following example generates histogram
statistics:
EXECUTE DBMS_STATS.GATHER_TABLE_STATS('',
'cola_marketing_budget_lt',
estimate_percent=>50, method_opt=>'FOR COLUMNS
SIZE 50 product_id');
A Boolean value (TRUE or FALSE).
remove_latest_deleted_rows
TRUE causes any LATEST row that has been deleted and that
will not adversely affect conflict resolution to be removed, if
workspace is LIVE. A value of TRUE is ignored for other
values of the workspace parameter.)
FALSE (the default) causes any LATEST row that has been
deleted to be preserved.
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 example, in
the hierarchy shown in Workspace Hierarchy, a CompressWorkspaceTree operation
specifying Workspace1 compresses Workspace1, Workspace2, and Workspace3. (For
an explanation of database workspace hierarchy, see Workspace Hierarchy.)
The compression operation is useful for the following reasons:
• You can reuse savepoint names after they are deleted. (You cannot create a
savepoint that has the same name as an existing savepoint.)
• Runtime performance for Workspace Manager operations is improved.
• Less disk storage is used for Workspace Manager structures.
While this procedure is executing, the current workspace is frozen in NO_ACCESS mode,
as explained in Freezing and Unfreezing Workspaces.
4-30
Chapter 4
CompressWorkspaceTree
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 ('NEWWORKSPACE', auto_commit => FALSE);
The following example compresses NEWWORKSPACE and all its descendant workspaces;
accepts the default value for the compress_view_wo_overwrite and auto_commit
parameters; specifies TRUE for the commit_in_batches parameter; and specifies
PRIMARY_KEY_RANGE for the batch_size parameter.
EXECUTE DBMS_WM.CompressWorkspaceTree ('NEWWORKSPACE', NULL, NULL, TRUE,
'PRIMARY_KEY_RANGE');
4-31
Chapter 4
CopyForUpdate
4.16 CopyForUpdate
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
Parameter Description
Name of the table containing one or more LOB columns. The name is
table_name
not case-sensitive.
The WHERE clause (excluding the WHERE keyword) identifying the rows
where_clause
affected. Example: 'department_id = 20'
Only primary key columns can be specified in the WHERE clause, except
in a subquery. The subquery can refer to columns that are not primary
keys, but it cannot refer to a version-enabled table.
If the where_clause parameter 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');
End;
4-32
Chapter 4
CopyWorkspace
4.17 CopyWorkspace
Copies all of the rows modified in a specified workspace into a target workspace.
Syntax
DBMS_WM.CopyWorkspace(
source_workspace IN VARCHAR2,
target_workspace IN VARCHAR2);
Parameters
Parameter Description
Name of the source workspace. The name is case-sensitive.
source_workspace
Usage Notes
This procedure copies all of the rows that have been modified in the source workspace
into the target workspace. Only tables that do not use the validtime option will be
copied. There is no conflict checking done between the two workspaces, so any
rows that already exist in the target workspace will be overwritten. For each row that
exits in the source workspace, the appropriate DML will be performed in the target
workspace. For example, if a row was inserted into the source but the row already
exists in the target, then the row in the target will be updated with the column values
from the source. Or, if a row is updated in the source but the row was deleted in the
target, then the row will be inserted into the target.
Once all of the rows are copied into the target workspace, all unique, check, and
foreign key constraints will be enforced on the target workspace to ensure the data
remains valid. If a constraint violation is found, an error will be raised and the operation
will be rolled back.
If a row in the source has been locked in exclusive or shared mode, it will not be
possible to copy the row into the target, and an error will be raised. Similarly, if the
target workspace has a default lock mode set by previously having executed the
SetWorkspaceLockModeON procedure, then an error will be raised in this case as
well, due to the row already having been versioned. As a result, it is recommended
not to have locking enabled, other than workspace-exclusive, on either the source or
target workspaces. In addition, if the target workspace uses the pessimistic locking
setting, then an error will be raised when attempting to copy the rows to the target
workspace.
The changes to the target workspace are performed in the currently open transaction,
or a new transaction is started if one does not yet exist.
An exception is raised if one or more of the following apply:
• The target and source workspace are the same workspace .
• The target or source workspace parameter is 'LIVE' .
4-33
Chapter 4
CreateSavepoint
Examples
The following example copies any rows modified in the child_1 workspace into
child_2. Both workspace are child workspace of LIVE.
EXECUTE DBMS_WM.CopyWorkspace('child_1', 'child_2');
4.18 CreateSavepoint
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
Parameter Description
Name of the workspace in which to create the savepoint. The name is
workspace
case-sensitive.
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, but only if these transactions have not modified a
versioned table.
4-34
Chapter 4
CreateWorkspace
While this procedure is executing, the current workspace is frozen in READ_ONLY mode,
as explained in Freezing and Unfreezing Workspaces.
An exception is raised if one or more of the following apply:
• The user is not in the latest version in the workspace (for example, if the user has
called the GotoDate procedure).
• workspace does not exist.
• savepoint_name already exists.
• auto_commit is TRUE and an open transaction exists in a parent or child workspace
of any table that needs to be modified.
• The user does not have the privilege to go to the specified workspace.
Examples
The following example creates a savepoint named Savepoint1 in the NEWWORKSPACE
workspace.
EXECUTE DBMS_WM.CreateSavepoint ('NEWWORKSPACE', 'Savepoint1');
4.19 CreateWorkspace
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
Parameter Description
Name of the workspace. The name is case-sensitive, and
workspace
it must be unique (no other workspace of the same name).
The name must not contain any of the following characters:
" (double quotes), ' (single quote), ` (grave accent), or |
(vertical bar).
4-35
Chapter 4
CreateWorkspace
Parameter Description
A Boolean value (TRUE or FALSE).
isrefreshed
TRUE causes the workspace to be continually refreshed.
In a continually refreshed workspace (described in
Continually Refreshed Workspaces), changes made in
the parent workspace are automatically applied to the
workspace whenever data changes are committed in the
parent workspace or are merged into the parent workspace
from another child 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 of the workspace.
description
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 Workspace Hierarchy.
The owner of the workspace is the user that executed the CreateWorkspace
procedure (or another procedure that executed the CreateWorkspace procedure), not
the user that had the active permissions at the time the workspace was being created.
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 Using Savepoints.
While this procedure is executing, the current workspace is frozen in READ_ONLY mode,
as explained in Freezing and Unfreezing Workspaces.
This procedure does not implicitly go to the workspace created. To go to the
workspace, use the GotoWorkspace procedure.
4-36
Chapter 4
Delete_Topo_Geometry_Layer
Examples
The following example creates a workspace named NEWWORKSPACE in the database.
EXECUTE DBMS_WM.CreateWorkspace ('NEWWORKSPACE');
4.20 Delete_Topo_Geometry_Layer
Deletes a topology geometry layer from a topology.
Format
DBMS_WM.Delete_Topo_Geometry_Layer(
topology IN VARCHAR2,
table_name IN VARCHAR2,
column_name IN VARCHAR2);
Parameters
Parameter Description
Topology from which to delete the topology geometry layer containing
topology
the topology geometries in the specified column. The topology must have
been created using the SDO_TOPO.CREATE_TOPOLOGY procedure.
Name of the topology geometry layer table containing the column
table_name
specified in column_name.
Usage Notes
This procedure has the same format and meaning as
the SDO_TOPO.DELETE_TOPO_GEOMETRY_LAYER procedure, which is
documented in Oracle Spatial and Graph Topology Data Model
and Network Data Model Graph Developer's Guide. However,
you must use DBMS_WM.Delete_Topo_Geometry_Layer, and not
SDO_TOPO.DELETE_TOPO_GEOMETRY_LAYER, to delete a topology geometry
4-37
Chapter 4
DeleteSavepoint
layer from a version-enabled feature table from a topology. For information about
Workspace Manager support for topologies, see Spatial and Graph Topology Support.
This procedure deletes data associated with the specified topology geometry layer
from the edge, node, and face tables (described in Oracle Spatial and Graph Topology
Data Model and Network Data Model Graph Developer's Guide).
An exception is generated if topology or table_name is not version-enabled, or if
table_name is the only feature table in topology.
Examples
The following example deletes the topology geometry layer that is based on the
geometries in the FEATURE column of the LAND_PARCELS table from the topology named
CITY_DATA.
EXECUTE DBMS_WM.Delete_Topo_Geometry_Layer('CITY_DATA', 'LAND_PARCELS',
'FEATURE');
4.21 DeleteSavepoint
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,
commit_in_batches IN BOOLEAN DEFAULT FALSE,
batch_size IN VARCHAR2 DEFAULT 'PRIMARY_KEY_RANGE');
Parameters
Parameter Description
Name of the workspace in which the savepoint was created.
workspace
The name is case-sensitive.
4-38
Chapter 4
DeleteSavepoint
Parameter Description
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager
Operations.
A Boolean value (TRUE or FALSE).
commit_in_batches
TRUE causes an internal commit operation to be performed
after compression operations on batch_size rows in
version-enabled tables. Periodic commit operations can be
useful or necessary if version-enabled tables have many
rows affected by the savepoint deletion, which can cause
substantial Oracle database resources (such as rollback
segments and undo tablespaces) to be used. If you specify
TRUE, the auto_commit value must also be TRUE.
FALSE (the default) causes internal commit operations not to
be performed during the savepoint deletion operation.
Batch size for internal commit operations if
batch_size
commit_in_batches is TRUE; otherwise, the parameter
is ignored. If specified, must be TABLE or
PRIMARY_KEY_RANGE.
TABLE causes an internal commit operation to be performed
after compressing each version-enabled table that needs to
be compressed.
PRIMARY_KEY_RANGE specifies that each table is divided
into batches of different ranges of primary key values,
and an internal commit operation is to be performed
after compressing each batch of rows in each version-
enabled table that needs to be compressed. You
must previously have generated statistics on the first
column of the primary key, such as by using the
DBMS_STATS.GATHER_TABLE_STATS procedure on the
<table_name>_LT table associated with each affected
version-enabled table. See the Usage Notes for more
information. The following example generates histogram
statistics:
EXECUTE DBMS_STATS.GATHER_TABLE_STATS('',
'cola_marketing_budget_lt',
estimate_percent=>50, method_opt=>'FOR COLUMNS
SIZE 50 product_id');
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).
4-39
Chapter 4
DisableVersioning
Examples
The following example deletes a savepoint named Savepoint1 in the NEWWORKSPACE
workspace.
EXECUTE DBMS_WM.DeleteSavepoint ('NEWWORKSPACE', 'Savepoint1');
4.22 DisableVersioning
Deletes all support structures that were created to enable the table to support
versioned rows.
4-40
Chapter 4
DisableVersioning
Syntax
DBMS_WM.DisableVersioning(
table_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE,
ignore_last_error IN BOOLEAN DEFAULT FALSE,
isTopology IN BOOLEAN DEFAULT FALSE,
keepWMValid IN BOOLEAN DEFAULT TRUE,
undo_space IN VARCHAR2 DEFAULT NULL;
Parameters
Parameter Description
Name of the table or (if isTopology is TRUE) Oracle Spatial and
table_name
Graph topology, or a comma-delimited list of names of tables related
by multilevel referential integrity constraints. (Multilevel referential
integrity constraints are explained in Referential Integrity Support.)
Table names are not case-sensitive.
A Boolean value (TRUE or FALSE).
force
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.
A Boolean value (TRUE or FALSE).
ignore_last_error
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 static data dictionary views, which are
described in Workspace Manager Static Data Dictionary Views . 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.
A Boolean value (TRUE or FALSE).
isTopology
TRUE indicates that the value specified for the table_name
parameter is the name of an Oracle Spatial and Graph topology (not
a database table name), as explained in Spatial and Graph Topology
Support.
FALSE (the default) indicates that the value specified for the
table_name parameter is not an Oracle Spatial and Graph topology
name.
A Boolean value (TRUE or FALSE). Applies only if valid time support
keepWMValid
(described in Workspace Manager Valid Time Support) has been
enabled for the table.
TRUE (the default) causes the WM_VALID column and all data in that
column to be kept in the table after the procedure completes.
FALSE causes the WM_VALID column to be dropped and all data in
that column deleted as a result of the procedure. Only the current row
for each primary key value is kept.
4-41
Chapter 4
DisableVersioning
Parameter Description
The string UNLIMITED (for no specified limit) or a number
undo_space
representing the maximum number of bytes for undo space
available for the version-enable operation. Example: '1048576'
for 1 megabyte. Any value specified overrides the value of the
UNDO_SPACE Workspace Manager system parameter (described in
System Parameters for Workspace Manager).
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 table_name has valid time support (described in Workspace Manager Valid Time
Support), this procedure deletes the WM_VALID column and all data in that column. If
deleting the WM_VALID column would cause a primary key constraint violation, only the
row valid at the current time is retained.
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 static data dictionary 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 table contains much data in workspaces and the size of the undo tablespace
required for the DisableVersioning procedure is not sufficient.
• A compilation error occurred while transferring user-defined triggers from the
version-enabled table to the version-disabled table.
The DisableVersioning operation fails if the force value is FALSE and any of the
following apply:
• The table is being modified by any user in any workspace other than the LIVE
workspace.
• There are versioned rows of the table in any workspace other than the LIVE
workspace.
Only the owner of a table or a user with the WM_ADMIN system privilege 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.
4-42
Chapter 4
EnableVersioning
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');
4.23 EnableVersioning
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',
isTopology IN BOOLEAN DEFAULT FALSE,
validTime IN BOOLEAN DEFAULT FALSE,
undo_space IN VARCHAR2 DEFAULT NULL,
validTimeRange IN WM_PERIOD DEFAULT NULL);
Parameters
Parameter Description
Name of the table or (if isTopology is TRUE) Oracle Spatial and
table_name
Graph topology, or a comma-delimited list of names of tables related by
multilevel referential integrity constraints. (Multilevel referential integrity
constraints are explained in Referential Integrity Support.) The length
of a table name must not exceed 25 characters. The table must not
contain any columns with names that start with WM_ or WM$. The table
name and any column names must not contain any characters that
need to be quoted, such as (but not restricted to) !, ?, or *. The table
name is not case-sensitive.
4-43
Chapter 4
EnableVersioning
Parameter Description
History option, for tracking modifications to table_name. Must be one
hist
of the following values:
NONE: The timestamps for modifications to the table are not tracked.
(This is the default.) A view named <table_name>_HIST (described
in xxx_HIST Views) is created to contain limited history information,
but it will show only the most recent modifications to the same
version of the table, and it will not contain the WM_CREATETIME and
WM_RETIRETIME columns. A history of modifications to the version
is not maintained; that is, subsequent changes to a row in the same
version overwrite earlier changes.
VIEW_W_OVERWRITE: The with overwrite (W_OVERWRITE) option. A
view named <table_name>_HIST (described in xxx_HIST Views) 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.
VIEW_WO_OVERWRITE: The without overwrite (WO_OVERWRITE)
option. A view named <table_name>_HIST (described in xxx_HIST
Views) 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.
A Boolean value (TRUE or FALSE).
isTopology
TRUE indicates that the value specified for the table_name parameter
is the name of an Oracle Spatial and Graph topology (not a database
table name), as explained in Spatial and Graph Topology Support.
FALSE (the default) indicates that the value specified for the
table_name parameter is not an Oracle Spatial and Graph topology
name.
A Boolean value (TRUE or FALSE).
validTime
TRUE causes valid time support to be included. Workspace Manager
valid time support is explained in Workspace Manager Valid Time
Support.
FALSE (the default) causes valid time support not to be included.
A string containing UNLIMITED (for no specified limit) or a number
undo_space
representing the maximum number of bytes for undo space available
for the version-enable operation. Example: '1048576' for 1 megabyte.
Any value specified overrides the value of the UNDO_SPACE Workspace
Manager system parameter (described in System Parameters for
Workspace Manager).
An object of type WM_PERIOD (explained in WM_PERIOD Data Type)
validTimeRange
that specifies the initial valid time range for the WM_VALID column. If
you specify a value, you must also specify the validTime parameter
value as TRUE. By default, if valid time support is included, the valid time
range is from the current system time and until changed.
Usage Notes
The table that is being version-enabled must have a primary key defined. The primary
key can be a composite (multicolumn) primary key.
4-44
Chapter 4
EnableVersioning
Only the owner of a table or a user with the WM_ADMIN system privilege 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, and version-enabled tables cannot
have any associated indexes or triggers owned by SYS.
4-45
Chapter 4
Export
• Constraints and privileges defined on the table are carried over to the version-
enabled table.
• DDL operations on version-enabled tables are subject to the procedures and
restrictions described in DDL Operations Related to Version-Enabled Tables.
• Index-organized tables cannot be version-enabled.
• Object tables cannot be version-enabled.
• A table with one or more columns of LONG data type cannot be version-enabled.
• A table with one or more nested table columns cannot be version-enabled unless
the ALLOW_NESTED_TABLE_COLUMNS Workspace Manager system parameter is set to
ON.
• A table that has a redaction policy defined on it cannot be version-enabled.
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');
4.24 Export
Exports data from a version-enabled table (all rows, or as limited by any combination
of several parameters) to a staging table.
Syntax
DBMS_WM.Export(
table_name IN VARCHAR2,
staging_table IN VARCHAR2,
workspace IN VARCHAR2,
where_clause IN VARCHAR2 DEFAULT NULL,
export_scope IN VARCHAR2 DEFAULT DBMS_WM.EXPORT_MODIFIED_DATA_ONLY,
after_savepoint_name IN VARCHAR2 DEFAULT NULL,
as_of_savepoint_name IN VARCHAR2 DEFAULT NULL,
after_instant IN DATE DEFAULT NULL,
as_of_instant IN DATE DEFAULT NULL,
versioned_db IN BOOLEAN DEFAULT TRUE,
overwrite_existing_data IN BOOLEAN DEFAULT FALSE,
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the table containing the data to be exported. The
table_name
name is not case-sensitive.
4-46
Chapter 4
Export
Parameter Description
Name of the table to hold the exported data. Must not exceed
staging_table
25 characters. The name is not case-sensitive. If the table
does not exist, a new table with this name is created, with a
structure suitable for Workspace Manager export and import
operations. (See the Usage Notes for more information about
the staging table.)
Name of the workspace from which to export the data. The
workspace
name is case-sensitive.
4-47
Chapter 4
Export
Parameter Description
A Boolean value (TRUE or FALSE).
versioned_db
TRUE (the default) creates a staging table that contains
versioning information.
FALSE creates a staging table that contains only user-defined
columns and user-visible data.
A Boolean value (TRUE or FALSE).
overwrite_existing_data
TRUE overwrites existing data in the staging table with the
data that is exported.
FALSE (the default) preserves all existing data in the staging
table, and raises an exception if the exported data conflicts
with the existing data.
A Boolean value (TRUE or FALSE).
auto_commit
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
Autocommitting of Workspace Manager Operations.
Usage Notes
All data that satisfies the where_clause in the version-enabled table table_name, the
export_scope parameter, and any parameters relating to a time or a savepoint in
workspace is exported to the staging table (staging_table parameter).
The staging table must be in the current user's schema; or if it is in another schema,
the current user must have the CREATE ANY TABLE and INSERT ANY TABLE privileges.
4-48
Chapter 4
Export_Schemas
If versioned_db is TRUE, the staging table has three metadata columns in addition to all
user-defined columns. The three added metadata columns are WM$DELETEDROW,
and two invisible columns (WM$FLAG and WM$WORKSPACE) that are used
internally. You can use the WM$DELETEDROW column to determine if the row was in
a deleted form in the source workspace.
An exception is raised if one or more of the following apply:
• A specified table, workspace, or savepoint does not exist.
• table_name contains a nested table column.
• table_name contains a column named WM_VALID of type WM_PERIOD. (That
is, this procedure is not supported for tables with valid time support, which is
explained in Workspace Manager Valid Time Support.)
• staging_table exists but is not in a valid format for the export operation.
• staging_table is not in the current user's schema and the current user does not
have the CREATE TABLE and INSERT TABLE privileges.
• The user does not have the ACCESS_WORKSPACE privilege for workspace or the
ACCESS_ANY_WORKSPACE privilege.
• overwrite_existing_data is FALSE and data that needs to be exported already
exists in staging_table.
• auto_commit is TRUE and an open transaction exists in a parent or child workspace
of any table that needs to be modified.
See also Import and Export Considerations.
Examples
The following example exports all data from the COLA_MARKETING_BUDGET table
in workspace B_Focus_2 into the staging table COLA_MARKETING_BUDGET_STG. (The
EXECUTE statement is actually on a single line.)
EXECUTE DBMS_WM.Export(table_name => 'COLA_MARKETING_BUDGET', staging_table =>
'COLA_MARKETING_BUDGET_STG', workspace => 'B_focus_2');
4.25 Export_Schemas
Creates a dump file containing everything related to Workspace Manager. Uses the
Oracle Data Pump Export utility.
Syntax
DBMS_WM.Export_Schemas(
job_name IN VARCHAR2,
alt_schema IN VARCHAR2 DEFAULT 'WMSYS_N',
ignore_last_error IN BOOLEAN DEFAULT FALSE);
4-49
Chapter 4
Export_Schemas
Parameters
Parameter Description
Name of the Data Pump job to be used for the export operation.
job_name
Usage Notes
Note:
DBMS_WM.Export_Schemas cannot be run in the Oracle Cloud because
creating the dump file requires access to the local file system, which is not
accessible to users within the cloud.
This procedure creates a dump file that contains all of the schemas that contain a
version-enabled table or a parent table in a referential integrity constraint of a version-
enabled table, as well as any internal Workspace Manager metadata. For any included
schema, all objects and data within the schema are included in the dump file, not just
the objects related to Workspace Manager. All other schemas are excluded.
This procedure makes use of an already existing Data Pump Export job. When
you create this job using the DBMS_DATAPUMP.OPEN procedure, the operation
parameter must be set to EXPORT and the mode parameter must be set to
SCHEMA. The dump file(s) and log file should also be specified before you call
DBMS_WM.Export_Schemas. No procedures that modify or limit what gets exported (such
as DBMS_DATAPUMP.METADATA_FILTER) should be executed on this job. The Data Pump
job should not be created while using SYSDBA privileges.
Because the WMSYS schema cannot be exported by the Oracle Data Pump Export
utility, a temporary schema is required to hold some of the required data. This schema,
specified by the alt_schema parameter, cannot exist before you call this procedure.
Because this schema will be included within the generated dump file, it should be a
schema that does not exist on the target database.
4-50
Chapter 4
Export_Schemas
For information about using the Data Pump Utility, see Oracle Database Utilities.
Note:
Export_Schemas does not automatically ensure that the database is in a
quiescent state so that the export is consistent. It finds all the related
tables and exports them one by one. So, you must ensure the tables
are not changing when this procedure is called. To do so, use the
export parameter FLASHBACK_TIME=SYSTIMESTAMP. (In the original Export, the
parameter CONSISTENT=Y has the same effect.)
If a call to the Export_Schemas procedure fails, you should try to fix the cause of
the error. Examine the DBA_WM_VT_ERRORS static data dictionary view where the
STATE column is equal to EXPORT to see the SQL statement and error message. Fix
the cause of the error, and then call the Export_Schemas 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 can ignore the error by calling the Export_Schemas
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.
If the Export_Schemas procedure fails and if you must execute the procedure again,
and if a row for this procedure exists in the DBA_WM_VT_ERRORS static data
dictionary view, the procedure will continue to use the original Data Pump job that was
specified (you do not need to create a new job). However, if the SQL statements being
executed attempt to use the original job but that job no longer exists, you must set the
ignore_last_error parameter to TRUE and execute the Export_Schemas procedure;
and after that succeeds, execute the Export_Schemas procedure again.
Before exporting a version-enabled topology using either a full database export or the
DBMS_WM.Export_Schemas procedure, you must do the following:
1. Connect to the database as the owner of the topology.
2. Execute the SDO_TOPO.PREPARE_FOR_EXPORT procedure, to create
the topology export information table, with a name in the format
<topology-name>_EXP$. This table contains the same columns as the
USER_SDO_TOPO_INFO and ALL_SDO_TOPO_INFO views.
An exception is raised if one or more of the following apply:
• job_name does not exist.
• alt_schema already exists.
• The executing user does not have the DATAPUMP_EXP_FULL_DATABASE role.
• Errors exist in the WMSYS schema or in any required user schemas.
See also Import and Export Considerations.
4-51
Chapter 4
FindRICSet
Examples
The following example exports the Workspace Manager metadata using the Oracle
Data Pump job named EXPORT_OWM_SCHEMAS. It assumes that the DUMP_DIR directory
has already been created.
DECLARE
job_name varchar2(128) := 'EXPORT_OWM_SCHEMAS' ;
dpj number ;
BEGIN
dpj := dbms_datapump.open('EXPORT', 'SCHEMA', null, job_name, 'COMPATIBLE') ;
dbms_datapump.add_file(dpj, 'owm_schema.dmp', 'DUMP_DIR') ;
dbms_datapump.add_file(dpj, 'owm_schema_export.log', 'DUMP_DIR',
filetype=>dbms_datapump.KU$_FILE_TYPE_LOG_FILE) ;
dbms_wm.export_schemas(job_name) ;
dbms_datapump.detach(dpj);
4.26 FindRICSet
Finds tables that need to be version-enabled along with a specified table, due to
referential integrity constraint relationships.
Syntax
DBMS_WM.FindRICSet(
table_name IN VARCHAR2,
result_table IN VARCHAR2);
Parameters
Parameter Description
Name of the table for which to find all other tables that will need to be
table_name
version-enabled along with it, because of referential integrity constraint
relationships. The name is not case-sensitive.
Name of the table to hold the results. The name is not case-sensitive.
result_table
This table must have two columns, TABLE_OWNER and TABLE_NAME, both
of type VARCHAR2. If the table does not exist, a new table with this name
and the required columns is created.
Usage Notes
Workspace Manager has several considerations relating to referential integrity
constraints, as explained in Referential Integrity Support. Sometimes, before you can
version-enable a table, you must version-enable other tables that are in referential
integrity constraints affecting the table. The FindRICSet procedure enables you to find
all these other tables.
4-52
Chapter 4
FreezeWorkspace
To display the results, use the SET SERVEROUTPUT ON statement before calling this
procedure.
If the result table is not in the current user's schema, the following requirements apply:
• If the result table does not exist, the current user must have the CREATE ANY TABLE
privilege.
• If the result table already exists, the current user must have the required privileges
to insert into the table.
An exception is raised if one or more of the following apply:
• table_name does not exist.
• result_table exists but is not in a valid format.
• result_table exists and the current user does not have the required privileges to
insert into the table.
• result_table does not exist, is specified for a schema other than the current
user's schema, and the current user does not have the CREATE ANY TABLE
privilege.
Examples
The following example creates two tables, EMPLOYEES and DEPARTMENTS,
where DEPARTMENTS.MANAGER_ID has a foreign key relationship referencing
EMPLOYEES.EMPLOYEE_ID. The example then finds all tables that would need to be
version-enabled if EMPLOYEES and DEPARTMENTS were version-enabled.
The results show that if you want to version-enable the EMPLOYEES table, you must
version-enable both the EMPLOYEES and DEPARTMENTS tables; but if you want to version-
enable the DEPARTMENTS table, you do not need to version-enable any other tables.
create table employees (employee_id number primary key, employee_name
varchar2(30));
create table departments (dept_id number primary key, manager_id number
references employees(employee_id));
TABLE_OWNER TABLE_NAME
------------------------------ ------------------------------
WM_DEVELOPER EMPLOYEES
WM_DEVELOPER DEPARTMENTS
TABLE_OWNER TABLE_NAME
------------------------------ ------------------------------
WM_DEVELOPER DEPARTMENTS
4.27 FreezeWorkspace
Restricts access to a workspace and the ability of users to make changes in the
workspace.
4-53
Chapter 4
FreezeWorkspace
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
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
4-54
Chapter 4
GetBulkLoadVersion
Parameter Description
A Boolean value (TRUE or FALSE).
force
TRUE forces the workspace to be frozen even if it is already frozen.
For example, this value enables you to 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:
• workspace is already frozen (unless force is TRUE).
• Any sessions are in workspace and freezemode is NO_ACCESS (specified or
defaulted).
• session_duration is FALSE and freezemode is 1WRITER_SESSION.
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:
• You are the owner of the specified workspace.
• You have the WM_ADMIN system privilege, the FREEZE_ANY_WORKSPACE privilege, or
the FREEZE_WORKSPACE privilege for the specified workspace.
The LIVE workspace can be frozen only if freezemode is READ_ONLY or 1WRITER.
Examples
The following example freezes the NEWWORKSPACE workspace.
EXECUTE DBMS_WM.FreezeWorkspace ('NEWWORKSPACE');
4.28 GetBulkLoadVersion
Returns a version number that can be specified in the call to the BeginBulkLoading
procedure and in the SQL*Loader control file.
4-55
Chapter 4
GetBulkLoadVersion
Note:
Effective with Oracle Database Release 12.1, this function is not necessary,
and it always returns a null value.
Format
DBMS_WM.GetBulkLoadVersion(
workspace IN VARCHAR2,
savepoint_var IN VARCVHAR2 DEFAULT 'LATEST') RETURN INTEGER;
Parameters
Parameter Description
Name of the workspace for which to return the bulk load version. The
workspace
name is case-sensitive.
The version in the workspace in which data will be bulk loaded. Must be
savepoint_var
one of the following: LATEST or ROOT_VERSION.
LATEST (the default) is the current version in the workspace.
ROOT_VERSION is into the root version (version number 0, which is
in the LIVE workspace). The root version is the ancestor of all other
versions, so data in the root version is visible from all other workspaces
(unless non-LIVE workspaces have updated the data). You can specify
ROOT_VERSION only if workspace is LIVE.
Usage
Effective with Oracle Database Release 12.1, this function is not necessary and
it always returns a null value. The BeginBulkLoading procedure automatically
determines the bulk load version based on the workspace name and the optional
savepoint name. (However, the bulk loading process in effect for previous releases is
still supported.)
Before you can begin bulk loading data into a version-enabled table, you must call the
BeginBulkLoading procedure. You must end the bulk loading session by calling either
the CommitBulkLoading procedure (to commit changes made when the data was
loaded) or the RollbackBulkLoading procedure (to roll back changes made when the
data was loaded). For more information about bulk loading with Workspace Manager,
see Bulk Loading into Version-Enabled Tables.
An exception is raised if one or more of the following apply:
• workspace does not exist.
• savepoint_var is not a valid value.
• savepoint_var is ROOT_VERSION but workspace is not LIVE.
Examples
The following example gets a bulk load version number for the W1 workspace, and
starts the bulk load operation into the EMP table in that workspace.
4-56
Chapter 4
GetConflictWorkspace
DECLARE
version INTEGER;
BEGIN
SELECT DBMS_WM.GetBulkLoadVersion ('W1') INTO version FROM DUAL;
DBMS_WM.BeginBulkLoading ('EMP', 'W1', version);
END;
/
4.29 GetConflictWorkspace
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
4.30 GetDiffVersions
Returns the names of the (workspace, savepoint) pairs on which the session has
performed the SetDiffVersions operation.
Format
DBMS_WM.GetDiffVersions() RETURN VARCHAR2;
Parameters
None.
Usage Notes
The returned string is in the format '(WS1,SP1), (WS2,SP2)'. This format, including
the parentheses, is intended to help you if you later want to use parts of the returned
string in a call to the SetDiffVersions procedure.
4-57
Chapter 4
GetLockMode
Examples
The following example displays the names of the (workspace, savepoint) pairs on
which the session has performed the SetDiffVersions operation.
SELECT DBMS_WM.GetDiffVersions FROM DUAL;
GETDIFFVERSIONS
--------------------------------------------------------------------------------
(B_focus_1, LATEST), (B_focus_2, LATEST)
4.31 GetLockMode
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.
Format
DBMS_WM.GetLockMode() RETURN VARCHAR2;
Parameters
None.
Usage Notes
This function returns E, S, C, or NULL.
Examples
The following example displays the locking mode in effect for the session.
SELECT DBMS_WM.GetLockMode FROM DUAL;
GETLOCKMODE
--------------------------------------------------------------------------------
C
4.32 GetMultiWorkspaces
Returns the names of workspaces visible in the multiworkspace views for version-
enabled tables.
Format
DBMS_WM.GetMultiWorkspaces() RETURN VARCHAR2;
4-58
Chapter 4
GetOpContext
Parameters
None.
Usage Notes
This procedure returns the names of workspaces visible in the multiworkspace views,
which are described in xxx_MW Views.
If no workspaces are visible in the multiworkspace views, NULL is returned. If more
than one workspace name is returned, names are separated by a comma (for
example: workspace1,workspace2,workspace3).
Examples
The following example displays the names of workspaces visible in the
multiworkspace views.
SELECT DBMS_WM.GetMultiWorkspaces FROM DUAL;
4.33 GetOpContext
Returns the context of the current operation for the current session.
Format
DBMS_WM.GetOpContext() RETURN VARCHAR2;
Parameters
None.
Usage Notes
This function returns one of the following values:
• DML: The current operation is driven by data manipulation language (DML) initiated
by the user.
• IMPORT: The current operation was initiated by a Import procedure call.
• MERGE_REMOVE: The current operation was initiated by a MergeWorkspace
procedure call with the remove_workspace parameter set to TRUE or a MergeTable
procedure call with the remove_data parameter set to TRUE.
• MERGE_NOREMOVE: The current operation was initiated by a MergeWorkspace
procedure call with the remove_workspace parameter set to FALSE or a MergeTable
procedure call with the remove_data parameter set to FALSE.
• WORKSPACE_COPY: The current operation was initiated by a CopyWorkspace
procedure call.
The returned value can be used in user-defined triggers to take appropriate action
based on the current operation.
4-59
Chapter 4
GetOriginalDDL
Examples
The following example displays the context of the current operation.
SELECT DBMS_WM.GetOpContext FROM DUAL;
GETOPCONTEXT
--------------------------------------------------------------------------------
DML
4.34 GetOriginalDDL
Returns the original DDL of the version-enabled table as it existed before the call to
the EnableVersioning procedure.
Format
DBMS_WM.GetOriginalDDL
table_id IN VARCHAR2,
ddl_stmts IN OUT KU$_DDLS;
or
DBMS_WM.GetOriginalDDL
table_id IN VARCHAR2,
ddl_clob IN OUT CLOB;
Parameters
Parameter Description
Name of the table for which to return the original DDL for creating the table.
table_id
The name is not case-sensitive.
The original DDL statements for creating the table and any indexes,
ddl_stmts
triggers, and grants on the table.
The type KU$DLLS is defined as TABLE OF KU$_DDL. The type KU$DDL
is defined as (DDLTEXT CLOB, PARSEDITEMS KU$_PARSED_ITEMS). The
type KU$_PARSED_ITEMS is defined as TABLE OF KU$_PARSED_ITEM.
The type KU$_PARSED_ITEM is defined as (ITEM VARCHAR2(30), VALUE
VARCHAR2(4000), OBJECT_ROW NUMBER).
(Same information as for ddl_stmts, but using the type CLOB.)
ddl_clob
Usage
When the EnableVersioning procedure is called, DDL statements are executed on the
table that modify its structure and that of related objects. (Some of these changes
are outlined in Infrastructure for Version-Enabling of Tables.) The GetOriginalDDL
procedure returns a series of DDL statements (CREATE TABLE, CREATE INDEX,
CREATE TRIGGER, GRANT, and so on) that represent the table as if it was not a
version-enabled table. These statements can then be used to create the table in a
non-versioned form in another schema or in another database. This new table can
then be version-enabled or used in its non-versioned form.
4-60
Chapter 4
GetPhysicalTableName
Examples
The following example returns the original DDL statements for the
COLA_MARKETING_BUDGET table into a variable of type KU$_DLLS.
DECLARE
original_ddl KU$_DDLS;
BEGIN
DBMS_WM.GetOriginalDDL('cola_marketing_budget',
original_ddl);
END;
/
4.35 GetPhysicalTableName
Returns the name (<table_name>_LT form) of the physical table for a version-enabled
table.
Format
DBMS_WM.GetPhysicalTableName(
table_owner IN VARCHAR2,
table_name IN VARCHAR2) RETURN VARCHAR2;
Parameters
Parameter Description
Name of the schema that owns table_name.
table_owner
Name of the version-enabled table for which to return the name of its
table_name
associated physical table.
Usage
If table_name is a version-enabled table, this function returns the name of the
table, whose name is in the form <table_name>_LT, that was created by Workspace
Manager when the EnableVersioning procedure was called. For information about
these <table_name>_LT tables, see Infrastructure for Version-Enabling of Tables.
If table_name is a not a version-enabled table, this function returns table_name. Thus,
you can also use this function to check whether or not a table is version-enabled (that
is, by checking whether a name in the form <table_name>_LT or the original table
name is returned).
If the user executing the function does not have access to the table or the table does
not exist, the function returns a null value.
4-61
Chapter 4
GetPrivs
Examples
The following example displays the physical table name associated with the
COLA_MARKETING_BUDGET table after that table is version-enabled.
SELECT DBMS_WM.GetPhysicalTableName('wm_developer', 'cola_marketing_budget')
FROM DUAL;
DBMS_WM.GETPHYSICALTABLENAME('WM_DEVELOPER','COLA_MARKETING_BUDGET')
--------------------------------------------------------------------------------
COLA_MARKETING_BUDGET_LT
4.36 GetPrivs
Returns a comma-delimited list of all privileges that the current user has for the
specified workspace.
Format
DBMS_WM.GetPrivs(
workspace IN VARCHAR2) RETURN VARCHAR2;
Parameters
Parameter Description
Name of the workspace for which to return the list of privileges. The name is
workspace
case-sensitive.
Usage
For information about Workspace Manager privileges, see Privilege Management with
Workspace Manager.
Examples
The following example displays the privileges that the current user has for the
B_focus_2 workspace.
SELECT DBMS_WM.GetPrivs ('B_focus_2') FROM DUAL;
DBMS_WM.GETPRIVS('B_FOCUS_2')
--------------------------------------------------------------------------------
ACCESS,MERGE,CREATE,REMOVE,ROLLBACK
4.37 GetSessionInfo
Retrieves information about the current workspace and session context.
Format
DBMS_WM.GetSessionInfo(
workspace OUT VARCHAR2,
4-62
Chapter 4
GetSessionInfo
Parameters
Parameter Description
Name of the workspace that the current session is in.
workspace
Usage Notes
This procedure is useful if you need to know where a session is (workspace and
context) -- for example, after you have performed a combination of GotoWorkspace,
GotoSavepoint, and GotoDate operations.
After the procedure successfully executes, the context parameter contains one of the
following values:
• LATEST: The session is currently on the LATEST logical savepoint (explained in
Using Savepoints), and it can see changes as they are made in the workspace.
The context is automatically set to LATEST when the session enters the workspace
(using the GotoWorkspace procedure).
• A savepoint name: The session is currently on a savepoint in the workspace.
The session cannot see changes as they are made in the latest version of
the workspace, but instead sees a static view of the data as of the savepoint
creation time. The session context is set to the savepoint name after a call to the
GotoSavepoint procedure.
• An instant (a point in time): The session is currently on a specific point in time.
The session cannot see changes as they are made in the latest version of the
workspace, but instead sees a static view of the data as of the specific time. The
session context is set to an instant after a call to the GotoDate procedure.
For detailed information about the session context, see Session Context Information
for Workspace Manager.
Examples
The following example retrieves and displays information about the current workspace
and context in the session.
DECLARE
current_workspace VARCHAR2(128);
current_context VARCHAR2(128);
current_context_type VARCHAR2(128);
BEGIN
4-63
Chapter 4
GetSystemParameter
DBMS_WM.GetSessionInfo(current_workspace,
current_context,
current_context_type);
DBMS_OUTPUT.PUT_LINE('Session currently in workspace: ' ||current_workspace);
DBMS_OUTPUT.PUT_LINE('Session context is: ' ||current_context);
DBMS_OUTPUT.PUT_LINE('Session context is on: ' ||current_context_type);
END;
/
Session currently in workspace: B_focus_2
Session context is: LATEST
Session context is on: LATEST
4.38 GetSystemParameter
Returns the value of a Workspace Manager system parameter.
Syntax
DBMS_WM.GetSytstemParameter(
name IN VARCHAR2) RETURN VARCHAR2;
Parameters
Parameter Description
Name of the Workspace Manager system parameter for which to set the
name
value. The name must be one of the following: ALLOW_CAPTURE_EVENTS,
ALLOW_MULTI_PARENT_WORKSPACES, ALLOW_NESTED_TABLE_COLUMNS,
CR_WORKSPACE_MODE, FIRE_TRIGGERS_FOR_NONDML_EVENTS,
NONCR_WORKSPACE_MODE.
Usage Notes
For information about Workspace Manager system parameters, see System
Parameters for Workspace Manager.
An exception is raised if the name value is not valid.
Examples
The following checks if multiparent workspaces (described in Multiparent Workspaces)
are allowed.
SELECT DBMS_WM.GetSystemParameter ('ALLOW_MULTI_PARENT_WORKSPACES') FROM DUAL;
DBMS_WM.GETSYSTEMPARAMETER('ALLOW_MULTI_PARENT_WORKSPACES')
--------------------------------------------------------------------------------
ON
4.39 GetValidFrom
Returns the ValidFrom attribute of the current session valid time. (Valid time support is
described in Workspace Manager Valid Time Support.)
4-64
Chapter 4
GetValidTill
Format
DBMS_WM.GetValidFrom() RETURN TIMESTAMP WITH TIME ZONE;
Parameters
None.
Usage Notes
To set the session valid time period, use the SetValidTime procedure.
To get the ValidTill attribute of the current session valid time, use the GetValidTill
function.
Examples
The following example displays the ValidFrom attribute of the current session valid
time.
SELECT DBMS_WM.GetValidFrom FROM DUAL;
GETVALIDFROM
---------------------------------------------------------------------------
01-JAN-1995 12:00:00 -04:00
4.40 GetValidTill
Returns the ValidTill attribute of the current session valid time. (Valid time support is
described in Workspace Manager Valid Time Support.)
Format
DBMS_WM.GetValidTill() RETURN TIMESTAMP WITH TIME ZONE;
Parameters
None.
Usage Notes
To set the session valid time period, use the SetValidTime procedure.
To get the ValidFrom attribute of the current session valid time, use the GetValidFrom
function.
Examples
The following example displays the ValidTill attribute of the current session valid
time.
SELECT DBMS_WM.GetValidTill FROM DUAL;
GETVALIDTILL
---------------------------------------------------------------------------
01-JAN-1996 12:00:00 -04:00
4-65
Chapter 4
GetVersion
4.41 GetVersion
Returns the current version of Workspace Manager.
Format
DBMS_WM.GetVersion() RETURN VARCHAR2;
Parameters
None.
Usage Notes
The value returned is the same as that in the WM_INSTALLATION view for the VALUE
column where the NAME column value is OMW_VERSION.
Examples
The following example displays the Workspace Manager version number.
SELECT DBMS_WM.GetVersion FROM DUAL;
GETOPCONTEXT
--------------------------------------------------------------------------------
12.2.0.1.0
4.42 GetWMMetadataSpace
Returns the number of bytes currently used to store the Workspace Manager
metadata.
Format
DBMS_WM.GetWMMetadataSpace() RETURN NUMBER;
Parameters
None.
Usage Notes
The Workspace Manager metadata (views, internal tables, and other objects) is by
default stored in the default tablespace of the WMSYS user. You cannot directly control
the size of the Workspace Manager metadata, but you can control its placement by
using the Move_Proc procedure to move the metadata to a different tablespace. You
can use the GetWMMetadataSpace function to determine the approximate minimum
space that you will need to have available in the tablespace into which you are
considering moving the Workspace Manager metadata.
Examples
The following example displays the number of bytes currently used to store the
Workspace Manager metadata.
SELECT DBMS_WM.GetWMMetadataSpace FROM DUAL;
4-66
Chapter 4
GetWorkspace
GETWMMETADATASPACE
------------------
6750208
4.43 GetWorkspace
Returns the current workspace for the session.
Format
DBMS_WM.GetWorkspace() RETURN VARCHAR2;
Parameters
None.
Usage Notes
None.
Examples
The following example displays the current workspace for the session.
SELECT DBMS_WM.GetWorkspace FROM DUAL;
GETWORKSPACE
--------------------------------------------------------------------------------
B_focus_2
4.44 GotoDate
Goes to a point at or near the specified date and time in the current workspace.
Syntax
DBMS_WM.GotoDate(
in_date IN VARCHAR2,
fmt IN VARCHAR2 DEFAULT 'mmddyyyyhh24miss',
nlsparam IN VARCHAR2 DEFAULT NULL,
tsWtz IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Date and time for the read-only view of the workspace. (See the Usage
in_date
Notes for details.)
If in_date is a VARCHAR2 string, it is a date string or a timestamp with
time zone, depending on the value of the tsWtz parameter.
Date format. The options are the same as for the TO_TIMESTAMP_TZ
fmt
function, which is described in Oracle Database SQL Language Reference.
Default: 'mmddyyyyhh24miss'
4-67
Chapter 4
GotoDate
Parameter Description
Globalization support options. The options are the same as for the
nlsparam
TO_TIMESTAMP_TZ function, which is described in Oracle Database SQL
Language Reference.
Timestamp with time zone flag. A Boolean value (TRUE or FALSE).
tsWtz
TRUE means that in_date is considered a timestamp with time zone
information.
FALSE (the default) means that in_date is a date string.
Usage Notes
You are presented a read-only view of the current workspace at or near the specified
date and time. The exact time point depends on the history option for tracking
changes to data in version-enabled tables, as set by the EnableVersioning procedure
or modified by the SetWoOverwriteOFF or SetWoOverwriteON procedure:
• NONE: The read-only view reflects the first savepoint after in_date.
• VIEW_W_OVERWRITE: The read-only view reflects the data values in effect at
in_date, except if in_date is between two savepoints and data was changed
between the two savepoints. In this case, data that had been changed between
the savepoints might be seen as empty or as having a previous value. To ensure
the most complete and accurate view of the data, specify the VIEW_WO_OVERWRITE
history option when version-enabling a table.
• VIEW_WO_OVERWRITE: The read-only view reflects the data values in effect at
in_date.
For an explanation of the history options, see the description of the hist parameter for
the EnableVersioning procedure.
The following example scenario shows the effect of the VIEW_WO_OVERWRITE setting.
Assume the following sequence of events:
1. The MANAGER_NAME value in a row is Adams.
2. Savepoint SP1 is created.
3. The MANAGER_NAME value is changed to Baxter.
4. The time point that will be specified as in_date (in step 7) occurs.
5. The MANAGER_NAME value is changed to Chang. (Thus, the value has been changed
both before and after in_date since the first savepoint and before the second
savepoint.)
6. Savepoint SP2 is created.
7. A GotoDate operation is executed, specifying the time point in step 4 as in_date.
In the preceding scenario:
• If the history option in effect is VIEW_WO_OVERWRITE, the MANAGER_NAME value after
step 7 is Baxter. After step 5, the versioned table has three rows, each with
a different MANAGER_NAME value (Adams, Baxter, Chang), because each change is
made in a new copy of the row.
4-68
Chapter 4
GotoSavepoint
Examples
The following example goes to a point at or near midnight at the start of 08-Jun-2004,
depending on the history option currently in effect.
EXECUTE DBMS_WM.GotoDate ('08-JUN-04', 'DD-MON-YY');
4.45 GotoSavepoint
Goes to the specified savepoint in the current workspace.
Syntax
DBMS_WM.GotoSavePoint(
savepoint_name IN VARCHAR2 DEFAULT 'LATEST');
Parameters
Parameter Description
Name of the savepoint. The name is case-sensitive. If
savepoint_name
savepoint_name is not specified, the default is LATEST.
Usage Notes
You are presented a read-only view of the workspace at the time of savepoint creation.
This procedure is useful for examining the workspace from different savepoints before
performing a rollback to a specific savepoint by calling the RollbackToSP procedure to
delete all rows from that savepoint forward.
This operation can be executed while users exist in the workspace. There are no
explicit privileges associated with this operation.
If you do not want to roll back to the savepoint, you can call the GotoSavepoint
procedure with a null parameter to go to the currently active version in the workspace.
(This achieves the same result as calling the GotoWorkspace procedure and
specifying the workspace.)
For more information about savepoints, including the LATEST savepoint, see Using
Savepoints.
4-69
Chapter 4
GotoWorkspace
Examples
The following example goes to the savepoint named Savepoint1.
EXECUTE DBMS_WM.GotoSavepoint ('Savepoint1');
4.46 GotoWorkspace
Moves the current session to the specified workspace.
Syntax
DBMS_WM.GotoWorkspace(
workspace IN VARCHAR2);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
After a user goes to a workspace, modifications to data can be made there.
To go to the live database, specify workspace as LIVE. Because many operations are
prohibited when any users (including you) are in the workspace, it is often convenient
to go to the LIVE workspace before performing operations on created workspaces.
Examples
The following example includes the user in the NEWWORKSPACE workspace. The user will
begin to work in the latest version in that workspace.
EXECUTE DBMS_WM.GotoWorkspace ('NEWWORKSPACE');
The following example includes the user in the LIVE database workspace. By default,
when users connect to a database, they are placed in this workspace.
EXECUTE DBMS_WM.GotoWorkspace ('LIVE');
4-70
Chapter 4
GrantGraphPriv
4.47 GrantGraphPriv
Grants privileges on multiparent graph workspaces to users and roles. The
grant_option parameter enables the grantee to grant the specified privileges to other
users and roles.
Syntax
DBMS_WM.GrantGraphPriv(
priv_types IN VARCHAR2,
leaf_workspace IN VARCHAR2,
grantee IN VARCHAR2,
node_types IN VARCHAR2 DEFAULT '(''R'',''I'',''L'')',
grant_option IN VARCHAR2 DEFAULT 'NO',
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
A string of one or more keywords representing privileges. (Privilege
priv_types
Management with Workspace Manager discusses Workspace Manager
privileges.) Use commas to separate privilege keywords. The
available keywords are ACCESS_WORKSPACE, MERGE_WORKSPACE,
CREATE_WORKSPACE, REMOVE_WORKSPACE, ROLLBACK_WORKSPACE,
and FREEZE_WORKSPACE.
Name of the leaf workspace in the directed acyclic graph. (Leaf
leaf_workspace
workspaces, directed acyclic graphs, and other concepts related to
multiparent workspaces are explained in Multiparent Workspaces.) The
name is case-sensitive.
Name of the user (can be the PUBLIC user group) or role to which to
grantee
grant priv_types.
List of letters (in parentheses and comma-delimited) representing the
node_types
types of nodes on which to grant the privileges: R for the root of the
graph, I for the specified intermediate node, L for the leaf of the graph.
The default is all types of nodes.
Specify YES to enable the grant option for grantee, or NO (the default) to
grant_option
disable the grant option for grantee. The grant option allows grantee
to grant the privileges specified in priv_types on the workspace
specified in leaf_workspace to other users and roles.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager
Operations.
4-71
Chapter 4
GrantPrivsOnPolicy
Usage Notes
Contrast this procedure with GrantWorkspacePriv , which grants workspace-level
Workspace Manager privileges on workspaces other than multiparent graph
workspaces.
If a user gets a privilege from more than one source and if any of those sources has
the grant option for that privilege, the user has the grant option for the privilege. For
example, assume that user SCOTT has been granted the ACCESS_WORKSPACE privilege
with grant_option as NO, but that the PUBLIC user group has been granted the
ACCESS_WORKSPACE privilege with grant_option as YES. Because user SCOTT is a
member of PUBLIC, user SCOTT has the ACCESS_WORKSPACE privilege with the grant
option.
The WM_ADMIN_ROLE role has all Workspace Manager privileges with the grant option.
The WM_ADMIN_ROLE role is automatically given to the DBA role.
Examples
The following example enables user Smith to access all types of nodes in the directed
acyclic graph in which the NEWWORKSPACE workspace is the leaf workspace and to
merge changes in these workspaces, and it allows Smith to grant the two specified
privileges on the leaf workspace to other users.
DBMS_WM.GrantGraphPriv ('ACCESS_WORKSPACE, MERGE_WORKSPACE', 'NEWWORKSPACE',
'Smith', 'YES');
4.48 GrantPrivsOnPolicy
Grants the privileges required to call the EnableVersioning procedure on a table that
contains the specified Oracle Label Security (OLS) policy.
Syntax
DBMS_WM.GrantPrivsOnPolicy(
policy_name IN VARCHAR2);
4-72
Chapter 4
GrantSystemPriv
Parameters
Parameter Description
Name of the policy for which privileges need to be granted.
policy_name
Usage Notes
This procedure grants the necessary privileges on an OLS policy to the WMSYS
schema. These privileges are required when executing workspace operations. If
multiple tables protected by the same policy need to be version-enabled, this
procedure only needs to be executed once.
Examples
The following grants the necessary privileges on a policy named my_policy.
EXECUTE DBMS_WM.GrantPrivsOnPolicy('my_policy');
4.49 GrantSystemPriv
Grants system-level privileges (not restricted to a particular workspace) to users
and roles. The grant_option parameter enables the grantee to grant the specified
privileges to other users and roles.
Syntax
DBMS_WM.GrantSystemPriv(
priv_types IN VARCHAR2,
grantee IN VARCHAR2,
grant_option IN VARCHAR2 DEFAULT 'NO',
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
A string of one or more keywords representing privileges. (Privilege
priv_types
Management with Workspace Manager discusses Workspace Manager
privileges.) Use commas to separate privilege keywords. The available
keywords are ACCESS_ANY_WORKSPACE, MERGE_ANY_WORKSPACE,
CREATE_ANY_WORKSPACE, REMOVE_ANY_WORKSPACE,
ROLLBACK_ANY_WORKSPACE, and FREEZE_ANY_WORKSPACE.
Name of the user (can be the PUBLIC user group) or role to which to grant
grantee
priv_types.
Specify YES to enable the grant option for grantee, or NO (the default) to
grant_option
disable the grant option for grantee. The grant option allows grantee to
grant the privileges specified in priv_types to other users and roles.
4-73
Chapter 4
GrantSystemPriv
Parameter Description
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager Operations.
Usage Notes
Contrast this procedure with GrantWorkspacePriv , which grants workspace-level
Workspace Manager privileges with keywords that do not contain ANY and which has a
workspace parameter.
If a user gets a privilege from more than one source and if any of those sources
has the grant option for that privilege, the user has the grant option for the privilege.
For example, assume that user SCOTT has been granted the ACCESS_ANY_WORKSPACE
privilege with grant_option as NO, but that the PUBLIC user group has been granted
the ACCESS_ANY_WORKSPACE privilege with grant_option as YES. Because user SCOTT
is a member of PUBLIC, user SCOTT has the ACCESS_ANY_WORKSPACE privilege with the
grant option.
The WM_ADMIN_ROLE role has all Workspace Manager privileges with the grant option.
The WM_ADMIN_ROLE role is automatically given to the DBA role.
Examples
The following example enables user Smith to access any workspace in the database,
but does not allow Smith to grant the ACCESS_ANY_WORKSPACE privilege to other users.
EXECUTE DBMS_WM.GrantSystemPriv ('ACCESS_ANY_WORKSPACE', 'Smith', 'NO');
4-74
Chapter 4
GrantWorkspacePriv
4.50 GrantWorkspacePriv
Grants workspace-level privileges to users and roles. The grant_option parameter
enables the grantee to grant the specified privileges to other users and roles.
Syntax
DBMS_WM.GrantWorkspacePriv(
priv_types IN VARCHAR2,
workspace IN VARCHAR2,
grantee IN VARCHAR2,
grant_option IN VARCHAR2 DEFAULT 'NO',
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
A string of one or more keywords representing privileges.
priv_types
(Privilege Management with Workspace Manager discusses Workspace
Manager privileges.) Use commas to separate privilege keywords.
The available keywords are ACCESS_WORKSPACE, MERGE_WORKSPACE,
CREATE_WORKSPACE, REMOVE_WORKSPACE, ROLLBACK_WORKSPACE, and
FREEZE_WORKSPACE.
Name of the workspace. The name is case-sensitive.
workspace
Name of the user (can be the PUBLIC user group) or role to which to grant
grantee
priv_types.
Specify YES to enable the grant option for grantee, or NO (the default) to
grant_option
disable the grant option for grantee. The grant option allows grantee to
grant the privileges specified in priv_types on the workspace specified
in workspace to other users and roles.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager Operations.
Usage Notes
Contrast this procedure with GrantSystemPriv, which grants system-level
Workspace Manager privileges with keywords in the form xxx_ANY_WORKSPACE
(ACCESS_ANY_WORKSPACE, MERGE_ANY_WORKSPACE, and so on). Contrast this procedure
also with GrantGraphPriv, which grants privileges on multiparent graph workspaces to
users and roles.
If a user gets a privilege from more than one source and if any of those sources has
the grant option for that privilege, the user has the grant option for the privilege. For
example, assume that user SCOTT has been granted the ACCESS_WORKSPACE privilege
4-75
Chapter 4
Import
with grant_option as NO, but that the PUBLIC user group has been granted the
ACCESS_WORKSPACE privilege with grant_option as YES. Because user SCOTT is a
member of PUBLIC, user SCOTT has the ACCESS_WORKSPACE privilege with the grant
option.
The WM_ADMIN_ROLE role has all Workspace Manager privileges with the grant option.
The WM_ADMIN_ROLE role is automatically given to the DBA role.
Examples
The following example enables user Smith to access the NEWWORKSPACE workspace
and merge changes in that workspace, and allows Smith to grant the two specified
privileges on NEWWORKSPACE to other users.
DBMS_WM.GrantWorkspacePriv ('ACCESS_WORKSPACE, MERGE_WORKSPACE', 'NEWWORKSPACE',
'Smith', 'YES');
4.51 Import
Imports data from a staging table (all rows, or as limited by any combination of several
parameters) into a version-enabled table in a specified workspace.
Syntax
DBMS_WM.Import(
staging_table IN VARCHAR2,
to_table IN VARCHAR2,
to_workspace IN VARCHAR2,
from_workspace IN VARCHAR2 DEFAULT NULL,
where_clause IN VARCHAR2 DEFAULT NULL,
import_scope IN VARCHAR2 DEFAULT DBMS_WM.IMPORT_ALL_DATA,
ancestor_savepoint_workspace IN VARCHAR2 DEFAULT NULL,
ancestor_savepoint_name IN VARCHAR2 DEFAULT NULL,
apply_locks IN BOOLEAN DEFAULT FALSE,
enforceUCFlag IN BOOLEAN DEFAULT TRUE,
enforceRICFlag IN BOOLEAN DEFAULT TRUE,
auto_commit IN BOOLEAN DEFAULT TRUE);
4-76
Chapter 4
Import
Parameters
Parameter Description
Name of the table that holds the data that had previously
staging_table
been exported using the Export procedure. The name is
not case-sensitive.
Name of the table into which to import the data. The name
to_table
is not case-sensitive.
4-77
Chapter 4
Import
Parameter Description
A Boolean value (TRUE or FALSE).
apply_locks
TRUE causes any locks that were present on the exported
data to be applied to the data when importing, unless
a more restrictive lock mode is in effect for the current
session.
FALSE (the default) ignores any locks on rows in the
staging table, but instead always uses the lock mode is
in effect for the current session.
A Boolean value (TRUE or FALSE).
enforceUCFlag
TRUE (the default) enforces any unique constraints defined
on to_table, ensuring that the import operation does not
violate any such constraints.
FALSE does not enforce any unique constraints defined on
to_table for the import operation.
A Boolean value (TRUE or FALSE).
enforceRICFlag
TRUE (the default) enforces any referential integrity
constraints defined on to_table, ensuring that the import
operation does not violate any such constraints.
FALSE does not enforce any referential integrity
constraints defined on to_table for the import operation.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace
Manager Operations.
Usage Notes
All data that satisfies the where_clause parameter value in the staging table named
staging_table and the import_scope parameter value is imported into the version-
enabled table named to_table.
The data must have been previously exported to the staging table using the Export
procedure.
Each row of data to be imported is considered to be one of the following: inserted,
updated, or deleted in from_workspace (that is, modified data); or data that was not
modified in from_workspace but can be seen in it (that is, ancestor data). If data is
exported from the LIVE workspace, it is all modified data.
4-78
Chapter 4
Import_Schemas
Examples
The following example imports modified data from the staging
table COLA_MARKETING_BUDGET_STG in workspace B_focus_2 into the
COLA_MARKETING_BUDGET table in workspace B_Focus_1. (The EXECUTE statement is
actually on a single line.)
EXECUTE DBMS_WM.Import(staging_table => 'COLA_MARKETING_BUDGET_STG',
to_table => 'COLA_MARKETING_BUDGET', to_workspace => 'B_focus_1',
from_workspace => 'B_focus_2');
4.52 Import_Schemas
Imports the entire Workspace Manager installation from a dump file that had been
created by the Export_Schemas procedure. Uses the Oracle Data Pump Import utility.
Syntax
DBMS_WM.Import_Schemas(
job_name IN VARCHAR2,
alt_schema IN VARCHAR2 DEFAULT 'WMSYS_N',
ignore_last_error IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the Data Pump job to be used for the import operation.
job_name
4-79
Chapter 4
Import_Schemas
Parameter Description
A Boolean value (TRUE or FALSE).
ignore_last_error
TRUE ignores the last error, if any, that occurred during the
previous call to the Import_Schemas procedure. Information about
the last error is stored in the DBA_WM_VT_ERRORS static
data dictionary view, which is described in Workspace Manager
Static Data Dictionary Views . 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 Import_Schemas
procedure.
Usage Notes
This procedure uses a dump file that had been created using the Export_Schemas
procedure. There must be no existing version-enabled tables or workspaces, other
than LIVE, before you call this procedure. All objects of the schemas contained in the
dump file are imported. If any system or workspace privileges or any privileges on
version-enabled tables were granted to users that were not contained in the generated
dump file, those schemas must be created before you call this procedure; otherwise,
the grants will be lost.
This procedure makes use of an already existing Data Pump Import job. When you
create this job using the DBMS_DATAPUMP.OPEN procedure, the operation parameter
must be set to IMPORT and the mode parameter must be set to FULL. The dump file(s)
and log file should also be specified before you call this procedure. No procedures
that modify or limit what gets imported (such as DBMS_DATAPUMP.METADATA_FILTER)
should be executed on this job. . The Data Pump job should not be created while using
SYSDBA privileges.
The schema specified by the alt_schema parameter cannot exist before you call this
procedure. It must also be the same schema as specified for alt_schema when you
called the Export_Schemas procedure.
For information about using the Data Pump Utility, see Oracle Database Utilities.
If a call to the Import_Schemas procedure fails, you should try to fix the cause of
the error. Examine the DBA_WM_VT_ERRORS static data dictionary view where the
STATE column is equal to IMPORT to see the SQL statement and error message. Fix
the cause of the error, and then call the Import_Schemas 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 can ignore the error by calling the Import_Schemas
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.
If the Import_Schemas procedure fails and if you must execute the procedure again,
and if a row for this procedure exists in the DBA_WM_VT_ERRORS static data
dictionary view, the procedure will continue to use the original Data Pump job that was
specified (you do not need to create a new job). However, if the SQL statements being
executed attempt to use the original job but that job no longer exists, you must set the
ignore_last_error parameter to TRUE and execute the Import_Schemas procedure
again.
4-80
Chapter 4
Initialize_After_Import
Examples
The following example imports the Workspace Manager metadata using the Oracle
Data Pump job named IMPORT_OWM_SCHEMAS.
DECLARE
job_name varchar2(128) := upper('IMPORT_OWM_SCHEMAS') ;
dpj number ;
BEGIN
dpj := dbms_datapump.open('IMPORT', 'FULL', null, job_name, 'COMPATIBLE') ;
dbms_datapump.add_file(dpj, 'owm_schema.dmp', 'DUMP_DIR') ;
dbms_datapump.add_file(dpj, 'owm_schema_import.log', 'DUMP_DIR',
filetype=>dbms_datapump.KU$_FILE_TYPE_LOG_FILE) ;
dbms_wm.import_schemas(job_name) ;
dbms_datapump.detach(dpj);
4.53 Initialize_After_Import
Creates (initializes) a version enabled topology that was imported from another
database.
Format
DBMS_WM.Add_Topo_Geometry_Layer(
topology IN VARCHAR2,
tg_layer_owner IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
Topology that was imported from another database.
topology
Owner of the topology layer. If this parameter is null (the default), the
tg_layer_owner
current user is the owner.
4-81
Chapter 4
IsWorkspaceOccupied
Usage Notes
This procedure creates the specified version-enabled topology and related database
structures, adjusts the topology ID values in all feature tables, and creates the feature
layers in the correct order. It also generates the necessary Workspace Manager
metadata on the spatial topology index tables that get created. For information about
Workspace Manager support for topologies, see Spatial and Graph Topology Support.
After importing a version-enabled topology using either a full database import or the
DBMS_WM.Import_Schemas procedure, you must do the following (with the last step
being to execute the DBMS_WM.Initialize_After_Import procedure):
1. Connect to the target database, that is, the database in which to create a topology
with the same name, structures, and data as the topology exported from the
source database. Connect as the user for the schema that is to own the topology
to be created.
2. Ensure that the target database does not already contain a topology with the same
name as the topology in the .dmp file.
3. Perform the import using either a full database import or the
DBMS.Import_Schemas procedure.
4. Execute the DBMS_WM.Initialize_After_Import procedure. (Do not execute the
SDO_TOPO.Initialize_After_Import procedure.)
Examples
The following example creates the topology named CITY_DATA using information
from the imported tables, including CITY_DATA_EXP$, which was created using the
SDO_TOPO.Prepare_For_Export procedure.
EXECUTE DBMS_WM.INITIALIZE_AFTER_IMPORT('CITY_DATA');
4.54 IsWorkspaceOccupied
Checks whether or not a workspace has any active sessions.
Syntax
DBMS_WM.IsWorkspaceOccupied(
workspace IN VARCHAR2) RETURN VARCHAR2;
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
This function returns YES if the workspace has any active sessions, and it returns NO if
the workspace has no active sessions.
4-82
Chapter 4
LockRows
An exception is raised if the LIVE workspace is specified or if the user does not have
the privilege to access the workspace.
Examples
The following example checks if any sessions are in the B_focus_2 workspace.
SELECT DBMS_WM.IsWorkspaceOccupied('B_focus_2') FROM DUAL;
DBMS_WM.ISWORKSPACEOCCUPIED('B_FOCUS_2')
--------------------------------------------------------------------------------
YES
4.55 LockRows
Controls access to versioned rows in a specified table and to corresponding rows in
the parent workspace.
Syntax
DBMS_WM.LockRows(
workspace IN VARCHAR2,
table_name IN VARCHAR2,
where_clause IN VARCHAR2 DEFAULT '',
lock_mode IN VARCHAR2 DEFAULT 'E',
Xmin IN NUMBER DEFAULT NULL,
Ymin IN NUMBER DEFAULT NULL,
Xmax IN NUMBER DEFAULT NULL,
Ymax IN NUMBER DEFAULT NULL);
Parameters
Parameter Description
Name of the workspace. The latest versions of rows visible from the
workspace
workspace are locked. If a row has not been modified in this workspace,
the locked version could be in an ancestor workspace. The name is
case-sensitive.
A value of NONE can be used if lock_mode is set to VE (version-
exclusive). This causes the latest versions of rows to be locked,
regardless of the workspaces from which they are visible.
Name of the table or (if Xmin, Ymin, Xmax, and Ymax are specified)
table_name
Spatial and Graph topology in which rows are to be locked. The name is
not case-sensitive.
The WHERE clause (excluding the WHERE keyword) identifying the rows to
where_clause
be locked. Example: 'department_id = 20'
Only primary key columns can be specified in the WHERE clause, except
in a subquery. The subquery can refer to columns that are not primary
keys, but it cannot refer to a version-enabled table.
If where_clause is not specified, all rows in table_name are locked.
Do not specify the where_clause parameter if table_name specifies a
Spatial and Graph topology name.
4-83
Chapter 4
LockRows
Parameter Description
Mode with which to set the locks: E (exclusive), WE (workspace-
lock_mode
exclusive), VE (version-exclusive), or S (shared). The default is E.
E (exclusive) mode locks the rows in the previous version and the
corresponding rows in the current version; no other users in the
workspace for either version can change any values.
WE (workspace-exclusive) mode locks the rows in the previous version
and the corresponding rows in the current version such that only the
user that set the lock can change the values in the current workspace;
however, other users in other workspaces can change the values.
VE (version-exclusive) mode locks the rows in the previous version and
the corresponding rows in the current version such that only the user that
set the lock can change the values; no other users (in any workspace)
can change the values.
S (shared) mode locks the rows in the previous version and the
corresponding rows in the current version; however, other users in the
workspace for the current version (but no users in the workspace for the
previous version) can change values in these rows.
For Oracle Spatial and Graph topologies only (see Locking
Xmin, Ymin
Considerations with Topologies), the X and Y coordinate values,
respectively, of the lower-left corner of the window containing the rows to
be locked.You must specify these parameters if you specified a topology
name for table_name; otherwise, do not specify these parameters.
For Oracle Spatial and Graph topologies only (see Locking
Xmax, Ymax
Considerations with Topologies), the X and Y coordinate values,
respectively, of the upper-right corner of the window containing the
rows to be locked.You must specify these parameters if you specified
a topology name for table_name; otherwise, do not specify these
parameters.
Usage Notes
This procedure affects Workspace Manager locking, which occurs in addition to any
standard Oracle database locking. For an explanation of Workspace Manager locking,
see Lock Management with Workspace Manager.
This procedure does not affect whether Workspace Manager locking is set on or off
(determined by the SetLockingON and SetLockingOFF procedures).
To unlock rows, use the UnlockRows procedure.
For information about Workspace Manager locking for tables in an Oracle Spatial and
Graph topology, see Locking Considerations with Topologies.
Examples
The following example locks rows in the EMPLOYEES table where last_name = 'Smith'
in the NEWWORKSPACE workspace.
EXECUTE DBMS_WM.LockRows ('NEWWORKSPACE', 'employees', 'last_name = ''Smith''');
4-84
Chapter 4
MergeTable
4.56 MergeTable
Applies changes to one or more tables (all rows or as specified in the WHERE clause) in
a workspace to its parent workspace.
For a multiparent workspace (explained in Multiparent Workspaces), applies changes
to one or more tables (all rows or as specified in the WHERE clause) from all non-root
workspaces in the directed acyclic graph to the multiparent root workspace.
Syntax
DBMS_WM.MergeTable(
workspace IN VARCHAR2,
table_id IN VARCHAR2,
where_clause IN VARCHAR2 DEFAULT '',
create_savepoint IN BOOLEAN DEFAULT FALSE,
remove_data IN BOOLEAN DEFAULT FALSE,
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
4-85
Chapter 4
MergeTable
Parameter Description
A Boolean value (TRUE or FALSE).
remove_data
TRUE removes the data in the table (as specified by the
where_clause parameter) in the child workspace. For a multiparent
workspace, it removes the data in the table (as specified by
the where_clause parameter) in the non-root workspaces in the
directed acyclic graph. The remove_data option is permitted only if
workspace has no child workspaces (that is, it is a leaf workspace).
FALSE (the default) does not remove the data in the table in the child
workspace.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of
Workspace Manager Operations.
Usage Notes
All data that satisfies the where_clause parameter value in the version-enabled table
named table_name in workspace is applied to the parent workspace of workspace.
4-86
Chapter 4
MergeWorkspace
Examples
The following example merges changes to the EMP table (in the USER3 schema) where
last_name = 'Smith' in NEWWORKSPACE to its parent workspace.
EXECUTE DBMS_WM.MergeTable ('NEWWORKSPACE', 'user3.emp', 'last_name =
''Smith''');
4.57 MergeWorkspace
Applies all changes in a workspace to its parent workspace, and optionally removes
the workspace.
For a multiparent workspace (explained in Multiparent Workspaces), applies all
changes in the workspace to all other workspaces in the directed acyclic graph, and
optionally removes the non-root workspaces in the directed acyclic graph.
Syntax
DBMS_WM.MergeWorkspace(
workspace IN VARCHAR2,
create_savepoint IN BOOLEAN DEFAULT FALSE,
remove_workspace IN BOOLEAN DEFAULT FALSE,
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
4-87
Chapter 4
MergeWorkspace
Parameter Description
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of
Workspace Manager Operations.
Usage Notes
All data in all version-enabled tables in workspace is merged to the parent workspace
of workspace, and workspace is removed if remove_workspace is TRUE.
4-88
Chapter 4
Move_Proc
• The user does not have the MERGE_WORKSPACE privilege for workspace or the
MERGE_ANY_WORKSPACE privilege.
• The user does not have sufficient privileges on all tables that need to be modified
(including, for example, tables modified by triggers).
• auto_commit is TRUE and there is an open database transaction in any workspace
under workspace in the workspace hierarchy.
• remove_workspace is TRUE and there are any sessions in any workspaces under
workspace in the workspace hierarchy.
• remove_workspace is TRUE and there are any child workspaces of any workspace
to be removed.
• auto_commit is TRUE and an open transaction exists in a parent or child workspace
of any table that needs to be modified.
• The merge of a multiparent workspace would cause the violation of a referential
integrity constraint or unique constraint in any continually refreshed child
workspace of the multiparent root workspace.
Examples
The following example merges changes in NEWWORKSPACE to its parent workspace.
EXECUTE DBMS_WM.MergeWorkspace ('NEWWORKSPACE');
4.58 Move_Proc
Moves the Workspace Manager metadata to a specified tablespace.
Syntax
DBMS_WM.Move_Proc(
dest_tablespace IN VARCHAR2 DEFAULT 'SYSAUX');
Parameters
Parameter Description
The table space to which to move the Workspace Manager metadata.
dest_tablespace
The default value is the SYSAUX tablespace.
Usage Notes
The Workspace Manager metadata (views, internal tables, and other objects) is
by default stored in the default tablespace of the WMSYS user. You cannot
directly control the size of the Workspace Manager metadata, but you can control
its placement by using this procedure to move the metadata from its current
tablespace to a different tablespace. If you call this procedure without specifying
the dest_tablespace parameter, the Workspace manager metadata is moved to the
SYSAUX tablespace.
Before you move the metadata, you can use the GetWMMetadataSpace function to
determine the approximate minimum space that you will need to have available in the
tablespace into which you are considering moving the Workspace Manager metadata.
4-89
Chapter 4
PurgeTable
Examples
The following example moves the Workspace Manager metadata to the TBLSP_1
tablespace.
EXECUTE DBMS_WM.Move_proc('TBLSP_1');
4.59 PurgeTable
Removes rows (all rows, or as limited by any combination of several parameters) from
a version-enabled table, and optionally inserts them into an archive table.
Syntax
DBMS_WM.PurgeTable(
table_id IN VARCHAR2,
archive_table IN VARCHAR2,
where_clause IN VARCHAR2,
workspace IN VARCHAR2 DEFAULT 'LIVE',
savepoint_name IN VARCHAR2 DEFAULT NULL,
instant IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
purgeAfter IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the table containing the data to be exported. The name is not
table_id
case-sensitive.
Name of the table into which to insert the purged rows. If this
archive_table
parameter is specified as NULL, purged rows are not archived. If this
parameter is specified as other than NULL and if there is an open
transaction, the transaction is committed before the table is created,
and a new transaction is opened.
The WHERE clause (excluding the WHERE keyword) identifying the rows
where_clause
to be purged. Example: 'department_id = 20'
Only primary key columns can be specified in the WHERE clause,
except in a subquery. The subquery can refer to columns that are not
primary keys, but it cannot refer to a version-enabled table.
If the where_clause parameter is not specified, all rows in
table_name are purged.
Name of the workspace from which to purge the data. The name is
workspace
case-sensitive.
4-90
Chapter 4
RecoverAllMigratingTables
Parameter Description
Date/time specification: only data that was in the workspace either
instant
after or before (depending on the purgeAfter value) this time is
purged.
You cannot specify both the savepoint_name and instant
parameters.
A Boolean value (TRUE or FALSE).
purgeAfter
TRUE (the default) causes rows in the workspace after any specified
savepoint_name or instant value to be purged.
FALSE causes rows in the workspace before any specified
savepoint_name or instant value to be purged.
Usage Notes
This procedure removes rows from a version-enabled table that is rooted at
workspace. If the purgeAfter parameter value is TRUE (the default), applicable child
rows rooted at the specified workspace are removed; if the purgeAfter parameter
value is FALSE, applicable ancestor rows rooted at the specified workspace are
removed.
You can use the where_clause parameter and the savepoint_name or instant
parameter to limit the rows that are purged. For most uses of the procedure, you
will probably want to specify a where_clause value to limit the rows to be purged;
otherwise all rows are purged (unless limited by the savepoint_name or instant
parameter).
An exclusive lock is obtained on the version-enabled table for the duration of the
procedure.
Examples
The following example purges any rows where the ID (primary ley) column value is
20 in the USER2.TEST table of the project workspace and its descendent workspaces.
(The EXECUTE statement is actually on a single line.)
EXECUTE DBMS_WM.PurgeTable('user2.test', where_clause=>'id=20',
workspace=>'project', purgeAfter=>TRUE);
4.60 RecoverAllMigratingTables
Attempts to complete the migration process on all tables that were left in an
inconsistent state after the Workspace Manager migration procedure failed.
Syntax
DBMS_WM.RecoverAllMigratingTables(
ignore_last_error IN BOOLEAN DEFAULT FALSE);
4-91
Chapter 4
RecoverFromDroppedUser
Parameters
Parameter Description
A Boolean value (TRUE or FALSE).
ignore_last_error
TRUE ignores the last error, if any, that occurred during the
migration process. Information about the last error is stored in the
USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS static data
dictionary views, which are described in Workspace Manager Static
Data Dictionary Views . See the Usage Notes for more information.
FALSE (the default) does not ignore the last error, if any, that occurred
during the migration process.
Usage Notes
If an error occurs while upgrading (migrating) to the current Workspace Manager
release, one or more version-enabled tables can be left in an inconsistent state. If
the upgrade procedure fails, you should try to fix the cause of the error (examine the
USER_WM_VT_ERRORS or ALL_WM_VT_ERRORS metadata view to see the SQL
statement and error message), and then call the RecoverMigratingTable procedure (for
a single table) or RecoverAllMigratingTables procedure (for all tables) with the default
ignore_last_error parameter value of FALSE, to try to complete the upgrade process.
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 RecoverMigratingTable or RecoverAllMigratingTables
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.
Examples
The following example attempts to recover all version-enabled tables that were left in
an inconsistent state when the upgrade procedure failed.
EXECUTE DBMS_WM.RecoverAllMigratingTables;
The following example attempts to recover all version-enabled tables that were left in
an inconsistent state when the upgrade procedure failed, and it ignores the last error
that caused the upgrade procedure to fail.
EXECUTE DBMS_WM.RecoverAllMigratingTables(TRUE);
4.61 RecoverFromDroppedUser
Performs necessary operations after the dropping of one or more database users that
owned one or more version-enabled tables.
Syntax
DBMS_WM.RecoverFromDroppedUser(
ignore_last_error IN BOOLEAN DEFAULT FALSE);
4-92
Chapter 4
RecoverMigratingTable
Parameters
Parameter Description
A Boolean value (TRUE or FALSE).
ignore_last_error
TRUE ignores the last error, if any, that occurred during the previous
call to the RecoverFromDroppedUser procedure. Information about
the last error is stored in the USER_WM_VT_ERRORS and
ALL_WM_VT_ERRORS static data dictionary views, which are
described in Workspace Manager Static Data Dictionary Views . 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 RecoverFromDroppedUser
procedure.
Usage Notes
If a database user with one or more version-enabled tables is dropped, you must
execute this procedure as soon as possible. This procedure removes any foreign key
constraints in existing tables that depended on any of the version-enabled tables that
were dropped as a result of dropping the user that owned these tables. This procedure
also fixes any invalid database metadata.
If a call to the RecoverFromDroppedUser 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 DBA_WM_VT_ERRORS metadata view to see the SQL statement and error
message), and then call the RecoverFromDroppedUser 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
RecoverFromDroppedUser 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.
To execute this procedure, you must connect to the database instance as a user with
SYSDBA privileges.
Examples
The following drops a user named HERMAN that owns one or more version-enabled
tables, and then performs the necessary operations after the drop operation.
DROP USER herman CASCADE;
EXECUTE DBMS_WM.RecoverFromDroppedUser;
4.62 RecoverMigratingTable
Attempts to complete the migration process on a table that was left in an inconsistent
state after the Workspace Manager migration procedure failed.
4-93
Chapter 4
RecoverMigratingTable
Syntax
DBMS_WM.RecoverMigratingTable(
table_name IN VARCHAR2,
ignore_last_error IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the version-enabled table to be recovered from the migration
table_name
error. The name is not case-sensitive.
Usage Notes
If an error occurs while upgrading to the current Workspace Manager release,
one or more version-enabled tables can be left in an inconsistent state. If the
upgrade procedure fails, you should try to fix the cause of the error (examine the
USER_WM_VT_ERRORS or ALL_WM_VT_ERRORS metadata view to see the SQL
statement and error message), and then call the RecoverMigratingTable procedure (for
a single table) or RecoverAllMigratingTables procedure (for all tables) with the default
ignore_last_error parameter value of FALSE, to try to complete the upgrade process.
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 RecoverMigratingTable or RecoverAllMigratingTables
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 table_name does not exist or is not version-enabled.
Examples
The following example attempts to recover the COLA_MARKETING_BUDGET table from the
error that caused the upgrade procedure to fail.
EXECUTE DBMS_WM.RecoverMigratingTable('COLA_MARKETING_BUDGET');
4-94
Chapter 4
RefreshTable
4.63 RefreshTable
Applies to a workspace all changes made to a table (all rows or as specified in the
WHERE clause) in its parent workspace.
Syntax
DBMS_WM.RefreshTable(
workspace IN VARCHAR2,
table_id IN VARCHAR2,
where_clause IN VARCHAR2 DEFAULT '',
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Name of the table containing the rows to be refreshed using values from
table_id
the parent workspace. The name is not case-sensitive.
The WHERE clause (excluding the WHERE keyword) identifying the rows to
where_clause
be refreshed from the parent workspace. Example: 'department_id =
20'
Only primary key columns can be specified in the WHERE clause, except
in a subquery. The subquery can refer to columns that are not primary
keys, but it cannot refer to a version-enabled table.
If the where_clause parameter is not specified, all rows in
table_name are refreshed.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager
Operations.
Usage Notes
This procedure applies to workspace all changes in rows that satisfy the where_clause
parameter value in the version-enabled table named table_id in the parent
workspace since the time when workspace was created or last refreshed.
If there are conflicts between the workspace being refreshed and its parent
workspace, the refresh operation fails and the user must manually resolve conflicts
4-95
Chapter 4
RefreshWorkspace
A table cannot be refreshed in the LIVE workspace (because that workspace has no
parent workspace).
An exception is raised if the user does not have access to table_id, if the user does
not have the MERGE_WORKSPACE privilege for workspace or the MERGE_ANY_WORKSPACE
privilege, or if auto_commit is TRUE and an open transaction exists in a parent or child
workspace of any table that needs to be modified.
Examples
The following example refreshes NEWWORKSPACE by applying changes made to the
EMPLOYEES table where last_name = 'Smith' in its parent workspace.
EXECUTE DBMS_WM.RefreshTable ('NEWWORKSPACE', 'employees', 'last_name =
''Smith''');
4.64 RefreshWorkspace
Applies to a workspace all changes made in its parent workspace.
For a multiparent workspace (explained in Multiparent Workspaces), applies changes
from the non-leaf workspaces in the directed acyclic graph to the specified
leaf workspace. The changes are propagated beginning with the multiparent root
workspace and continuing with the intermediate workspaces.
Syntax
DBMS_WM.RefreshWorkspace(
workspace IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE,
copy_data IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
4-96
Chapter 4
RemoveAsParentWorkspace
Parameter Description
A Boolean value (TRUE or FALSE).
copy_data
TRUE causes all changes in the parent workspace since the creation or
last refresh of the child workspace to be copied to the child workspace. No
changes occur in any descendent of the child workspace, and the history of
changes to the child workspace is preserved.
FALSE (the default) causes minimal data to be copied to the child
workspace. The parent version of the child workspace is updated in order
for the child workspace and its descendents to have access to the modified
rows from the parent workspace. No history of changes to the child
workspace is recorded for the operation.
Usage Notes
This procedure applies to workspace all changes made to version-enabled tables in
the parent workspace since the time when workspace was created or last refreshed.
If there are conflicts between the workspace being refreshed and its parent
workspace, the refresh operation fails and the user must manually resolve conflicts
using the <table_name>_CONF view. (Conflict resolution is explained in Resolving
Conflicts Before a Merge or Refresh Operation.)
The specified workspace and the parent workspace are frozen in READ_ONLY mode, as
explained in Freezing and Unfreezing Workspaces.
The LIVE workspace cannot be refreshed (because it has no parent workspace).
An exception is raised if the user does not have the MERGE_WORKSPACE privilege for
workspace or the MERGE_ANY_WORKSPACE privilege, if the user does not have sufficient
privileges on all tables that need to be modified (including, for example, tables
modified by triggers), or if auto_commit is TRUE and an open transaction exists in a
parent or child workspace of any table that needs to be modified.
Examples
The following example refreshes NEWWORKSPACE by applying changes made in its
parent workspace.
EXECUTE DBMS_WM.RefreshWorkspace ('NEWWORKSPACE');
4.65 RemoveAsParentWorkspace
Removes a workspace as a parent workspace in a multiparent workspace
environment.
Syntax
DBMS_WM.RemoveAsParentWorkspace(
mp_leafworkspace IN VARCHAR2,
parent_workspace IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE);
4-97
Chapter 4
RemoveDeferredWorkspaces
Parameters
Parameter Description
Name of the child workspace (multiparent leaf workspace) from
mp_leaf_workspace
which to remove parent_workspace as a parent workspace. The
name is case-sensitive.
Name of the workspace to remove as a parent workspace of
parent_workspace
mp_leaf_workspace. The name is case-sensitive.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of
Workspace Manager Operations.
Usage Notes
This procedure is part of the support for the multiparent workspaces feature, which
is described in Multiparent Workspaces. This procedure must be used only on
a parent workspace that was previously added to the child workspace using the
AddAsParentWorkspace procedure.
This procedure does not remove any workspaces. It only makes parent_workspace no
longer a parent workspace of mp_leaf_workspace.
Examples
The following example removes Workspace4 as a parent workspace of Workspace3.
(See the hierarchy illustration in Multiparent Workspaces.)
EXECUTE DBMS_WM.RemoveAsParentWorkspace ('Workspace3', 'Workspace4');
4.66 RemoveDeferredWorkspaces
Removes the rows and locks from any version enabled tables associated with
workspaces that were removed by specifying either FAST or REMOVE_LOCKS for
4-98
Chapter 4
RemoveUserDefinedHint
Syntax
DBMS_WM.RemoveDeferredWorkspaces(
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager Operations.
Usage Notes
After a workspace has been removed using RemoveWorkspace or
RemoveWorkspaceTree and specifying FAST or REMOVE_LOCKS for the defer_option
parameter, the only way to remove the rows associated with that workspace is to
execute this procedure. In addition, if FAST was used, any locks that still remain will be
released.
This procedure removes the rows and any remaining metadata for all workspaces that
had deferred removal. It is not possible to specify a subset of the deferred workspaces
to be removed. Any workspaces that need to removed after being deferred will
appear in the DBA_WORKSPACES view with a DEFERRED_REMOVAL value for the
FREEZE_MODE column. Until a workspace in this state is removed, it is not possible
to create a new workspace using the same name.
WM_ADMIN privileges are necessary to execute this procedure.
Examples
The following example removes the rows and locks from any version enabled
tables associated with workspaces that were removed by specifying either FAST
or REMOVE_LOCKS for the defer_option parameter of the RemoveWorkspace or
RemoveWorkspaceTree procedure.
EXECUTE DBMS_WM.RemoveDeferredWorkspaces;
4.67 RemoveUserDefinedHint
Removes a user-defined hint: that is, causes the default optimizer hint to be used with
SQL statements executed by the DBMS_WM package on a specified version-enabled
table or all version-enabled tables.
4-99
Chapter 4
RemoveWorkspace
Syntax
DBMS_WM.RemoveUserDefinedHint(
hint_id IN NUMBER,
table_id IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
Numeric ID that uniquely identifies the user-defined hint. Must match an
hint_id
existing hint ID previously specified in a call to the AddUserDefinedHint
procedure.
Name of the table from which to remove the hint. The name is not case-
table_id
sensitive.
If this value is null and if the table_id parameter was null in the call to the
AddUserDefinedHint procedure that added the hint, the hint is no longer used
with any version-enabled tables for any SQL statements that specify the hint ID.
However, if this value is null and if the table_id parameter was not null
in the call to the AddUserDefinedHint procedure that added the hint, the
RemoveUserDefinedHint procedure will not remove any hints that were
defined for the originally specified tables.
Usage Notes
Use this procedure only to remove or modify the effect of a user-defined hint that you
previously specified using the AddUserDefinedHint procedure. (See the Usage Notes
for that procedure.)
Examples
The following example removes, for the SCOTT.TABLE1 table, the user-defined hint
from SQL statements associated with the hint with the hint ID 1101, and causes the
default hint to be used instead.
EXECUTE DBMS_WM.RemoveUSerDefinedHint (1101, 'scott.table1');
4.68 RemoveWorkspace
Discards all row versions associated with a workspace and deletes the workspace.
Syntax
DBMS_WM.RemoveWorkspace(
workspace IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE,
defer_option IN VARCHAR2 DEFAULT NULL;
4-100
Chapter 4
RemoveWorkspaceTree
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
The RemoveWorkspace operation can only be performed on leaf workspaces (the
bottom-most workspaces in a branch in the hierarchy). For an explanation of database
workspace hierarchy, see Workspace Hierarchy.
If the workspace being removed is a child workspace, its parent workspace is
exclusively locked for the duration of the operation.
There must be no other users in the workspace being removed.
An exception is raised if the user does not have the REMOVE_WORKSPACE privilege
for workspace or the REMOVE_ANY_WORKSPACE privilege, if the user does not have
sufficient privileges on all tables that need to be modified (including, for example,
tables modified by triggers), or if auto_commit is TRUE and an open transaction exists
in a parent or child workspace of any table that needs to be modified.
Examples
The following example removes the NEWWORKSPACE workspace.
EXECUTE DBMS_WM.RemoveWorkspace('NEWWORKSPACE');
4.69 RemoveWorkspaceTree
Discards all row versions associated with a workspace and its descendant
workspaces, and deletes the affected workspaces.
4-101
Chapter 4
RemoveWorkspaceTree
Syntax
DBMS_WM.RemoveWorkspaceTree(
workspace IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE,
defer_option IN VARCHAR2 DEFAULT NULL;
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
The RemoveWorkspaceTree operation should be used with extreme caution, because
it removes support structures and rolls back changes in a workspace and all its
descendants down to the leaf workspace or workspaces. For example, in the hierarchy
shown in Workspace Hierarchy, a RemoveWorkspaceTree operation specifying
Workspace1 removes Workspace1, Workspace2, and Workspace3. (For an explanation
of database workspace hierarchy, see Workspace Hierarchy.)
There must be no other users in workspace or any of its descendant workspaces.
An exception is raised if the user does not have the REMOVE_WORKSPACE privilege for
workspace or any of its descendant workspaces, if the user does not have sufficient
privileges on all tables that need to be modified (including, for example, tables
modified by triggers), or if auto_commit is TRUE and an open transaction exists in a
parent or child workspace of any table that needs to be modified.
Examples
The following example removes the NEWWORKSPACE workspace and all its descendant
workspaces.
EXECUTE DBMS_WM.RemoveWorkspaceTree('NEWWORKSPACE');
4-102
Chapter 4
RenameSavepoint
4.70 RenameSavepoint
Renames a savepoint in a specified workspace.
Syntax
DBMS_WM.RenameSavepoint(
workspace_name IN VARCHAR2,
savepoint_name IN VARCHAR2;
new_savepoint_name IN VARCHAR2;
Parameters
Parameter Description
Name of the existing workspace in which the savepoint to be
workspace_name
renamed exists. The name is case-sensitive.
Usage Notes
An exception is raised if the user does not own the workspace or savepoint or does
not have the WM_ADMIN system privilege.
Examples
The following example renames savepoint SP1 in the LIVE workspace to 2009
milestone.
EXECUTE DBMS_WM.RenameSavepoint('LIVE', 'SP11', '2009 milestone');
4.71 RenameWorkspace
Renames a workspace.
Syntax
DBMS_WM.RenameWorkspace(
workspace_name IN VARCHAR2,
new_workspace_name IN VARCHAR2;
4-103
Chapter 4
ResolveConflicts
Parameters
Parameter Description
Name of the existing workspace to be renamed. The name is case-
workspace_name
sensitive.
New name to be given to the workspace. The new name must not
new_workspace_name
be LIVE or the name of an existing workspace, and it must not
contain any of the following characters: " (double quotes), ' (single
quote), ` (grave accent), or | (vertical bar).
Usage Notes
This procedure automatically updates the metadata for existing version-enabled tables
to refer to the new workspace name. The time required for the procedure to complete
will depend on the number of version-enabled tables.
An exception is raised if the user does not own the workspace or does not have the
WM_ADMIN system privilege.
Examples
The following example renames workspace WS1 to Construction Project.
EXECUTE DBMS_WM.RenameWorkspace('WS1', 'Construction Project');
4.72 ResolveConflicts
Resolves conflicts between workspaces.
Syntax
DBMS_WM.ResolveConflicts(
workspace IN VARCHAR2,
table_name IN VARCHAR2,
where_clause IN VARCHAR2,
keep IN VARCHAR2,
resolve_base_ne IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the workspace to check for conflicts with other workspaces.
workspace
The name is case-sensitive.
Name of the table to check for conflicts. The name is not case-
table_name
sensitive.
4-104
Chapter 4
ResolveConflicts
Parameter Description
The WHERE clause (excluding the WHERE keyword) identifying
where_clause
the rows to be refreshed from the parent workspace. Example:
'department_id = 20'
Only primary key columns can be specified in the WHERE clause,
except in a subquery. The subquery can refer to columns that are not
primary keys, but it cannot refer to a version-enabled table.
Workspace in favor of which to resolve conflicts: PARENT, CHILD, or
keep
BASE.
PARENT causes the parent workspace rows to be copied to the child
workspace.
CHILD does not cause the child workspace rows to be copied
immediately to the parent workspace. However, the conflict is
considered resolved, and the child workspace rows are copied to the
parent workspace when the child workspace is merged.
BASE causes the base rows to be copied to the child workspace
but not to the parent workspace. However, the conflict is considered
resolved; and when the child workspace is merged, the base rows
are copied to the parent workspace. Note that BASE is ignored for
insert-insert conflicts where a base row does not exist; in this case,
the keep parameter value must be PARENT or CHILD.
A Boolean value (TRUE or FALSE). Applies only if the value of keep is
resolve_bnase_ne
BASE.
TRUE allows the resolution of conflicts in favor of the base row, even
when the base row was nonexistent, as is the case in an insert-insert
conflict.
FALSE (the default) disallows the resolution of conflicts in favor of
nonexistent base rows. If a nonexistent base row is encountered while
other conflicts are being resolved, the conflict is effectively ignored
and will not be considered resolved.
Usage Notes
This procedure checks the condition identified by the table_name and where_clause
parameters, and it finds any conflicts between row values in workspace and its
parent workspace. This procedure resolves conflicts by using the row values in the
parent or child workspace, as specified in the keep parameter; however, the conflict
resolution is not actually merged until you commit the transaction (standard database
commit operation) and call the CommitResolve procedure to end the conflict resolution
session. (For more information about conflict resolution, including an overall view of
the process, see Resolving Conflicts Before a Merge or Refresh Operation.)
For example, assume that for Department 20 (DEPARTMENT_ID = 20), the
MANAGER_NAME in the LIVE and Workspace1 workspaces is Tom. Then, the following
operations occur:
1. The manager_name for Department 20 is changed in the LIVE database workspace
from Tom to Mary.
2. The change is committed (a standard database commit operation).
4-105
Chapter 4
RevokeGraphPriv
Examples
The following example resolves conflicts involving rows in the DEPARTMENT table in
Workspace1 where DEPARTMENT_ID is 20, and uses the values in the child workspace
to resolve all such conflicts. It then merges the results of the conflict resolution by first
committing the transaction (standard commit) and then calling the MergeWorkspace
procedure.
EXECUTE DBMS_WM.BeginResolve ('Workspace1');
EXECUTE DBMS_WM.ResolveConflicts ('Workspace1', 'department', 'department_id =
20', 'child');
COMMIT;
EXECUTE DBMS_WM.CommitResolve ('Workspace1');
4.73 RevokeGraphPriv
Revokes (removes) privileges on multiparent graph workspaces from users and roles
for a specified leaf workspace.
4-106
Chapter 4
RevokeGraphPriv
Syntax
DBMS_WM.RevokeGraphPriv(
priv_types IN VARCHAR2,
leaf_workspace IN VARCHAR2,
grantee IN VARCHAR2.
node_types IN VARCHAR2 DEFAULT '(''R'',''I'',''L'')',
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
A string of one or more keywords representing privileges.
priv_types
(Privilege Management with Workspace Manager discusses
Workspace Manager privileges.) Use commas to separate
privilege keywords. The available keywords are ACCESS_WORKSPACE,
MERGE_WORKSPACE, CREATE_WORKSPACE, REMOVE_WORKSPACE, and
ROLLBACK_WORKSPACE.
Name of the leaf workspace in the directed acyclic graph. (Leaf
leaf_workspace
workspaces, directed acyclic graphs, and other concepts related to
multiparent workspaces are explained in Multiparent Workspaces.) The
name is case-sensitive.
Name of the user (can be the PUBLIC user group) or role from which to
grantee
revoke priv_types.
List of letters (in parentheses and comma-delimited) representing the
node_types
types of nodes on which to revoke the privileges: R for the root of the
graph, I for the specified intermediate node, L for the leaf of the graph.
The default is all types of nodes.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager
Operations.
Usage Notes
Contrast this procedure with RevokeWorkspacePriv , which grants workspace-
level Workspace Manager privileges on workspaces other than multiparent graph
workspaces.
To grant workspace-level privileges on multiparent graph workspaces, use the
GrantGraphPriv procedure.
An exception is raised if one or more of the following apply:
• grantee is not a valid user or role in the database.
• You were not the grantor of priv_types to grantee.
4-107
Chapter 4
RevokeSystemPriv
Examples
The following example disallows user Smith from accessing all types of nodes in the
directed acyclic graph in which the NEWWORKSPACE workspace is the leaf workspace and
from merging changes in these workspaces.
EXECUTE DBMS_WM.RevokeWorkspacePriv ('ACCESS_WORKSPACE, MERGE_WORKSPACE',
'NEWWORKSPACE', 'Smith');
4.74 RevokeSystemPriv
Revokes (removes) system-level privileges from users and roles.
Syntax
DBMS_WM.RevokeSystemPriv(
priv_types IN VARCHAR2,
grantee IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
A string of one or more keywords representing privileges. (Privilege
priv_types
Management with Workspace Manager discusses Workspace Manager
privileges.) Use commas to separate privilege keywords. The
available keywords are ACCESS_ANY_WORKSPACE, MERGE_ANY_WORKSPACE,
CREATE_ANY_WORKSPACE, REMOVE_ANY_WORKSPACE, and
ROLLBACK_ANY_WORKSPACE.
Name of the user (can be the PUBLIC user group) or role from which to
grantee
revoke priv_types.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager Operations.
Usage Notes
Contrast this procedure with RevokeWorkspacePriv , which revokes workspace-
level Workspace Manager privileges with keywords in the form xxx_WORKSPACE
(ACCESS_WORKSPACE, MERGE_WORKSPACE, and so on).
4-108
Chapter 4
RevokeWorkspacePriv
Examples
The following example disallows user Smith from accessing workspaces and merging
changes in workspaces.
EXECUTE DBMS_WM.RevokeSystemPriv ('ACCESS_ANY_WORKSPACE, MERGE_ANY_WORKSPACE',
'Smith');
4.75 RevokeWorkspacePriv
Revokes (removes) workspace-level privileges from users and roles for a specified
workspace.
Syntax
DBMS_WM.RevokeWorkspacePriv(
priv_types IN VARCHAR2,
workspace IN VARCHAR2,
grantee IN VARCHAR2.
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
A string of one or more keywords representing privileges. (Privilege
priv_types
Management with Workspace Manager discusses Workspace Manager
privileges.) Use commas to separate privilege keywords. The
available keywords are ACCESS_WORKSPACE, MERGE_WORKSPACE,
CREATE_WORKSPACE, REMOVE_WORKSPACE, and ROLLBACK_WORKSPACE.
Name of the workspace. The name is case-sensitive.
workspace
Name of the user (can be the PUBLIC user group) or role from which to
grantee
revoke priv_types.
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager
Operations.
Usage Notes
Contrast this procedure with RevokeSystemPriv , which revokes system-level
Workspace Manager privileges with keywords in the form xxx_ANY_WORKSPACE
(ACCESS_ANY_WORKSPACE, MERGE_ANY_WORKSPACE, and so on). Also contrast this
4-109
Chapter 4
RollbackBulkLoading
Examples
The following example disallows user Smith from accessing the NEWWORKSPACE
workspace and merging changes in that workspace.
EXECUTE DBMS_WM.RevokeWorkspacePriv ('ACCESS_WORKSPACE, MERGE_WORKSPACE',
'NEWWORKSPACE', 'Smith');
4.76 RollbackBulkLoading
Rolls back changes made to a version-enabled table during a bulk load operation.
Syntax
DBMS_WM.RollbackBulkLoading(
table_name IN VARCHAR2,
ignore_last_error IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the version-enabled table into which data will be bulk
table_name
loaded. The name is not case-sensitive.
Usage Notes
For information about the requirements for bulk loading data into version-enabled
tables, see Bulk Loading into Version-Enabled Tables.
This procedure re-creates all the views that were dropped by the BeginBulkLoading
procedure.
4-110
Chapter 4
RollbackDDL
If a call to the RollbackBulkLoading procedure fails, you should try to fix the cause of
the error. Examine the USER_WM_VT_ERRORS and ALL_WM_VT_ERRORS static
data dictionary views to see the SQL statement and error message. Fix the cause
of the error, and then call the RollbackBulkLoading 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
RollbackBulkLoading 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:
• table_name does not exist.
• table_name is not version-enabled.
• The BeginBulkLoading procedure has not been called on the table.
• The user does not own the table or does not have the WM_ADMIN system privilege.
Examples
The following example rolls back changes made to EMP table during a bulk load
operation.
EXECUTE DBMS_WM.RollbackBulkLoading ('EMP');
4.77 RollbackDDL
Rolls back (cancels) DDL (data definition language) changes made during a DDL
session for a specified table, and ends the DDL session.
Syntax
DBMS_WM.RollbackDDL(
table_name IN VARCHAR2);
Parameters
Parameter Description
Name of the version-enabled table. The name is not case-sensitive.
table_name
Usage Notes
This procedure rolls back (cancels) changes that were made to a version-enabled
table and to any indexes and triggers based on the version-enabled table during a
DDL session. It also deletes the <table-name>_LTS skeleton table that was created by
the BeginDDL procedure.
For detailed information about performing DDL operations related to version-enabled
tables, see DDL Operations Related to Version-Enabled Tables.
An exception is raised if one or more of the following apply:
4-111
Chapter 4
RollbackResolve
Examples
The following example begins a DDL session, adds a column named COMMENTS
to the COLA_MARKETING_BUDGET table by using the skeleton table named
COLA_MARKETING_BUDGET_LTS, and ends the DDL session by canceling the change.
EXECUTE DBMS_WM.BeginDDL('COLA_MARKETING_BUDGET');
ALTER TABLE cola_marketing_budget_lts ADD (comments VARCHAR2(100));
EXECUTE DBMS_WM.RollbackDDL('COLA_MARKETING_BUDGET');
4.78 RollbackResolve
Quits a conflict resolution session and discards all changes in the workspace since the
BeginResolve procedure was executed.
Syntax
DBMS_WM.RollbackResolve(
workspace IN VARCHAR2);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
This procedure quits the current conflict resolution session (started by the
BeginResolve procedure), and discards all changes in the workspace since the start
of the conflict resolution session. Contrast this procedure with CommitResolve, which
saves all changes.
While the conflict resolution session is being rolled back, the workspace is frozen in
1WRITER mode, as explained in Freezing and Unfreezing Workspaces.
For more information about conflict resolution, see Resolving Conflicts Before a Merge
or Refresh Operation.
An exception is raised if one or more of the following apply:
• There are one or more open database transactions in workspace.
• The procedure was called by a user that does not have the WM_ADMIN system
privilege or that did not execute the BeginResolve procedure on workspace.
4-112
Chapter 4
RollbackTable
Examples
The following example quits the conflict resolution session in Workspace1 and discards
all changes.
EXECUTE DBMS_WM.RollbackResolve ('Workspace1');
4.79 RollbackTable
Discards all changes made in the workspace to a specified table (all rows or as
specified in the WHERE clause).
Syntax
DBMS_WM.RollbackTable(
workspace IN VARCHAR2,
table_id IN VARCHAR2,
sp_name IN VARCHAR2 DEFAULT '',
where_clause IN VARCHAR2 DEFAULT '',
remove_locks IN BOOLEAN DEFAULT TRUE,
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
The WHERE clause (excluding the WHERE keyword) identifying the rows to
where_clause
be discarded. Example: 'department_id = 20'
Only primary key columns can be specified in the WHERE clause, except in
a subquery. The subquery can refer to columns that are not primary keys,
but it cannot refer to a version-enabled table.
If the where_clause parameter is not specified, all rows that meet the
criteria of the other parameters are discarded.
A Boolean value (TRUE or FALSE).
remove_locks
TRUE (the default) releases those locks on rows in the parent workspace
that satisfy the condition in the where_clause parameter and that
were not versioned in the child workspace. This option has no effect if a
savepoint is specified (sp_name parameter).
FALSE does not release any locks in the parent workspace.
4-113
Chapter 4
RollbackToSP
Parameter Description
A Boolean value (TRUE or FALSE).
auto_commit
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 Autocommitting of Workspace Manager
Operations.
Usage Notes
You cannot roll back to a savepoint if any implicit savepoints were created since the
specified savepoint, unless you first merge or remove the descendant workspaces that
caused the implicit savepoints to be created. For example, referring to Figure 1-2
in Using Savepoints, the user in Workspace1 cannot roll back to savepoint SP1
until Workspace3 (which caused implicit savepoint SPc to be created) is merged or
removed.
An exception is raised if one or more of the following apply:
• workspace does not exist.
• You do not have the privilege to roll back workspace or any affected table.
• A database transaction affecting table_id is open in any workspace.
• auto_commit is TRUE and an open transaction exists in a parent or child workspace
of any table that needs to be modified.
Examples
The following example rolls back all changes made to the EMP table (in the USER3
schema) in the NEWWORKSPACE workspace since that workspace was created.
EXECUTE DBMS_WM.RollbackTable ('NEWWORKSPACE', 'user3.emp');
4.80 RollbackToSP
Discards all data changes made in the workspace to version-enabled tables since the
specified savepoint.
Syntax
DBMS_WM.RollbackToSP(
workspace IN VARCHAR2,
savepoint_name IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE);
4-114
Chapter 4
RollbackToSP
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
While this procedure is executing, the workspace is frozen in NO_ACCESS mode.
Contrast this procedure with RollbackWorkspace, which rolls back all changes made
since the creation of the workspace.
You cannot roll back to a savepoint if any implicit savepoints were created since the
specified savepoint, unless you first merge or remove the descendant workspaces
that caused the implicit savepoints to be created. For example, referring to Figure 1-2
in Using Savepoints, the user in Workspace1 cannot roll back to savepoint SP1 until
Workspace3 (which caused implicit savepoint SPc to be created) is merged or removed.
Examples
The following example rolls back any changes made in the NEWWORKSPACE workspace
to all tables since the creation of Savepoint1.
EXECUTE DBMS_WM.RollbackToSP ('NEWWORKSPACE', 'Savepoint1');
4-115
Chapter 4
RollbackWorkspace
4.81 RollbackWorkspace
Discards all data changes made in the workspace to version-enabled tables.
Syntax
DBMS_WM.RollbackWorkspace(
workspace IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
Only leaf workspaces can be rolled back. That is, a workspace cannot be rolled back
if it has any descendant workspaces. (For an explanation of workspace hierarchy, see
Workspace Hierarchy.)
Contrast this procedure with RollbackToSP, which rolls back changes to a specified
savepoint.
Like the RemoveWorkspace procedure, RollbackWorkspace deletes the data in the
workspace; however, unlike the RemoveWorkspace procedure, RollbackWorkspace
does not delete the Workspace Manager workspace structure.
While this procedure is executing, the specified workspace is frozen in NO_ACCESS
mode, as explained in Freezing and Unfreezing Workspaces.
An exception is raised if one or more of the following apply:
• workspace has any descendant workspaces.
• workspace does not exist.
• auto_commit is TRUE and an open transaction exists in a parent or child workspace
of any table that needs to be modified.
• You do not have the privilege to roll back workspace or any affected table.
• Any sessions are in workspace.
4-116
Chapter 4
SetCaptureEvent
Examples
The following example rolls back any changes made in the NEWWORKSPACE workspace
since that workspace was created.
EXECUTE DBMS_WM.RollbackWorkspace ('NEWWORKSPACE');
4.82 SetCaptureEvent
Enables or disables the capture of all Workspace Manager events or events of a
specific type.
Syntax
DBMS_WM.SetCaptureEvent(
event_name IN VARCHAR2,
capture IN VARCHAR2 DEFAULT 'ON');
Parameters
Parameter Description
One of the following values: ALL_EVENTS, TABLE_MERGE_W_REMOVE_DATA,
event_name
TABLE_MERGE_WO_REMOVE_DATA, TABLE_REFRESH,
TABLE_ROLLBACK, WORKSPACE_COMPRESS, WORKSPACE_CREATE,
WORKSPACE_MERGE_W_REMOVE, WORKSPACE_MERGE_WO_REMOVE,
WORKSPACE_REFRESH, WORKSPACE_REMOVE, WORKSPACE_ROLLBACK,
WORKSPACE_VERSION.
ALL_EVENTS includes all Workspace Manager events. The other values
reflect specific event types, which are listed and explained in List of
Workspace Manager Events.
capture
ON (the default) enables the capture of event_name events.
OFF disables the capture of event_name events.
Usage Notes
For information about Workspace Manager events, see Workspace Manager Events.
This procedure requires that the Workspace Manager system parameter
ALLOW_CAPTURE_EVENTS be set to ON. To check the value of a Workspace Manager
system parameter, use the GetSystemParameter procedure; to set a Workspace
Manager system parameter, use the SetSystemParameter procedure.
You can use this procedure to control which types of events are captured. For
example, you can enable the capture of all events, and then disable the capture of
a few types of events; or you can disable the capture of all events, and then enable the
capture of a few types of events.
To see which types of events are currently being captured, examine the
WM_EVENTS_INFO metadata view, which is described in WM_EVENTS_INFO.
If this procedure completes successfully, it commits the caller's open database
transaction.
4-117
Chapter 4
SetCompressWorkspace
Examples
The following example captures all Workspace Manager events except workspace
compression events, by first specifying that all events are to be captured, and then
excluding workspace compression events.
-- Allow Workspace Manager events to be captured. (Required for SetCaptureEvent)
EXECUTE DBMS_WM.SetSystemParameter ('ALLOW_CAPTURE_EVENTS', 'ON');
-- Start capturing all Workspace Manager events.
EXECUTE DBMS_WM.SetCaptureEvent ('ALL_EVENTS','ON');
-- Exclude workspace compression events.
EXECUTE DBMS_WM.SetCaptureEvent ('WORKSPACE_COMPRESS','OFF');
4.83 SetCompressWorkspace
Creates rows in the WM_COMPRESSIBLE_TABLES metadata view with information
about version-enabled tables that need to be compressed if workspace compression
operations are performed.
Syntax
DBMS_WM.SetCompressWorkspace(
workspace IN VARCHAR2,
firstSP IN VARCHAR2 DEFAULT NULL,
secondSP IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
4-118
Chapter 4
SetConflictWorkspace
Usage Notes
You can (but do not need to) use this procedure before calling the
CompressWorkspace or CompressWorkspaceTree procedure.
This procedure creates rows in the WM_COMPRESSIBLE_TABLES metadata view
(described in WM_COMPRESSIBLE_TABLES) only for version-enabled tables that
would need to be compressed during a workspace compression operation.
Examples
The following example creates rows in the WM_COMPRESSIBLE_TABLES metadata
view for any version-enabled tables that would need to be compressed during an
operation that compressed the B_focus_1 workspace.
EXECUTE DBMS_WM.SetCompressWorkspace ('B_focus_1');
4.84 SetConflictWorkspace
Determines whether or not conflicts exist between a workspace and its parent.
Syntax
DBMS_WM.SetConflictWorkspace(
workspace IN VARCHAR2);
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
This procedure checks for any conflicts between workspace and its parent workspace,
and it modifies the content of the <table_name>_CONF views (explained in
xxx_CONF Views) as needed.
A SELECT operation from the <table_name>_CONF views for all tables modified in
a workspace displays all rows in the workspace that are in conflict with the parent
workspace. (To obtain a list of tables that have conflicts for the current conflict
workspace setting, use the SQL statement SELECT * FROM ALL_WM_VERSIONED_TABLES
WHERE conflict = 'YES';. The SQL statement SELECT * FROM <table_name>_CONF
displays conflicts for <table_name> between the current workspace and its parent
workspace.)
Any conflicts must be resolved before a workspace can be merged or refreshed. To
resolve a conflict, you must use the ResolveConflicts procedure, and then merge the
result of the resolution by using the MergeWorkspace procedure.
4-119
Chapter 4
SetDiffVersions
Examples
The following example checks for any conflicts between B_focus_2 and its parent
workspace, and modifies the contents of the <table_name>_CONF views as needed.
EXECUTE DBMS_WM.SetConflictWorkspace ('B_focus_2');
4.85 SetDiffVersions
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.
Syntax
DBMS_WM.SetDiffVersions(
workspace1 IN VARCHAR2,
workspace2 IN VARCHAR2,
onlyModified IN BOOLEAN DEFAULT FALSE);
or
DBMS_WM.SetDiffVersions(
workspace1 IN VARCHAR2,
savepoint1 IN VARCHAR2,
workspace2 IN VARCHAR2,
savepoint2 IN VARCHAR2,
onlyModified IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
Name of the first workspace to be checked for differences in version-
workspace1
enabled tables. The name is case-sensitive.
4-120
Chapter 4
SetDiffVersions
Parameter Description
A Boolean value (TRUE or FALSE).
onlyModified
TRUE removes from the _DIFF any rows that have a NC (no change)
or NE (nonexistent) value for the WM_CODE column. This improves the
performance of the view when these rows are not needed. As such, each
primary key can have from one through three rows, instead of the usual
three.
FALSE (the default) causes queries on the _DIFF view to always return
three rows for each primary key value: one for the base row, and one for
each of the specified savepoints.
Usage Notes
This procedure modifies the contents of the differences views (xxx_DIFF), which are
described in xxx_DIFF Views. Each call to the procedure populates one or more sets
of three rows, each set consisting of:
• Values for the common ancestor
• Values for workspace1 (savepoint1 or LATEST savepoint values)
• Values for workspace2 (savepoint2 or LATEST savepoint values)
You can then select rows from the appropriate xxx_DIFF view or views to check
comparable table values in the two savepoints and their common ancestor. The
common ancestor (or base) is identified as DiffBase in xxx_DIFF view rows.
Examples
The following example checks the differences in version-enabled tables for the
B_focus_1 and B_focus_2 workspaces. (The output has been reformatted for
readability.)
-- Add rows to difference view: COLA_MARKETING_BUDGET_DIFF
EXECUTE DBMS_WM.SetDiffVersions ('B_focus_1', 'B_focus_2');
12 rows selected.
4-121
Chapter 4
SetLockingOFF
xxx_DIFF Views explains how to interpret and use the information in the differences
(xxx_DIFF) views.
4.86 SetLockingOFF
Disables Workspace Manager locking for the current session.
Syntax
DBMS_WM.SetLockingOFF();
Parameters
None.
Usage Notes
This procedure turns off Workspace Manager locking that was set on by the
SetLockingON procedure. Existing locks applied by this session remain locked. All
new changes by this session are not locked.
Examples
The following example sets locking off for the session.
EXECUTE DBMS_WM.SetLockingOFF;
4.87 SetLockingON
Enables Workspace Manager locking for the current session.
Syntax
DBMS_WM.SetLockingON(
lockmode IN VARCHAR2);
4-122
Chapter 4
SetLockingON
Parameters
Parameter Description
Locking mode. Must be E, WE, VE, S, or C.
lockmode
E (exclusive) mode locks the rows in the previous version and the
corresponding rows in the current version; no other users in the workspace
for either version can change any values.
WE (workspace-exclusive) mode locks the rows in the previous version and the
corresponding rows in the current version such that only the user that set the
lock can change the values in the current workspace; however, other users in
other workspaces can change the values.
VE (version-exclusive) mode locks the rows in the previous version and the
corresponding rows in the current version such that only the user that set the
lock can change the values; no other users (in any workspace) can change
the values.
S (shared) mode locks the rows in the previous version and the corresponding
rows in the current version; however, other users in the workspace for the
current version (but no users in the workspace for the previous version) can
change values in these rows.
C (carry-forward) mode locks rows in the current workspace with the same
locking mode as the corresponding rows in the previous version. (If a row is
not locked in the previous version, its corresponding row in the current version
is not locked.)
Usage Notes
This procedure affects Workspace Manager locking, which occurs in addition to any
standard Oracle database locking. Workspace Manager locks can be used to prevent
conflicts. When a user locks a row, the corresponding row in the parent workspace is
also locked. Thus, when this workspace merges with the parent at merge time, it is
guaranteed that this row will not have a conflict.
For information about Workspace Manager lock management, see Lock Management
with Workspace Manager.
Exclusive locking (lockmode value of E) prevents the use of what-if scenarios in
which different values for one or more columns are tested. Thus, plan any testing
of scenarios when exclusive locking is not in effect.
Locking is enabled at the user session level, and the locking mode stays in effect until
any of the following occurs:
• The session goes to another workspace or connects to the database, in which
case the locking mode is set to C (carry-forward) unless another locking mode has
been specified using the SetWorkspaceLockModeON procedure.
• The session executes the SetLockingOFF procedure.
The locks remain in effect for the duration of the workspace, unless unlocked by
the UnlockRows procedure. (Existing locks are not affected by the SetLockingOFF
procedure.)
There are no specific privileges associated with locking. Any session that can go to a
workspace can set locking on.
4-123
Chapter 4
SetMultiWorkspaces
Examples
The following example sets exclusive locking on for the session.
EXECUTE DBMS_WM.SetLockingON ('E');
All rows locked by this user remain locked until the workspace is merged or rolled
back.
4.88 SetMultiWorkspaces
Makes the specified workspace or workspaces visible in the multiworkspace views for
version-enabled tables.
Syntax
DBMS_WM.SetMultiWorkspaces(
workspaces IN VARCHAR2);
Parameters
Parameter Description
The workspace or workspaces for which information is to be added to
workspaces
the multiworkspace views (described in xxx_MW Views). The workspace
names are case-sensitive.
To specify more than one workspace (but no more than eight),
use a comma to separate workspace names. For example:
'workspace1,workspace2'
Usage Notes
This procedure adds rows to the multiworkspace views (xxx_MW). See xxx_MW Views
for information about the contents and uses of these views.
To see the names of workspaces visible in the multiworkspace views, use the
GetMultiWorkspaces function.
An exception is raised if one or more of the following apply:
• The user does not have the privilege to go to one or more of the workspaces
named in workspaces.
• A workspace named in workspaces is not valid.
Examples
The following example adds information to the multiworkspace views for version-
enabled tables in the B_focus_1 workspace.
EXECUTE DBMS_WM.SetMultiWorkspaces ('B_focus_1');
The following example shows the use of the SetMultiWorkspaces procedure to view
information without leaving the current workspace, and the use of the GotoWorkspace
procedure to view the same information.
4-124
Chapter 4
SetSystemParameter
To select only the rows modified in myworkspace, change the first SELECT statement in
the preceding example to the following:
SELECT * from mytable_mw WHERE wm_modified_by = 'myworkspace';
The following example shows the latest rows in the combined ancestor versions of the
workspaces named myworkspace and yourworkspace. If the same row is selected from
more than workspace, that row is shown only once. Note that there may be more than
one row for a primary key because different workspaces might be selecting different
versions of the primary key.
EXECUTE DBMS_WM.SetMultiWorkspaces ('myworkspace,yourworkspace');
SELECT * from mytable_mw;
4.89 SetSystemParameter
Sets the value of a Workspace Manager system parameter.
Syntax
DBMS_WM.SetSystemParameter(
name IN VARCHAR2,
value IN VARCHAR2);
Parameters
Parameter Description
Name of the Workspace Manager system parameter for which to set the
name
value. The name must be one of the parameter names listed in the table in
System Parameters for Workspace Manager.
Value for the specified Workspace Manager system parameter, as explained
value
in the table in System Parameters for Workspace Manager.
Usage Notes
For information about Workspace Manager system parameters, see System
Parameters for Workspace Manager.
If this procedure completes successfully, it commits the caller's open database
transaction.
An exception is raised if one or more of the following apply:
• The user does not have the WM_ADMIN system privilege.
• The system parameter name is not valid.
• The value is not valid for the system parameter.
4-125
Chapter 4
SetTriggerEvents
• You tried to disallow capturing of events, and one or more types of events were
being captured. You must first disable the capturing of all events (for example, by
calling the SetCaptureEvent procedure and specifying ALL_EVENTS for event_type
and OFF for capture).
• You tried to disallow multiparent workspaces, and one or more multiparent
workspaces already existed. You must first ensure that all workspaces
have no more than one parent workspace (for example, by calling the
RemoveAsParentWorkspace procedure as needed).
• You tried to disallow nested table columns, and one or more tables with a nested
table column were version-enabled. You must first disable versioning on all tables
with nested table columns.
• You tried to change CR_WORKSPACE_MODE or NONCR_WORKSPACE_MODE to
PESSIMISTIC_LOCKING, and data exists in a non-LIVE workspace for the
corresponding type of workspace (continually refreshed or not continually
refreshed).
Examples
The following example allows multiparent workspaces (described in Multiparent
Workspaces) to be created.
EXECUTE DBMS_WM.SetSystemParameter ('ALLOW_MULTI_PARENT_WORKSPACES', 'ON');
4.90 SetTriggerEvents
Enables the execution of a trigger for a specified set of triggering events. The trigger
will not be executed for events not specified
Syntax
DBMS_WM.SetTriggerEvents(
triggerName IN VARCHAR2,
triggerEvents IN VARCHAR2);
Parameters
Parameter Description
Name of the trigger for which to set one or more events.
triggerName
4-126
Chapter 4
SetTriggerEvents
Parameter Description
A comma-delimited list of trigger event names, where each trigger
triggerEvents
event name is one of the following string constants:
DBMS_WM.DML: Only for DML operations.
DBMS_WM.TABLE_IMPORT: Import table (using the Import procedure).
DBMS_WM.TABLE_MERGE_W_REMOVE_DATA: Merge table and remove
data.
DBMS_WM.TABLE_MERGE_WO_REMOVE_DATA: Merge table without
removing data.
DBMS_WM.WORKSPACE_MERGE_W_REMOVE: Merge workspace and
remove the workspace
DBMS_WM.WORKSPACE_MERGE_WO_REMOVE: Merge workspace without
removing the workspace.
Usage Notes
For information about using triggers with Workspace Manager, see Triggers on
Version-Enabled Tables.
By default, user-defined triggers are executed for both DML and workspace events,
unless the default behavior is changed by using the Workspace Manager system
parameter FIRE_TRIGGERS_FOR_NONDML_EVENTS (described in System Parameters for
Workspace Manager). You can use the SetTriggerEvents procedure to override
the current FIRE_TRIGGERS_FOR_NONDML_EVENTS setting for specific triggers; however,
if you later change the value of the FIRE_TRIGGERS_FOR_NONDML_EVENTS system
parameter, this new value overrides any setting previously specified using the
SetTriggerEvents procedure.
Examples
The following example enables the trigger SCOTT.InsertTrigger only for DML events.
EXECUTE DBMS_WM.setTriggerEvents('SCOTT.InsertTrigger', DBMS_WM.DML);
The following example enables the trigger SCOTT.InsertTrigger for DML events and
table merge operations.
EXECUTE DBMS_WM.setTriggerEvents('SCOTT.InsertTrigger', dbms_wm.DML || ',' ||
dbms_wm.TABLE_MERGE_WO_REMOVE_DATA || ',' ||
dbms_wm.TABLE_MERGE_W_REMOVE_DATA);
4-127
Chapter 4
SetValidTime
4.91 SetValidTime
Sets the session valid time period. (Valid time support is described in Workspace
Manager Valid Time Support.)
Syntax
DBMS_WM.SetValidTime(
validFrom IN TIMESTAMP WITH TIME ZONE DEFAULT DBMS_WM.CURRENT_TIME,
validTill IN TIMESTAMP WITH TIME ZONE DEFAULT DBMS_WM.UNTIL_CHANGED);
Parameters
Parameter Description
The start of the session valid time period. The default value is the current
validFrom
timestamp value.
The end of the session valid time period. The default is that the time
validTill
remains valid until the session valid time is changed.
Usage Notes
For information about Workspace Manager valid time support, see Workspace
Manager Valid Time Support. WM_PERIOD Data Type explains how validFrom and
validTill values are interpreted.
If this procedure is not invoked in the session or if it is invoked with no parameters, all
rows that are valid at the current time are considered valid, and the valid time period is
considered to be from the current time forward without limit.
Examples
The following example sets the session valid time to include all of the year 2003.
EXECUTE DBMS_WM.SetValidTime(TO_DATE('01-01-2003', 'MM-DD-YYYY'),
TO_DATE('01-01-2004', 'MM-DD-YYYY'));
4.92 SetValidTimeFilterOFF
Removes the valid time filter for the current session.
Syntax
DBMS_WM.SetValidTimeFilterOFF();
Parameters
None.
Usage Notes
This procedure reverses the effect of theSetValidTimeFilterON procedure, and causes
the previously defined valid time filter to be ignored for queries against tables with
4-128
Chapter 4
SetValidTimeFilterON
valid time support. Workspace Manager valid time support is explained in Workspace
Manager Valid Time Support.
See also the Usage Notes for the SetValidTimeFilterON procedure.
Examples
The following example removes the valid time filter for the current session.
EXECUTE DBMS_WM.SetValidTimeFilterOFF;
4.93 SetValidTimeFilterON
Sets a valid time filter for the current session (that is, a time to be applied to version-
enabled tables.
Syntax
DBMS_WM.SetValidTimeFilterON(
filtertime IN TIMESTAMP WITH TIME ZONE DEFAULT NULL);
Parameters
Parameter Description
Date to be used as a filter when querying version-enabled tables that have
filtertime
valid time support.
The default value is the current time; that is, each select operation on a
version-enabled table with valid time support returns data that is valid as of
the current time.
Usage Notes
A valid time filter is a time that is applied to queries against version-enabled tables
that have valid time support. When a valid time filter is set for the current session, only
rows that are valid for the specified time are returned. Workspace Manager valid time
support is explained in Workspace Manager Valid Time Support.
The purpose for setting a valid time filter is usually to work with only one row for a
given primary key value. For example, assume that for the current valid time period,
the session has two rows for employee Adams: the first row is valid from 01-Mar-2004
to 30-Apr-2005, and the second row is valid from 01-May-2005 until it is changed. If
you set the valid time filter to 01-Jan-2005 and select all rows for Adams, only the first
row (the one valid from 01-Mar-2004 to 30-Apr-2005) is returned. If you remove the
valid time filter and select all rows for Adams, both rows are returned.
The filtertime value must be in the valid time range for the session. You can set the
valid time range using the SetValidTime procedure.
Examples
The following example sets a valid time filter so that for queries against version-
enabled tables with valid time support, only rows that are valid on January 1, 2005 are
returned.
EXECUTE DBMS_WM.SetValidTimeFilterOn(TO_DATE('2005-01-01', 'yyyy-mm-dd'));
4-129
Chapter 4
SetWMValidUpdateModeOFF
4.94 SetWMValidUpdateModeOFF
Disables sequenced and nonsequenced update operations and sequenced delete
operations on tables that have valid time support.
Syntax
DBMS_WM.SetWMValidUpdateModeOFF();
Parameters
None.
Usage Notes
This procedure disables sequenced and nonsequenced update operations and
sequenced delete operations on tables that have valid time support. Workspace
Manager valid time support is explained in Workspace Manager Valid Time Support;
sequenced and nonsequenced update operations and sequenced delete operations
are explained in Update Operations.
When sequenced update and delete operations are enabled, when an update or
delete operation is performed on a table with valid time support, the session's current
valid time period is used so that only rows valid during that period are updated
or deleted. However, calling the SetWMValidUpdateModeOFF procedure enables all
row data to be updated or deleted, regardless of the valid time period, and causes
WM_VALID column values in the table not to be updated. (This procedure does not
affect insert or query operations on tables with valid time support.)
See also the Usage Notes for the SetWMValidUpdateModeON procedure.
Examples
The following example disables sequenced and nonsequenced update operations and
sequenced delete operations on tables that have valid time support.
EXECUTE DBMS_WM.SetWMValidUpdateModeOFF;
4.95 SetWMValidUpdateModeON
Enables sequenced and nonsequenced update operations and sequenced delete
operations on tables that have valid time support.
Syntax
DBMS_WM.SetWMValidUpdateModeON();
Parameters
None.
Usage Notes
This procedure enables sequenced and nonsequenced update operations and
sequenced delete operations on tables that have valid time support. Sequenced
update and delete operations are enabled when a table is version-enabled with
4-130
Chapter 4
SetWoOverwriteOFF
valid time support or when valid time support is added to a version-enabled table;
however, sequenced update and delete operations can be disabled using the
SetWMValidUpdateModeOFF procedure.
Workspace Manager valid time support is explained in Workspace Manager Valid Time
Support; sequenced and nonsequenced update operations and sequenced delete
operations are explained in Insert Operations.
Examples
The following example enables sequenced and nonsequenced update operations and
sequenced delete operations on tables that have valid time support. It reverses the
effect of the SetWMValidUpdateModeOFF procedure.
EXECUTE DBMS_WM.SetWMValidUpdateModeON;
4.96 SetWoOverwriteOFF
Disables the VIEW_WO_OVERWRITE history option that was enabled by the
EnableVersioning or SetWoOverwriteON procedure, changing the option to
VIEW_W_OVERWRITE (with overwrite).
Syntax
DBMS_WM.SetWoOverwriteOFF();
Parameters
None.
Usage Notes
This procedure affects the recording of history information in the views
named <table_name>_HIST by changing the VIEW_WO_OVERWRITE option to
VIEW_W_OVERWRITE. That is, from this point forward, the views 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.
This procedure affects only tables that were version-enabled with the hist parameter
set to VIEW_WO_OVERWRITE in the call to the EnableVersioning procedure.
Examples
The following example disables the VIEW_WO_OVERWRITE history option.
EXECUTE DBMS_WM.SetWoOverwriteOFF;
4-131
Chapter 4
SetWoOverwriteON
4.97 SetWoOverwriteON
Enables the VIEW_WO_OVERWRITE history option that was disabled by the
SetWoOverwriteOFF procedure.
Syntax
DBMS_WM.SetWoOverwriteON();
Parameters
None.
Usage Notes
This procedure affects the recording of history information in the views named
<table_name>_HIST by changing the VIEW_W_OVERWRITE option to VIEW_WO_OVERWRITE
(without overwrite). That is, from this point forward, the views 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.
This procedure affects only tables that were affected by a previous call to the
SetWoOverwriteOFF procedure.
The <table_name>_HIST views are described in xxx_HIST Views. The
VIEW_WO_OVERWRITE and VIEW_W_OVERWRITE options are further described in the
description of the EnableVersioning procedure.
The VIEW_WO_OVERWRITE history option can be overridden when a workspace is
compressed by specifying the compress_view_wo_overwrite parameter as TRUE with
the CompressWorkspace or CompressWorkspaceTree procedure.
The history option affects the behavior of the GotoDate procedure. See the Usage
Notes for that procedure.
To reverse the effect of this procedure, use the SetWoOverwriteOFF procedure.
Examples
The following example enables the VIEW_WO_OVERWRITE history option.
EXECUTE DBMS_WM.SetWoOverwriteON;
4.98 SetWorkspaceLockModeOFF
Disables Workspace Manager locking for the specified workspace.
Syntax
DBMS_WM.SetWorkspaceLockModeOFF(
workspace IN VARCHAR2,
auto_commit IN BOOLEAN DEFAULT TRUE);
4-132
Chapter 4
SetWorkspaceLockModeON
Parameters
Parameter Description
Name of the workspace for which to set the locking mode off. The name is
workspace
case-sensitive.
Usage Notes
This procedure turns off Workspace Manager locking that was set on by the
SetWorkspaceLockModeON procedure. Existing locks applied by this session remain
locked. All new changes by this session or a subsequent session are not locked,
unless the session turns locking on by executing the SetLockingON procedure.
An exception is raised if any of the following occurs:
• The user does not have the WM_ADMIN system privilege or is not the owner of
workspace.
• auto_commit is TRUE and an open transaction exists.
Examples
The following example sets locking off for the workspace named NEWWORKSPACE.
EXECUTE DBMS_WM.SetWorkspaceLockModeOFF('NEWWORKSPACE');
4.99 SetWorkspaceLockModeON
Enables Workspace Manager locking for the specified workspace.
Syntax
DBMS_WM.SetWorkspaceLockModeON(
workspace IN VARCHAR2,
lockmode IN VARCHAR2,
override IN BOOLEAN DEFAULT FALSE,
auto_commit IN BOOLEAN DEFAULT TRUE);
4-133
Chapter 4
SetWorkspaceLockModeON
Parameters
Parameter Description
Name of the workspace for which to enable Workspace Manager locking.
workspace
The name is case-sensitive.
4-134
Chapter 4
UnfreezeWorkspace
Usage Notes
This procedure affects Workspace Manager locking, which occurs in addition to any
standard Oracle database locking. Workspace Manager locks can be used to prevent
conflicts. When a user locks a row, the corresponding row in the parent workspace is
also locked. Thus, when this workspace merges with the parent at merge time, it is
guaranteed that this row will not have a conflict.
For information about Workspace Manager lock management, see Lock Management
with Workspace Manager.
The main use for the"Disregard" locking mode (lockmode value of D) is so that a
workspace can be completely isolated from the rest of the workspaces in the system
and is free to update any rows it wants. It turns the workspace into a test ("sandbox")
workspace where anything can be tested, but because it cannot merge or refresh, the
workspace is unable to propagate its changes to other workspaces. It is meant for
testing only, after which the workspace can be removed.
Exclusive locking (lockmode value of E) prevents the use of what-if scenarios in
which different values for one or more columns are tested. Thus, plan any testing
of scenarios when exclusive locking is not in effect.
If the override parameter value is TRUE, locking can also be enabled and disabled
at the user session level with the SetLockingON and SetLockingOFF procedures,
respectively.
All new changes by this session or a subsequent session are locked, unless the
session turns locking off by executing the SetLockingOFF procedure.
An exception is raised if any of the following occurs:
• The user does not have the WM_ADMIN system privilege or is not the owner of
workspace.
• auto_commit is TRUE and an open transaction exists.
• lockmode is D and the workspace either is continually refreshed or is the LIVE
workspace.
Examples
The following example sets exclusive locking on for the workspace named
NEWWORKSPACE.
EXECUTE DBMS_WM.SetWorkspaceLockModeON ('NEWWORKSPACE', 'E');
All locked rows remain locked until the workspace is merged or rolled back.
4.100 UnfreezeWorkspace
Enables access and changes to a workspace, reversing the effect of the
FreezeWorkspace procedure.
Syntax
DBMS_WM.UnfreezeWorkspace(
workspace IN VARCHAR2);
4-135
Chapter 4
UnlockRows
Parameters
Parameter Description
Name of the workspace. The name is case-sensitive.
workspace
Usage Notes
The operation fails if any sessions are in workspace.
You can unfreeze a workspace only if one or more of the following apply:
• You are the owner of the specified workspace.
• You have the WM_ADMIN system privilege, the FREEZE_ANY_WORKSPACE privilege, or
the FREEZE_WORKSPACE privilege for the specified workspace.
Examples
The following example unfreezes the NEWWORKSPACE workspace.
EXECUTE DBMS_WM.UnfreezeWorkspace ('NEWWORKSPACE');
4.101 UnlockRows
Enables access to versioned rows in a specified table and to corresponding rows in
the parent workspace.
Syntax
DBMS_WM.UnlockRows(
workspace IN VARCHAR2,
table_name IN VARCHAR2,
where_clause IN VARCHAR2 DEFAULT '',
all_or_user IN VARCHAR2 DEFAULT 'USER',
lock_mode IN VARCHAR2 DEFAULT 'ES',
Xmin IN NUMBER DEFAULT NULL,
Ymin IN NUMBER DEFAULT NULL,
Xmax IN NUMBER DEFAULT NULL,
Ymax IN NUMBER DEFAULT NULL);
Parameters
Parameter Description
Name of the workspace: locked rows in this workspace and corresponding
workspace
rows in the parent workspace will be unlocked, as specified in the
remaining parameters. The name is case-sensitive.
A value of NONE can be used if lock_mode is set to VE (version-exclusive).
This causes rows locked by any workspace to be unlocked.
4-136
Chapter 4
UnlockRows
Parameter Description
Name of the table or (if Xmin, Ymin, Xmax, and Ymax are specified) Spatial
table_name
and Graph topology in which rows are to be unlocked. The name is not
case-sensitive.
The WHERE clause (excluding the WHERE keyword) identifying the rows to
where_clause
be unlocked. Example: 'department_id = 20'
Only primary key columns can be specified in the WHERE clause, except in
a subquery. The subquery can refer to columns that are not primary keys,
but it cannot refer to a version-enabled table.
If the where_clause parameter is not specified, all rows in table_name
are made accessible.
Do not specify the where_clause parameter if table_name specifies a
Spatial and Graph topology name.
Scope of the request: ALL or USER.
all_or_user
ALL: All locks accessible by the user in the specified workspace are
considered.
USER (default): Only locks owned by the user in the specified workspace
are considered.
Locking mode: E, WE, VE, S, or ES (default).
lock_mode
E (exclusive): Only exclusive mode locks are considered.
WE (workspace-exclusive): Only workspace-exclusive mode locks are
considered.
VE (version-exclusive): Only version-exclusive mode locks are considered.
S (shared): Only shared mode locks are considered.
ES (exclusive and shared: the default): Both exclusive mode and shared
mode locks are considered.
For Oracle Spatial and Graph topologies only (see Locking Considerations
Xmin, Ymin
with Topologies), the X and Y coordinate values, respectively, of the
lower-left corner of the window containing the rows to be locked.You
must specify these parameters if you specified a topology name for
table_name; otherwise, do not specify these parameters.
For Oracle Spatial and Graph topologies only (see Locking Considerations
Xmax, Ymax
with Topologies), the X and Y coordinate values, respectively, of the
upper-right corner of the window containing the rows to be locked.You
must specify these parameters if you specified a topology name for
table_name; otherwise, do not specify these parameters.
Usage Notes
This procedure affects Workspace Manager locking, which occurs in addition to any
standard Oracle database locking. For an explanation of Workspace Manager locking,
see Lock Management with Workspace Manager.
This procedure unlocks rows that were previously locked (see the LockRows
procedure). It does not affect whether Workspace Manager locking is set on or off
(determined by the SetLockingON and SetLockingOFF procedures).
For information about Workspace Manager locking for tables in an Oracle Spatial and
Graph topology, see Locking Considerations with Topologies.
4-137
Chapter 4
UseDefaultValuesForNulls
Examples
The following example unlocks the EMPLOYEES table where last_name = 'Smith' in
the NEWWORKSPACE workspace.
EXECUTE DBMS_WM.UnlockRows ('employees', 'NEWWORKSPACE', 'last_name =
''Smith''');
4.102 UseDefaultValuesForNulls
Determines whether or not Workspace Manager, for the current session, uses the
default value for a column when the user either specifies a null value or does not
specify any value for the column in an insert operation on a version-enabled table.
Syntax
DBMS_WM.UseDefaultValuesForNulls(
mode_var IN VARCHAR2);
Parameters
Parameter Description
Mode for handling the insertion of null values: OFF or ON.
mode_var
OFF: A null value is inserted into the column. (This is the normal Oracle
behavior.)
ON: The default value for the column is inserted into the column.
Usage Notes
This procedure affects what Workspace Manager does only if an INSERT statement
into a version-enabled table explicitly specifies NULL for a column when the column
has been defined as having a default value or leaves the column unspecified. For
example, assume the following table definition:
CREATE TABLE players (name VARCHAR2(20) primary key, rating NUMBER DEFAULT 10);
If the PLAYERS table is version-enabled and if you have executed this procedure with a
mode_var parameter value of OFF, either of the following statements would insert a row
for Smith with a null RATING value:
INSERT INTO players VALUES ('Smith', NULL);
INSERT INTO players(name) VALUES ('Smith');
Examples
The following example causes the column default value to be used during the rest
of the current session whenever an INSERT statement into a version-enabled table
4-138
Chapter 4
UseDefaultValuesForNulls
specifies a null value for a column that has a default value or the column is left
unspecified.
EXECUTE DBMS_WM.UseDefaultValuesForNulls('ON');
4-139
5
Workspace Manager Static Data Dictionary
Views
Workspace Manager creates and maintains static data dictionary views to hold
information about such things as version-enabled tables, workspaces, savepoints,
users, privileges, locks, and conflicts.
These views are read-only to users. You can use the information in these views to help
administer the Workspace Manager environment and diagnose problems.
There are also views created for each version-enabled table, as follows:
• Conflict view, each having a name in the form <table_name>_CONF. (See
xxx_CONF Views.)
• Difference view, each having a name in the form <table_name>_DIFF. (See
xxx_DIFF Views.)
• History view (if history tracking is enabled), each having a name in the form
<table_name>_HIST. (See xxx_HIST Views.)
• Lock view, each having a name in the form <table_name>_LOCK. (See xxx_LOCK
Views.)
• Multiworkspace view, each having a name in the form <table_name>_MW. (See
xxx_MW Views.)
Note:
When an ALL_xxx or USER_xxx view is queried from a procedure, the
results returned are based on whether the procedure has definer's rights
or the rights of the database user whose privileges are currently active.
CDB_xxx Views
For every DBA_xxx view, a CDB_xxx view is defined. In the root of a multitenant
container database (CDB), CDB_xxx views can be used to obtain information about
tables, tablespaces, users, privileges, parameters, and so on contained in the root and
in pluggable databases (PDBs).
CDB_xxx views are container data objects. When a user connected to the root queries
a CDB_xxx view, the query results will depend on the CONTAINER_DATA attribute
for users for the view. The CONTAINER_DATA clause of the SQL ALTER USER
statement is used to set and modify users' CONTAINER_DATA attribute.
The CDB_xxx views are owned by SYS, regardless of which user owns the underlying
DBA_xxx view.
By default, a user connected to the root will only see data pertaining to the root.
5-1
Chapter 5
In a PDB, the CDB_xxx views only show objects visible through a corresponding
DBA_xxx view.
In addition to all the columns found in a given DBA_xxx view, the corresponding
CDB_xxx view also contains the CON_ID column, which identifies a container whose
data a given CDB_* row represents. In a non-CDB, the value of a CON_ID column will
be 0.
CDB views can return data from different containers in a CDB when queried from the
root container. These objects will implicitly convert data to the character set of the
root container (AL32UTF8) and then return the result to the user. Some character sets
may have character expansion (more bytes needed to represent a character) when
converted to AL32UTF8, so there may be data truncation if the view column width is
not able to accommodate data from a given PDB.
Data returned by these views depends on whether a given PDB is open at the time the
query is issued. In particular, in an Oracle RAC environment, data returned by these
view may vary according to the instance to which a session is connected.
Note:
A multitenant container database is the only supported architecture in Oracle
Database 20c. While the documentation is being revised, legacy terminology
may persist. In most cases, "database" and "non-CDB" refer to a CDB or
PDB, depending on context. In some contexts, such as upgrades, "non-CDB"
refers to a non-CDB from a previous release.
• ALL_MP_GRAPH_WORKSPACES
• ALL_MP_PARENT_WORKSPACES
• ALL_REMOVED_WORKSPACES
• ALL_VERSION_HVIEW
• ALL_WM_CONS_COLUMNS
• ALL_WM_CONSTRAINT_VIOLATIONS
• ALL_WM_CONSTRAINTS
• ALL_WM_IND_COLUMNS
• ALL_WM_IND_EXPRESSIONS
• ALL_WM_LOCKED_TABLES
• ALL_WM_MODIFIED_TABLES
• ALL_WM_POLICIES
• ALL_WM_RIC_INFO
• ALL_WM_TAB_TRIGGERS
• ALL_WM_VERSIONED_TABLES
• ALL_WM_VT_ERRORS
• ALL_WORKSPACE_PRIVS
• ALL_WORKSPACE_SAVEPOINTS
5-2
Chapter 5
• ALL_WORKSPACES
• DBA_REMOVED_WORKSPACES
• DBA_WM_SYS_PRIVS
• DBA_WM_VERSIONED_TABLES
• DBA_WM_VT_ERRORS
• DBA_WORKSPACE_PRIVS
• DBA_WORKSPACE_SAVEPOINTS
• DBA_WORKSPACE_SESSIONS
• DBA_WORKSPACES
• ROLE_WM_PRIVS
• USER_MP_GRAPH_WORKSPACES
• USER_MP_PARENT_WORKSPACES
• USER_REMOVED_WORKSPACES
• USER_WM_CONS_COLUMNS
• USER_WM_CONSTRAINTS
• USER_WM_IND_COLUMNS
• USER_WM_IND_EXPRESSIONS
• USER_WM_LOCKED_TABLES
• USER_WM_MODIFIED_TABLES
• USER_WM_POLICIES
• USER_WM_PRIVS
• USER_WM_RIC_INFO
• USER_WM_TAB_TRIGGERS
• USER_WM_VERSIONED_TABLES
• USER_WM_VT_ERRORS
• USER_WORKSPACE_PRIVS
• USER_WORKSPACE_SAVEPOINTS
• USER_WORKSPACES
• WM_COMPRESS_BATCH_SIZES
• WM_COMPRESSIBLE_TABLES
• WM_EVENTS_INFO
• WM_INSTALLATION
• xxx_CONF Views
• xxx_DIFF Views
• xxx_HIST Views
• xxx_LOCK Views
• xxx_MW Views
5-3
Chapter 5
ALL_MP_GRAPH_WORKSPACES
5.1 ALL_MP_GRAPH_WORKSPACES
ALL_MP_GRAPH_WORKSPACES contains information about multiparent graph
workspaces (explained in Multiparent Workspaces) for which the leaf workspace can
be accessed by the current user.
Related View
• USER_MP_GRAPH_WORKSPACES contains information about multiparent
graph workspaces for which the leaf workspace is owned by the current user.
5.2 ALL_MP_PARENT_WORKSPACES
ALL_MP_PARENT_WORKSPACES contains information about parent workspaces of
multiparent workspaces (explained in Multiparent Workspaces) that the current user
can access.
Related View
• USER_MP_PARENT_WORKSPACES contains information about parent
workspaces of multiparent workspaces that the current user owns.
5-4
Chapter 5
ALL_REMOVED_WORKSPACES
5.3 ALL_REMOVED_WORKSPACES
ALL_REMOVED_WORKSPACES contains information about workspaces, that the
current user has access to, that have been removed during a RemoveWorkspace
operation or a MergeWorkspace operation in which the remove_workspace parameter
value was true, and while the value of the Workspace Manager system parameter
KEEP_REMOVED_WORKSPACES_INFO was ON. (This system parameter is described in
System Parameters for Workspace Manager.)
Related Views
• USER_REMOVED_WORKSPACES contains information about workspaces, that
the current user owns, that have been removed during a RemoveWorkspace
operation or a MergeWorkspace operation in which the remove_workspace
parameter value was true, and while the value of the Workspace Manager system
parameter KEEP_REMOVED_WORKSPACES_INFO was ON.
• DBA_REMOVED_WORKSPACES contains information about workspaces
that have been removed during a RemoveWorkspace operation or a
MergeWorkspace operation in which the remove_workspace parameter value
was true, and while the value of the Workspace Manager system parameter
KEEP_REMOVED_WORKSPACES_INFO was ON.
5-5
Chapter 5
ALL_VERSION_HVIEW
5.4 ALL_VERSION_HVIEW
ALL_VERSION_HVIEW contains information about the version hierarchy. It is used by
Workspace Manager to perform queries against the xxx_HIST views (described in
xxx_HIST Views).
5.5 ALL_WM_CONS_COLUMNS
ALL_WM_CONS_COLUMNS contains information about columns in unique
constraints on version-enabled tables on which the current user has one or more of
the following privileges: SELECT, INSERT, UPDATE, or DELETE.
Related View
• USER_WM_CONS_COLUMNS contains information about columns in unique
constraints on version-enabled tables that the current user owns.
5.6 ALL_WM_CONSTRAINT_VIOLATIONS
ALL_WM_CONSTRAINT_VIOLATIONS contains information related to unique,
foreign key, and check constraint violation errors raised while executing the
MergeWorkspace, MergeTable, RefreshWorkspace, RefreshTable, CommitDDL,
AddAsParentWorkspace, RemoveAsParentWorkspace, and PurgeTable procedures.
The view is only populated within a session after executing one of the these
procedures and it fails due to a constraint violation. The view data is cleared any time
one of these procedures is executed and a constraint check is successfully performed
or the session disconnects.
5-6
Chapter 5
ALL_WM_CONSTRAINTS
5.7 ALL_WM_CONSTRAINTS
ALL_WM_CONSTRAINTS contains information about constraints on version-enabled
tables on which the current user has one or more of the following privileges:
SELECT, INSERT, UPDATE, or DELETE. It provides information about the following kinds
of constraints: UNIQUE constraint, unique index, PRIMARY KEY constraints, and CHECK
constraints.
Related View
• USER_WM_CONSTRAINTS contains information about constraints on version-
enabled tables that the current user owns.
5-7
Chapter 5
ALL_WM_IND_COLUMNS
5.8 ALL_WM_IND_COLUMNS
ALL_WM_IND_COLUMNS contains information about indexes used for enforcing
unique constraints on version-enabled tables on which the current user has one or
more of the following privileges: SELECT, INSERT, UPDATE, or DELETE.
Related View
• USER_WM_IND_COLUMNS contains information about indexes used for
enforcing unique constraints on version-enabled tables that the current user owns.
5.9 ALL_WM_IND_EXPRESSIONS
ALL_WM_IND_EXPRESSIONS contains information about functional expressions on
functional unique indexes on version-enabled tables on which the current user has one
or more of the following privileges: SELECT, INSERT, UPDATE, or DELETE.
Related View
• USER_WM_IND_EXPRESSIONS contains information about functional
expressions on functional unique indexes on version-enabled tables that the
current user owns.
5-8
Chapter 5
ALL_WM_LOCKED_TABLES
5.10 ALL_WM_LOCKED_TABLES
ALL_WM_LOCKED_TABLES contains information about Workspace Manager locks
on rows in version-enabled tables that the current user can access.
Related View
• USER_WM_LOCKED_TABLES contains information about Workspace Manager
locks on rows in version-enabled tables that the current user owns.
5.11 ALL_WM_MODIFIED_TABLES
ALL_WM_MODIFIED_TABLES contains information about all version-enabled tables
that have been modified and on which the current user has one or more of the
following privileges: SELECT, INSERT, DELETE, UPDATE.
Related View
• USER_WM_MODIFIED_TABLES contains information about version-enabled
tables that have been modified and that the current user owns.
5.12 ALL_WM_POLICIES
ALL_WM_POLICIES contains information about Oracle Virtual Private Database
(VPD) security policies defined on any version-enabled table or related view
accessible to the current user. Its columns are the same as those in the
ALL_POLICIES view, described in Oracle Database Reference.
Workspace Manager uses this information to provide VPD support, which is described
in Virtual Private Database Considerations.
Related View
5-9
Chapter 5
ALL_WM_RIC_INFO
5.13 ALL_WM_RIC_INFO
ALL_WM_RIC_INFO contains information about referential integrity constraints in
version-enabled tables that the current user can access. Workspace Manager
uses this information to provide referential integrity support, which is described in
Referential Integrity Support.
Related View
• USER_WM_RIC_INFOcontains information about referential integrity constraints
in version-enabled tables that the current user owns.
5.14 ALL_WM_TAB_TRIGGERS
ALL_WM_TAB_TRIGGERS contains information about triggers that the current user
created and for version-enabled tables owned by the current user that have triggers
defined on them. If the current user has the CREATE ANY TRIGGER privilege, trigger
information is displayed for all version-enabled tables.
Related View
5-10
Chapter 5
ALL_WM_TAB_TRIGGERS
5-11
Chapter 5
ALL_WM_VERSIONED_TABLES
5.15 ALL_WM_VERSIONED_TABLES
ALL_WM_VERSIONED_TABLES contains information about all version-enabled
tables on which the current user has one or more of the following privileges: SELECT,
INSERT, DELETE, UPDATE.
Related Views
• USER_WM_VERSIONED_TABLES contains information about version-enabled
tables that the current user owns.
• DBA_WM_VERSIONED_TABLES contains information about all that the current
user owns.
5-12
Chapter 5
ALL_WM_VT_ERRORS
5.16 ALL_WM_VT_ERRORS
ALL_WM_VT_ERRORS contains information about the error that occurred during the
last call to the DisableVersioning or CommitDDL procedure that specified a table on
which the current user has one or more of the following privileges: SELECT, INSERT,
DELETE, UPDATE.
Related View
5-13
Chapter 5
ALL_WORKSPACE_PRIVS
5.17 ALL_WORKSPACE_PRIVS
ALL_WORKSPACE_PRIVS contains information about Workspace Manager privileges
in all workspaces that the current user can access.
Related Views
• USER_WORKSPACE_PRIVS contains information about Workspace Manager
privileges in workspaces created by the current user.
• DBA_WORKSPACE_PRIVS contains information about Workspace Manager
privileges in all workspaces.
5.18 ALL_WORKSPACE_SAVEPOINTS
ALL_WORKSPACE_SAVEPOINTS contains information about savepoints in all
workspaces that the current user can access.
Related Views
5-14
Chapter 5
ALL_WORKSPACES
5.19 ALL_WORKSPACES
ALL_WORKSPACES contains information about all workspaces that the current user
can access.
Its columns are the same as those for the DBA_WORKSPACES view, except for the
following:
• ALL_WORKSPACES includes the following columns that
are not in DBA_WORKSPACES: CONTINUALLY_REFRESHED,
WORKSPACE_LOCKMODE, and WORKSPACE_LOCKMODE_OVERRIDE.
• DBA_WORKSPACES includes the following columns that are not in
ALL_WORKSPACES: SID and SERIAL#.
Related Views
5-15
Chapter 5
ALL_WORKSPACES
5-16
Chapter 5
DBA_REMOVED_WORKSPACES
5.20 DBA_REMOVED_WORKSPACES
DBA_REMOVED_WORKSPACES contains information about workspaces that have been
removed during a RemoveWorkspace operation or a MergeWorkspace operation in
which the remove_workspace parameter value was true, and while the value of the
Workspace Manager system parameter KEEP_REMOVED_WORKSPACES_INFO was ON. (This
system parameter is described in System Parameters for Workspace Manager.) Its
columns are the same as those in ALL_REMOVED_WORKSPACES. This view is only
available to users with the WM_ADMIN_ROLE or SELECT_CATALOG_ROLE role.
5.21 DBA_WM_SYS_PRIVS
DBA_WM_SYS_PRIVS contains information about all users that have
Workspace Manager system-level privileges (that is, privilege names containing
_ANY_WORKSPACE, as explained in Privilege Management with Workspace
Manager). This view is only available to users with the WM_ADMIN_ROLE or
SELECT_CATALOG_ROLE role.
5.22 DBA_WM_VERSIONED_TABLES
DBA_WM_VERSIONED_TABLES contains information about all version-enabled
tables. Its columns are the same as those in ALL_WM_VERSIONED_TABLES. This
view is only available to users with the WM_ADMIN_ROLE or SELECT_CATALOG_ROLE role.
5-17
Chapter 5
DBA_WM_VT_ERRORS
5.23 DBA_WM_VT_ERRORS
DBA_WM_VT_ERRORS contains information about the error that occurred during
the last call to the DisableVersioning, CommitDDL, or RecoverFromDroppedUser
procedure. Its columns are the same as those in ALL_WM_VT_ERRORS. This view is
only available to users with the WM_ADMIN_ROLE or SELECT_CATALOG_ROLE role.
5.24 DBA_WORKSPACE_PRIVS
DBA_WORKSPACE_PRIVS contains information about Workspace Manager
privileges in all workspaces. Its columns are the same as those in
ALL_WORKSPACE_PRIVS. This view is only available to users with the
WM_ADMIN_ROLE or SELECT_CATALOG_ROLE role.
5.25 DBA_WORKSPACE_SAVEPOINTS
DBA_WORKSPACE_SAVEPOINTS contains information about savepoints in all
workspaces. Its columns are the same as those in ALL_WORKSPACE_SAVEPOINTS.
This view is only available to users with the WM_ADMIN_ROLE or SELECT_CATALOG_ROLE
role.
5.26 DBA_WORKSPACE_SESSIONS
DBA_WORKSPACE_SESSIONS contains information about all users and workspaces
(except for the LIVE workspace). This view is only available to users with the
WM_ADMIN_ROLE or SELECT_CATALOG_ROLE role. It is useful for monitoring users in the
different workspaces.
5.27 DBA_WORKSPACES
DBA_WORKSPACES contains information about all workspaces, including those
whose removal has been deferred. This view is only available to users with the
WM_ADMIN_ROLE or SELECT_CATALOG_ROLE role.
5-18
Chapter 5
DBA_WORKSPACES
Its columns are the same as those for the ALL_WORKSPACES view, except for the
following:
• ALL_WORKSPACES includes the following columns that
are not in DBA_WORKSPACES: CONTINUALLY_REFRESHED,
WORKSPACE_LOCKMODE, and WORKSPACE_LOCKMODE_OVERRIDE.
• DBA_WORKSPACES includes the following columns that are not in
ALL_WORKSPACES: SID, SERIAL#, and INST_ID.
Related Views
• ALL_WORKSPACES contains information about all workspaces.
• USER_WORKSPACES contains information about workspaces created by the
current user.
5-19
Chapter 5
ROLE_WM_PRIVS
5.28 ROLE_WM_PRIVS
ROLE_WM_PRIVS contains information about privileges that all roles granted to the
current user have in each workspace.
Related View
• USER_WM_PRIVS contains information about privileges that the current user has
in each workspace.
5.29 USER_MP_GRAPH_WORKSPACES
USER_MP_GRAPH_WORKSPACES contains information about multiparent graph
workspaces (explained in Multiparent Workspaces) for which the leaf workspace
is owned by the current user. Its columns are the same as those in
ALL_MP_GRAPH_WORKSPACES.
5-20
Chapter 5
USER_MP_PARENT_WORKSPACES
5.30 USER_MP_PARENT_WORKSPACES
USER_MP_PARENT_WORKSPACES contains information about parent workspaces
of multiparent workspaces (explained in Multiparent Workspaces) that the current user
owns. Its columns are the same as those in ALL_MP_PARENT_WORKSPACES.
5.31 USER_REMOVED_WORKSPACES
USER_REMOVED_WORKSPACES contains information about workspaces, that the current
user owns, that have been removed during a RemoveWorkspace operation or
a MergeWorkspace operation in which the remove_workspace parameter value
was true, and while the value of the Workspace Manager system parameter
KEEP_REMOVED_WORKSPACES_INFO was ON. (This system parameter is described in
System Parameters for Workspace Manager.) Its columns are the same as those in
ALL_REMOVED_WORKSPACES.
5.32 USER_WM_CONS_COLUMNS
USER_WM_CONS_COLUMNS contains information about columns in unique
constraints on version-enabled tables that the current user owns. Its columns are the
same as those in ALL_WM_CONS_COLUMNS, except it does not contain an OWNER
column.
5.33 USER_WM_CONSTRAINTS
USER_WM_CONSTRAINTS contains information about constraints on version-
enabled tables that the current user owns. It provides information about the following
kinds of constraints: UNIQUE constraint, unique index, PRIMARY KEY constraints, and
CHECK constraints. Its columns are the same as those in ALL_WM_CONSTRAINTS,
except it does not contain an OWNER or INDEX_OWNER column.
5.34 USER_WM_IND_COLUMNS
USER_WM_IND_COLUMNS contains information about indexes used for enforcing
unique constraints on version-enabled tables that the current user owns. Its columns
are the same as those in ALL_WM_IND_COLUMNS, except it does not contain an
OWNER column.
5.35 USER_WM_IND_EXPRESSIONS
USER_WM_IND_EXPRESSIONS contains information about indexes used for
enforcing unique constraints on version-enabled tables that the current user owns.
Its columns are the same as those in ALL_WM_IND_EXPRESSIONS, except it does
not contain an OWNER column.
5-21
Chapter 5
USER_WM_LOCKED_TABLES
5.36 USER_WM_LOCKED_TABLES
USER_WM_LOCKED_TABLES contains information about Workspace Manager locks
on rows in version-enabled tables that the current user owns. Its columns are the
same as those in ALL_WM_LOCKED_TABLES.
5.37 USER_WM_MODIFIED_TABLES
USER_WM_MODIFIED_TABLES contains information about version-enabled tables
that have been modified and that the current user owns. Its columns are the same as
those in ALL_WM_MODIFIED_TABLES.
5.38 USER_WM_POLICIES
USER_WM_POLICIES contains information about Oracle Virtual Private Database
(VPD) security policies defined on any version-enabled table or related view owned by
the current user. Its columns are the same as those in the ALL_WM_POLICIES view,
except it does not include an OWNER column.
Workspace Manager uses this information to provide VPD support, which is described
in Virtual Private Database Considerations.
5.39 USER_WM_PRIVS
USER_WM_PRIVS contains information about privileges that the current user has in
each workspace.
Related View
• ROLE_WM_PRIVS contains information about privileges that all roles granted to
the current user have in each workspace.
5.40 USER_WM_RIC_INFO
USER_WM_RIC_INFO contains information about referential integrity constraints in
version-enabled tables that the current user owns. Its columns are the same as those
in ALL_WM_RIC_INFO.
Workspace Manager uses this information to provide referential integrity support,
which is described in Referential Integrity Support.
5-22
Chapter 5
USER_WM_TAB_TRIGGERS
5.41 USER_WM_TAB_TRIGGERS
USER_WM_TAB_TRIGGERS contains information about triggers that are owned
by the current user and that are on version-enabled tables. Its columns are the
same as those in ALL_WM_TAB_TRIGGERS, except that it does not contain the
TRIGGER_OWNER column.
5.42 USER_WM_VERSIONED_TABLES
USER_WM_VERSIONED_TABLES contains information about version-enabled
tables that the current user owns. Its columns are the same as those in
ALL_WM_VERSIONED_TABLES.
5.43 USER_WM_VT_ERRORS
USER_WM_VT_ERRORS contains information about the error that occurred during
the last call to the DisableVersioning or CommitDDL procedure that specified a table
that the current user owns and on which the current user has one or more of the
following privileges: SELECT, INSERT, DELETE, UPDATE. Its columns are the same as
those in ALL_WM_VT_ERRORS.
5.44 USER_WORKSPACE_PRIVS
USER_WORKSPACE_PRIVS contains information about Workspace Manager
privileges in workspaces created by the current user. Its columns are the same as
those in ALL_WORKSPACE_PRIVS.
5.45 USER_WORKSPACE_SAVEPOINTS
USER_WORKSPACE_SAVEPOINTS contains information about savepoints in
workspaces created by the current user. Its columns are the same as those in
ALL_WORKSPACE_SAVEPOINTS.
5.46 USER_WORKSPACES
USER_WORKSPACES contains information about workspaces created by the current
user. Its columns are the same as those in ALL_WORKSPACES.
5.47 WM_COMPRESS_BATCH_SIZES
WM_COMPRESS_BATCH_SIZES contains information related to compression
capabilities for version-enabled tables. This view is only available to users with the
WM_ADMIN_ROLE or SELECT_CATALOG_ROLE role.
5-23
Chapter 5
WM_COMPRESSIBLE_TABLES
5.48 WM_COMPRESSIBLE_TABLES
WM_COMPRESSIBLE_TABLES contains information about version-enabled tables
that need to be compressed (if compression is to be performed) between
two savepoints in a workspace. To create rows in this view, use the
SetCompressWorkspace procedure.
5.49 WM_EVENTS_INFO
WM_EVENTS_INFO contains information about the capture of Workspace Manager
events. For information about Workspace Manager events, see Workspace Manager
Events.
5-24
Chapter 5
WM_INSTALLATION
5.50 WM_INSTALLATION
WM_INSTALLATION contains information about the installed release of Workspace
Manager. The information includes the Workspace Manager version number
(OWM_VERSION) and the Workspace Manager system parameters.
5-25
Chapter 5
xxx_DIFF Views
A SELECT operation from a conflict view uses the workspace conflict context
established by the GotoWorkspace procedure, unless you have specified a workspace
conflict context for the session by using the SetConflictWorkspace procedure.
Selecting from the conflict view finds rows in that table that are changed in the current
workspace context, and compares their values with corresponding rows in the parent
workspace to identify conflicts. If the current workspace conflict context is the LIVE
workspace, all rows in the table are selected and no conflicts are found.
The following example lists the key value and all column values of conflicting rows in
the EMPLOYEE table in the current workspace and its parent workspace. The conflict
view reflects the context established by a previous call to the GetWorkspace or
SetConflictWorkspace procedure to set the workspace conflict context (the current
workspace in this case).
SELECT * FROM EMPLOYEE_CONF;
If ID, NAME, and CITY are the columns in the EMPLOYEE table, then assume the following
values:
WM_WORKSPACE ID NAME CITY WM_DELETED
NEWWORKSPACE 12 SMITH NASHUA NO
DiffBase 12 SMITH NY NO
LIVE 12 SMITH BOSTON NO
For additional information about conflict resolution, see Resolving Conflicts Before a
Merge or Refresh Operation.
5-26
Chapter 5
xxx_DIFF Views
• '<workspace1>, <savepoint1>'
• '<workspace2>, <savepoint2>'
• 'DiffBase'
If the two-parameter version of the SetDiffVersions procedure was used, the value of
savepoint1 or savepoint2 is LATEST.
• NC will appear for rows in workspaces that did not change the value when another
workspace did change the value. For example, if '<workspace2>, <savepoint2>'
updated the row, the code for that row is U, but the code for the '<workspace1>,
<savepoint1>' and 'DiffBase' rows is NC if they did not modify the row.
• NE will appear for 'DiffBase' if a row is inserted in one or more branches, and
NE will appear for 'DiffBase' and a branch if only one branch has had any insert
operations.
For more information, including an example showing rows being added to a
differences view, see the section on the SetDiffVersions procedure in DBMS_WM
Package: Reference .
5-27
Chapter 5
xxx_HIST Views
You can use the history views to log and audit modifications to version-enabled tables.
Each history view contains the columns shown in Table 5-3. However, the
WM_CREATETIME and WM_RETIRETIME columns are included only if the hist
parameter was set to VIEW_W_OVERWRITE or VIEW_WO_OVERWRITE in the call to the
EnableVersioning procedure.
5-28
Chapter 5
xxx_MW Views
5-29
Chapter 5
xxx_MW Views
You can use the <table_name>_MW view to see changes in another workspace
without leaving the current workspace (for example, to check if there is a conflict
with the other workspace). Each row in the view shows the data as it would be in that
workspace if the workspace had been merged when the row was inserted in the view.
You can also use the <table_name>_DIFF view (see xxx_DIFF Views) to see
changes in another workspace without leaving the current workspace; however,
the <table_name>_DIFF view can be used for only two workspaces, whereas the
<table_name>_MW view can be used for any number of workspaces. In addition, the
<table_name>_DIFF view shows deleted rows, whereas the <table_name>_MW view
does not show deleted rows.
For more information and several examples, see the information about the
SetMultiWorkspaces procedure in DBMS_WM Package: Reference .
5-30
Part III
Supplementary Information
This document has three parts:
• Conceptual and Usage Information provides conceptual and usage information
about Workspace Manager.
• Reference Information provides reference information about the Workspace
Manager PL/SQL API (DBMS_WM package) and static data dictionary views.
• Part III provides supplementary information (appendixes and a glossary).
Part III contains the following:
• Installing Workspace Manager with Custom Databases
• Workspace Manager Error Messages
• Glossary
A
Installing Workspace Manager with Custom
Databases
Workspace Manager is installed by default in the seed database and in all databases
created by the Database Configuration Assistant (DBCA). However, in all other Oracle
databases, such as those you create with a customized procedure, you must install
Workspace Manager before you can use its features.
To install Workspace Manager in a custom database, do the following:
1. At the system command prompt, change the current directory to the directory that
contains Workspace Manager installation script and packages, as shown in the
following example:
cd <ORACLE_HOME>/rdbms/admin
2. Connect as SYS to the Oracle instance with a command in the following format:
sqlplus sys
Enter the password for the SYS account when you are prompted.
3. Run the owminst.plb script:
SQL> @owminst.plb
4. Verify the installation of Workspace Manager by entering the following command
while connected as any valid database user, and ensure that the output is as
shown here:
SQL> select dbms_wm.getWorkspace from dual;
GETWORKSPACE
----------------------------------------------------------------------------
LIVE
A-1
B
Workspace Manager Error Messages
This appendix lists the Workspace Manager error messages, including the cause and
recommended user action for each.
Action: Ensure that all column names for the table are 28 characters or less.
Action: Do not perform DML operations on columns in the primary key constraints of
version-enabled tables.
Action: The user with the open database transaction should issue a standard
database commit or rollback.
Action: Delete all matching records from the child table first.
B-1
Appendix B
Action: The import platform may not have any version-enabled tables. A clean install
of Workspace Manager is needed on the import platform.
Action: The import platform may have only the LIVE workspace and there may be no
explicit savepoints. A clean install of Workspace Manager is needed on the import
platform.
Action: Ensure that the primary key is not violated by the insert operation in the
current workspace.
Action: Ensure that the current session is on the LATEST version in the workspace by
using the GotoWorkspace or GotoSavepoint procedures.
Action: Ensure that the current session is on the LATEST version in the workspace by
using the GotoWorkspace or GotoSavepoint procedures.
Action: Ensure that the current session is on the LATEST version in the workspace by
using the GotoWorkspace or GotoSavepoint procedures.
B-2
Appendix B
Action: Choose another workspace name that does not contain a "/".
Action: Ensure that the invoking user has the required privileges before attempting to
version-disable this table. Otherwise, have the owner of the table version-disable it.
Action: Ensure that the invoking user has the required privileges before attempting to
version-enable this table. Otherwise, have the owner of the table version-enable it.
Action: Ensure that the invoking user has the required privileges before attempting to
alter the workspace attributes. Otherwise, have the owner of the workspace alter the
workspace attributes.
Action: Ensure that the invoking user has the required privileges before attempting to
freeze the workspace. Otherwise, have the owner of the workspace freeze it.
Action: Ensure that the invoking user has the required privileges before attempting to
set the workspace lock mode. Otherwise, have the owner of the workspace set the
workspace lock mode.
Action: Ensure that the invoking user has the required privileges before attempting to
alter the savepoint attributes. Otherwise, have the workspace owner or the savepoint
owner alter the savepoint attributes.
B-3
Appendix B
Action: Ensure that the invoking user has the required privileges before attempting to
delete the savepoint. Otherwise, have the workspace owner or the savepoint owner
delete the savepoint.
Action: Do not rollback over an implicit savepoint. To remove the implicit savepoint,
merge or remove the descendant workspace.
Action: Do not rollback over an implicit savepoint. To remove the implicit savepoint,
merge or remove the descendant workspace.
B-4
Appendix B
Action: Ensure that all the version-enabled tables owned by the user have been
explicitly disabled before attempting to drop the database user.
Action: Wait for the lock on the row to be released or have the lock owner use the
UnlockRows procedure to unlock the row. Consult the table's _LOCK view to see
which rows in this table are locked.
Action: Wait for the lock on the row to be released or have the lock owner use the
UnlockRows procedure to unlock the row. Consult the table's _LOCK view to see
which rows in this table are locked.
Action: Wait for the lock on the row to be released or have the lock owner use the
UnlockRows procedure to unlock the row. Consult the table's _LOCK view to see
which rows in this table are locked.
Action: Wait for the lock on the row to be released or have the lock owner use the
UnlockRows procedure to unlock the row. Consult the table's _LOCK view to see
which rows in this table are locked.
Action: Remove or merge all workspaces that have modified this table. Otherwise,
use the FORCE option of DisableVersioning.
B-5
Appendix B
Action: Consult the WM_RIC_INFO view and version-disable the table that is involved
in the foreign key relationship before attempting to drop the table.
Action: Use the function GetPrivs to ensure that the user invoking this operation has
the required privileges.
Action: Use the function GetPrivs to ensure that the user invoking this operation has
the required privileges on the parent workspace.
B-6
Appendix B
Action: The user with the open database transaction should issue a standard
database commit or rollback.
Action: The user with the open database transaction should issue a standard
database commit or rollback.
Action: The user with the open database transaction should issue a standard
database commit or rollback.
Action: The user with the open database transaction should issue a standard data
Action: The user with the open database transaction should issue a standard
database commit or rollback.
Action: The user with the open database transaction should issue a standard
database commit or rollback.
Action: Use the function GetPrivs to ensure that the user invoking this operation has
the required privileges on the workspace.
B-7
Appendix B
Action: Use the function GetPrivs to ensure that the user invoking this operation has
the required privileges on the workspace.
Action: Use the function GetPrivs to ensure that the user invoking this operation has
the required privileges on the workspace.
Action: Use the function GetPrivs to ensure that the user invoking this operation has
the required privileges on the workspace.
Action: Ensure that the invoking user has the required privileges before attempting
to invoke RollbackResolve. Otherwise, have the user that issued the BeginResolve
operation invoke RollbackResolve.
Action: version-disable the table first. In the case of a view, version-disable the table
associated with the view.
B-8
Appendix B
Action: Ensure that the current session is on the LATEST version in the workspace by
using the GotoWorkspace or GotoSavepoint procedures.
Action: Ensure that the current session is on the LATEST version in the workspace by
using the GotoWorkspace or GotoSavepoint procedures.
Action: Do not attempt to grant or revoke privileges from or to the same user.
Privileges can only be granted or revoked between different users.
Action: The grantee may only be an existing user, role, or PUBLIC. Verify correct
spelling of the grantee parameter.
Action: Ensure that the valid parameters are passed to the GrantWorkspacePriv or
GrantSystemPriv procedure. The grant_option parameter may only be YES or NO.
Action: The in_date parameter for GotoDate must be greater than or equal to the
create time for the current workspace.
B-9
Appendix B
Action: Ensure that the invoking user has the required privileges before invoking
the operation. The lockRows procedure requires the invoking user to have SELECT,
INSERT, UPDATE and DELETE privileges on the versioned table.
Action: Ensure that the invoking user has the required privileges before invoking the
operation. The UnlockRows procedure requires the invoking user to have SELECT,
INSERT, UPDATE and DELETE privileges on the versioned table.
Action: Ensure that the invoking user has the required privileges before invoking the
operation. The ResolveConflicts procedure requires the invoking user to have SELECT,
INSERT, UPDATE and DELETE privileges on the versioned table being conflict resolved.
Action: Ensure that the invoking user has the required privileges before invoking
the operation. Privileges can be granted using the GrantWorkspacePriv or the
GrantSystemPriv procedures. Use the function GetPrivs to see which privileges you
have on a workspace.
Action: Ensure that the invoking user has the required privileges before invoking
the operation. Privileges can be granted using the grantWorkspacePriv or the
grantSystemPriv procedures. Use the function GetPrivs to see which privileges you
have on a workspace.
Action: Ensure that the invoking user has the required privileges before invoking
the operation. The invoking user must have CREATE privileges on a workspace to
be allowed to create a workspace off of it. Privileges can be granted using the
grantWorkspacePriv or the grantSystemPriv procedures. Use the function GetPrivs
to see which privileges you have on a workspace.
B-10
Appendix B
Action: Ensure that the invoking user has the required privileges to grant the privilege.
A user needs to have been granted a privilege with the GRANT option to be able to
grant it to others.
Action: Ensure that the invoking user has the required privileges before invoking the
operation. All Workspace Manager workspace wide operations require the invoking
user to have SELECT, INSERT, UPDATE and DELETE privileges on all versioned tables
that were modified in the input workspace.
Action: Ensure that the invoking user has the required privileges before invoking the
operation. All Workspace Manager workspace wide operations require the invoking
user to have SELECT, INSERT, UPDATE and DELETE privileges on all versioned tables
that were modified in the input workspace.
Action: Valid values for the hist parameter are NONE, VIEW_W_OVERWRITE, and
VIEW_WO_OVERWRITE.
Action: Ensure that the input where_clause parameter contains only valid column
names and has proper syntax.
Action: Ensure that the valid parameters are passed to the Grant or Revoke Privilege
operation. The valid privilege types are: ACCESS_WORKSPACE, MERGE_WORKSPACE,
ROLLBACK_WORKSPACE, REVOKE_WORKSPACE, and CREATE_WORKSPACE.
B-11
Appendix B
Action: Specify a valid value for lock_mode. The valid values for lock_mode are E and
S (default is E).
WM_ERROR_85 invalid value for the lock_mode argument - "E", "S" or "ES"
expected
Cause: An invalid value has been specified for the lock_mode parameter (fifth
parameter) of procedure UnlockRows.
Action: Specify a valid value for lock_mode. The valid values for lock_mode are E, S,
and ES (default is ES).
Action: Specify a valid value for all_or_user. The valid values for all_or_user are
ALL and USER (default is USER).
Action: IsWorkspaceOccupied can only be invoked for a workspace on which the user
has ACCESS privilege.
Action: The user requires ACCESS privilege on the parent workspace of the workspace
for which lockRows in invoked.
B-12
Appendix B
Action: The user requires ACCESS privilege on the workspace for which LockRows in
invoked.
Action: To update, delete, or insert a row that was already versioned in some other
workspace, the current session must turn locking off. Consult the table's _LOCK view
to see which rows in this table are locked.
Action: Names of only those workspaces for which the user has ACCESS privilege can
be passed to SetMultiWorkspaces.
Action: This operation can only be invoked on a version-enabled table. Verify that
the table is version-enabled. The xxx_VERSIONED_TABLES views show all the
versioned tables in the database.
B-13
Appendix B
Action: Before version-enabling a table, all tables that are child tables of referential
integrity constraints (excluding self referential integrity constraints) that have this table
as the parent table must be version-enabled.
Action: The FORCE option cannot be specified while version-disabling a table that is
the parent table of a referential integrity constraint. Commit or roll back all changes
done on this table in non-LIVE workspaces and then version-disable the table without
the FORCE option.
Action: Workspace Manager requires that before version-enabling the child table of
a integrity constraint, the child table owner must have SELECT privilege on the parent
table. Grant the required privilege before version-enabling.
B-14
Appendix B
Action: Workspace Manager requires that before version-enabling the parent table
of a referential integrity constraint, the parent table owner must have the specified
privilege on the child table. Grant the privilege on the child table to the owner of the
table being version-enabled.
Action: Workspace Manager requires that before version-enabling the parent table
of a referential integrity constraint, the parent table owner must have the specified
privilege on the child table. Grant the privilege on the child table to the owner of the
table being version-enabled.
Action: Drop the trigger and re-create separate triggers (with identical bodies) for
insert, update, and delete.
Action: Drop the unique constraint on this table before version-enabling it. If the table
needs to have a index for performance reasons, create a non-unique index on the
relevant set of columns. Oracle will use the created index to optimize queries on the
version-enabled table whenever appropriate.
Action: Use the GetPrivs function to ensure that the user invoking this operation has
the required privileges.
Action: Ensure that the invoking user has ACCESS privilege on the parent workspace
before invoking RefreshTable or RefreshWorkspace. Privileges can be granted using
the GrantWorkspacePriv or the GrantSystemPriv procedures. Use the GetPrivs
function to see which privileges the current user has on a workspace.
B-15
Appendix B
Action: Ensure that the invoking user has ACCESS and ROLLBACK privileges on the
workspace before invoking RollbackTable or RollbackWorkspace. Privileges can be
granted using the GrantWorkspacePriv or the GrantSystemPriv procedures. Use the
function GetPrivs to see which privileges the current user has on a workspace.
Action: Choose a savepoint name that does not begin with the string "ICP-".
Workspace Manager reserves names starting with "ICP-" for naming implicit
savepoints.
B-16
Appendix B
Action: Verify that the savepoint name is spelled correctly and that it exists in the
specified workspace. Workspace names and savepoint names are case-sensitive.
Action: Wait for the database session that holds the lock to release the lock.
See the Workspace Manager documentation for a description of the Workspace
Manager operations allowed for different workspace freeze modes. Consult the
xxx_WM_WORKSPACES view to see which workspaces are currently frozen.
Action: Workspace Manager allows only one user to resolve conflicts for a workspace
at the same time. Wait until the user is finished resolving conflicts in the workspace
and verify that the conflicts you are attempting to resolve still exist. Use the
xxx_WORKSPACES views to check on the current resolve status of the workspace.
B-17
Appendix B
Action: Workspace Manager acquires internal freezes on workspaces for the duration
of various Workspace Manager operations. Wait until Workspace Manager releases
the internal freeze on the workspace. See the User Guide for details on the freezes
that Workspace Manager acquires for various workspace-wide operations. Use the
xxx_WORKSPACES views to check on the current freeze status of the workspace.
Action: Ensure that all open database transactions on the specified table have
completed before invoking the Workspace Manager operation.
Action: Add a primary key constraint on this table before version-enabling it.
Action: Wait until the other transaction finishes version-disabling the specified table.
The xxx_VERSIONED_TABLES views show all the versioned tables in the database.
Action: Wait until the other transaction finishes version-enabling the specified table.
The xxx_VERSIONED_TABLES views show all the versioned tables in the database.
B-18
Appendix B
Action: To successfully version-disable this table, verify that there are no database
transaction locks on the table.
Action: Ensure that the keep parameter to the ResolveConflicts procedure is one
of (CHILD,PARENT,BASE). This parameter is not case-sensitive. See the Resolving
Conflicts section of the Workspace Manager documentation for details on the process
of conflict resolution.
Action: Workspace Manager disallows commit of the LIVE workspace. Do not invoke
MergeWorkspace on the LIVE workspace.
B-19
Appendix B
Action: To rollback changes in the LIVE workspace, use the RollbackToSP operation.
To remove descendants to the LIVE workspace, use the RemoveWorkspace operation
on the child workspaces.
Action: Workspace Manager disallows the Refresh operation on the LIVE workspace.
Do not invoke RefreshWorkspace on the LIVE workspace.
WM_ERROR_148 the lock mode is currently not set for this session
Cause: The user invoked a SetLockingOFF operation without having called
SetLockingON earlier in the current session.
Action: A user can only execute SetLockingOff if the user had called SetLockingOn in
the session. To see what the current lock mode is, use the GetLockMode function.
Action: Use a lock mode that Workspace Manager currently supports: C(carry-
forward), D (disregard), E (exclusive), S (Shared), VE (version exclusive), or WE
(workspace exclusive). For a discussion of the differences and similarities among
these modes, see the Workspace Manager documentation.
Action: Wait for the workspace to be unfrozen before invoking the Workspace
Manager operation. The workspace can be unfrozen by the owner of the workspace,
by a user with the WM_ADMIN_ROLE, or by a user with the WM_ADMIN system privilege
using the UnfreezeWorkspace procedure.
B-20
Appendix B
Action: The lock mode can be changed by the current session only if the session
is in a workspace whose lock mode has not been set or if the session is in a
workspace whose lock mode has been set with the override option. Privileged users
can change the lock mode for a workspace using the SetWorkspaceLockModeON
and the SetWorkspaceLockModeOFF procedures.
Action: Ensure that the input where_clause parameter contains only valid column
names and has proper syntax. The where_clause parameter for this Workspace
Manager operation can contain only columns that are part of the primary key.
Action: To successfully version-disable this table, verify that there are no database
transaction locks on the table.
B-21
Appendix B
Action: The specified resource may have been locked by some other database
session performing a Workspace Manager operation. Wait for the lock on the
resource to be released before proceeding with the Workspace Manager operation.
Action: To freeze workspaces that are already frozen, use the FreezeWorkspace
procedure with the force parameter.
B-22
Appendix B
Action: CommitResolve can be invoked only by the user who initiated the
BeginResolve operation or by a user who has the WM_ADMIN system privilege.
Action: The user must pass in a non-null lockmode parameter for this operation to
succeed.
Action: Ensure that the invoking user has the required privileges before attempting to
unfreeze the workspace. Otherwise, have the owner of the workspace unfreeze it.
Action: Do not attempt to lock rows that have already been versioned. Use the
where_clause parameter of LockRows to specify those rows that have not already
been versioned.
WM_ERROR_173 cannot create workspaces that are more than 30 levels deep
Cause: An attempt was made to create a workspace that is more than 30 levels in
depth from the LIVE workspace.
Action: Do not create workspaces that are more than 30 levels in depth from the LIVE
workspace.
B-23
Appendix B
Action: Ensure that all the columns in the table being version-enabled are of
supported data types. The currently unsupported data types for version-enabled
tables are: LONG and LONG RAW.
Action: Ensure that the savepoint being deleted is not implicit or it does not have any
child workspaces created off of it. The xxx_WORKSPACES views show the parent
savepoints for all the workspaces in the system. Ensure that the savepoint being
deleted is not a parent savepoint for some workspace.
Action: Ensure that all user-defined triggers on the table to be version-enabled have
no compilation errors.
Action: Rename some of the table's columns to reduce the sum of the column name
lengths.
Action: Ensure that all user-defined triggers on the table to be version-enabled have
trigger body lengths that are less than 28,000 characters.
Action: Reduce the length of the largest trigger body defined on this table, rename
some of the table's columns to reduce the sum of the column name lengths, or do
both.
Action: Decrease the number of primary key columns on the table to 31, at most.
B-24
Appendix B
Action: Do not re-create this view. The view will automatically be dropped when the
table associated with it is version-disabled.
Action: Wait for conflict resolution to either commit or rollback before trying the
operation on the workspace.
B-25
Appendix B
Action: Contact Oracle Support Services with the upgrade or downgrade log.
Action: Contact Oracle Support Services with the upgrade or downgrade output log.
Action: Internal error: contact Oracle Support Services with the upgrade or downgrade
output log.
Action: Internal error: contact Oracle Support Services with the upgrade or downgrade
log.
B-26
Appendix B
Action: Wait until the DDL operation is complete and then retry the current operation.
Action: Rename the primary key constraint of the skeleton table to its original name
and call the CommitDDL procedure again.
Action: Restore the primary key columns to their original state and call the
CommitDDL procedure again.
Action: Drop all partitioned or join indexes on the skeleton table and call the
CommitDDL procedure again.
Action: Rename the index and call the CommitDDL procedure again.
B-27
Appendix B
Action: Call BeginDDL on the table and then perform the current operation again.
Action: Restore the column to its original state and call the CommitDDL procedure
again.
Action: Restore the columns to their original state and call the CommitDDL procedure
again. Reordering of columns can be achieved by first dropping columns in a DDL
session and then adding columns in a subsequent DDL session.
Action: Add the table to the list passed to enable or disable versioning. If you do not
want to version-enable this table not contained in the list, you need to version-enable
the tables one at a time.
Action: Drop one of the referential constraints in the cycle and implement it using
user-defined triggers.
Action: Remove or merge all workspaces that have modified this table. Otherwise,
use the FORCE option of DisableVersioning.
Action: Wait until the previous DDL session has been committed or rolled back.
B-28
Appendix B
Action: Re-create any referential constraints that have the deferrable option so that
they do not have the deferrable option.
Action: Drop this referential constraint. You can only define referential constraints
between two skeleton tables.
Action: Drop the new referential integrity constraint between the skeleton tables and
perform the current operation again.
Action: Examine the spool file to find the Oracle error that caused this error to
occur. Correct the error and enter the following SQL statement while connected AS
SYSDBA: SQL> EXECUTE WMSYS.OWM_MIG_PKG.AllFixSentinelVersion;
B-29
Appendix B
Action: The WM_ADMIN system privilege or WM_ADMIN_ROLE role is required to invoke this
specific operation. Ensure that the current user has the required privileges to invoke
this operation.
Action: Add a primary key constraint to any nested table column contained in the table
to be version-enabled.
WM_ERROR_228 this operation is not allowed for table 'string' with version
state 'string'
Cause: An attempt was made to invoke a workspace operation on a table with a
version state that is invalid.
Action: The table on which the operation was invoked has a version
state that disallows the operation from being performed. Query the
ALL_WM_VERSIONED_TABLES view to look up the version state for the specified
table, and see the documentation for the ALL_WM_VERSIONED_TABLES view (in
ALL_WM_VERSIONED_TABLES) for a definition of the possible version state values.
Action: Retry the operation after fixing the cause of the error.
Action: Check the ALL_WM_VT_ERRORS view to see the statement that failed
and the error that occurred. After fixing the cause of the error, you can version-
enable the table using EnableVersioning or disable versioning on the table using
DisableVersioning. (Be careful if you specify 'ignore_last_error => TRUE' with
DisableVersioning.)
Action: See the Usage Notes for the DisableVersioning procedure for information
about handling the error.
B-30
Appendix B
Action: Find the row that violates the constraint, and attempt the operation without the
row.
Action: Commit or roll back the current database transaction before invoking the
procedure, or invoke the procedure with an auto_commit value of FALSE.
Action: Check the documentation for valid names and values of Workspace Manager
system parameters.
Action: If no data exists in workspaces that are not continually refreshed, you can set
NONCR_WORKSPACE_MODE is set to OPTIMISTIC_LOCKING. To see the current Workspace
Manager system parameter settings, use the WM_INSTALLATION metadata view.
Action: Insert a matching record in the parent table or roll back deleted matching
parent table records first.
B-31
Appendix B
Action: Insert a matching record in the parent table or roll back deleted matching
parent table records first.
Action: Check the documentation about Workspace Manager system parameters, and
be sure that any values required for multiparent workspace support are set correctly.
Action: Ensure that the workspaces under the root of a multiparent graph are
either all continually refreshed or all not continually refreshed. You can use the
ChangeWorkspaceType procedure to change the workspace type between continually
refreshed and not continually refreshed.
Action: Use the function GetPrivs to ensure that the user invoking this operation has
the required privileges.
B-32
Appendix B
Action: Roll back the leaf workspace to remove the versioned data from the branch
being removed.
Action: Remove all the workspaces that are children of non-root workspaces of the
graph before performing this operation.
Action: Delete or roll back one of the rows that is shown as a duplicate.
Action: The row cannot be edited by the current user until the locking user removes
the lock on the row.
Action: The row cannot be edited by the current user until the locking user removes
the lock on the row.
B-33
Appendix B
Action: If data has not been versioned in non-LIVE workspaces, you can change the
PESSIMISTIC_LOCKING setting to OPTIMISTIC_LOCKING. To see the current Workspace
Manager system parameter settings, use the WM_INSTALLATION metadata view.
Action: Ensure that the user has the required privileges before invoking the operation.
To import from or export to a staging table, the user must have privileges to select
from and perform DML operations on the staging table.
Action: Reissue the operation using a non-null value for the specified parameter.
Action: Ensure the compatibility of the system WHERE clause in conjunction with the
parameters for the operation.
B-34
Appendix B
Action: If you want to use the PESSIMISTIC_LOCKING setting, ensure that there
is no data versioned in non-LIVE workspaces for the workspace type (continually
refreshed or not continually refreshed) for which the parameter is being set.
Action: Pass a valid event name. See the WM_EVENTS_INFO view for a list of all
valid events.
WM_ERROR_274 this parameter cannot be set to 'OFF' when some events are
set to be captured
Cause: An attempt was made to disallow the capture of Workspace Manager events
while one or more types of events were set to be captured.
Action: Disable versioning on all tables that contain a nested table column.
B-35
Appendix B
Action: Remove the quote from the table or dependent object and retry the operation.
B-36
Appendix B
Action: Grant the necessary privilege or privileges on the object to the user.
WM_ERROR_290 only the table owner or a user with the "WM_ADMIN" system
privilege can invoke this procedure
Cause: The procedure invoker had insufficient privileges.
Action: Either grant the WM_ADMIN system privilege or WM_ADMIN_ROLE role to the
executing user, or execute the procedure as the owner of the table.
Action: Wait for the sessions that caused the deadlock to either roll back or commit
their transactions.
Action: The required action is dependent on the specified status: status=1: retry the
operation; status=2: wait for the sessions that caused the deadlock to either roll back
or commit their transactions; status=3 or status=5: contact Oracle Support Services to
resolve the issue.
Action: Drop the objects from the schema, and re-create them in a different schema.
B-37
Appendix B
Action: Create the necessary object if it does not exist; otherwise, check the spelling
of the string.
Action: Choose a different workspace name that does not contain the character.
WM_ERROR_302 the new name must be distinct from the old name
Cause: When renaming an object, the old name and the new name must be distinct.
Action: Set the remove_data parameter to false, or do not execute the operation on
the table for the specified workspace.
WM_ERROR_307 workspace 'string' has a crstatus that is not supported for this
operation
Cause: The operation attempted to use a workspace that is not currently supported.
WM_ERROR_308 a 'string' with more than 'string' characters in its name was
found - rename to a shorter name
Cause: The object's name exceeded the specified number of characters.
B-38
Appendix B
Action: Use the validtime parameter option that was originally specified.
Action: Specify a valid value for the parameter. In the case of the PurgeTable
procedure, do not specify non-null values for both the instant and savepoint
parameters.
Action: Wait for the bulk loading of the workspace to complete before executing the
operation.
B-39
Appendix B
Action: When bulk loading into the LIVE workspace, the savepoint_name parameter
must be either 'LATEST' or 'ROOT_VERSION'. When bulk loading into any workspace
other than LIVE, the savepoint_name parameter must be 'LATEST'.
Action: Revert the table to a supported state before retrying the operation.
Action: Remove the nested table from the data type, or the column from the table.
B-40
Appendix B
WM_ERROR_327 the child table 'string' contains a record outside the specified
valid time range
Cause: A constraint violation occurred as a result of adding the validtime option to a
parent table in a foreign key relationship.
Action: Set the validtime range to encompass all child table rows.
Action: Avoid issuing the DDL statement directly on the index. Use CommitDDL.
Action: Specify an instant that is greater than all rows that are going to be purged.
Action: Choose a different savepoint name that does not contain the character.
Action: Avoid issuing the DDL statement directly on the object. Use CommitDDL.
B-41
Appendix B
WM_ERROR_339 this table is not available for queries and DML operations
Cause: An attempt as made to issue a DML statement on a table that is currently
unavailable.
Action: Wait for the operation that caused the table to become unavailable to
complete.
Action: Disable the constraint or remove the data that is violating the constraint.
Action: Avoid creating the trigger directly on the base table. Use CommitDDL.
Action: Rename the index preventing the creation of the _LCK table.
B-42
Appendix B
Action: Ensure that the invoking user has the required privileges to revoke the
privilege. A user needs to have been granted a privilege with the GRANT option to be
able to revoke it from others.
Action: Drop or disable the constraint, or set the enforce_ric parameter to false.
Action: Only revoke privileges from a user that has already had the privileges granted
to them.
WM_ERROR_353 instant can be specified only for a table with history option
Cause: The instant parameter was not null for a table that did not have the history
option.
Action: Ensure the compatibility of the parameters specified for the operation.
B-43
Appendix B
Action: Make sure that the primary key is unique for all time periods.
B-44
Appendix B
Action: Do not execute the operation on a table that has the validtime option
enabled.
Action: Rename either the column in the nested table or the column in the parent
table.
Action: Fix all rows containing the wm_valid column so that the validfrom column is
non-null and the validtill column is not less than the validfrom column.
B-45
Appendix B
Action: Make sure that Workspace Manager is in a valid state before importing the
data.
Action: Install a compatible version of Workspace Manager before importing the data.
Action: See the Data Pump log files for more details on the error.
WM_ERROR_376 the 'string' schema does not contain the necessary data
Cause: The schema contained in the dump file did not contain the necessary data to
complete the import_schemas procedure.
Action: Only use dump files that have been generated by the export_schemas
procedure.
Action: Do not attempt to merge or refresh this workspace with that lockmode.
B-46
Appendix B
Action: Do not set the lockmode of this workspace to an unsupported mode. Instead,
specify one that is supported ('E', 'S', 'VE', 'WE').
WM_ERROR_381 all child workspaces must have their lockmodes set to 'D'
Cause: An attempt was made to set the lockmode of the specified workspace to 'D',
even though a child workspace of the specified workspace had a different lockmode.
Action: For any workspace with the lockmode set to 'D', all child workspaces must
also have the same lockmode. So, either update the lockmode of all of the child
workspaces of the specified workspace to 'D' before changing the lockmode of the
specified workspace, or use a different lockmode for this workspace.
Action: Either do not attempt to version-enable this table, or use a different partitioning
scheme.
Action: Either drop the invisible column from the table, or do not attempt to version-
enable the table.
B-47
Appendix B
Action: Avoid doing such modifications, either by updating the trigger definition or by
executing dbms_wm.SetTriggerEvents to specify when the trigger is executed.
Action: Either change the type of identity column, or do not attempt to version-enable
the table.
Action:Remove the redaction policy from the table, or do not attempt to version-
enable the table.
Action:Set the table_name parameter to the name of the topology and the isTopology
parameter to true in order to include this table.
Action:Either redefine the virtual column or remove the column as part of the primary
key prior to executing EnableVersioning.
B-48
Appendix B
B-49
Glossary
active version
See current version.
child workspace
A workspace created from its parent workspace.
conflicts
Differences in data values resulting from changes to rows in the child and parent
workspace. Conflicts are detected at merge time and presented to the user in conflict
views.
context
Information about the workspace that determines what data the session can see in the
workspace. The context can be retrieved using the GetSessionInfo procedure
current version
The version in which the changes are currently being made.
exclusive locking
A Workspace Manager lock mode that prevents any other user from changing a locked
row.
explicit savepoint
A savepoint that is explicitly created. It can later be used to perform partial rollbacks in
workspaces.
Glossary-1
Glossary
freezing (a workspace)
Causing the condition in which no changes can be made to data in version-enabled
rows in a workspace, and access to the workspace is restricted.
implicit savepoint
A savepoint that is created automatically whenever a new workspace is created.
LATEST
The name of the logical savepoint that refers to the latest version in the workspace.
LIVE
The name of the topmost workspace in the workspace hierarchy.
locks
Version locks provided by Workspace Manager, separate from locks provided by
conventional Oracle database transactions. These locks are primarily intended to
eliminate row conflicts between a parent workspace and a child workspace. Locking
is enabled at a session level and is a session property independent of the workspace
in which the session is. When locking is enabled for a session, it locks rows in all
workspaces in which it participates.
merging (a workspace)
Applying changes made in a workspace to its parent workspace.
nonwriter site
A master site in a multimaster group in a Workspace Manager replication environment
that is not the writer site. A nonwriter site cannot perform any write operations, but
can perform all read operations, such as CreateSavepoint or SELECT queries on
version-enabled tables.
parent workspace
A workspace from which another workspace (a child workspace) was created.
Glossary-2
Glossary
privileges
A set of privileges for Workspace Manager that are separate from standard
Oracle database privileges. Workspace-level privileges (with names in the form
xxx_WORKSPACE) that allow the user to affect a specified workspace. System-level
privileges (with names in the form xxx_ANY_WORKSPACE) that allow the user to
affect any workspace.
removable savepoint
A workspace that can be deleted by the CompressWorkspace,
CompressWorkspaceTree, and DeleteSavepoint procedures. A savepoint is
removable if it is an explicit savepoint or if it is an implicit savepoint that does not
have any child dependencies.
savepoint
A point in the workspace to which operations can be rolled back. It is analogous to a
firewall, in that by creating a savepoint you can prevent any damage to the "other side"
of the wall (that is, operations performed in the workspace before the savepoint was
created).
session context
See context.
shared locking
A Workspace Manager lock mode that allows only users in the workspace in which the
row was locked to modify the row.
unfreezing (a workspace)
Reversing the effect of a freeze operation.
Glossary-3
Glossary
valid time
The time during which a record is valid, or the ability to specify the time for which a
record is valid. Also called effective dating.
version-enabled table
A table in the database in which all rows in the table can now support multiple versions
of data. The versioning infrastructure is not visible to the database users. After a table
has been version-enabled, users automatically see the correct version of the record in
which they are interested.
workspace
A virtual environment that one or more users can share to make changes to the data
in the database. Workspace management involves managing one or more workspaces
that can be shared by many users.
workspace hierarchy
The hierarchy of workspaces in the database. For example, a workspace can be a
parent to one or more workspaces. By default, when a workspace is created, it is
created from the topmost, or LIVE, database workspace.
workspace management
The ability of the database to hold different versions of the same record (that is, row) in
one or more workspaces.
writer site
The master definition site in a Workspace Manager replication environment. Only
the writer site can perform workspace operations and DML and DDL operations on
version-enabled tables. All other sites in the multimaster group are nonwriter sites.
Glossary-4
Index
Symbols auditing modifications
EnableVersioning history option, 4-45
_LT tables history views (xxx_HIST), 5-28
created for Workspace Manager auto_commit parameter, 1-9
infrastructure, 1-12 autocommitting of operations, 1-9
getting name of, 4-61
B
A
base row, 1-8
Add_Topo_Geometry_Layer procedure, 4-4 BeginBulkLoading procedure, 4-13
AddAsParentWorkspace procedure, 4-5 BeginDDL procedure, 4-15
AddUserDefinedHint procedure, 4-7 BeginResolve procedure, 4-16
Advanced Queuing bulk loading, 1-33
and Workspace Manager events, 2-1 BeginBulkLoading procedure, 4-13
ALL_MP_GRAPH_WORKSPACES view, 5-4 CommitBulkLoading procedure, 4-18
ALL_MP_PARENT_WORKSPACES view, 5-4 RollbackBulkLoading procedure, 4-110
ALL_REMOVED_WORKSPACES view, 5-5
ALL_VERSION_HVIEW view, 5-6
ALL_WM_CONS_COLUMNS view, 5-6
C
ALL_WM_CONSTRAINT_VIOLATIONS view, 5-6 ChangeWorkspaceType procedure, 4-17
ALL_WM_CONSTRAINTS view, 5-7 child row, 1-8
ALL_WM_IND_COLUMNS view, 5-8 child workspace, 1-5
ALL_WM_IND_EXPRESSIONS view, 5-8 as alternative to creating savepoint, 1-6
ALL_WM_LOCKED_TABLES view, 5-9 merging, 4-87
ALL_WM_MODIFIED_TABLES view, 5-9 refreshing, 4-95, 4-96
ALL_WM_POLICIES view, 5-9 removing, 4-101
ALL_WM_RIC_INFO view, 5-10 CommitBulkLoading procedure, 4-18
ALL_WM_TAB_TRIGGERS view, 5-10 CommitDDL procedure, 4-21
ALL_WM_VERSIONED_TABLES view, 5-12 CommitResolve procedure, 4-23
ALL_WM_VT_ERRORS view, 5-13 compressing
ALL_WORKSPACE_PRIVS view, 5-14 workspaces, 4-24, 4-28
ALL_WORKSPACE_SAVEPOINTS view, 5-14 compression (Workspace Manager)
ALL_WORKSPACES view, 5-15 SetCompressWorkspace procedure, 4-118
ALLOW_CAPTURE_EVENTS system WM_COMPRESS_BATCH_SIZES view,
parameter, 2-3 5-23
altering WM_COMPRESSIBLE_TABLES view, 5-24
savepoint description, 4-8 CompressWorkspace procedure, 4-24
version-enabled table to add valid time CompressWorkspaceTree procedure, 4-28
support, 4-9 conflict management, 1-48, 4-104
workspace description, 4-12 beginning resolution, 4-16
AlterSavepoint procedure, 4-8 committing resolution, 4-23
AlterVersionedTable procedure, 4-9 rolling back resolution, 4-112
AlterWorkspace procedure, 4-12 showing conflicts, 4-119
asynchronous notification for Workspace conflict resolution
Manager events, 2-6 example, 5-26
Index-1
Index
Index-2
Index
Index-3
Index
H LT tables
created for Workspace Manager
hierarchy infrastructure, 1-12
removing, 4-101 getting name of _LT (physical) table, 4-61
workspaces, 1-5
historical data, 1-13
history option
M
EnableVersioning procedure, 4-44 materialized views
history views (xxx_HIST), 5-28 version management with, 1-42
MergeTable procedure, 4-85
I MergeWorkspace procedure, 4-87
merging
implicit savepoints, 1-6 table changes, 4-85
import considerations, 1-31 workspaces, 1-7, 4-87
Import procedure, 4-76 metadata space
Import_Schemas procedure, 4-79 getting, 4-66
infrastructure for version-enabling of tables, 1-12 Move_Proc procedure, 4-89
Initialize_After_Import procedure, 4-81 multilevel referential integrity constraints, 1-38
invisible index multiparent workspaces, 1-11
supported on version-enabled table, 1-36 multiworkspace views (xxx_MW), 5-29
IsWorkspaceOccupied function, 4-82
N
J
name length of database objects
join index maximums for Workspace Manager, 1-12
cannot be created or dropped on version- nonsequenced update operations, 3-15
enabled table, 1-36 null values
using default values for, 4-138
L
O
LATEST savepoint, 1-6
length of object names OE.WAREHOUSES table
maximums for Workspace Manager, 1-12 Workspace Manager example, 1-53
LOB columns with versioned tables, 4-32 OLS (Oracle Label Security)
lock management, 1-16, 1-48 DDL operations on version-enabled tables,
with DML operations on tables with 1-36
referential integrity constraints, 1-39 granting privileges related to, 4-72
lock mode operation context
getting, 4-58 getting, 4-59
lock views (xxx_LOCK), 5-28 operators for valid time support, 3-5
locking table rows, 4-83 WM_CONTAINS, 3-6
LockRows procedure, 4-83 WM_EQUALS, 3-7
locks WM_GREATERTHAN, 3-8
disabling, 4-122 WM_INTERSECTION, 3-8
enabling, 4-122 WM_LDIFF, 3-9
exclusive, 1-16 WM_LESSTHAN, 3-10
shared, 1-16 WM_MEETS, 3-11
version-exclusive, 1-17 WM_OVERLAPS, 3-12
workspace-exclusive, 1-17 WM_RDIFF, 3-12
logging of modifications Oracle Label Security (OLS)
EnableVersioning history option, 4-45 DDL operations on version-enabled tables,
history views (xxx_HIST), 5-28 1-36
long transactions, 1-2 granting privileges related to, 4-72
Index-4
Index
Index-5
Index
Index-6
Index
Index-7