转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件使用 >> 办公软件 >> 正文
SYBASE dbcc         

SYBASE dbcc

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1191 更新时间:2009/4/25 1:15:49

dbcc checkstorage 检查数据库的一致性。在新版本的数据库中用处比任何一个DBCC命令都大,尤其在数据库备份前。这篇文章的用意是帮助你:
Ø 掌握dbcc checkstorage命令
Ø 维护dbccdb数据库
Ø 根据dbccdb生成报告

  本文使用的案例中,你将首先由sp_plan_dbccdb的输出得到运行dbcc checkstorage命令所需资源环境,并在此基础上规划资源,建立dbccdb数据库,最终根据dbccdb数据库生成报告。

本节练习将基于如下环境:

Ø 系统中存在用户数据库aca_db,容量为20MB(数据10MB、日志10MB)
Ø aca_db数据库占用disk1和disk2两个设备
Ø aca_db数据库中有若干个用户表(auths,article等)

步骤如下:

1、为目标数据库获取有关数据库大小、设备工作空间的大小,高速缓存大小和工作进程数的建议。

sp_plan_dbccdb aca_db

执行结果为:

Recommended size for dbccdb database is 15MB (data = 13MB, log = 2MB).
No suitable devices for dbccdb in master..sysdevices.
Recommended values for workspace size, cache size and process count are:
dbname scan ws text ws cache process count
aca_db 272K 80K 1280K 2
(return status = 0)

2、如果必要,调整Adaptive Server的工作进程数

3、 为dbcc创建命名高速缓存

  配置一个dbcc checkstorage专用的命名高速缓存,不仅可以提高性能并且还可以使数据库的一致性检查对其他用户的影响降到最小。

  Dbcc checkstorage要求在命名高速缓存的16k内存池中为每个工作进程准备至少640k的存储空间,16k内存池的最小容量为推荐的高速缓存容量。

  Sp_cacheconfig aca_cache,”3072k”

(注意:重新启动Adaptive Server才起作用)

4、配置16k的I/O缓存池

sp_poolconfig aca_cache,”2048”,”16k”
使用sp_poolconfig aca_cache命令查看命名高速缓存,结果如下
Cache Name Status Type Config Value Run Value
---------- ------ ---- ------------ ---------
aca_cache Active Mixed 3.00 Mb 3.00 Mb
IO Size Wash Size Config Size Run Size APF Percent
------- --------- ----------- -------- -----------
2 Kb 204 Kb 0.00 Mb 1.00 Mb 10
16 Kb 400 Kb 2.00 Mb 2.00 Mb 10


4、 如果dbccdb存在,则在创建新的dbccdb数据库之前,删除它及其相关的所有设备

use master
go
if exists (select * from master.dbo.sysdatabases
where name = "dbccdb")
begin
print "+++ Dropping the dbccdb database"
drop database dbccdb
end
go

5、 初始化用于dbccdb数据和日志的磁盘设备

disk init
name="dbccdb_dat",
physname="d:\sybase\example\dbccdata.dat",
vdevno=6,
size=7680
disk init
name="dbccdb_log",
physname="d:\sybase\example\dbcclog.dat",
vdevno=7,
size=1024

6、 在数据库设备上创建dbccdb数据库

create database dbccdb
on dbcc_dat=13
log on dbccdb_log=2

7、 添加磁盘段

use dbccdb
sp_addsegment scanseg,dbccdb,dbccdb_dat
sp_addsegment textseg,dbccdb,dbccdb_dat

8、 填充dbcc数据库并安装dbcc存储过程

执行installdbccdb脚本为dbccdb创建表并初始化dbcc-type表

isql -Usa –P -S -Iiinstalldbccdb

9、 建立和初始化scan和text空间

sp_dbcc_createws dbccdb,scanseg,scan_aca,scan,"272k"
sp_dbcc_createws dbccdb,textseg,text_aca,text,"80k"
10、 更新dbcc_config配置值
use dbccdb
sp_dbcc_updateconfig aca_db,"max worker processes","2"
sp_dbcc_updateconfig aca_db,"dbcc named cache",aca_cache,"3072"
sp_dbcc_updateconfig aca_db,"scan workspace",scan_aca
sp_dbcc_updateconfig aca_db,"text workspace",text_aca
sp_dbcc_updateconfig aca_db,"OAM count threshold","5"
sp_dbcc_updateconfig aca_db,"IO error abort","3"
sp_dbcc_updateconfig aca_db,"linkage error abort","8"

11、检查aca_db数据库

