We help IT Professionals succeed at work.
Get Started

How to schedule DB2 scripts to run

484 Views
Last Modified: 2017-12-05
DB2 10.5 on Windows

How do most people schedule DB2 scripts to run?  I would like to be able to run certain maintenance scripts to run at 3:00 am nightly.  

I have created a batch file that calls another batch file that runs the DB2 cmd window.  The script in the second batch files creates another file of SQL commands that is then run.  The whole thing is run from the windows task scheduler but there are some issues.  

1.  I hate batch files and having to have 2 seems silly.

2.  The files run fine when I run them but fail more often than not when called from the windows task scheduler.  (various reasons not the focus of this post).  The problem is in running the 3rd script file.

3.  I have to put the username / password in the bat file in clear text.

So my question is how do most DB2 DBA's do this on windows?  SQL Server has a nice built-in job agent that makes it a breeze but DB2 does not seem to have that ability.

Is there an easier way to do this?  Am I missing something obvious that would make my life simpler?  Is there a third party application that will run as the SQL Server Agent with DB2?

Thank you!

Jim
Comment
Watch Question
Data Warehouse / Database Architect
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE