Wednesday, July 17, 2013

statistics manipulation commands

1. create local stats table
exec DBMS_STATS.CREATE_STAT_TABLE (ownname => 'TUSER', stattab => 'TEST_STAT_TABLE');

2. export current table stats to local table
exec DBMS_STATS.EXPORT_TABLE_STATS(ownname => 'TUSER',tabname => 'TTABLE',stattab => 'TEST_STAT_TABLE', statid => 'T1', cascade => true);

3. delete current table stats
exec DBMS_STATS.DELETE_TABLE_STATS(ownname => 'TUSER',tabname => 'TTABLE', cascade_columns => true, cascade_indexes => true);

4. import local stats to table
exec DBMS_STATS.IMPORT_TABLE_STATS(ownname => 'TUSER',tabname => 'TTABLE',stattab => 'TEST_STAT_TABLE', statid => 'T1', cascade => true);

5. check statistics

select statid, count(*) from TEST_STAT_TABLE group by statid;

6. statistics stored in table can be moved to other database and be imported.

7. Columns “C5” and “C1” of the statistics table represent schema owner and table name respectively. if owner and table_name is different when imported, update this two columns.

reference:
http://momendba.blogspot.com/2011/01/import-table-statistics-to-another.html


Swingbench installation

1.down load the file

2. unzip the file to the location you want it to be.

3. include java_home/bin into path variable

4. run oewizard to install soe schema for order entry test

5. check table record change for order entry test
select count(*) from CUSTOMERS ;
select count(*) from LOGON ;
select count(*) from ORDERS ;
select count(*) from ORDER_ITEMS ;

6. below table can be truncate and will be loaded when testing.

truncate table logon;
truncate table order_ITEMS;

reference:
http://www.dominicgiles.com/installation.html