Oracle Object Fragmentation Test

Fragmentation of tables and indexes may reduce performance, depending on the way data is accessed. Fragmentation also leads to greater overall storage space usage.

Table fragmentation will result in longer query times when a full table scan is performed. Since data is not as evenly packed in the data blocks, many blocks may have to be read during a scan to satisfy the query. These blocks may be distributed on various extents. In this case, Oracle must issue recursive calls to locate the address of the next extent in the table to scan.

Index fragmentation may bring a higher penalty to application performance. When accessing data through an index and an index range scan, Oracle must read each block in the specified range to retrieve the indexed values. If the index is highly fragmented, Oracle may have to search many more blocks, and possibly levels, to get this information, thus delaying query processing and degrading overall performance.

The first step to resolving the performance threat posed by fragmentation is to identify which objects (tables, indexes, or both) are fragmented. The Oracle Object Fragmentation test helps in this regard. This test scans a pre-configured object sample for high and very high levels of fragmentation, and reports the count of fragmented objects. Using the detailed diagnosis capability of the test, you can also quickly drill down to the specific objects that have been fragmented. You can thus proceed to rebuild the fragmented objects to reduce disk I/O. 

This test is disabled by default. To enable the test, go to the enable / disable tests page using the menu sequence : Agents -> Tests -> Enable/Disable, pick Oracle Database as the Component type, Performance as the Test type, choose this test from the disabled tests list, and click on the << button to move the test to the ENABLED TESTS list. Finally, click the Update button.

Target of the test : An Oracle server

Agent deploying the test : An internal agent

Outputs of the test : One set of results for every DisplayName configured for the object name parameter of this test.

Configurable parameters for the test
  1. TEST PERIOD - How often should the test be executed. As this test, if executed frequently, may increase the processing overheads of the eG agent, It is recommended that you run this test less frequently - say, once a day (24 hrs).
  2. Host – The host for which the test is to be configured
  3. Port - The port on which the server is listening
  4. User – In order to monitor an Oracle database server, a special database user account has to be created in every Oracle database instance that requires monitoring. A Click here hyperlink is available in the test configuration page, using which a new oracle database user can be created. Alternatively, you can manually create the special database user. When doing so, ensure that this user is vested with the select_catalog_role and create session privileges.

    The sample script we recommend for user creation (in Oracle database server versions before 12c) for eG monitoring is:

    create user oraeg identified by oraeg

    create role oratest;

    grant create session to oratest;

    grant select_catalog_role to oratest;

    grant oratest to oraeg;

    The sample script we recommend for user creation (in Oracle database server 12c) for eG monitoring is:

    alter session set container=<Oracle_service_name>;

    create user <user_name>identified by <user_password> container=current default tablespace <name_of_default_tablespace> temporary tablespace <name_of_temporary_tablespace>;

    Grant create session to <user_name>;                                

    Grant select_catalog_role to <user_name>;

    The name of this user has to be specified here.

  5. Password – Password of the specified database user

    This login information is required to query Oracle’s internal dynamic views, so as to fetch the current status / health of the various database components.

  6. Confirm password – Confirm the password by retyping it here.
  7. OBJECT NAME - Specify a comma-separated list of objects - i.e., tables and/or indexes - that need to be checked for fragmentation. Every object name should be specified in the following format: <DisplayName>:<schema_name>.<object_name>, where schema_name refers to the name of the object owner, and object_name refers to the name of the table/index you want to monitor. The DisplayName in your specification will appear as the descriptor of this test. For instance, to monitor the fragmentation-levels of alarm and history tables owned by user admin, your specification would be: AlarmMon1:admin.alarm,AlarmMon2:admin.history. To monitor all objects in a schema, the specification would be of the following format: <DisplayName>:<schema_name>.*. For example, to monitor all the objects in the admin schema, your specification would be: AlarmMon:admin.*.

    You can also configure the OBJECT NAME to indicate what percentage of records in a table are to be considered by this test for running fragmentation checks. To achieve this, your OBJECT NAME specification should be of the following format: <DisplayName>:<schema_name>.<table_name>@<Percentage_of_records_in_the table>. For instance, say that you want to configure this test to monitor the fragmentation level of 20% of the alarm table and 30% of the history table. The OBJECT NAME specification in this case will be: AlarmMon:admin.alarm@20,AlarmMon1:admin.history@30. It is recommended that you keep this ‘percentage value’ small, as higher values will make this test that much more resource-intensive.

    Note:

    Make sure that you configure the OBJECT NAME parameter with only table names and/or index names, and not view names. This is because, tables and indexes alone get fragmented, and not views.

  8. QUERYTIMEOUT - Specify the time period up to which a query has to wait to obtain the required result set from the database in the QUERYTIMEOUT text box. If the query is not successful or if the query waits for a time period exceeding the specified time limit, the test will automatically kill the query.
  9. INCLUDE INDEX – By default, this test reports metrics on table-level fragmentation only. This is why, the INCLUDE INDEX flag is set to No by default. If you want the test to report metrics on index-level fragmentation as well, set this flag to Yes.
  10. ISPASSIVE – If the value chosen is yes, then the Oracle server under consideration is a passive server in an Oracle cluster. No alerts will be generated if the server is not running. Measures will be reported as “Not applicable" by the agent if the server is not up.
  11. SSL- By default, this flag is set to No, as the target Oracle database is not SSL-enabled by default. If the target database is SSL-enabled, then set this flag to Yes.
  12. SSL Cipher-This parameter is applicable only if the target Oracle database is SSL-enabled, if not, set this parameter to none. A cipher suite is a set of cryptographic algorithms that are used before a client application and server exchange information over an SSL/TLS connection. It consist of sets of instructions on how to secure a network through SSL (Secure Sockets Layer) or TLS (Transport Layer Security). In this text box, provide a comma-seperated list of cipher suites that are allowed for SSL/TLS connection to the target database. By default, this parameter is set to none.
  13. TRUSTSTORE FILE- This parameter is applicable only if the target Oracle database is SSL-enabled, if not, set this parameter to none. TrustStore is used to store certificates from Certified Authorities (CA) that verify and authenticate the certificate presented by the server in an SSL connection. Therefore, the eG agent should have access to the truststore where the certificates are stored to authenticate and connect with the target database and collect metrics. For this, first import the certificates into the following default location <eG_INSTALL_DIR>/lib/security/mytruststore.jks. To know how to import the certificate into the truststore, refer toPre-requisites for monitoring Oracle Cluster. Then, provide the truststore file name in this text box. For example: mytruststore.jks. By default, none is specified against this text box.
  14. TRUSTSTORE TYPE-This parameter is applicable only if the target Oracle database is SSL-enabled, if not, set this parameter to none.Specify the type of truststore that contains the certificates for server authentication in this text box. For eg.,JKS. By default, this parameter is set to the value none.
  15. TRUSSTORE PASSWORD-This parameter is applicable only if the target Oracle database is SSL-enabled, if not, set this parameter to none. If a Truststore File name is provided, then, in this text box, provide the password that is used to obtain the associated certificate details from the Truststore File. By default, this parameter is set to none.
  16. DETAILED DIAGNOSIS – To make diagnosis more efficient and accurate, the eG Enterprise embeds an optional detailed diagnostic capability. With this capability, the eG agents can be configured to run detailed, more elaborate tests as and when specific problems are detected. To enable the detailed diagnosis capability of this test for a particular server, choose the On option. To disable the capability, click on the Off option.

    The option to selectively enable/disable the detailed diagnosis capability will be available only if the following conditions are fulfilled:

    • The eG manager license should allow the detailed diagnosis capability
    • Both the normal and abnormal frequencies configured for the detailed diagnosis measures should not be 0.
