SQL Scripts for OLAP DBAs

SQL Scripts for OLAP DBAs

The olap_dba_scripts.sql file contains several SQL scripts for use by DBAs in managing resources when the database is used for OLAP applications. Following are brief descriptions and sample output from the scripts. These examples were tested using Oracle Database 10g Release 10.2.0.1 and Release 10.2.0.3.

aw_objects_in_cache

Identifies the objects in the buffer cache that are related to analytic workspaces.

SQL> @aw_objects_in_cache

USERNAME   OBJECT                         SUBOBJECT       OBJECT_TYPE               BLOCKS
---------- ------------------------------ --------------- ------------------- ------------
GLOBAL_AW  SYS_IL0000046805C00004$$       SYS_IL_SUBP56   INDEX SUBPARTITION             1
GLOBAL_AW  AW$GLOBAL                      SYS_SUBP27      TABLE SUBPARTITION             2
GLOBAL_AW  SYS_LOB0000046805C00004$$      SYS_LOB_SUBP39  LOB SUBPARTITION               2
GLOBAL_AW  SYS_LOB0000046805C00004$$      SYS_LOB_SUBP42  LOB SUBPARTITION               2
GLOBAL_AW  AW$GLOBAL                      SYS_SUBP22      TABLE SUBPARTITION             2
GLOBAL_AW  SYS_IL0000046805C00004$$       SYS_IL_SUBP59   INDEX SUBPARTITION             2
GLOBAL_AW  AW$GLOBAL                      SYS_SUBP31      TABLE SUBPARTITION             3
GLOBAL_AW  AW$GLOBAL                      SYS_SUBP30      TABLE SUBPARTITION             3
GLOBAL_AW  AW$GLOBAL                      SYS_SUBP24      TABLE SUBPARTITION             3
GLOBAL_AW  AW$GLOBAL                      SYS_SUBP23      TABLE SUBPARTITION             3
GLOBAL_AW  AW$GLOBAL                      SYS_SUBP21      TABLE SUBPARTITION             3
       .
       .
       .

aw_reads_writes

Tallies the number of reads from temporary and permanent tablespaces, the writes to cache, and the rows processed in analytic workspaces.

SQL> @aw_reads_writes

USERNAME               SID   TEMP_READS    LOB_READS    CACHE_WRS   ROWS_PROCD
--------------- ---------- ------------ ------------ ------------ ------------
GLOBAL_AW               49            2          419          204            0

aw_size

Displays the amount of disk space used by each analytic workspace.

SQL> @aw_size

Analytic Workspace                       On Disk MB Tablespace
----------------------------------- --------------- --------------------
GLOBAL.GLOBAL                                 67.25 GLOBAL
GLOBAL_AW.GLOBAL                              60.31 GLOBAL
SYS.AWCREATE                                   2.00 SYSAUX
SYS.AWCREATE10G                                0.75 SYSAUX
SYS.AWMD                                       2.00 SYSAUX
SYS.AWREPORT                                   0.81 SYSAUX
SYS.AWXML                                      8.00 SYSAUX
SYS.EXPRESS                                    2.00 SYSAUX
                                    ---------------
Total Disk:                                  143.13
  

aw_tablespaces

Provides extensive information about the tablespaces used by analytic workspaces. The report produced by this script contains the following columns:

Column

 Description

Tablespace

Name of tablespace

TYPE

U: undo
T: temporary
P: permanent

AUTO

Y if the tablespace auto extensible; otherwise N

SEGM

Tablespace segment space management:

A: auto

M: manual

PLUG

Y if the tablespace is plugged in; otherwise N

LOGG

Y if tablespace logging is set; otherwise N

LIVE

Y if the tablespace is online, or N if it is offline

Users

Number of users who own objects in the tablespace

Size(MB)

Total size of the tablespace

Used(MB)

Total space occupied by objects in the tablespace

AW(MB)

The space consumed by analytic workspaces in the tablespace

AW#

Number of analytic workspaces in the tablespace

AWPts

Number of partitions for analytic workspaces in the tablespace

SQL> @aw_tablespaces

                   T A S P L L
                   Y U E L O I
                   P T G U G V
