• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • SYBASE dbcc

    發表于:2007-07-14來源:作者:點擊數: 標簽:
    dbcccheckstorage檢查 數據庫 的一致性。在新版本的數據庫中用處比任何一個DBCC命令都大,尤其在 數據庫備份 前。這篇文章的用意是幫助你: Oslash;掌握dbcccheckstorage命令 Oslash;維護dbccdb數據庫 Oslash;根據dbccdb生成報告 本文使用的案例中,你將首先

      dbcc checkstorage 檢查數據庫的一致性。在新版本的數據庫中用處比任何一個DBCC命令都大,尤其在數據庫備份前。這篇文章的用意是幫助你:

    &Oslash; 掌握dbcc checkstorage命令
    &Oslash; 維護dbccdb數據庫
    &Oslash; 根據dbccdb生成報告

      本文使用的案例中,你將首先由sp_plan_dbccdb的輸出得到運行dbcc checkstorage命令所需資源環境,并在此基礎上規劃資源,建立dbccdb數據庫,最終根據dbccdb數據庫生成報告。

    本節練習將基于如下環境:

    &Oslash; 系統中存在用戶數據庫aca_db,容量為20MB(數據10MB、日志10MB)
    &Oslash; aca_db數據庫占用disk1和disk2兩個設備
    &Oslash; 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生成報告

    &Oslash; 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 
    &Oslash; 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)
    &Oslash; 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 
    &Oslash; sp_dbcc_faultreport報告指定的數據庫對象中發現的在指定日期或該日期之前發生的故障??梢陨啥虉蟾?,也可以生成長報告。

    示例:

    sp_dbcc_faultreport 'short'
    sp_dbcc_faultreport 'long'

      


      

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>