Have done this as well and it works well. Here are some bash functions that
read the existing servicename , stop it and restore the same servicename.
# prevent users from logging on while doing conversion
function StopService
{
db2 "get dbm cfg" | grep -i SVCENAME 2>> $LOG_FILE > ./db2svc.tmp
CheckDB2CommandStatus $? "db2 get dbm cfg"
export DB2SERVICENAME="`$AWKCMD '{printf("%s\n",$6);}' ./db2svc.tmp`"
db2 "force application all" 2>> $LOG_FILE >> $LOG_FILE
CheckDB2CommandStatus $? "db2 force application all"
sleep 10
db2 "update dbm cfg using SVCENAME ''" 2>> $LOG_FILE >> $LOG_FILE
CheckDB2CommandStatus $? "db2 update dbm cfg using SCVCENAME ''"
echo "running db2stop" >> $LOG_FILE
db2stop 2>> $LOG_FILE >> $LOG_FILE
echo "running db2start" >> $LOG_FILE
db2start 2>> $LOG_FILE >> $LOG_FILE
# Cleanup temp file
$RM_COMMAND ./db2svc.tmp
}
function StartService
{
echo "running db2 force application all" >> $LOG_FILE
db2 "force application all" 2>> $LOG_FILE >> $LOG_FILE
CheckDB2CommandStatus $? "db2 force application all"
sleep 10
echo "running db2 update dbm cfg using SVCENAME "$DB2SERVICENAME >>
$LOG_FILE
db2 "update dbm cfg using SVCENAME "$DB2SERVICENAME 2>> $LOG_FILE >>
$LOG_FILE
CheckDB2CommandStatus $? "db2 update dbm cfg using SVCENAME
$DB2SERVICENAME"
db2 "force application all" 2>> $LOG_FILE >> $LOG_FILE
CheckDB2CommandStatus $? "db2 force application all"
sleep 10
echo "running db2stop" >> $LOG_FILE
db2stop 2>> $LOG_FILE >> $LOG_FILE
echo "running db2start" >> $LOG_FILE
db2start 2>> $LOG_FILE >> $LOG_FILE
}
-----Original Message-----
From: Vanderhoof Tzadik
[mailto:db2udbdba-ezmlmshield-x50818823.[Email address protected]
Sent: Monday, February 28, 2005 2:16 PM
To: LazyDBA Discussion
Subject: RE: Backup script fails with SQL1035N - The database currently
in use SQLSTATE=57019
You can do it by db in v8. We faced the same problem as you for v7. Our
solution was to write a Perl script to do:
db2 update dbm cfg using svcename ''
db2stop force
db2start
At this point no one can connect, because the service name is blank. Do a
backup. Then:
db2 update dbm cfg using svcename 'abc'
db2stop
db2start
Where 'abc' is your service name. You can get the service name from
/etc/services. Look in there for the line with your instance id. (We had
the Perl script look in /etc/services to find the service name each time it
was run, to avoid any hardcoding, but if you want to make the script
simpler, you can hard code the service name into the script).
-----Original Message-----
From: Brian Sandmann
[mailto:db2udbdba-ezmlmshield-x71406414.[Email address protected]
Sent: Monday, February 28, 2005 11:24 AM
To: LazyDBA Discussion
Subject: RE: Backup script fails with SQL1035N - The database currently in
use SQLSTATE=57019
Using 7.2, but I thought the quiesce could only be used for a table, not an
entire db.
-----Original Message-----
From: Matt Devlin
[mailto:db2udbdba-ezmlmshield-x84774479.[Email address protected]
Sent: Monday, February 28, 2005 11:23 AM
To: LazyDBA Discussion
Subject: RE: Backup script fails with SQL1035N - The database currently in
use SQLSTATE=57019
What Version of UDB? What about using the quiesce database command?
-----Original Message-----
From: Domnick Wolfgang
[mailto:db2udbdba-ezmlmshield-x55148046.[Email address protected]
Sent: Monday, February 28, 2005 11:05 AM
To: LazyDBA Discussion
Subject: AW: Backup script fails with SQL1035N - The database currently in
use SQLSTATE=57019
I'm afraid all this won't help very much if another user makes a connect to
the database before the backup starts. If you have a lot of users and can
prevent this then you must write a skript, which removes all other users the
right to connect to the database. After the backup you have to run another
skript to return this right to the users.
Mit freundlichen Grüßen / Kind Regards
Wolfgang Domnick
Vitanet GmbH
W.[Email address protected]
www.vitanet.de
-----Ursprüngliche Nachricht-----
Von: mcannon [mailto:db2udbdba-ezmlmshield-x45402769.[Email address
protected]
Gesendet: Montag, 28. Februar 2005 16:52
An: LazyDBA Discussion
Betreff: RE: Backup script fails with SQL1035N - The database currently in
use SQLSTATE=57019
Quote:
"db2stop
db2start
db2backup database prd use tsm open 2 sessions"
Answer from me was to use stop force instead of just stop.... This will
force all applications and connections on a stop....
"db2stop force
db2start
db2backup database prd use tsm open 2 sessions"
|---------+--------------------------------------------------------->
| | "Hutchins Robert " |
| | <db2udbdba-ezmlmshield-x57442500.[Email Address Removed] | azyDBA.com> |
| | |
| | |
| | 02/28/2005 10:34 AM |
| | |
|---------+--------------------------------------------------------->
>-----------------------------------------------------------------------
--------------------|
|
|
| To: "LazyDBA Discussion" <[Email address protected]
|
| cc:
|
| Subject: RE: Backup script fails with SQL1035N - The database
currently in use |
| SQLSTATE=57019
|
>-----------------------------------------------------------------------
--------------------|
The database needs to be up to be backed up.
-----Original Message-----
From: mcannon
[mailto:db2udbdba-ezmlmshield-x85115378.[Email
address protected]
Sent: Mon 2/28/2005 10:25 AM
To: LazyDBA Discussion
Cc:
Subject: Re: Backup script fails with SQL1035N - The
database
currently in use SQLSTATE=57019
You could use
db2 stop force Command....
|---------+--------------------------------------------------------->
| | "Brian Sandmann "
|
| |
<db2udbdba-ezmlmshield-x34213196.[Email Address Removed] | | azyDBA.com>
|
| |
|
| |
|
| | 02/28/2005 10:05 AM
|
| |
|
|---------+--------------------------------------------------------->
>-----------------------------------------------------------------------
--------------------|
|
|
| To: "LazyDBA Discussion" <[Email address
protected] |
| cc:
|
| Subject: Backup script fails with SQL1035N - The
database currently in use |
| SQLSTATE=57019
|
>-----------------------------------------------------------------------
--------------------|
My backup script failed with SQL1035N - The database
currently
in use
SQLSTATE=57019. My script is as follows.
db2stop
db2start
db2backup database prd use tsm open 2 sessions
Instead of using db2stop/db2start should I use the "force
apllications all"
command or the "teminate" command. What the difference
between db2stop,
terminate, and force applications all?
Thanks in advance,
sandmann
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
DB2 & UDB email list listserv db2-l LazyDBA home page