DB2 INCREMENTAL BACKUP RESTORY

时间:2018-01-29 13:11:50

标签: database db2 database-backups db2-luw

我们在Windows Server 2008 R2上使用IBM DB2 10.1。

我尝试测试DB2的恢复计划。

  1. 我创建了一个新数据库
  2. CREATE DATABASE EAPOTEST AUTOMATIC STORAGE YES ALIAS EAPOBLOB

    1. Craate BufferPool和Tablespace
    2. CREATE BUFFERPOOL "BufferPool32" IMMEDIATE ALL DBPARTITIONNUMS SIZE AUTOMATIC NUMBLOCKPAGES 0 PAGESIZE 32 K

      CREATE REGULAR TABLESPACE "tablespace1"
      IN DATABASE PARTITION GROUP "IBMDEFAULTGROUP"
      PAGESIZE 32 K
      MANAGED BY AUTOMATIC STORAGE
      AUTORESIZE YES
      EXTENTSIZE 16
      PREFETCHSIZE 16
      BUFFERPOOL "BufferPool32"
      OVERHEAD 10.5
      TRANSFERRATE 0.14
      DATA TAG NONE
      USING STOGROUP "IBMSTOGROUP"
      FILE SYSTEM CACHING
      
      1. 创建2个简单表格。
      2. CREATE TABLE "DB2ADMIN"."ARTIFACT_FILE1" ( "FILE_ID" DECIMAL(10 , 0) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999 NO CYCLE CACHE 20 NO ORDER ),"FILE_TYPE" VARCHAR(1) NOT NULL) DATA CAPTURE NONE IN "tablespace1" COMPRESS NO

        CREATE TABLE "DB2ADMIN"."EA_PACKAGE1" (
        "DOSSIER_NUMBER" VARCHAR(50) NOT NULL 
        )
        DATA CAPTURE NONE 
        IN "tablespace1"
        COMPRESS NO
        
        1. 每个表添加一行。
        2. 启用增量备份
        3. UPDATE DATABASE CONFIGURATION FOR EAPOTEST USING TRACKMOD YES

          1. 准备完整的离线备份。
          2. BACKUP DATABASE EAPOTEST TO %DB_PATH_BACKUP% COMPRESS EXCLUDE LOGS WITHOUT PROMPTING

            1. 之后,我在数据库中做了一些更改,并进行了离线增量备份。
            2. BACKUP DATABASE EAPOTEST INCREMENTAL TO %DB_PATH_BACKUP% COMPRESS EXCLUDE LOGS WITHOUT PROMPTING

              1. 删除数据库。
              2. DROP DATABASE EAPOTEST

                1. Restory完整备份。 确定。
                2. RESTORE DB EAPOTEST FROM "..." TAKEN AT ... REPLACE HISTORY FILE WITHOUT PROMPTING

                  1. 恢复增量备份。
                  2. RESTORE DATABASE EAPOTEST INCREMENTAL FROM "..." TAKEN AT ... WITHOUT PROMPTING

                    消息是:SQL2540WВосстановлениеуспешно,однакоприработеутилиты数据库“2539”。

                    Dtabese无法访问! 当我尝试连接时: SQL1119N SQLSTATE = 57019

                    这是一种可行的备份方法吗?我们采取的备份和恢复步骤是否足够?

1 个答案:

答案 0 :(得分:0)

您的程序不正确。您的第一次恢复应该引用目标增量映像。

RESTORE DATABASE ... INCREMENTAL FROM "..." TAKEN AT <incremental backup timestamp>
RESTORE DATABASE ... INCREMENTAL FROM "..." TAKEN AT <full backup timestamp>
RESTORE DATABASE ... INCREMENTAL FROM "..." TAKEN AT <incremental backup timestamp>

详细解释了in the manual