I have a scenario where it is necessary to execute some scripts daily.Is it possible to automate the execution via some tools.?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Yes, it's possible and in two different ways.
Using the Administrative Task Scheduled (ATS) built inside db2 to execute scheduled operations.
the db2 command can also read command from a file specified from the command line
The two solution have both pros and cons: the setup of the AST solution requires administrative privileges on the db while the command line doesn't need changes on the database, on the other side the command line version requires to be scheduled using an external cron daemon while the AST use the scheduling service offered by db2
If you would like kind of automated tool which is not only capable of executing queries but also report execution time, perform assertions on returned result set, re-using return values for further queries, etc. I would recommend to look into Apache JMeter which can talk to DB2 instance via JDBC (assuming that you have relevant JDBC driver in JMeter classpath) and execute queries/scripts through JDBC Request Sampler provided.
As an option it'll allow to do performance testing of your DB2 instance by sending concurrent queries and collecting performance metrics.
See The Real Secret to Building a Database Test Plan With JMeter guide for more details.
From my side I can suggest you to use SoapUI tool. It allows you to manage your DB tests and extend them with scripting using Groovy. Or you can use Groovy and built in API for SQL handling and implement your own framework.