WELCOME!

What is Pinoy? It's a slang for Filipino, a person who comes from the Republic of the Philippines, or commonly known as the Philippine Islands (PI). I am a Filipino and works as an Oracle DBA in the United States. Whenever an issue arises or just for experiments, I usually forget what I did to solve/conduct them. There must be a central location where I can put everything. Thus, this blog was born. It's a collection of ideas, tips and tricks, scripts, or anything interesting that happened to me on an Oracle database or any other stuff.

The simpler, the better! has always been my motto. You don't have to complicate things. Simple things, for me, is always easier, just like my site.

FYI, anything that is written here is based on my personal experiences and is not endorsed by any other party. Also, I will not be held liable for issues that can arise by following whatever I did. Just like any other good DBA would say... ALWAYS TEST!

Hope you can find this site helpful in whatever you need and remember, I am not a guru.

Jun 9, 2011

MySQL: expire_logs_days System Variable

Our MySQL database crashed because the disk where the data files are hit 100% usage. Eventhough, there was a script that runs, checks, and purges the bin logs, a flaw prevented it from deleting the logs. The script was modified to correct the issue.



But there's another way and it avoids creating a script that manually deletes the bin logs. We can set a system variable called expire_logs_days. This parameter deletes log files that are greater than the value specified. It is dynamic and can be changed on-the-fly. Make sure that the value is at least the maximum number of lag days before the bin logs are applied.

To change it, log into the database as a super user (usually root) and set the global variable:

mysql> set global expire_logs_days=7;

After changing it, make sure that you modify the .ini file also to reflect the value. 

No comments:

Post a Comment