By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,778 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,778 IT Pros & Developers. It's quick & easy.

SQL10007N Message "-1390" could not be retrieved. Reason code: "6".

P: n/a
hi,

I want to backup database (db2, aix 5.1) using script. When I exec script
logging to user db2inst1 then is everything ok, but from cron, I get these
error:

SQL10007N Message "-1390" could not be retrieved. Reason code: "6".

Where is the problem?

My script is basic:
db2 connect to database
db2 prune history 2005
db2 backup db database to /sys/db2inst1/backups/

Line in crontab:
0 2 * * 1 /sys/db2inst1/backup.time

--
Wito
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi,

Wito wrote:

SQL10007N Message "-1390" could not be retrieved. Reason code: "6". Where is the problem?

My script is basic:
db2 connect to database
db2 prune history 2005
db2 backup db database to /sys/db2inst1/backups/

Line in crontab:
0 2 * * 1 /sys/db2inst1/backup.time


Have you set the complete users environment in your crontab? If not, do
so. I donīt know much about the cron-version used on aix. Linux cron
daemons usually donīt do any automatic environment setup.
Eg. PATH, DB2INSTANCE need to be set explicitly.

regards,

Norbert
Nov 12 '05 #2

P: n/a
Hi,

Norbert wrote:
Have you set the complete users environment in your crontab? If not, do
so. I donīt know much about the cron-version used on aix. Linux cron
daemons usually donīt do any automatic environment setup.
Eg. PATH, DB2INSTANCE need to be set explicitly.


When I don't set evironment then I get message: "db2 not found". When I set
environment then I get message from the topic. I set it from script, before
executing db2 command. I paste to script all of variables (printenv). Maybe
setting ev. in cron will help? But how can I set it from cron profile?

regards
Wito
Nov 12 '05 #3

P: n/a
Hi again,

Wito wrote:
When I don't set evironment then I get message: "db2 not found". When I set
environment then I get message from the topic. I set it from script, before
executing db2 command. I paste to script all of variables (printenv). Maybe
setting ev. in cron will help? But how can I set it from cron profile?


You should find the answer in your cron-daemons documentation. I donīt
know AIX. Most Linux Systems use vixie cron.

Try

man 5 crontab

---snip---
An active line in a crontab will be either an environment setting or a
cron command. An environment setting is of the form,

name = value

where the spaces around the equal-sign (=) are optional, and
any subsequent non-leading spaces in value will be part of the value
assigned to
name. The value string may be placed in quotes (single or
double, but matching) to preserve leading or trailing blanks.

Several environment variables are set up automatically by the
cron(8) daemon. SHELL is set to /bin/sh, and LOGNAME and HOME are set
from the
/etc/passwd line of the crontab's owner. HOME and SHELL may be
overridden by settings in the crontab; LOGNAME may not.
---snap----

As I said, this one is from the vixie-cron manual page. You would need
to consult your systems documentation to find out how to set environment
variables on your AIX-System or ask your system administrator.

regards,

Norbert
Nov 12 '05 #4

P: n/a
#!/usr/bin/sh
.. /home/db2inst1/.profile ##(after the . leave a space then
/home/db2inst1/.profile where /home/db2inst1/.profile is the home
directory for db2inst1)
/home/db2inst1/sqllib/bin/db2 connect to toolsdb

/home/db2inst1/sqllib/bin/db2 select count(1) from tools.mdtask00
/home/db2inst1/sqllib/bin/db2 connect reset

The above is a sample script.

Hope this helps.

Kums

Nov 12 '05 #5

P: n/a
Hi,
#!/usr/bin/sh
Hope this helps.


It's working!!! Thank you,

Regards
Wito
Nov 12 '05 #6

P: n/a
hi****@gmail.com wrote:
#!/usr/bin/sh
. /home/db2inst1/.profile ##(after the . leave a space then
/home/db2inst1/.profile where /home/db2inst1/.profile is the home
directory for db2inst1)
/home/db2inst1/sqllib/bin/db2 connect to toolsdb

/home/db2inst1/sqllib/bin/db2 select count(1) from tools.mdtask00
/home/db2inst1/sqllib/bin/db2 connect reset

The above is a sample script.

Hope this helps.

Kums


Genrally it's better to load settings from a profile file using:
source /home/db2inst1/.profile than just executing it (depending on the
content of the profile file, it's not always sure that executing the
file will set the environment.)

Instead of loading the user profile, you could try loading the db2
profile using:
source /home/db2inst1/sqllib/db2profile

And if you're the instance user, you can substitute /home/db2inst1 with
the ~

Another time saving option:

instead of calling db2 seperate for each statement you could also place
the statements in 1 sql file and call it with db2 -td\; -f <file.sql>
(not useful if you're parsing output)

-R-
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.