Sunteți pe pagina 1din 1

Gather Statistic Collection Plan

Step to do:
Step 1: Creating the stats table to backup the existing statistics of EXAMPLE_USER
schema.
$ sqlplus testuser/******* #testuser should have dba privilege
SQL>
DBMS_STATS.create_stat_table('TESTUSER','EXAMPLE_USER_STATS_23DEC2015');

Step 2: Exporting the EXAMPLE_USER schema statistics and stored in newly created
statistics tableEXAMPLE_USER_STATS_23DEC2015
EXEC
DBMS_STATS.export_schema_stats('EXAMPLE_USER','EXAMPLE_USER_STATS_23D
EC2015',NULL,'TESTUSER');

Step 3: Gathering Dictionary Statistics


EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;

Step 4: Gathering Fixed Objects Statistics


EXEC DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

Step 5: Gathering Schema Statistics for EXAMPLE_USER


EXEC SYS.DBMS_STATS.GATHER_SCHEMA_STATS (ownname =>
'"EXAMPLE_USER"',estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => 'FOR ALL COLUMNS SIZE AUTO',cascade => TRUE,no_invalidate
=> FALSE, degree => 60,options=> 'GATHER',granularity=> 'ALL');

Important Note: If the performance is bad with the new statistics then import the old stats
using below command
Importing the old EXAMPLE_USER schema statistics from the created statistics
tableEXAMPLE_USER_STATS_23DEC2015 ,
EXEC
DBMS_STATS.import_schema_stats('EXAMPLE_USER','EXAMPLE_USER_STATS_23D
EC2015',NULL,'TESTUSER');

S-ar putea să vă placă și