Oracle® OLAP Application Developer's Guide 10g Release 1 (10.1) Part Number B10333-02 |
|
|
View PDF |
This chapter describes the various administrative tasks that are associated with Oracle OLAP. It contains the following topics:
Because Oracle OLAP is contained in the database and its resources are managed using the same tools, the management tasks of Oracle OLAP and the database converge. Nonetheless, a database administrator or applications developer needs to address management tasks in the specific context of Oracle OLAP, in addition to creating and maintaining analytic workspaces. Following is a list of these tasks.
Tablespaces. Create permanent and temporary tablespaces to prevent I/O bottlenecks, as described in "Creating Tablespaces for Analytic Workspaces".
Database configuration. Set initialization parameters to optimize performance, as described in "Initialization Parameters for Oracle OLAP" and "Initialization Parameters for the BI Beans".
Security. Users of OLAP applications must have database identities that have been granted the appropriate access rights. For users to have access to files, you must define database directory objects and grant users access to them. Refer to "Setting Up User Names".
Performance. Database monitoring tools can identify recommended changes to the database configuration based on past usage, as described in "Monitoring Performance".
See Also: Oracle Database Administrator's Guide for detailed information about managing the Oracle Database. |
Before you create an analytic workspace, you should create undo, permanent, and temporary tablespaces dedicated to their use. Analytic workspaces are created in the user's default tablespace, unless the user specifies otherwise. The default tablespace for all users is set initially to SYS
. Creating analytic workspaces in the SYS
tablespace can degrade overall performance. Similarly, analytic workspaces should not share tablespaces with relational tables, especially not the source star or snowflake schema.
Oracle OLAP makes heavy use of temporary tablespaces, so it is particularly important that they be set up correctly to prevent I/O bottlenecks.
The tablespaces that you set up for use by Oracle OLAP are used by SQL for tasks such as creating and maintaining OLAP Catalog metadata and views of workspace data, in addition to their use by analytic workspaces.
If possible, you should stripe the datafiles and temporary files across as many controllers and drives as are available.
The following SQL commands create an undo tablespace.
CREATE UNDO TABLESPACE tablespace DATAFILE 'pathname' SIZE size REUSE AUTOEXTEND ON NEXT size MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL;
Where:
For example:
CREATE UNDO TABLESPACE olapundo DATAFILE '$ORACLE_HOME/oradata/undo.dbf' SIZE 64M REUSE AUTOEXTEND ON NEXT 8M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL;
After creating the undo tablespace, change your system parameter file to include these settings, then restart the database as described in "Initialization Parameters for Oracle OLAP".
UNDO_TABLESPACE=tablespace UNDO_MANAGEMENT=AUTO
When a user creates an analytic workspace, it is created in the user's default tablespace, which is initially set to the SYS
tablespace. The following SQL statements create a tablespace appropriate for storing analytic workspaces.
CREATE TABLESPACE tablespace DATAFILE 'pathname' SIZE size REUSE AUTOEXTEND ON NEXT size MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; ALTER USER username DEFAULT TABLESPACE tablespace
Where:
For example:
CREATE TABLESPACE glo DATAFILE '$ORACLE_HOME/oradata/glo.dbf' SIZE 64M REUSE AUTOEXTEND ON NEXT 8M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
If your computer has multiple disks, then you can stripe the tablespace across them. The next example shows SQL statements that distribute the GLO
tablespace across three physical disks:
CREATE TABLESPACE glo DATAFILE 'disk1/oradata/glo1.dbf' SIZE 64M REUSE AUTOEXTEND ON NEXT 8M MAXSIZE 1024M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; ALTER TABLESPACE glo ADD DATAFILE 'disk2/oradata/glo2.dbf' SIZE 64M REUSE AUTOEXTEND ON NEXT 8M MAXSIZE 1024M, 'disk3/oradata/glo3.dbf' SIZE 64M REUSE AUTOEXTEND ON NEXT 8M MAXSIZE UNLIMITED;
Oracle OLAP uses temporary tablespace to store all changes to the data in an analytic workspace, whether the changes are the result of a data load, what-if analysis, forecasting, aggregation, or some other analysis. An OLAP DML UPDATE
command moves the changes into the permanent tablespace and clears the temporary tablespace.
Oracle OLAP also uses temporary tablespace to maintain different generations of an analytic workspace. This enables it to present a consistent view of the analytic workspace when one or more users are reading it while the contents are being updated. This usage creates numerous extensions within the tablespace, so be sure to specify a small EXTENT MANAGEMENT
size.
The following commands create a temporary tablespace suitable for use by Oracle OLAP.
CREATE TEMPORARY TABLESPACE tablespace TEMPFILE 'pathname' SIZE size REUSE AUTOEXTEND ON NEXT size MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE size;
Where:
For example:
CREATE TEMPORARY TABLESPACE glotmp TEMPFILE '$ORACLE_HOME/oradata/glotmp.tmp' SIZE 50M REUSE AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE 256K;
You can stripe temporary tablespaces across several disks the same as permanent tablespaces. The next example shows the GLOTMP temporary tablespace striped across three physical disks.
CREATE TEMPORARY TABLESPACE glotmp TEMPFILE 'disk1/oradata/glotmp1.tmp' SIZE 50M REUSE AUTOEXTEND ON NEXT 5M MAXSIZE 1024M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 256K; ALTER TABLESPACE glotmp ADD TEMPFILE 'disk2/oradata/glotmp2.tmp' SIZE 50M REUSE AUTOEXTEND ON NEXT 5M MAXSIZE 1024M, 'disk3/oradata/glotmp3.tmp' SIZE 50M REUSE AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED;
To find out the size of the tablespace extensions for a particular analytic workspace, use the following SQL statements:
COLUMN DBMS_LOB.GETLENGTH(AWLOB) HEADING "Bytes"; SELECT EXTNUM, DBMS_LOB.GETLENGTH(AWLOB) FROM AW$awname;
Where:
awname is the name of the analytic workspace.
To connect to the database, a user must present a user name and password that can be authenticated by database security. All users must have the CONNECT
role. The additional privileges associated with that user name control the user's access to data. As a database administrator, you must set up user names with appropriate credentials for all users of Oracle OLAP applications.
You can define user names and grant them these rights from the Security folder of Oracle Enterprise Manager or by using SQL commands.
Two roles are defined on installation of the database explicitly to support Oracle OLAP:
OLAP_USER
role provides users with the privileges to create and manage OLAP Catalog metadata and standard form analytic workspaces in their own schemas. Any OLAP user who will be performing these tasks should have the OLAP_USER
role or equivalent privileges.
OLAP_DBA
role provides a DBA or system administrator with privileges to create and manage OLAP Catalog metadata and standard form analytic workspaces in any schema. The OLAP_DBA
role is granted with the DBA role. Care should be taken in extending this privilege to additional users.
See Also: Oracle Database SQL Reference for more information about granting privileges. |
To create OLAP Catalog metadata, users must be granted the OLAP_USER
role. To create analytic workspaces, users also need SELECT
privileges on the source schema tables, and an unlimited quota on the tablespace in which the workspace is created. Example 12-1 shows the SQL statements for creating the GLOBAL_AW
user.
Example 12-1 SQL Statements for Creating the GLOBAL_AW User
CREATE USER 'GLOBAL_AW' IDENTIFIED BY 'global_aw' DEFAULT TABLESPACE glo TEMPORARY TABLESPACE glotmp QUOTA UNLIMITED ON glo QUOTA UNLIMITED ON glotmp ACCOUNT UNLOCK; GRANT SELECT ON global.channel_dim TO global_aw; GRANT SELECT ON global.customer_dim TO global_aw; GRANT SELECT ON global.product_dim TO global_aw; GRANT SELECT ON global.time_dim TO global_aw; GRANT SELECT ON global.price_and_cost_history_fact TO global_aw; GRANT SELECT ON global.price_and_cost_update_fact TO global_aw; GRANT SELECT ON global.units_history_fact TO global_aw; GRANT SELECT ON global.units_update_fact TO global_aw;
To access an existing analytic workspace, users must have these access privileges on the table in which the workspace is stored:
To read from the analytic workspace, SELECT
privileges.
To write to the analytic workspace, SELECT
, INSERT
, and UPDATE
privileges.
Note that the name of the table is the same as the name of the analytic workspace, with the addition of an AW$
prefix. For example, the XADEMO
analytic workspace is stored in the AW$XADEMO
relational table.
For users to access views of workspace data, they must be granted EXECUTE
privileges explicitly on those views.
Example 12-2 shows the SQL statements that gives all users read-only privileges to the GLOBAL
analytic workspace, and user SCOTT
read/write privileges.
To connect to the database using the BI Beans, users must have the following access rights to the database:
CONNECT
role
QUERY REWRITE
system privilege
SELECT
privileges on the database objects containing the data to be analyzed, whether the data is stored in an analytic workspace or in relational tables. Refer to the previous topic, "SQL Access for Analysts", for information about granting access to analytic workspaces.
Table 12-1 identifies the parameters that affect the performance of Oracle OLAP. Alter your server parameter file or init.ora
file to these values, then restart your database instance. You can monitor the effectiveness of these settings and adjust them as necessary.
Table 12-1 Initial Settings for Database Parameter Files
Parameter | Setting |
---|---|
DB_CACHE_SIZE |
Half of physical memory |
OLAP_PAGE_POOL_SIZE |
For queries, 2-8MB; enlarge temporarily for data loads |
PARALLEL_MAX_SERVERS |
The number of processors minus one
This parameter limits the number of processes that are used for a parallel update and for SQL |
PGA_AGGREGATE_TARGET |
200-400 MB |
SESSIONS |
2.5 * maximum number of simultaneous OLAP users |
UTL_FILE_DIR |
Directory path where the Oracle Database can write to a file. |
UNDO_MANAGEMENT |
AUTO |
UNDO_TABLESPACE |
Name of the undo tablespace, which must be defined first as shown in "Creating an UNDO Tablespace" |
Take the following steps to set system parameters:
Open the init
sid
.ora
initialization file in a text editor.
The initialization file is located in $ORACLE_HOME/admin/
sid
/pfile
, where sid
is the system identifier as defined in $ORACLE_HOME/network/admin/tnsnames.ora
.
Add or change the settings in the file.
For example, you might enter a command like this so that Oracle can write files to the olapscripts
directory:
UTL_FILE_DIR=/users/oracle/olapscripts
Stop and restart the database, using commands such as the following. Be sure to identify the initialization file in the STARTUP
command.
SQLPLUS '/ AS SYSDBA' SHUTDOWN IMMEDIATE STARTUP pfile=$ORACLE_HOME/admin/rel10g/pfile/initrel10g.ora
OLAP_PAGE_POOL_SIZE
is an initialization parameter that is specific to Oracle OLAP. This parameter specifies in bytes the maximum size of the paging cache to be allocated to each OLAP session. The minimum value of OLAP_PAGE_POOL_SIZE
is 2 MB. The default value is 32 MB.
These are the basic guidelines for setting OLAP_PAGE_POOL_SIZE
:
In the database initialization file, set OLAP_PAGE_POOL_SIZE
to a value based on the maximum number of simultaneous OLAP users. The setting should be in the order to 2-8MB; 4MB is typical. Larger is better, but remember that each user is allocated that amount.
For data loads, use a SQL ALTER SESSION
statement to enlarge the OLAP page pool as much as possible just for the duration of the load, on the basis that the page pool is not shared with other users at this time. The setting should be in the order of 100-400MB, but smaller than DB_CACHE_SIZE
.
The OLAP page pool is allocated at the start of an OLAP session and released when the user closes the session. An OLAP session can be initiated by the OLAP_TABLE
function, the DBMS_AWM
PL/SQL package, or using the command line in OLAP Worksheet.
The OLAP page pool is allocated from the User Global Area (UGA). When the database is running in dedicated mode, the UGA is part of the Process Global Area (PGA). When the database is running as a shared server process, the UGA is part of the Shared Global Area (SGA).
When the OLAP page pool is full, it uses the DB cache as a swap space. This in-memory swapping is a relatively fast operation. When the DB cache is full, it swaps to disk, which is a relatively slow operation. If the DB cache must swap to disk frequently, then performance will suffer significantly.
PGA_AGGREGATE_TARGET
is used by SQL statements, particularly when performing SELECT
statements with GROUP BY
and ORDER BY
clauses. It is not used by the OLAP engine. However, PGA_AGGREGATE_TARGET
can affect the performance of the BI Beans when selecting data from relational tables. If your Oracle Database supports this type of application, set PGA_AGGREGATE_TARGET
initially to 200-400MB, and use the database performance monitoring tools to recommend adjustments.
The BI Beans will perform best if the configuration parameters for the database are optimized for this type of use. During installation of the Oracle Database, an OLAP configuration table is created and populated with ALTER SESSION
commands that have been tested to optimize the performance of the BI Beans. Each time the BI Beans opens a session, it executes these ALTER SESSION
commands.
If a database instance is being used only to support Java applications that use the BI Beans, then you can modify your server parameter file or init.ora
file to include these settings. Alternatively, you might want to include some of the settings in the server parameter file and leave others in the table, depending upon how your database instance is going to be used. These are your choices:
Keep all of the parameters in the configuration table, so that they are set as part of the initialization of a BI Beans session. This method fully isolates these configuration settings solely for the BI Beans. (Default)
Add some of the configuration parameters to the server parameter file or init.ora
file, and delete those rows from the configuration table. This is useful if your database is being used by other applications that require the same settings.
Add all of the configuration parameters to the server parameter file or init.ora
file, and delete all rows from the configuration table. This is the most convenient if your database instance is being used only by the BI Beans.
Regardless of where these parameters are set, you should check the Oracle Technology Network for updated recommendations.
See Also: Oracle Database SQL Reference for descriptions of initialization parameters that can be set by theALTER SESSION command |
The OLAP DML contains three types of commands that read from and write to external files:
File read commands that copy data from flat files to workspace objects.
Import and export commands that copy workspace objects and their contents to files for transfer to another database instance.
File input and output commands that read and execute DML commands from a file and redirect command output to a file.
These commands control access to files by using BFILE
security. This database security mechanism creates a logical database directory to represent a physical disk directory. Permissions are assigned to the database directory, which control access to files within the associated physical directory.
You use PL/SQL statements to create a database directory and grant permissions. The relevant syntax of these SQL statements is provided in this chapter.
See Also: Oracle Database SQL Reference under the entries forCREATE DIRECTORY and GRANT for the full syntax and usage notes. |
To create a database directory, you must have CREATE ANY DIRECTORY
system privileges.
Use a CREATE DIRECTORY
statement to create a new directory, or a REPLACE DIRECTORY
statement to redefine an existing directory, using the following PL/SQL syntax:
{CREATE | REPLACE | CREATE OR REPLACE} DIRECTORY directory AS 'pathname';
Where:
After you create a directory, grant users and groups access rights to the files contained in that directory, using the following PL/SQL syntax:
GRANT permission ON DIRECTORY directory TO {user | role | PUBLIC};
Where:
permission is one of the following:
READ
for read-only accessWRITE
for write-only accessALL
for read and write accessdirectory is the name of the database directory
user is a database user who gets immediate access rights to directory
role is a database role that gets immediate access rights to directory
PUBLIC
gives all database users immediate access rights to directory
The following SQL commands create a directory named OLAPFILES
to control access to a directory named /users/oracle/OraHome1/olap
and grant read access to all users.
CREATE DIRECTORY olapfiles as '/users/oracle/OraHome1/olap'; GRANT READ ON DIRECTORY olapfiles TO PUBLIC;
Users access files located in /users/oracle/OraHome1/olap
with DML commands such as this one:
IMPORT ALL FROM EIF FILE 'olapfiles/salesq2.eif' DATA DFNS
Oracle OLAP multidimensional data is stored in analytic workspaces, which are, in turn, stored in relational tables. An analytic workspace can contain a variety of objects, such as dimensions, variables, and OLAP DML programs. These objects typically support a particular application or set of data.
Whenever an analytic workspace is created, modified, or accessed, the information is stored in a table in the relational database.
Important: These tables are vital for the operation of Oracle OLAP. Do not delete them or attempt to modify them directly unless you are fully aware of the consequences. |
Analytic workspaces are stored in tables in the Oracle Database. The names of these tables always begin with AW$
.
For example, if the GLOBAL_AW
user creates two analytic workspaces, one named GLOBAL
and the other named GLOBAL_PROGRAMS
, then these tables will be created in the GLOBAL_AW
schema:
AW$GLOBAL AW$GLOBAL_PROGRAMS
Tables are created by default with eight partitions. You can manage these partitions the same as you would for any other table in your database.
The tables store all of the object definitions and data. Each object in an analytic workspace is stored in one or more page spaces, and each page space is stored in a separate row of the table. A page space is grouping of related data pages; a page is a unit for swapping data in and out of memory.
For example, a dimension is stored in three page spaces and thus has three rows (one each for dimension members, a hash index, and a logical-to-physical map). A variable is stored in one row; a partitioned variable has a row for each partition.
Table 12-2 describes the columns of a table that stores an analytic workspace.
Table 12-2 Column Descriptions for Analytic Workspace Tables
Column | Data Type | NULL | Description |
---|---|---|---|
EXTNUM |
NUMBER(8) |
- | Extension number
Analytic workspaces are stored in physical LOBs (called extensions), which have a default maximum size of 500MB. The first extension is 0, the second is 1, and so forth. |
PS# |
NUMBER(10) |
- | Page space number
Each object is stored in at least one page space. |
GEN# |
NUMBER(10) |
- | Generation number
A generation (a snapshot of the page space) is maintained for each reader to assure a consistent view of the analytic workspace throughout a session. |
AWLOB |
BLOB |
- | Analytic workspace LOB
Actual storage of the analytic workspace object. |
OBJNAME |
VARCHAR2(60) |
- | Object name
The name of the object in the analytic workspace. |
PARTNAME |
VARCHAR2(60) |
- | Partition name
A name for the page space in which the object is stored. Each object is stored in its own page space. A partitioned variable is stored with a page space for each partition. The number of partitions and their names are specified when a partition template is created in the analytic workspace. |
Table 12-3 shows a few sample rows of an analytic workspace table, which are the results of the following query.
SELECT * FROM aw$global WHERE OBJNAME = 'TIME' OR OBJNAME = 'UNITS_VARIABLE' ORDER BY GEN#, PS#;
Table 12-3 Sample Rows From AW$GLOBAL
EXTNUM | PS# | GEN# | AWLOB | OBJNAME | PARTNAME |
---|---|---|---|---|---|
0 |
2515 |
0 |
- | TIME |
TIME |
0 |
2516 |
0 |
- | TIME |
TIME |
0 |
2517 |
0 |
- | TIME |
TIME |
0 |
2745 |
0 |
- | UNITS_VARIABLE |
UNITS_VARIABLE |
0 |
2515 |
9 |
- | TIME |
TIME |
0 |
2516 |
9 |
- | TIME |
TIME |
0 |
2517 |
9 |
- | TIME |
TIME |
The SYS
user owns several tables associated with analytic workspaces:
AW$EXPRESS AW$AWCREATE AW$AWMD AW$ PS$
AW$EXPRESS
stores the EXPRESS
analytic workspace. This workspace contains objects and programs that support the OLAP DML. The EXPRESS
workspace is used any time that a session is open.
AW$AWCREATE
stores the AWCREATE
analytic workspace, which contains programs for creating and managing standard form analytic workspaces.
AW$AWMD
stores the AWMD
analytic workspace, which contains programs for creating standard form catalogs.
AW$
maintains a record of all analytic workspaces in the database, recording its name, owner, and other information.
PS$
maintains a history of all page spaces. A page is an ordered series of bytes equivalent to a file. Oracle OLAP manages a cache of workspace pages. Pages are read from storage in a table and written into the cache in response to a query. The same page can be accessed by several sessions.
The information stored in PS$
enables the Oracle OLAP to discard pages that are no longer in use, and to maintain a consistent view of the data for all users, even when the workspace is being modified during their sessions. When changes to a workspace are saved, unused pages are purged and the corresponding rows are deleted from PS$
.
The CWM1
and CWM2
read APIs are tables owned by the OLAPSYS
user. Public synonyms provide user access to these tables.
Each Oracle Database instance maintains a set of virtual tables that record current database activity. These tables are called dynamic performance tables. The dynamic performance tables collect data on internal disk structures and memory structures. Among them are tables that collect data on Oracle OLAP. By monitoring these tables, you can detect usage trends and diagnose system bottlenecks. Refer to the Oracle OLAP Reference for information about the OLAP dynamic performance views.