<DB2>《DB2数据库健康检查》第3部分

2 数据库对象检查

2.12 检查是否需要对表和索引进行runstats(30天未作统计更新)

检查点:

检查是否需要对表和所有进行runstats

检查方法:

//对于表:
$db2 "select substr(tabschema,1,10) as tabschema, substr(tabname,1,30) as tabname from syscat.tables where stats_time< current timestamp -30 days"
//对于索引
$db2 "select substr(tabschema,1,10) as tabschema, substr(indname,1,30) as indname from syscat.indexes where stats_time< current timestamp -30 days"
//标准:	返回30未作统计更新的表和索引。

示例:

$ db2 "select substr(tabschema,1,10) as tabschema, substr(tabname,1,30) as tabname from syscat.tables where stats_time< current timestamp -30 days"
	 
	TABSCHEMA  TABNAME
	---------- ------------------------------
	SYSIBM     SYSTABLES                     
	SYSIBM     SYSINDEXES                    
	SYSIBM     SYSVIEWDEP                    
	SYSIBM     SYSVERSIONS                   
	SYSIBM     SYSROUTINEPROPERTIESJAVA      
	SYSIBM     SYSCODEPROPERTIES   
	 
	 
	$ db2 "select substr(tabschema,1,10) as tabschema, substr(indname,1,30) as indname from syscat.indexes where stats_time< current timestamp -30 days"
	 
	TABSCHEMA  INDNAME
	---------- ------------------------------
	SYSIBM     INDTABLES01                   
	SYSIBM     INDTABLES02                   
	SYSIBM     INDTABLES03                   
	SYSIBM     INDTABLES04                   
	SYSIBM     INDTABLES05
	 

2.13 检查表和索引是否需要重组

检查点:

检查是否需要重组reorg

检查方法:
ü

//重组表检查
$db2 "call reorgchk_tb_stats('T','ALL')"
//重组索引检查
$db2 "call reorgchk_ix_stats('T','ALL')"
//标准:	REORG字段是否有一个和多个“*”

示例:

$ db2 reorgchk current statistics on table all
	 
	Table statistics:
	 
	F1: 100 * OVERFLOW / CARD < 5
	F2: 100 * (Effective Space Utilization of Data Pages) > 70
	F3: 100 * (Required Pages / Total Pages) > 80
	 
	SCHEMA.NAME                     CARD     OV     NP     FP ACTBLK    TSIZE  F1  F2  F3 REORG
	----------------------------------------------------------------------------------------
	Table: DB2INST1.ADVISE_INDEX
	                                   -      -      -      -      -        -   -   -   - --- 
	Table: DB2INST1.ADVISE_INSTANCE
	                                   -      -      -      -      -        -   -   -   - --- 
	Table: DB2INST1.ADVISE_MQT
	                                   -      -      -      -      -        -   -   -   - --- 
	Table: DB2INST1.ADVISE_PARTITION
	                                   -      -      -      -      -        -   -   -   - --- 
	Table: DB2INST1.ADVISE_TABLE
	                                   -      -      -      -      -        -   -   -   - --- 
	Table: DB2INST1.ADVISE_WORKLOAD
	                                   -      -      -      -      -        -   -   -   - --- 
	Table: DB2INST1.DIM_ATTR
	                                  30      0      1      1      -     1710   0   - 100 ---
//输出信息说明:REORG字段若是有一个和多个“*”的话,可以考虑对该表或索引重组。

2.14 查看表空间所在裸设备权限

检查点:

查看表是否正常

检查方法:

$db2pd -d tycjdb -table
//标准:STATUS列返回为C表示待审核。

示例
在这里插入图片描述
在这里插入图片描述

输出信息说明:
□ 输出显示了模式名、表名、状态和表类型。
□ 在 SYSCAT.TABLES 中有项的所有用户定义的表的名称,以及每个表的列数和表的状态(N = 正常;C = 待审核(check pending))

2.15 查看数据库备份进度

b2inst1@localhost ~]$ db2pd -d ssit -utilities

Option -utilities is an instance scope option.  The database option has been ignored.

Database Member 0 -- Active -- Up 0 days 00:01:43 -- Date 2023-06-08-23.20.51.062531

Utilities:
Address            ID         Type                   State      Invoker    Priority   StartTime           DBName   NumPhases  CurPhase   Description         
0x0000000203A3E900 3          BACKUP                 0          0          0          Thu Jun  8 23:20:50 SSIT     1           1           offline db          

Progress:
Address            ID         PhaseNum   CompletedWork                TotalWork                    StartTime           Description           
0x0000000203A3EEA8 3          1          2219530 bytes                113703970 bytes              Thu Jun  8 23:20:50 n/a                   
//db2top -d dbname 然后按u
  Hash       # of     Utility         Utility         Uti Utility    Invoker    Completed        Work          Phase           
    Value      entries  Start Time      Type            Pri State      Type       Work             Unit    Prog% Start Time      
    ---------- -------- --------------- --------------- --- ---------- ---------- ---------------- ------- ----- --------------- 
       2122349       1  23:22:43.450675 Backup            0 Execute    User                  93.1M Bytes     85% 23:22:43.450682

在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/tangcoolcole/article/details/131117779
今日推荐