Prayer

在一般中寻求卓越
posts - 1256, comments - 190, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

db2 开启归档日志的功能

Posted on 2010-03-20 00:55 Prayer 阅读(5564) 评论(2)  编辑 收藏 引用 所属分类: DB2
1、 查看默认情况下的设置:
   db2 get db cfg for db_name |grep -i log
   结果如下:
Log retain for recovery enabled             (LOGRETAIN) = OFF
 User exit for logging enabled                (USEREXIT) = OFF
 HADR log write synchronization mode     (HADR_SYNCMODE) = NEARSYNC
 First log archive method                 (LOGARCHMETH1) = OFF
 默认情况为循环日志
 
2、更改为归档日志:
   db2 update db cfg for db_name using LOGRETAIN ON
  
   运行后结果如下:
Log retain for recovery enabled             (LOGRETAIN) = RECOVERY
 User exit for logging enabled                (USEREXIT) = OFF
 HADR log write synchronization mode     (HADR_SYNCMODE) = NEARSYNC
 First log archive method                 (LOGARCHMETH1) = LOGRETAIN、
 
  更改归档目录:
  db2 update db cfg for db_name using LOGARCHMETH1 "disk:/archive/db_name_db_log"
 
 运行后结果如下:
 Log retain for recovery enabled             (LOGRETAIN) = RECOVERY
 User exit for logging enabled                (USEREXIT) = OFF
 HADR log write synchronization mode     (HADR_SYNCMODE) = NEARSYNC
 First log archive method                 (LOGARCHMETH1) =  
                                                    DISK:/archivelog/db_name_db_log/
 
3、手工归档方法:
  db2 archive log for db db_name
  (但前提是没数据库连接,很奇怪,不知道为什么)
 如下:
[db2inst1@home SQLOGDIR]$ db2 connect to fangys
   Database Connection Information
 Database server        = DB2/LINUX 8.2.9
 SQL authorization ID   = DB2INST1
 Local database alias   = FANGYS
[db2inst1@home SQLOGDIR]$ db2 archive log for db fangys
SQL1493N  The application is already connected to an active database.
  -------不知道为什么不行!!!!
 
[db2inst1@home SQLOGDIR]$ db2 connect reset
DB20000I  The SQL command completed successfully.
[db2inst1@home SQLOGDIR]$ db2_ps
Node 0
     UID        PID       PPID    C     STIME     TTY     TIME CMD
db2inst1       6608       6607    0     21:30   pts/1 00:00:00 db2sysc 0
    root       6609       6608    0     21:30   pts/1 00:00:00 db2ckpwd 0
    root       6610       6608    0     21:30   pts/1 00:00:00 db2ckpwd 0
    root       6611       6608    0     21:30   pts/1 00:00:00 db2ckpwd 0
    root       6612       6608    0     21:30   pts/1 00:00:00 db2pmd 0
db2inst1       6613       6608    0     21:30   pts/1 00:00:00 db2gds 0
db2inst1       6615       6608    0     21:30   pts/1 00:00:00 db2ipccm 0
db2inst1       6616       6608    0     21:30   pts/1 00:00:00 db2tcpcm 0
db2inst1       6617       6608    0     21:30   pts/1 00:00:00 db2resync 0
db2inst1       6620       6608    0     21:30   pts/1 00:00:00 db2hmon  ,0,0,0,1,0,0,0,0,1e014,2,0,1,9fe0,0x113a0000,0x113a0000,15fc000,58004,2,f800a
db2inst1       6618       6613    0     21:30   pts/1 00:00:00 db2srvlst 0
db2inst1       8502       6613    0     22:50   pts/1 00:00:00 db2agent (instance) 0
db2inst1       8748       6613    0     23:07   pts/1 00:00:00 db2agent (idle) 0
db2inst1       8831       6613    0     23:17   pts/1 00:00:00 db2agent (idle) 0
db2inst1       9026       6613    0     23:27   pts/1 00:00:00 db2agent (idle) 0
db2inst1       9124       6613    0     23:34   pts/1 00:00:00 db2agent (idle) 0
db2inst1       9125       6613    0     23:34   pts/1 00:00:00 db2agent (idle) 0
db2inst1       6873       6615    0     21:46   pts/1 00:00:00 db2agent (instance) 0
[db2inst1@home SQLOGDIR]$ db2 archive log for db fangys
DB20000I  The ARCHIVE LOG command completed successfully.
----------------这样就行了,很奇怪

Feedback

# re: db2 开启归档日志的功能   回复  更多评论   

2015-02-10 16:07 by 等等
SQL1493N The application is already connected to an active database.

# re: db2 开启归档日志的功能   回复  更多评论   

2015-02-10 16:08 by 等等
application 已经连接了(其他的)活动数据库,当然要断开当前的连接。

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理