The simplest command for offline DB2 backup can be: db2 backup db sample to c: \ db2bak, but which of the following is so simple during the actual regular backup, I have compiled scripts for timed offline backup in UNIX/Linux and Windows. very useful.UNIX/Linux:1. Create a directory and authorize it to store the backup file [root @ O11g64 tmp] #Id db2inst1Uid = 1051 (db2inst1) gid = 1010 (db2iadm1) groups = 1010 (db2iadm1), 1020 (db2fadm1)Mkdir/db2bakChown-R db2inst1: db2iadm1/db2bak2. Create the BAT file db2bkoffline. sh.
# Author: xiongchuanliang # Pause database db2 connect to xcldbdb2 quiesce database immediate force connectionsdb2 connect reset # Disconnect all applications db2 force application all # offline backup db2 backup db xcldb to "/db2bak" with 2 buffers buffer 1024 parallelism 1 without prompting # cancel database pause db2 connect to xcldbdb2 unquiesce databasedb2 connect resetexit
3. Authorization
Chmod a + x/tmp/db2bkoffline. sh4. Run backup
Su-db2inst1-c "/tmp/db2bkoffline. sh">/db2bak/db2bkoffline. log
Windows:1. Create the BAT file db2bkoffline. bat
; Author: xiongchuanliang; pause database db2 connect to xcldbdb2 quiesce database immediate force connectionsdb2 connect reset; disconnect all applications db2 force application all ;; offline backup of db2 backup db xcldb to "c: \ db2bak" with 2 buffers buffer 1024 parallelism 1 without prompting; cancel database pause db2 connect to xcldbdb2 unquiesce databasedb2 connect resetexit;
2. Run backup
Db2cmd/c/w/I db2bkoffline. bat> c: \ db2bkoffline. log
Parameter description: -- 2 buffers: two caches -- buffer 1024: the cache size is 1024 -- parallelism 1: parallelism. When these parameters are backed up, DB2 will be automatically adjusted to the relevant value if they are not specified.
Offline backup recoveryIt is also very simple
Db2 list history backup all for xcldb
Db2 resotre db xcldb from/db2bak taken at Timestamp
MAIL: xcl_168@aliyun.comBlog: http://blog.csdn.net/xcl168