Powered By Blogger

Wednesday, 1 June 2011

analye the insert and update using binary logs


This is for analyzing the insert and update using mysqlbinlog file

#!/bin/sh
mysqlbinlog ${1} | grep -i -e "^update" -e "^insert" -e "^delete" -e "^replace" -e "^alter" | cut -c1-100 | tr '[A-Z]' '[a-z]'
| sed -e "s/\t/ /g;s/\`//g;s/(.*$//;s/ set .*$//;s/ as .*$//" | sed -e "s/ where .*$//" | sort | uniq -c | sort -nr

No comments:

Post a Comment