ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DB2 archive log mode 设置

DB2 archive log mode 设置

原创 Linux操作系统 作者:wiron 时间:2013-11-22 14:42:24 0 删除 编辑
Two method to set up the db2 archive log mode.

Archive log test:
  Action desc:
   Change LOGARCHMETH1, backup DB; use command force archive log twice, then I see the archived logs.

Details:
[db2inst1@DB2-EL5 ~]$ db2 connect to sample
[db2inst1@DB2-EL5 ~]$ db2 update db cfg for sample using LOGARCHMETH1 /home/db2inst1/arch
DB20000I  The UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363W  One or more of the parameters submitted for immediate modification
were not changed dynamically. For these configuration parameters, the database
must be shutdown and reactivated before the configuration parameter changes
become effective.
[db2inst1@DB2-EL5 ~]$ db2 backup database sample to /home/db2inst1/backup

Backup successful. The timestamp for this backup image is : 20131122141632

[db2inst1@DB2-EL5 ~]$ db2 connect to sample

   Database Connection Information

 Database server        = DB2/LINUXX8664 10.5.1
 SQL authorization ID   = DB2INST1
 Local database alias   = SAMPLE

[db2inst1@DB2-EL5 ~]$
[db2inst1@DB2-EL5 backup]$ db2 get db cfg|grep LOG
 Catalog cache size (4KB)              (CATALOGCACHE_SZ) = (MAXAPPLS*5)
 Log buffer size (4KB)                        (LOGBUFSZ) = 256
 Log file size (4KB)                         (LOGFILSIZ) = 100
 Number of primary log files                (LOGPRIMARY) = 3
 Number of secondary log files               (LOGSECOND) = 10
 Changed path to log files                  (NEWLOGPATH) =
 Path to log files                                       = /home/db2inst1/db2inst1/NODE0000/SQL00001/LOGSTREAM0000/
 Overflow log path                     (OVERFLOWLOGPATH) =
 Mirror log path                         (MIRRORLOGPATH) =
 First active log file                                   = S0000000.LOG
 Block log on disk full                (BLK_LOG_DSK_FUL) = NO
 Block non logged operations            (BLOCKNONLOGGED) = NO
 Percent max primary log space by transaction  (MAX_LOG) = 0
 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0
 First log archive method                 (LOGARCHMETH1) = DISK:/home/db2inst1/arch/
 Archive compression for logarchmeth1    (LOGARCHCOMPR1) = OFF
 Options for logarchmeth1                  (LOGARCHOPT1) =
 Second log archive method                (LOGARCHMETH2) = OFF
 Archive compression for logarchmeth2    (LOGARCHCOMPR2) = OFF
 Options for logarchmeth2                  (LOGARCHOPT2) =
 Log pages during index build            (LOGINDEXBUILD) = OFF
 Log DDL Statements                      (LOG_DDL_STMTS) = NO
 Log Application Information             (LOG_APPL_INFO) = NO
