Entering content frameProcedure documentation Updating Statistics using Integrated Approach with SAPDBA Locate the document in its SAP Library structure

Use

You can use this procedure to check and update statistics for the Oracle cost-based optimizer (CBO), resulting in improved database performance. This section describes the new integrated SAPDBA approach for update statistics, which you start from the command line. It uses parallel processing to reduce the time taken to update statistics: the father process starts child processes to perform the optimizer analyses for individual tables, and communication between father and child uses pipes.

Recommendation

We strongly recommend you to use the update statistics functionality in BRCONNECT instead of the SAPDBA functionality. The reason is that we will in future no longer develop the SAPDBA functions, whereas BRCONNECT functions will always be fully up-to-date.

Here is the detailed command syntax to update statistics with SAPDBA:

sapdba

-statistics ALL | DBSTATCO | <tables>

[ -method E | C | EH | CH

-option Pn | Rn ]

The command is explained in the procedure below.

For an overview of update statistics for the Oracle database, see Update Statistics for the Cost-Based Optimizer with SAPDBA.

Prerequisites

The number of parallel child processes is determined by the cbo_parallel_degree parameter in the SAPDBA profile init<SID>.dba. If the parameter is not specified or zero, SAPDBA sets parallelism to the number of CPUs in the database host.

The operation log is stored in the SAPCHECK directory under <timestamp>.sta . For more information on the SAPCHECK directory, refer to Environment Variables (UNIX) and Environment Variables (Windows NT).

Procedure

  1. To update all database statistics, enter the following command:

sapdba -statistics

Note

This is the usual command, which is equivalent to the following with the previous two-phase method:

sapdba -checkopt PSAP%

sapdba -analyze DBSTATCO

You can add the switch ALL to the command sapdba -statistics , but it is no longer necessary.

SAPDBA:

SAPDBA deletes the statistics on tables that do not need statistics. These include all R/3 pool and cluster tables as well as all tables listed in the DBSTATC table for which ACTIV is set to N .

SAPDBA proceeds as follows:

SAPDBA examines the primary index of each table to see how many records have changed. The analysis method used to see how many records have changed is described in Update Statistics: Internal Rules with SAPDBA.

If enough records in a table have changed, SAPDBA updates statistics for the table. The criteria that SAPDBA uses to decide whether enough records have changed are described in Update Statistics: Internal Rules with SAPDBA.

SAPDBA does not update statistics for the following tables:

SAPDBA generates statistics by analyzing the primary index using the method "Estimate Statistics Sample 1 Percent." The next time that you run update statistics with SAPDBA, it handles the table like any other table.

SAPDBA updates statistics for all tables in the DBSTATC table, to which the following apply:

The criteria that SAPDBA uses to decide whether enough records have changed are described in Update Statistics: Internal Rules with SAPDBA.

  1. To only update statistics for tables listed in the DBSTATC table, enter the following command:
  2. sapdba -statistics DBSTATCO

    SAPDBA follows the rules given in "Updates statistics for tables listed in the DBSTATC table" in the previous step.

  3. To check and update statistics for a specific table or set of tables, enter the following command:
  4. sapdba -statistics <tables>

    You can specify <tables> using the name of a single table or a wildcard (for example, psap* ).

    SAPDBA proceeds as described for sapdba -statistics (see the first step above) for the table or tables that you specify.

  5. To force SAPDBA to use a particular method or option for update statistics, enter a command containing method or option , such as the following:

sapdba -statistics ALL -method E -option P10

The methods and options are as follows:

Result

The database statistics are up-to-date, resulting in better performance.

Leaving content frame