Tuesday, July 15, 2014

Database Tuning Tips for EIM (For Oracle Only)


1. Table Fragmentation:



Prior to running EIM it is important to clean up fragmented objects, especially those that will be used during the EIM processing. The following SQL statement can be used to identify objects with greater than 10 extents:

SELECT segment_name,segment_type,tablespace_name,extents
FROM dba_segments
WHERE owner = (Siebel table_owner)
and extents > 9;

To fix fragmentation, the objects will need to be rebuilt with appropriate storage parameters. Always be careful when rebuilding objects because of defaults, triggers, etc. on the objects.

2. Optimizer Mode:


Oracle optimization mode can also affect EIM performance. The Siebel application has been found to perform better under RULE based optimization under normal application usage. While there have been cases where it has been found that Cost based optimization has improved EIM performance this should only be attempted as a last resort and must be switched back to RULE for online usage. Be aware that Siebel only supports Rule-Based optimization. Optimization mode can be verified by running the following query:

SELECT NAME, VALUE FROM V$PARAMETER WHERE NAME = ‘OPTIMIZER_MODE’;

3. Purging an EIM table:


When purging data from the EIM table, use the TRUNCATE command as opposed to DELETE. The TRUNCATE command will release the data blocks and reset the high water mark while DELETE will not, thus causing additional blocks to be read during processing. Also, be sure to drop and re-create the indexes on the EIM table to release the empty blocks.

4. Index creation:


When working with large volumes of data in the EIM tables, index build time can be costly when refreshing the EIM table with a new data set. To improve the performance of the index build use the UNRECOVERABLE (Oracle 7.3) or NOLOGGING (Oracle 8) option. This will prevent Oracle from writing to the REDO LOG files. Users can also improve index build time by creating multiple SQL scripts to create the indexes and running these scripts in parallel through SQLPlus. Below is a sample SQL statement demonstrating the syntax for using the UNRECOVERABLE or NOLOGGING option:

CREATE INDEX S_SAMPLE_M1 ON
S_SAMPLE (SAMPLE_ID)
TABLESPACE TS_INDX
STORAGE (INITIAL 10M NEXT 5M PCTINCREASE 0)
UNRECOVERABLE/NOLOGGING; (choose one based on the Oracle version)

5. Disable archive logging:


It is recommended that Archive logging be disabled during the initial data loads. This can be enabled after the data loads are complete to provide for “point-in-time” recovery.

6. FREELIST parameter:


Multiple EIM processes can be executed against an EIM table provided they all use different batches or batch ranges. The concern is that contention for locks on common objects may be experienced. To run multiple jobs in parallel against the same EIM table, check that the ‘FREELIST’ parameter is set appropriately for the tables and indexes used in the EIM processing. This would include the EIM tables and indexes as well as the base tables and indexes. The value of this parameter specifies the number of block ids that will be stored in memory which are available for record insertion. As a rule of thumb, users should set this to at least half of the intended number of parallel jobs to be run against the same EIM table (example, a FREELIST setting of 10 should permit up to 20 parallel jobs against the same EIM table). This parameter is set at the time of object creation and the default for this parameter is 1. To check the value of this parameter for a particular object the following query can be used:

SELECT SEGMENT_NAME, SEGMENT_TYPE, FREELISTS
FROM DBA_SEGMENTS
WHERE SEGMENT_NAME=’<OBJECT NAME TO BE CHECKED>’;


To change this parameter the object must be rebuilt. Again, be careful when rebuilding objects because of defaults, triggers, etc. on the objects. To rebuild the object follow the steps below:


  1. Export the data from the table with the grants.
  2. Drop the table.
  3. Re-create the table with the desired FREELIST parameter.
  4. Import the data back into the table
  5. Rebuild the indexes with the desired FREELIST parameter.


7. Caching tables:



One other measure that can help performance is to pin small tables that are frequently accessed in cache. The value of BUFFER_POOL_KEEP determines the 'keep pool', example, the portion of the buffer cache that will not be flushed by the LRU algorithm. The 'keep pool' allows one to 'pin' certain tables in memory, thus improving performance for accessing those tables. This will ensure that after the first time that the table is accessed it will always be in memory. Otherwise it is possible that the table will get pushed out of memory and will require disk access the next time used. Keep in mind that the amount of memory allocated to the ‘keep’ area is subtracted from the overall buffer cache memory (defined by DB_BLOCK_BUFFERS). A good candidate for this would be the S_LST_OF_VAL table. The syntax for pinning a table in cache is as follows:

ALTER TABLE S_LST_OF_VAL CACHE;