If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I am trying to run db2diag -A filename to archive
db2diag.log in /db2/SID/db2dump folder. It works fine from command
line, but does not work in crontab. I made a script that the crontab will
call. I get a db2 command not found error. I read on forum to add
-readfile option. I need help where to add this option.
My command in the script is
db2diag -A /backup/dump_xxx
this works fine from the command but not in the script, where should I add
the -readfile option.
Thanks a lot for the help.
Make sure that the instance profile ($INSTANCE_HOME/sqllib/db2profile) is executed by cron prior to db2diag. The easiest approach would be to schedule a script similar to this:
Code:
#!/bin/sh
. /home/db2inst1/sqllib/db2profile
db2diag -A
__________________
---
"It does not work" is not a valid problem statement.
The reason you are getting the command not found error is because your DB2 environment is not set up properly through cron. By loading the profile as the fist line, like we have suggested, this will fix the problem.
Yes, you need the -readfile option to make it work in cron. This is due to some sadistic IBM programmer who owes 2 weeks of my life back that it took me to figure this out.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
db2diag -A /directory_name_for_archive_file
where do I put -readfile option
db2diag -A -readfile /directory_name_for_archive_file
because it says after -A option other options are overlooked
Thanks Marcus - you're absolutely right about the solution. If you're trying to use
db2diag in a script that crontab invokes, use the -readfile parameter. I can't tell you how many variations of running sqllib/db2profile and other things within the script I've tried, but -readfile worked right away.