analyze_schema.sh script

Use the analyze_schema.sh script to generate statistics of your Oracle and DB2® databases.

Syntax

analyze_schema.sh

Parameters

None

This command will prompt to get the dbpassword and use the current user id as the schema name to analyze.

Example

In this example, the analyze_schema.sh script is run.

$<install directory>/bin/db/analyze_schema.sh

Sample output

============================================================
Analyzing schema 'schema1'
This may take several minutes. Do not kill the session.
============================================================
Note: If the schema to analyze is not the same as the current user id, the output will be empty.
No other details display when the script is executed, that is, if the script finishes without errors. Therefore, to check the last updated statistics time in DB2 and Oracle, refer to the following links respectively:

The following command is specifically for Oracle:

execute dbms_stats.gather_schema_stats(NULL,estimate_percent => 100, method_opt =>  'FOR ALL COLUMNS
SIZE AUTO', DEGREE =>  2, cascade => TRUE)

The following command is specifically for DB2:

SELECT TABNAME FROM SYSCAT.TABLES WHERE TYPE = 'T' AND TABSCHEMA = ucase('$schema')
RUNSTATS ON TABLE $schema.$_ USE PROFILE;