Hi,
we are using DB2 on Fedora
We try to backup the datbases automatically every day (night). For this
purpose, I wrote two scripts, a shell (bash) and a sql script.
The shell script set the profile and call the sql script.
******* short form
/home/db2iusr/sqllib/db2profile
/opt/IBM/db2/V8.1/bin/db2 -tvf /db2/backup/db2-backup.sql
*******
The sql script performs the backup like this:
*******
force application all;
backup database <db> user <user> using <pw> to <dir> without prompting;
quit;
*******
Problem:
--------
When we call the shell script manually using the bash, there is no
problem. But, if we use the unix cron to backup the databases daily and
automatically we receive every time the following error
SQL10007N Message "-1390" could not be retrieved. Reason code: "1".
If we paste all rows from the db2profile to shell script we receive the
same error message with reason code 2.
Any suggestions would be helpful.
Toralf 7 8010
Toralf,
on AIX I have to put the whole PATH in the .ksh-Script
PATH=...
export PATH
But, also you can use the DB2 Scheduler with CC, it works very well.
regards,
Joachim Müller
"Toralf Kirsten" <tk******@izbi.uni-leipzig.de> schrieb im Newsbeitrag
news:ca**********@news.uni-leipzig.de... Hi, we are using DB2 on Fedora
We try to backup the datbases automatically every day (night). For this purpose, I wrote two scripts, a shell (bash) and a sql script. The shell script set the profile and call the sql script.
******* short form /home/db2iusr/sqllib/db2profile /opt/IBM/db2/V8.1/bin/db2 -tvf /db2/backup/db2-backup.sql *******
The sql script performs the backup like this: ******* force application all; backup database <db> user <user> using <pw> to <dir> without prompting; quit; *******
Problem: -------- When we call the shell script manually using the bash, there is no problem. But, if we use the unix cron to backup the databases daily and automatically we receive every time the following error
SQL10007N Message "-1390" could not be retrieved. Reason code: "1".
If we paste all rows from the db2profile to shell script we receive the same error message with reason code 2.
Any suggestions would be helpful. Toralf
Toralf Kirsten wrote: Hi, we are using DB2 on Fedora
We try to backup the datbases automatically every day (night). For this purpose, I wrote two scripts, a shell (bash) and a sql script. The shell script set the profile and call the sql script.
******* short form /home/db2iusr/sqllib/db2profile
This should read:
. /home/db2iusr/sqllib/db2profile
The '.' executes the db2profile in the current shell (i.e. all environment
variables are exported in the _current_ shell).
As you've written it, you are executing the db2profile in a sub shell.
The variables get set in the sub-shell, and then the sub-shell exits.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Toralf Kirsten <tk******@izbi.uni-leipzig.de> wrote in message news:<ca**********@news.uni-leipzig.de>...
Are you really reading the db2profile? On aix you would need to 'dot'
it rather than run it - since it doesn't have a #! at the top.
So, instead of this: ******* short form /home/db2iusr/sqllib/db2profile /opt/IBM/db2/V8.1/bin/db2 -tvf /db2/backup/db2-backup.sql *******
I'd have this:
******* short form . /home/db2iusr/sqllib/db2profile db2 -tvf /db2/backup/db2-backup.sql *******
The fact that you could run it manually could easily be masked by your
own user profile, unless you explicitely isabled it.
buck
Ian,
many thanks for your reply.
You are right. It's a mistake and I corrected the script.
The shell script is now like this:
*******
.. /home/db2iusr/sqllib/db2profile
/opt/IBM/db2/V8.1/bin/db2 -tvf /db2/backup/db2-backup.sql
*******
The sql script is like this:
*******
force application all;
backup database <db> user <user> using <pw> to <dir> without prompting;
quit;
*******
Now I get the same error with reason code 2.
SQL10007N Message "-1390" could not be retrieved. Reason code: "2".
I think it is a simple error, but I don't know what's wrong.
Thanks, Toralf
Ian wrote: Toralf Kirsten wrote:
Hi, we are using DB2 on Fedora
We try to backup the datbases automatically every day (night). For this purpose, I wrote two scripts, a shell (bash) and a sql script. The shell script set the profile and call the sql script.
******* short form /home/db2iusr/sqllib/db2profile
This should read:
. /home/db2iusr/sqllib/db2profile
The '.' executes the db2profile in the current shell (i.e. all environment variables are exported in the _current_ shell).
As you've written it, you are executing the db2profile in a sub shell. The variables get set in the sub-shell, and then the sub-shell exits.
> When we call the shell script manually using the bash, there is no problem. But, if we use the unix cron to backup the databases daily and automatically we receive every time the following error
SQL10007N Message "-1390" could not be retrieved. Reason code: "1".
This often means that DB2INSTANCE is not set.
dave
Joachim,
thanks for your reply.
After modifying the script by using the dot in front of calling the
db2profile script, I print out two variables within my script which are
set in db2profile script.
The result is:
backup uses the DB2INSTANCE: db2iusr
use the paths:
/sbin:/bin:/usr/sbin:/usr/bin:/home/db2iusr/sqllib/bin:/home/db2iu
sr/sqllib/adm:/home/db2iusr/sqllib/misc
The db2 instance is set correctly. But, I'm not really sure which
additional path I have to set.
Now, I get the error
SQL10007N Message "-1390" could not be retrieved. Reason code: "2".
Toralf
Joachim Mueller wrote: Toralf,
on AIX I have to put the whole PATH in the .ksh-Script
PATH=... export PATH
But, also you can use the DB2 Scheduler with CC, it works very well.
regards, Joachim Müller
Hi,
just to give the solution of the problem.
There were two errors.
First, as proposed by other guys, the dot in front of the command
loading the db2 environment was missed. The right string is as follows
.. /home/db2iusr/sqllib/db2profile or alternatively
source /home/db2iusr/sqllib/db2profile
Second, we set the lang variables $LANG to en_US.UTF-8 which was set in
the normal user environment but not in the CRON environment.
Hope it helps you in similar cases.
Cheers, Toralf
Toralf Kirsten wrote: Hi, we are using DB2 on Fedora
We try to backup the datbases automatically every day (night). For this purpose, I wrote two scripts, a shell (bash) and a sql script. The shell script set the profile and call the sql script.
******* short form /home/db2iusr/sqllib/db2profile /opt/IBM/db2/V8.1/bin/db2 -tvf /db2/backup/db2-backup.sql *******
The sql script performs the backup like this: ******* force application all; backup database <db> user <user> using <pw> to <dir> without prompting; quit; *******
Problem: -------- When we call the shell script manually using the bash, there is no problem. But, if we use the unix cron to backup the databases daily and automatically we receive every time the following error
SQL10007N Message "-1390" could not be retrieved. Reason code: "1".
If we paste all rows from the db2profile to shell script we receive the same error message with reason code 2.
Any suggestions would be helpful. Toralf This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Neil |
last post by:
Hi,
I hope this question isn't too far off topic....I'm almost at my wits
end trying to figure this out.
I have a Mysql database and I wish to automate the backup of the
database because I...
|
by: Konrad |
last post by:
I have an internet portal based on MySql database and what I need is
to make a database backup , after each actualization of data.
I know how should PHP code look like but I have no idea how to...
|
by: Robert Fitzpatrick |
last post by:
I'm sure this has been discussed many times. I can find references to
the problem in the archives, but decided to query the list here instead
of sifting through archives all day.
Is there a way...
|
by: mrwheel |
last post by:
Hello
I am seeking after a backup script, to take backup of my webspace on
my server, my server is www.servage.net i need to take backup 2 times
per day. Via cronjob on www.cronjob.de but i have...
|
by: damezumari |
last post by:
I use Windows XP and Apache.
I am trying to backup a database on my local computer with the
following php code:
$dbname = 'ol';
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass =...
|
by: overcomersonline |
last post by:
We have a Perl script that is supposed to back up all our files, folders and databases on our server however its sending an error via email. This is the error
Unrecognized character \xA6 at...
|
by: Aidan |
last post by:
Hi,
I'm having a bit of trouble with a python script I wrote, though I'm not
sure if it's related directly to python, or one of the other software
packages...
The situation is that I'm trying...
|
by: zorgi |
last post by:
Hi
Basically I have table TABLE_1 with number of fields being updated all the time. Once a month I run cron job and all the records in TABLE_1 become not needed for my next cron job. Now I need to...
|
by: bsamer |
last post by:
Well very simply i have a script when i run it manualy from the root it will work but from the crontab. I get an error
The problem is from root i run the script which will define all the env. var....
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |