It's all about the answers!

Ask a question

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


0
1
vijay panari (5211118) | asked Apr 23 '15, 1:21 a.m.
 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. 




3 answers



permanent link
Lily Wang (4.9k714) | answered Apr 23 '15, 3:55 a.m.
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

Comments
vijay panari commented Apr 23 '15, 5:03 a.m.

 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-


Lily Wang commented Apr 23 '15, 9:55 p.m.

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


permanent link
Larry McCarthy (2102224) | answered Sep 01 '15, 7:00 p.m.
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.

permanent link
Kevin Ramer (4.5k8183200) | answered Sep 09 '15, 4:44 p.m.
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

Your answer


Register or 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.