Wednesday, June 17, 2009

Database Configuration Versioning

The crontab takes care of grabbing a copy of my database manager and database configuration files(db2 dbm and db cfg). A regular "get dbm and get db cfg" in time will generate a lot files. Multiply these by the number of databases and environments and you have a lot more.

Making the scripts smarter will make the number of files manageable. Saving configs only when there are changes should do the trick.

Now how to implement it?

. get cfg (filter the active logs S0000nnn.LOG, not a cfg)
. if there are changes, timestamp and keep file

Using this method, one can call the script manually even if scheduled and the number of files will only grow if there are changes.

This is also very friendly with code versioning tools(cvs/svn/git diff), so you can check them in if you have them.

The timestamp on the file makes it easier to determine what changed when.

scripts:
compare.sh = diff of file, needed by getDBCFG and getDBMCFG
getDBCFG.sh = ./getDBCFG.sh DBNAME
getDBMCFG.sh = ./getDBMCFG.sh

No comments:

Post a Comment