Beruflich Dokumente
Kultur Dokumente
Alejandro Vargas
Oracle Israel
Case Definition
A critical application suddenly seems to hang, wait events show long table scans running on the OLTP environment. It comes out
that the DBA in charge of this system did run statistics on the tables of the user that owns the application. The gather statistics got
stuck and the process was killed. Since this moment the application started to perform extremely slowly.
The production database has several clones; we decide to export back statistics from one of these clones, to the production
database.
Steps in Brief
Grant succeeded.
Variables:
&tabname = the table created on the previous step to hold the statistics
&usrname = The name of the owner of &tabname
spool off
---- script to generate export table stats end here ----------
Note: you may also use instead of the script this command:
exec DBMS_STATS.export_schema_stats('&usrname','&tabname')
This syntax will run in 10g. It may fail on 8i – 9i databases with some objects. That’s why I prefer the script on these versions.
&tabname = the table created on the previous step to hold the statistics
&usrname = The name of the owner of &tabname
spool off
---- script to generate import table stats end here ----------
Execute this script to generate impstats.sql that will import the statistics on the production database.
Password:
6. Ftp export file with clone statistics table from clone server to production server and
script to import statistics from clone server to production server
Execute FTP session from target server, get both the table that contains the exported statistics and the script to import them,
generated on step :
Password:
Using the script impstats.sql; generated on step 3, import statistics into the production database.