Tablespace         E O M G G E Users   Size(MB)   Used(MB)     AW(MB)  AW# AWPts
------------------ - - - - - - ----- ---------- ---------- ---------- ---- -----
GLOBAL             P Y M N Y Y     2      175.0      146.3      127.6    1    32
SH_AW              P Y A N Y Y     0      224.0        0.3        0.0    0     0
SYSAUX             P Y A N Y Y     7       88.6       88.6       15.6    6     6
SYSTEM             P Y M N Y Y    10      450.0      147.6        0.0    0     0
SYSTEM             P N M N Y Y    10      230.0      -72.4        0.0    0     0
TBS_1              P Y M N Y Y     0      100.0        0.0        0.0    0     0
GLOBAL_TEMP        T Y M N N Y     0      175.0       80.0        0.0    0     0
SH_AWTEMP          T Y M N N Y     0      224.0        0.0        0.0    0     0
TEMP               T Y M N N Y     0       40.0        2.0        0.0    0     0
OLAPUNDO           U Y M N Y Y     1       29.0        4.7        0.0    0     0
TBS_9              U Y M N Y Y     1       10.0        1.3        0.0    0     0
UD1                U Y M N Y Y     1       10.0        2.4        0.0    0     0
                                     ---------- ---------- ---------- ---- -----
total                                   1,834.6      400.8      143.1    7    38
  

aw_users

Identifies the users of analytic workspaces.

SQL> @aw_users

User            SID Serial# AW Name                   Mode
------------ ------ ------- ------------------------- -----
GLOBAL_AW        46      94 SYS.AWXML                 RO
GLOBAL_AW        46      94 SYS.EXPRESS               RO
GLOBAL_AW        46      94 GLOBAL_AW.GLOBAL          RW
  

aw_wait_events

Describes the wait events that occurred over the previous hour for users connected to analytic workspaces.

SQL> @aw_wait_events


AWUSER                    AWNAME               EVENT                     STATE           CNT     WAITED
------------------------- -------------------- ------------------------- -------- ---------- ----------
GLOBAL_AW (47,1207)       SYS.AWXML (RO)                                 WAITING          62          0
GLOBAL_AW (47,1207)       GLOBAL_AW.GLOBAL (RW                           WAITING          62          0
                          )
GLOBAL_AW (47,1207)       SYS.EXPRESS (RO)     db file sequential read   WAITING           2      47686
GLOBAL_AW (47,1207)       SYS.AWXML (RO)       db file sequential read   WAITING           2      47686
GLOBAL_AW (47,1207)       GLOBAL_AW.GLOBAL (RW log file switch (checkpoi WAITING           9    7792952
                          )                    nt incomplete)
GLOBAL_AW (47,1207)       SYS.EXPRESS (RO)     log file switch (checkpoi WAITING           9    7792952
                                               nt incomplete)
GLOBAL_AW (47,1207)       SYS.AWXML (RO)       log file switch (checkpoi WAITING           9    7792952
                                               nt incomplete)
GLOBAL_AW (47,1207)       GLOBAL_AW.GLOBAL (RW db file sequential read   WAITING           2      47686
                          )
GLOBAL_AW (47,1207)       SYS.EXPRESS (RO)                               WAITING          62          0
 

buffer_cache_hits

Calculates the buffer cache hit ratio.

SQL> @buffer_cache_hits

Buffer Cache Hit Ratio
-----------------------------------------
99.14%
  

cursor_parameters

Indicates whether the database parameters that limit the number of open cursors are set too low.

SQL> @cursor_parameters

PARAMETER              VALUE USAGE
---------------------- ----- -----
session_cached_cursors    20  100%
open_cursors             300   13%
  

olap_pga_performance

Determines how much PGA is in use, the size of the OLAP page pool, and the hit/miss ratio for OLAP pages for each user.

SQL> @olap_pga_performance

User            SID PGA_USED PGA_MAX  OLAP_PP  OLAP_RATIO
------------ ------ -------- -------- -------- ----------
GLOBAL_AW        46 13.53 MB 35.91 MB 5.15 MB  99.65%
 

olap_pga_use

Determines how much PGA is consumed by the OLAP page pool to perform operations on analytic workspaces.

SQL> @olap_pga_use

INFO
-----------------------------------------------------------------
Total PGA Inuse Size: 30948 KB
Total OLAP Page Size: 5271 KB
OLAP Pages Occupying: 17%
 

session_resources

Identifies the use of cursors, PGA, and UGA for each open session.

SQL> @session_resources

USERNAME             NAME                                VALUE
-------------------- ------------------------------ ----------
SYS:45               opened cursors cumulative             202
                     opened cursors current                  1
                     session cursor cache count             19
                     session cursor cache hits             163
                     session pga memory                2035400
                     session pga memory max           41225928
                     session stored procedure space          0
                     session uga memory                 701256
                     session uga memory max            7278364
GLOBAL_AW:46         opened cursors cumulative            4315
                     opened cursors current                 19
                     session cursor cache count             20
                     session cursor cache hits            4140
                     session pga memory               23269064
                     session pga memory max           24514248
                     session stored procedure space          0
                     session uga memory               10063560
                     session uga memory max           10375928
  

shared_pool_hits

Calculates the shared pool hit ratio.

SQL> shared_pool_hits

Shared Pool Hit Ratio
-----------------------------------------
97.138%
E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy