![]() Previous |
![]() Next |
The AW ATTACH command attaches an analytic workspace to your session. Oracle OLAP makes the specified workspace the current one. Previously attached workspaces move down in the list of attached workspaces to make room for the new current one at the top of the list. When there is a cached version of the requested analytic workspace then the cached version is moved back to the list of attached workspaces unless, of course, the current version of the analytic workspace is more recent than the cached version.
When you attach multiple workspaces, the code and data in all the attached workspaces are available during your session. The current workspace is first on the workspace list, which Oracle OLAP keeps for your session.
Note: When an AW ATTACH statement executes, it can trigger the execution of several programs. See "Startup Programs" for more information. |
Syntax
AW ATTACH workspace -
[ONATTACH [progname]|NOONATTACH] -
[RO [THAW] ] | RW | RWX | MULTI [THAW]] [WAIT | NOWAIT] ] -
[AUTOGO [progname]|NOAUTOGO] -
[AFTER workspace|BEFORE workspace|LAST|FIRST] -
[PASSWORD password]
Parameters
The name of the analytic workspace. When you use the ATTACH keyword to attach an analytic workspace that is not already attached, you must specify the workspace name. Again this is because no alias has been assigned using AW ALIAS LIST. However, when you use the ATTACH keyword on an already attached workspace (for example, to change its position in the workspace list), you can assign an alias using AW ALIAS LIST and then use that assigned alias.
(Default) When you do not specify progname, the ONATTACH clause automatically runs a program named ONATTACDH if one exists in the attached workspace. You can get the same results by not specifying NOONATTACH.
Specifying NOONATTACH indicates that when a program named ONATTACH
exists in the workspace, Oracle OLAP should not execute that program.
(Default) When you do not specify progname, the AUTOGO clause automatically runs a program named AUTOGO if one exists in the attached workspace. You can get the same results by not specifying NOAUTOGO.
When you do specify progname, the AUTOGO clause automatically runs the specified program in the attached program.
Specifying NOAUTOGO indicates that when a program named AUTOGO
exists in the workspace, Oracle OLAP should not execute that program.
(Default) Specifies that the workspace is attached in read-only access mode. Users can make private changes to the data in the workspace to perform what-if analysis but cannot commit any of these changes.
an analytic workspace that is attached read-only can be accessed simultaneously by several sessions. The read-only attach mode is compatible with the read/write and multiwriter access mode. A user can attach an analytic workspace in read-only mode when other users have the workspace attached in either read/write and multiwriter access mode. Likewise, a user cannot attach an analytic workspace in read/write exclusive mode when another user has it attached in read-only mode. When you attach an analytic workspace with read-only access, Oracle OLAP executes a program called PERMIT_READ, when it finds one in the workspace.
Specifies that Oracle OLAP attach the current view of an analytic workspace that was frozen using an AW FREEZE command without the NOTHAW keyword.
Specifies that the workspace is attached in read/write access mode. Only one user can have an analytic workspace open in read/write at a time. The user has to commit either all or none of the changes made to the workspace.
an analytic workspace that is attached read/write non-exclusive can be accessed simultaneously by several sessions. The read/write non-exclusive attach mode is only compatible with the read-only access mode. A user can attach an analytic workspace in read/write mode when other users have the workspace attached in read-only mode; however, a user cannot attach an analytic workspace in read/write mode when another user has it attached in any other mode. Likewise, a user cannot attach an analytic workspace in any mode other than read-only when another user has it attached in read/write non-exclusive mode. When you attach an analytic workspace with read/write access, Oracle OLAP executes a program called PERMIT_WRITE, when it finds one in the workspace.
Specifies that the workspace is attached in read/write exclusive access mode. Only one user can have an analytic workspace open in read/write exclusive at a time. The user has to commit either all or none of the changes made to the workspace.
an analytic workspace that is attached read/write exclusive cannot be accessed by any other sessions. The read/write exclusive attach mode is not compatible with any other access modes. A user cannot attach an analytic workspace in read/write exclusive mode when another user has it attached in any mode. Likewise, a user cannot attach an analytic workspace in any other mode when another user has it attached in read/write exclusive mode. When you attach an analytic workspace with read/write access, Oracle OLAP executes a program called PERMIT_WRITE, when it finds one in the workspace.
Specifies that the workspace is attached in multiwriter access mode. An analytic workspace that is attached in multiwriter mode can be accessed simultaneously by several sessions. In multiwriter mode, users can simultaneously modify the same analytic workspace in a controlled manner by specifying the attachment mode (read-only or read/write) for individual variables, relations, valuesets, and dimensions.
The multiwriter attach mode is only compatible with read-only and multiwriter modes. A user cannot attach an analytic workspace in multiwriter mode when another user has it attached in read/write or exclusive modes. Likewise, a user cannot attach an analytic workspace in read/write or exclusive mode when another user has it attached in multiwriter mode.
Specifies whether Oracle OLAP waits for an analytic workspace to become available for access when you request access to an analytic workspace that is being used with read/write exclusive access or when you request read/write access to an analytic workspace that is being used with read/write non-exclusive access. NOWAIT (the default) causes Oracle OLAP to produce an error message indicating that the workspace is unavailable. When you specify WAIT, Oracle OLAP waits for the workspace to become available for access. The number of seconds that Oracle OLAP waits for access depends on the value of the Oracle OLAP AWWAITTIME option.
(Default) Makes the workspace you are attaching the current workspace in the workspace list.
Puts the workspace after the current workspace in the workspace list and before the EXPRESS
workspace. When there are other workspaces attached before the EXPRESS
workspace, the specified workspace is attached after them. When there are no workspaces before the EXPRESS
workspace, LAST makes the specified workspace the current one. LAST ignores any workspaces after the EXPRESS
workspace.
Let you specify the position in the workspace list of the newly attached workspace relative to an analytic workspace that is attached. Use AFTER, rather than LAST, to attach an analytic workspace after the EXPRESS
workspace. When specifying BEFORE puts the workspace first, the workspace becomes the current one.
The order of the workspace list determines the order in which workspaces are searched when Oracle OLAP looks for programs or objects named in programs.
Specifies a password to be checked in a startup program to give or deny access to the workspace being attached. See "Startup Programs".
Usage Notes
Using ATTACH on an Already-Attached Workspace
Reattaching an attached workspace with a AW ATTACH workspace statement does not cause Oracle OLAP to bring a new copy of the workspace into working memory. Instead, Oracle OLAP takes the following actions:
Makes the workspace the current workspace.
Runs an Autogo program, when you specify the AUTOGO keyword
However, when you have made any changes to data during the session, they are not discarded when you reattach an active workspace. Furthermore, current aliases for the workspace are not changed.
Managing Analytic Workspaces Attached in Multiwriter Mode
You use the following commands to manage objects in multiwriter mode:
ACQUIRE -- Acquires and (optionally) resynchronizes the specified objects so that their changes can be updated and committed.
RELEASE -- Changes the access mode of the specified variables, relations, valuesets, or dimensions from read/write (acquired) access to read-only access.
RESYNC -- Drops private changes for the specified read-only objects and retrieves the data from the latest visible generations.
REVERT-- Drops all changes made to the specified objects since they were last updated, resynchronized (using a RESYNC statement), or acquired using ACQUIRE with the RESYNC phrase, or since the analytic workspace was attached.
The following considerations apply:
Only one user can acquire an object in read/write mode at a time. You can first acquire an object in read-only mode, and then, assuming another user has not also acquired it in read-only mode, you can acquire it in read/write mode without releasing it first. However, once another user has acquired an object in read-only mode, you cannot acquire the same object in read/write mode until the other user releases the object. When a specified object has been acquired by another user or when your read-only generation for a specified object is not the latest generation for the object, an acquire fails.
You must resynchronize all variables, valuesets, and relations that share a composite dimension at the same time.
When resynchronizing objects, keep in mind the logical relationship of different objects to avoid losing the logical consistency of the data by promoting some objects, but not others to a new generation.
Objects that share a composite dimension can be resynchronized separately when all such objects that are not being resynchronized are either unchanged or acquired.
You cannot update a variable if any of its dimensions have been acquired and modified.
You must acquire a dimension before you maintain it.
If you release a dimension, then an automatic revert occurs.
Releasing objects that have been updated does not allow others to acquire the object until you commit or roll back the transaction. It may still be useful to release an object that has been updated before a commit when one wants to make further what-if changes and later update all acquired variables
Reverting a dimension after adding dimension values is not recommended since it can result in suboptimal space allocation for variables dimensioned by that dimension
If an acquired variable is dimension by an acquired dimension that has been maintained then you cannot update that variable until after you update or release the dimension.
You cannot delete dimension values.
Attaching a Frozen Analytic Workspace
Once an analytic workspace is frozen, attaching an analytic workspace in RO and MULTI attaches the frozen view of the workspace unless you specify the THAW keyword to request that the current view be attached. (When you attach in RW or RW, you always get the latest generation.)
When you attach the current view, the state of the analytic workspace may not necessarily be consistent if there is a multi-step build with intermediate commits. For example, assume that there is an analytic workspace that has two variables: actual and budget
. Assume also that you have populated actual
and then issued UPDATE and COMMIT commands. At this point in time, there is data only in actual.
When you are attaching a frozen analytic workspace in read multi mode, you can use the multi-writer commands (RESYNC and ACQUIRE) to retrieve up-to-date versions of the data whether or not you have specified AW FREEZE with the NOTHAW keyword.
Conflicts between Workspace Names and Aliases
You cannot attach an analytic workspace that is in your schema and whose name is the same as an assigned alias. Similarly, you cannot assign an alias that duplicates the name of an attached workspace that is in your schema. Furthermore, you cannot assign the same alias to two attached workspaces.
In an AW DELETE statement, when you specify an analytic workspace name (for an analytic workspace that is not attached) and the name is the same as an assigned alias, Oracle OLAP interprets the name as an alias and reports an error.
Examples
Startup Programs
Assume that you have created an analytic workspace named awtest
that contains five programs named PERMIT_READ,
PERMIT_WRITE
, ONATTACH
, MYATTACH
, and AUTOGO
that have the following definitions.
DEFINE PERMIT_READ PROGRAM BOOLEAN PROGRAM SHOW 'permit_read program executing' AW LIST RETURN YES END DEFINE PERMIT_WRITE PROGRAM BOOLEAN PROGRAM SHOW 'permit_write program executing' AW LIST RETURN YES END DEFINE ONATTACH PROGRAM BOOLEAN PROGRAM SHOW 'onattach program executing' AW LIST RETURN YES END DEFINE MYATTACH PROGRAM BOOLEAN PROGRAM SHOW 'myattach program executing' AW LIST RETURN YES END DEFINE AUTOGO PROGRAM PROGRAM SHOW 'autogo program executing' AW LIST END
The programs that execute when you attach awtest
vary depending on the attachment mode and keywords in the AW ATTACH statement:
When you attach awtest
in read/write mode using the following statements.
AW DETACH awtest AW ATTACH awtest RW
First the PERMIT_WRITE
program executes, and then the ONATTACH
program executes.
When you attach awtest
in read-only mode using the following statements.
AW DETACH axuserwtest AW ATTACH awtest NOONATTACH RO
Only the PERMIT_READ
program executes.
When you attach awtest
in read-only mode using the following statements.
AW DETACH awtest AW ATTACH awtest RO
First the PERMIT_READ
program executes, and then the ONATTACH
program executes.
When you attach awtest
in read-only mode using the following statements.
AW DETACH awtest AW ATTACH awtest ONATTACH myattach RO
First the PERMIT_READ
program executes, and then the MYATTACH
program executes.
When you attach awtest
in multi mode using the following statements.
AW DETACH awtest AW ATTACH awtest MULTI
First the PERMIT_WRITE
program executes, and then the ONATTACH
program executes.
When you attach awtest
in read-only mode using the following statements.
AW DETACH awtest AW ATTACH awtest AUTOGO
First the PERMIT_WRITE
program executes. Secondly, the ONATTACH
program executes. Finally, the AUTOGO
program executes.
Attaching an Analytic Workspace Using an ONATTACH Program
Suppose you have two workspaces of sales data, one for expenses
and one for revenue
. You have a third workspace called analysis
contains programs to analyze the data. Your analysis
workspace has the following ONATTACH
program to attach the other two.
DEFINE onattach PROGRAM PROGRAM AW ATTACH expenses RW AFTER analysis AW ATTACH revenues RW AFTER analysis END
To run the ONATTACH
program, attach the analysis
workspace with the following statement.
AW ATTACH analysis
When you issue an AW LIST statement, you can see from the following output, that all three of your analytic workspaces are attached.
ANALYSIS R/W CHANGED XUSER.ANALYSIS REVENUE R/W UNCHANGED XUSER.REVENUES EXPENSES R/W UNCHANGED XUSER.EXPENSES EXPRESS R/O UNCHANGED SYS.EXPRESS