近日sybase库出现3021错误:
Error: 3021, Severity: 18, State: 2
Unable to write statistics for all indexes of object 1887707142 in database 4. Please run update statistics on all indexes after loading this database or prior to using the indexes in the loaded database.
Unable to write statistics for all indexes of object 12224463 in database 4. Please run update statistics on all indexes after loading this database or prior to using the indexes in the loaded database.
该问题可能再load database之后发生,需要对表的statistics做update,方法如下:
1> select name from sysobjects where id=613274609
2> go
name
------------------------------
smc_detail_0704110_0099_t
(1 row affected)
1> select name from sysobjects where id=1887707142
2> go
name
------------------------------
smc_detail_0604110_0099_t
(1 row affected)
1> update statistics smc_detail_0706110_0099_t
2> go
1> update statistics smc_detail_0704110_0099_t
2> go
1> commit
2> go
1> sp_recompile smc_detail_0706110_0099_t
2> go
Each stored procedure and trigger that uses table 'smc_detail_0706110_0099_t'
will be recompiled the next time it is executed.
(return status = 0)
1> sp_recompile smc_detail_0704110_0099_t
2> go
Each stored procedure and trigger that uses table 'smc_detail_0704110_0099_t'
will be recompiled the next time it is executed.
(return status = 0)
之后问题解决。统计信息错误可能会导致执行计划的错误,所以及时更正为上。
阅读(2802) | 评论(0) | 转发(0) |