[db2inst1@DB2-EL5 backup]$
[db2inst1@DB2-EL5 backup]$ cd /home/db2inst1/db2inst1/NODE0000/SQL00001/LOGSTREAM0000/
[db2inst1@DB2-EL5 LOGSTREAM0000]$ ls -l
total 4848
-rw------- 1 db2inst1 db2iadm1  417792 Nov 22 14:12 S0000000.LOG
-rw------- 1 db2inst1 db2iadm1  417792 Nov 22 14:12 S0000001.LOG
-rw------- 1 db2inst1 db2iadm1 4104192 Nov 13 17:25 S0000002.LOG
[db2inst1@DB2-EL5 LOGSTREAM0000]$ ls -l /home/db2inst1/arch/
total 8
drwxr-x--- 3 db2inst1 db2iadm1 4096 Nov 22 14:12 db2inst1
[db2inst1@DB2-EL5 LOGSTREAM0000]$ cd /home/db2inst1/arch/db2inst1
[db2inst1@DB2-EL5 db2inst1]$ ls -l
total 8
drwxr-x--- 3 db2inst1 db2iadm1 4096 Nov 22 14:12 SAMPLE
[db2inst1@DB2-EL5 db2inst1]$ cd SMAPLE
-bash: cd: SMAPLE: No such file or directory
[db2inst1@DB2-EL5 db2inst1]$ cd SAMPLE
[db2inst1@DB2-EL5 SAMPLE]$ ls -l
total 8
drwxr-x--- 3 db2inst1 db2iadm1 4096 Nov 22 14:12 NODE0000
[db2inst1@DB2-EL5 SAMPLE]$ cd NODE0000
[db2inst1@DB2-EL5 NODE0000]$ ls -l
total 8
drwxr-x--- 3 db2inst1 db2iadm1 4096 Nov 22 14:12 LOGSTREAM0000
[db2inst1@DB2-EL5 NODE0000]$ cd LOG*
[db2inst1@DB2-EL5 LOGSTREAM0000]$ ls -l
total 8
drwxr-x--- 2 db2inst1 db2iadm1 4096 Nov 22 14:12 C0000000
[db2inst1@DB2-EL5 LOGSTREAM0000]$ cd C*
[db2inst1@DB2-EL5 C0000000]$ ls -l
total 0
[db2inst1@DB2-EL5 C0000000]$
[db2inst1@DB2-EL5 C0000000]$
[db2inst1@DB2-EL5 C0000000]$ db2 archive log for db sample
DB20000I  The ARCHIVE LOG command completed successfully.
[db2inst1@DB2-EL5 C0000000]$ db2 archive log for db sample
DB20000I  The ARCHIVE LOG command completed successfully.
[db2inst1@DB2-EL5 C0000000]$ ls -l /home/db2inst1/db2inst1/NODE0000/SQL00001/LOGSTREAM0000/
total 848
-rw------- 1 db2inst1 db2iadm1  12288 Nov 22 14:36 S0000005.LOG
-rw------- 1 db2inst1 db2iadm1 417792 Nov 22 14:36 S0000006.LOG
-rw------- 1 db2inst1 db2iadm1 417792 Nov 22 14:36 S0000007.LOG
[db2inst1@DB2-EL5 C0000000]$ ls -l
total 96
-rw------- 1 db2inst1 db2iadm1 12288 Nov 22 14:36 S0000000.LOG
-rw------- 1 db2inst1 db2iadm1 12288 Nov 22 14:36 S0000001.LOG
-rw------- 1 db2inst1 db2iadm1 12288 Nov 22 14:36 S0000002.LOG
-rw------- 1 db2inst1 db2iadm1 12288 Nov 22 14:36 S0000003.LOG
-rw------- 1 db2inst1 db2iadm1 12288 Nov 22 14:36 S0000004.LOG
-rw------- 1 db2inst1 db2iadm1 12288 Nov 22 14:36 S0000005.LOG
[db2inst1@DB2-EL5 C0000000]$

Logarchmeth1和Logarchmeth2配置可能有如下几种组合

  1,Logarchmeth1设置为LOGRETAIN,Logarchmeth2只能设置为OFF

  归档日志位置就是DB2数据库日志的位置,需要人工干预归档日志的转移和空间维护工作

  2,Logarchmeth1设置为USEREXIT,Logarchmeth2只能设置为OFF

  归档日志的管理交由USEREXIT来处理,通过设置编译USEREXIT可以实现相对复杂一些的归档管理方式

  3,Logarchmeth1设置为,Logarchmeth2设置为OFF

  归档日志的工作将会自动进行,需要归档日志将会被自动归档到指定的位置,由于归档是自动进行,DB2的日志目录中只有正常logprimary+logsecond个数据库日志。

  4,Logarchmeth1设置为,Logarchmeth2设置为

 归档日志的工作将会自动进行,需要归档日志将会被自动归档到指定的位置, 也就是会产生两份归档日志由于归档是自动进行,DB2的日志目录中只有正常logprimary+logsecond个数据库日志。

 或者都可以设置为TSM。一般推荐为 文件系统,设置为TSM,既可以归档到TSM离线保存,又可以在线使用文件系统中归档日志,比较方便。




来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/167471/viewspace-777335/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2013-11-15

  • 博文量
    4
  • 访问量
    30892