Measurements made by the test
Measurement Description Measurement Unit Interpretation

Highly fragmented Oracle objects:

Indicates the number of highly fragmented objects of this type.

Number

If 30% - 49%  of an object is found to be fragmented, then such an object is counted as a highly fragmented object.

Table Fragmentation occurs when we update/delete data in table. The space which gets freed up during non-insert DML operations is not immediately re-used (or sometimes, may not get reused ever). This leaves behind holes in the table, which results in table fragmentation. When rows are not stored contiguously, or if rows are split onto more than one block, performance decreases because these rows require additional block accesses.

Index fragmentation is characterized by splitting and spawning. Splitting happens when an index node becomes full with keys and a new index node is created at the same level as a full node. This widens the B*-tree horizontally.

Spawning is the process of adding a new level to an index. As a new index is populated, it begins life as a single-level index. As keys are added, a spawning takes place and the first-level node reconfigures itself to have pointers to lower-level nodes.

Both these phenomenon are key performance degraders. This is why, a high value of this measure, if left unchecked, can cause disk I/O to mount, queries to run for long periods, and the overall performance of the database server to deteriorate.

Use the detailed diagnosis of this measure to identify the highly fragmented objects and  the percentage fragmentation of each object, so that you can understand how badly that object is fragmented and can proceed to rebuild it.

Very highly fragmented Oracle objects:

Indicates the number of objects of this type that are very highly fragmented.

Number

If 50% or more of an object is found to be fragmented, then such an object is counted as a very highly fragmented object.

Table Fragmentation occurs when we update/delete data in table. The space which gets freed up during non-insert DML operations is not immediately re-used (or sometimes, may not get reused ever). This leaves behind holes in the table, which results in table fragmentation. When rows are not stored contiguously, or if rows are split onto more than one block, performance decreases because these rows require additional block accesses.

Fragmentation is characterized by splitting and spawning. Splitting happens when an index node becomes full with keys and a new index node is created at the same level as a full node. This widens the B*-tree horizontally.

Spawning is the process of adding a new level to an index. As a new index is populated, it begins life as a single-level index. As keys are added, a spawning takes place and the first-level node reconfigures itself to have pointers to lower-level nodes.

Both these phenomenon are key performance degraders. This is why, a high value of this measure, if left unchecked, can cause disk I/O to mount, queries to run for long periods, and the overall performance of the database server to deteriorate.