Oracle runstats oneliner (ok, two liner)

Posted: September 3rd, 2009 | Author: Graham | Filed under: Uncategorized | Tags: , , | No Comments »

Use this to generate a runstats script for your Oracle system. Only works for 6.1 . Also very ugly :)

#!/bin/bash
export PROFILE_PATH=/opt/WebSphere/wp_profile
cat ${PROFILE_PATH}/ConfigEngine/properties/wkplc_comp.properties | grep DbUser | grep -v source | grep -v '#' | grep -v DBA | awk -F = '{print "execute dbms_stats.gather_schema_stats(ownname=>'"'"'" $2 "'\'', cascade=> TRUE);"}' > reorg.sql

Now copy this file to your oracle system and run this:

sqlplus / as sysdba @reorg.sql

Pow! All done.



Leave a Reply