[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

database is currently in use

Posted on 2007-10-08
15
Medium Priority
?
2,107 Views
Last Modified: 2012-08-13
when i try to backup a database it come out "database is currently in use",
so i can db2 "force applications all", then backup again.

but the problem is when i "force applications all", it will stop other database,
is there any method to backup database A which not stop database B?
0
Comment
Question by:aaaaaa
  • 5
  • 3
  • 2
  • +1
12 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 20034278
yes
connect to database a and issue the command
quiesce database immediate force applications

that  should do the trick
0
 
LVL 4

Author Comment

by:aaaaaa
ID: 20034387
db2 quiesce instance xxx user xxx immediate force connections  

i get this:

SQL1428N  The application is already attached to "DB2" while the command
issued requires an attachment to "xxx" for successful execution.
SQLSTATE=00000

still cannot
0
 
LVL 37

Expert Comment

by:momi_sabag
ID: 20034522
you should use quiesce database, not quiesce instance
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 4

Author Comment

by:aaaaaa
ID: 20034540
db2 quiesce database xxx user xxx immediate force connections  

get this:
SQL0104N  An unexpected token "xxx" was found following "DATABASE".
Expected tokens may include:  "IMMEDIATE".  SQLSTATE=42601
0
 
LVL 37

Expert Comment

by:momi_sabag
ID: 20034563
no
assumeing the database name is dummy :

connect to dummy
quiesce database immediate force applications

thats it
once you finish the backup you should perform
connect to dummy
unquiesce database
0
 
LVL 4

Author Comment

by:aaaaaa
ID: 20034679
ya
connect to dummy
quiesce database immediate force applications
DB20000I  The QUIESCE DATABASE command completed successfully.
backup xxxxx.....
successful in window environment,

but i AIX server,
connect to dummy
quiesce database immediate force applications
DB20000I  The QUIESCE DATABASE command completed successfully.
backup xxxxx.....
"database is currently in use"... fail!
0
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 20035674
Hi aaaaaa,

You not only need to quiesce the database, you need to drop all of the connections.  Here's a copy of a script that I use to backup one of my databases.  You can modify it to suit you.


Good Luck,
Kent


. /home/oelinst/sqllib/db2profile
cd /home/oelinst/scripts
rptloc=/home/oelinst/rpt/efs_backup.rpt
date > $rptloc
echo 'Force off Applications ' >> $rptloc
db2 "force application all" >> $rptloc
db2 "list applications" >> $rptloc
echo 'Deactivate Database' >> $rptloc
db2 "deactivate database efs" >> $rptloc
sleep 10
echo 'BACKUP EFS ' >> $rptloc
db2 "force application all" >> $rptloc
db2 "force application all" >> $rptloc
db2 "backup database efs TO /DB_backup/oel WITH 4 BUFFERS BUFFER 4096 PARALLELISM 2 WITHOUT PROMPTING" >> $rptloc
date >> $rptloc
echo 'Activate Database' >> $rptloc
db2 "activate database efs" >> $rptloc
echo "EFS Backup Complete" >> $rptloc
0
 
LVL 4

Author Comment

by:aaaaaa
ID: 20038265
when "force application all"
my others database also will stop... this is my problem.
how?
0
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 100 total points
ID: 20040275

What's your underlying operating system?

If it's *nix, you can get the relevent connections and feed the output through a filter, passing it back to FORCE.

  db2 list applications for database MYDB

You'll get something that looks like this:


Auth Id  Application    Appl.      Application Id                                                 DB       # of
         Name           Handle                                                                    Name    Agents
-------- -------------- ---------- -------------------------------------------------------------- -------- -----
OELINST  db2taskd       152        *LOCAL.DB2.071006080506                                        EFSFS    1
OELINST  db2stmm        151        *LOCAL.DB2.071006080505                                        EFSFS    1

Of course, these are the "default" agents that come with version 9.  They don't affect backs so you can leave them alone.

  db2 list applications|sed '1,4d; /^DATABASENAME[ ]*db2taskd/d; /^DATABASENAME[ ]*db2stmm/d'

That will filter the output so that you only get user agents connected to the databases.  The 3rd column is the handle that you want to connect.  Just pass each of them to 'FORCE APPLICATION handle'.

Kent
0
 
LVL 26

Expert Comment

by:Tomas Helgi Johannsson
ID: 20041376
     Hi!

Is your DB configured to handle online backups ?
If so why not use that option ?

Regards,
   Tomas Helgi
0
 
LVL 4

Author Comment

by:aaaaaa
ID: 20041916
can give me the script
0
 
LVL 26

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 100 total points
ID: 20042263
  Hi!

Just add the keyword online into your backup cmd.
Example:
db2 backup db sample online to /samplebackup/

Here is a complete list of DB2 commands
http://iibm01.inf.uni-jena.de/db2/db2n0/frame3.htm#db2n067

Hope it helps

Regards,
  Tomas Helgi
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question