dbcc checkstorage(aca_db)

执行结果为:

Checking aca_db Server Message: Number 9954, Severity 10
Line 1:
Storage checks for 'aca_db' are complete. DBCC is now recording the results in the dbccdb database.
Server Message: Number 9974, Severity 10
Line 1:
DBCC CHECKSTORAGE for database 'aca_db' sequence 1 completed at May 30 2000 10:01AM. 0 faults and 0 suspect conditions were located. 0 checks were aborted. You should investigate the recorded faults, and plan a course of action that will correct them.

11、 dbccdb生成报告

Ø sp_dbcc_summaryreport在指定的日期或该日期之前为指定的数据库完成的所有dbcc checkstorage操作

示例:

sp_dbcc_summaryreport

DBCC Operation : checkstorage
(1 row affected)
(return status = 0)
Database Name Start time End Time Operation ID Hard Faults Soft Faults Text Columns Abort Count User Name
------------- ---------- -------- ------------ ----------- ----------- ------------ ----------- ---------aca_db 05/30/2000 10:01:36 10:1:50:503 1 0 0 0 0 sa
Ø sp_dbcc_configreport为目标数据库生成配置信息的报告。

示例:

sp_dbcc_configreport

Reporting configuration information of database aca_db.
Parameter Name Value Size
database name aca_db 20480K
dbcc named cache aca_cache 3072K
text workspace text_aca (id = 544004969) 80K
scan workspace scan_aca (id = 512004855) 272K
OAM count threshold 5%
IO error abort 3
linkage error abort 8
max worker processes 2
operation sequence number 1
(1 row affected)
(return status = 0)
Ø sp_dbcc_statisticsreport产生从dbcc_counter表中得到的统计信息

示例:

sp_dbcc_statisticsreport "aca_db","auths"

结果:

Parameter Name Index Id Value
-------------- -------- -----
count 0 20.0
max size 0 88.0
max count 0 20.0
bytes data 0 1321.0
bytes used 0 1599.0
count 1 1.0
max count 1 1.0
max level 1 0.0
max size 1 11.0
bytes data 1 6.0
bytes used 1 43.0
count 255 0.0
max size 255 0.0
max count 255 0.0
bytes data 255 0.0
bytes used 255 0.0
Parameter Name Index Id Partition Value Dev_name
-------------- -------- --------- ----- --------
page gaps 0 1 1.0 disk1
pages used 0 1 2.0 disk1
extents used 0 1 1.0 disk1
overflow pages 0 1 0.0 disk1
pages overhead 0 1 1.0 disk1
pages reserved 0 1 6.0 disk1
page extent gaps 0 1 0.0 disk1
ws buffer crosses 0 1 0.0 disk1
page extent crosses 0 1 0.0 disk1
page gaps 1 1 1.0 disk1
pages used 1 1 2.0 disk1
extents used 1 1 1.0 disk1
overflow pages 1 1 0.0 disk1
pages overhead 1 1 1.0 disk1
pages reserved 1 1 6.0 disk1
page extent gaps 1 1 0.0 disk1
ws buffer crosses 1 1 0.0 disk1
page extent crosses 1 1 0.0 disk1
page gaps 255 1 1.0 disk1
pages used 255 1 2.0 disk1
extents used 255 1 1.0 disk1
overflow pages 255 1 0.0 disk1
pages overhead 255 1 1.0 disk1
pages reserved 255 1 6.0 disk1
page extent gaps 255 1 0.0 disk1
ws buffer crosses 255 1 0.0 disk1
page extent crosses 255 1 0.0 disk1
Ø sp_dbcc_faultreport报告指定的数据库对象中发现的在指定日期或该日期之前发生的故障。可以生成短报告,也可以生成长报告。

示例:

sp_dbcc_faultreport 'short'
sp_dbcc_faultreport 'long' 


[办公软件]在sybase中插入图片、PDF、文本文件  [办公软件]SYBASE数据库用户管理基本概念
[办公软件]关于SYBASE的自动启动  [办公软件]SYBASE事务
[C语言系列]SQL Server到SYBASE连接服务器的实现  [其他]SQLServer到SYBASE连接服务器的实现
[SyBase]四川移动BOSS系统Sybase解决方案  [SyBase]中国联通CDMA计费系统工程的Sybase解决方案
[SyBase]Sybase ASE12.5智能管理《北京青年报》新闻采编系…  [SyBase]Sybase EA Server 在网上税务系统中的应用
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · 办公软件  · 系统软件
    · 常用软件  · 聊天工具
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台