Monthly Archives: April 2010

Script to send email unix with sendmail

cat << EOF | /usr/sbin/sendmail -t to:myemail@mysite.com from:”no reply” (Automated Processor) subject:My subject My email body. EOF

Posted in Email | 1 Comment

du -sk to identify space usage unix

Find out what directories are using up disk space in unix with this command: du -sk * | sort -n I often put it into a function so I can call it quickly: g () { du -sk * | … Continue reading

Posted in Linux, Space | Leave a comment

Materialized Views with dbms_metadata.get_ddl

See the SQL create definition of a materialized view by running this SQL: set long 200000 pages 0 lines 131 doc off column txt format a121 word_wrapped spool recreate_sql select dbms_metadata.get_ddl(‘MATERIALIZED_VIEW’,'my_mv_name’,'my_owner’) txt from dual; spool off set pages 9999 Look … Continue reading

Posted in Materialized views | Leave a comment

dbms_stats export import optimizer statistics

Examples of syntax to export/import dbms_stats: exec dbms_stats.create_stat_table ( ownname => user , stattab => ‘temp_stats’ ) ; exec dbms_stats.export_table_stats ( ownname => user , stattab => ‘temp_stats’, tabname => ‘mytable’, statid => ‘Taken_7Apr2010′) ; exec dbms_stats.import_table_stats ( ownname => … Continue reading

Posted in Stats | Leave a comment

Keep log files by copying into new directory unix

cp -pR logs logs`date +$d%m%y%T` Creates a timestamped copy directory named like “logs041015:44:42″.

Posted in Linux | Leave a comment