Suggest you consider a commercial product, such as those offered by http://www.dbbalance.com or http://www.zidsoft.com. These have a free trial period, if the tool does the job then purchase it, it will be cheaper and more reliable than rolling your own.