Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How we can take ONLINE backup for DB2 10.5.4 on windows using script

 Hi All,

i am trying to take DB2 10.5.4 ONLINE backup using below script---

@ECHO OFF

set db2path="D:\DB2\IBM\SQLLIB\BIN"
FOR CCM IN (OPNACT BLOGS SNCOMM DOGEAR FILES FORUM HOMEPAGE PEOPLEDB WIKIS) DO ( 
@!|db2path!\DB2 CONNECT TO CCM
@!|db2path!\DB2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS
@!|db2path!\DB2 CONNECT RESET
@!|db2path!\DB2 BACKUP DATABASE CCM TO "C:\Backup\DB2" WITH 2 BUFFERS BUFFER 1024 PARALLELISM 3 WITHOUT PROMPTING
@!|db2path!\DB2 CONNECT TO CCM
@!|db2path!\DB2 UNQUIESCE DATABASE
@!|db2path!\DB2 CONNECT RESET
)


I am not able to run the above said script and gives me below error
"CCm was unexpected at this time"

But all the commands are working individually.

Please help me into this issue as this is very critical at this point for me. 




1

0 votes



3 answers

Permanent link
Hi Vijay,
Your question is more like a batch script question.
Please try to change the script to:

FOR %%x IN (OPNACT BLOGS SNCOMM DOGEAR FILES FORUM HOMEPAGE PEOPLEDB WIKIS) DO ( 
@!|db2path!\DB2 CONNECT TO %%x

....
)

You can find a lot of resource about how to use FOR in Windows batch script online. Below are some samples:
http://en.wikibooks.org/wiki/Windows_Batch_Scripting#FOR
http://www.robvanderwoude.com/variableexpansion.php

0 votes

Comments

 Hey hi Lily...


Actually I already used "%%CCM" in my script....bt it is showing me the same error
"CCM was unexpected at this time"

Please provide another work around...

-Thank You-

Have you tried "%%x"  instead of "%%ccm"?


Permanent link
On Linux, Unix and Windows, you could use IBM Data Studio to set up automatic maintenance, including online backups, as described in the dW article "Configure automatic maintenance in DB2 for Linux, UNIX, and Windows using IBM Data Studio".

You can download Data Studio for no charge here.

HTH,
Larry.

0 votes


Permanent link
For what it's worth your "Online backup" is counter with the db2 commands you issue.  In every context I've used "online backup" the connecting applications ( i.e RTC ) are left alone, but you quiesce the database and drop connections and essentially take offline ( in the db2 sense ) backup.

Each db2 database has to be configured to enable online backup and you would need to add the "online" keyword to the db2 backup command.   There is overhead associated with enabling the online backup as each database must receive an update to LOGARCHMETH1 configuration parameter (at a minimum ) and have an immediate offline backup taken before the database can be connected again and future online backups can be run.

See this article:  https://jazz.net/library/article/98

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 7,495
× 1,700
× 383

Question asked: Apr 23 '15, 1:21 a.m.

Question was seen: 12,514 times

Last updated: Sep 09 '15, 4:44 p.m.

Confirmation Cancel Confirm