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
@!|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
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
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
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.
You can download Data Studio for no charge here.
HTH,
Larry.
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
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