17 Aralık 2015 Perşembe

[EN] Cleaning SYSAUX Optimizer Statistics History

When new optimizer statistics collected for a database object, old statisitcs are sent to SYSAUX tablespace. This information is stored in "Server Manageability - Optimizer Statistics History" component of SYSAUX tablespace. 

By this feature we can use DBMS_STATS.RESTORE... procedures.

The default retention for Optimizer Statistics History is 31 days. Old information are automaticly deleted by Oracle Database. Without any manual intervention.

But sometimes this 31 day retention may be too much. In one of my database this component was 75 GB.

--Check SYSAUX components and their sizes.
select * from v$sysaux_occupants order by space_usage_kbytes desc;

10 Aralık 2015 Perşembe

[EN] Sending HTML UTF-8 e-mail via UTL_SMTP

You can directly use SYS.UTL_SMTP package from your e-mail sending code. But for ease of use i recommend creating the following procedure. Because if you use UTL_SMTP directly from your code, you have to write UTL_SMTP package parameters again and again. With this following procedure you can easily send e-mails from your e-mail sending code.

Please carefully examine and change parts specific to your site on the following code. Like "smtp_hostname","smtp_port".