Relay binlog corrupt

The slave failed with the error that the relay binlog is corrupt. It had copied close to 12 binlogs from the master and they were yet to be applied. Unfortunately those binlogs have been purged on the master. Now to sync up cleanly we might have to refresh data from the master which can be [...]

Script to obtain the count of archive logs applied during recovery

Pass the start date + time and end date + time to the following script. It looks at the alert log file and obtains the no of archive logs that have been applied during media recovery in that time interval.
#!/usr/bin/perl -w

BEGIN { push @INC,”/home/user/TimeDate-1.16/lib/” }
use Date::Parse;
$start=str2time(@ARGV[0]);
chomp(@ARGV[1]);
$end=str2time(@ARGV[1]);

$log=’path to the log file’;
open(ALERTLOGFILE,$log) or die “Not able to [...]

Adding dynamic swap file

All production servers are normally installed using kickstart files. Unfortunately, the ks file had a bug that it didnt add a swap partition if there was only one logical or physical disk.
Once the database was setup without swap, the configuration was sized such that all processes fit into memory. But we started seeing OOM killing [...]

Tweaks for loading data into MySQL

Whenever we load data into a MySQL database the following settings can help speed up the import.

innodb_flush_log_at_trx_commit = 0

innodb_support_xa = 0

skip-innodb_doublewrite

If the host doesn’t have slaves, and if log-bin is turned on, turning it off using set SQL_LOG_BIN=0 or commenting out log-bin in my.cnf will also help. Similarly disabling other logs like update [...]

Skip duplicate entries in a slave

The following one liner helps to sync a slave that is facing duplicate entry errors.

while [ 1 ]; do if [ `mysql -u root -e "show slave status \G;" | grep "Duplicate entry" | wc -l` -eq 1 ] ; then mysql -u root -e “stop slave; set global sql_slave_skip_counter=1; start slave;”; fi; sleep [...]

building mysql proxy ! not my cup of tea

On a RHEL 4u4 host run the following wget commands to get the necessary source code.
wget http://gd.tuwien.ac.at/graphics/gimp/gtk/v2.6/glib-2.6.4.tar.bz2
wget http://dev.mysql.com/get/Downloads/MySQL-Proxy/mysql-proxy-0.6.1.tar.gz/from/http://mysql.easynet.be/
wget http://luaforge.net/frs/download.php/3132/lua5_1_3_Sources.tar.gz
wget http://monkey.org/~provos/libevent-1.3d.tar.gz
Untar all the files and run configure , make and make install.
To tackle few of the hiccups that you might encounter, you can install glib on to a location that is different from your root.
For Glib [...]

my first oracle regex

REGEXP_REPLACE(target_name,’(([\.]|[:])[a-z,A-Z,0-9]*)|(-[0-9]{3})’,”)
It was written to transform host entries in the table of the format “aaa-bbb-001.ccc.ddd.eeeeeee.fff” to aaa-bbb . The underlying requirement was to get one distinct entry for all RAC nodes in a cluster.