清理DB2的归档日志

来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 15:38 点击:

DB2归档日志的相关信息保存在恢复历史文件中,可以通过 db2 list history 命令查看。 
 
db2inst1@suse-db:~> db2 list history archive log all for ggyy 
 
List History File for ggyy 
 
Number of matching file entries = 6 
 
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID 
-- --- ------------------ ---- --- ------------ ------------ -------------- 
X D 20100103235553 1 D S0000038.LOG C0000007 
---------------------------------------------------------------------------- 
---------------------------------------------------------------------------- 
Comment: 
Start Time: 20100103235553 
End Time: 20100103235553 
Status: A   www.2cto.com  
---------------------------------------------------------------------------- 
EID: 80 Location: /data/palog/db2inst1/GGYY/NODE0000/C0000007/S0000038.LOG 
 
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID 
-- --- ------------------ ---- --- ------------ ------------ -------------- 
X D 20100103235553 N S0000038.LOG 
---------------------------------------------------------------------------- 
---------------------------------------------------------------------------- 
Comment: ARCHIVE LOG 
Start Time: 20100103235553 
End Time: 20100103235553 
Status: A 
---------------------------------------------------------------------------- 
EID: 81 
 
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID 
-- --- ------------------ ---- --- ------------ ------------ -------------- 
X D 20100103235608 1 D S0000039.LOG C0000007 
---------------------------------------------------------------------------- 
---------------------------------------------------------------------------- 
Comment: 
Start Time: 20100103235608 
End Time: 20100103235608 
Status: A 
---------------------------------------------------------------------------- 
EID: 82 Location: /data/palog/db2inst1/GGYY/NODE0000/C0000007/S0000039.LOG 
 
...... 
 
清除这些信息,需要使用 db2 prune history 命令。该命令会清除指定时间戳及之前的所有条目(不只是归档日志的)。默认情况下,系统不会清除最近一次数据库全备之后的归档日志信息。 
 
db2inst1@suse-db:~> db2 prune history 20100103235553 
SQL1024N A database connection does not exist. SQLSTATE=00000 
db2inst1@suse-db:~> db2 connect to ggyy   www.2cto.com  
 
Database Connection Information 
 
Database server = DB2/LINUX 9.7.0 
SQL authorization ID = DB2INST1 
Local database alias = GGYY 
 
db2inst1@suse-db:~> db2 prune history 20100103235553 
DB20000I The PRUNE command completed successfully. 
db2inst1@suse-db:~> db2 list history archive log all for ggyy | head -20 
 
List History File for ggyy 
 
Number of matching file entries = 6 
 
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID 
-- --- ------------------ ---- --- ------------ ------------ -------------- 
X D 20100103235553 1 D S0000038.LOG C0000007 
---------------------------------------------------------------------------- 
 

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • db2管理工具小结
      • DB2数据库的导出与导入(Windows客户端)
      • db2 CLP中如何换行
      • DB2查看表结构及所用表语句
      • DB2 · CREATE TABLESPACE
      • 使用DB2对象:创建模式、表和视图
      • DB2数据库逻辑卷的复制
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1