Iterating through many databases
fordc03
Posts: 49 Bronze 2
Okay, I seem to be hitting a brick wall on the best way to do this.
We have about 3,000 databases that we apply scripts to on a nightly basis. We have a master database that gets all the updates applied to it and then we need to compare the schema's.
So, it's a 1 to many kind of thing. I have 1 master database that I want to compare to 3,000 children to make sure the build went through and all database schemas are exactly the same.
My question is, it takes a few minutes to register a database, and it locks my application. Probly the way I'm coding it, but I don't know a better way at the moment.
How can I get a status message or percent complete when registering databases? Is that possible?
We have about 3,000 databases that we apply scripts to on a nightly basis. We have a master database that gets all the updates applied to it and then we need to compare the schema's.
So, it's a 1 to many kind of thing. I have 1 master database that I want to compare to 3,000 children to make sure the build went through and all database schemas are exactly the same.
My question is, it takes a few minutes to register a database, and it locks my application. Probly the way I'm coding it, but I don't know a better way at the moment.
How can I get a status message or percent complete when registering databases? Is that possible?
Comments
If you have a look at the class Database you can see that it implements ICancellable
ICancellable has two properties - Cancel() and a Status event which is fired on updates.
The toolkit samples has an example how to use it:
In the UI we spawn the Register call off onto another thread so the main application can continue to respond to users (and show the progress dialog) and marshall that status event calls back onto the main UI thread to update the UI.
Hope this helps,
- James
--
James Moore
Red Gate Software Ltd
Head of DBA Tools
Red Gate Software Ltd