A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  Sonderzeichen  sybase-tech-blog


Kategorie: ASE: dbcc

keep count

Der keep count ist ein Marker, um festzustellen wieviele Benutzer in der Datenbank sind. Den keep count kann man sich mit dbcc dbtable() ausgeben lassen.

keep count einer Datenbank ausgeben

    -- dbcc-Ausgabe auf Komandozeilenebene
    dbcc traceon(3604)
    go
    -- check keep count
    dbcc dbtable(db_name)
    go
Die Ausgabe seiht dann etwa so aus:
    DBTABLES:

    DB Table at: 0x10012bfec40

    dbt_dbid=7   dbt_stat=0x100c (0x1000 (DBT_SINGLE), 0x0008 (DBT_AUTOTRUNC), 0x0004 (DBT_SELBULK))
    dbt_stat2=0x 0 (0x0000)
    dbt_stat3=0x   0 (0x00000000)
    dbt_stat4=0x   0 (0x00000000)
    dbt_state=0x2(0x0002 (DBST_ACTIVE))   dbt_keep=0  
    dbt_hdeskeep=0 dbt_next=0x10012bc9800   dbt_systask_keep=0 dbt_detachxact_keep 0
    dbt_lock=0  dbt_dbaid=3
    dbt_verstimestamp= Nov 19 2008  8:04PM   dbt_dbname=db_name
    dbt_logrows=0   dbt_extstat=0x0
    dbt_lastlogbp=0x101338e5d60
    dbt_nextseq=457665760  dbt_oldseq=457665759
    dbt_logvers=6
    dbt_upgdvers=31 ... dbt_upgd_minor=1418
    dbt_dbinfovers=5
    dbt_sarg_vers=2  dbt_threshstat=0x0
    dbt_thresholds=0x10012bff5c8  dbt_thresh_spin=0x100004afc00

    dbt_maxthresh=256
    dbt_nextid=194096701 dbt_nextidstat=0x0
    dbt_dflinfo=0x0  dbt_dflstat=0x0
    dbt_dumpthreadlock=0
    dbt_dbts=0x0000 0x52cc16f7   dbt_xdesqueue   next=0x10012bfecc0 
    prev=0x10012bfecc0
    dbt_xdesqueue_spin=0x100004afa00
    dbt_seqspin=0x100004afac0
    dbt_append_log_reqs=0  dbt_append_log_waits=0
    dbt_commits=0x0000 0x52cc16f7   
    dbt_commitsqueue   next=0x10012bfed80 prev=0x10012bfed80
    dbt_lastckptts=0x0000 0x52cc16f7
    dbt_lwm_ts    =0x0000 0x00000019

    dbt_desqueue 0x10012bff0d8 next=0x10010a34370 prev=0x10012a25328
    dbt_udes=0x10012bff1d8 dbt_mastxlate=0x1000001f978 dbt_xlate=0x10012bff0f0
    dbt_dbaudflags=0x0 dbt_deftabaud=0x0 dbt_defviewawd=0x0 dbt_defpraud=0x0
    dbt_rep_stat=0x0, dbt_rep_work=0x0, dbt_rep_level=0

    dbt_xstat=0  dbt_slotid=15  dbt_ddlcount=0
    dbt_logxlate=0x0 dbt_logxlate_maxoff=0
    dbt_protstamp=0
    dbt_logflush=457665758
    dbt_backup_start: Nov 21 2008  4:13PM
    dbt_pagelkprom=[lwm=200 hwm=200 pct=100 status=(0x0008 (LKPROM_PAGE), 
    0x0001 (LKPROM_SERVER)) seqno=1]
    dbt_rowlkprom=[lwm=200 hwm=200 pct=100 status=(0x0010 (LKPROM_ROW), 
    0x0001 (LKPROM_SERVER)) seqno=1]

    dbt_singleuser=0x0 dbt_seg=0x10012bff2c8
    dbt_logsuspended=0
    dbt_repl_context=0x10012bffde8  dbt_repl_spin=0x100004afb80
    dbt_secondary_truncpg=00x0
    dbt_rep_gen_id=0
    dbt_dbcache=0  dbt_sysindcache=-1
    dbt_csysindcache=-1 ha_suspect_info=0x0
    dbt_supergam array
           72            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0            0            0            0            0
            0
    dbt_logsize=2550000,  dbt_plcspace=0 dbt_dbinstcount 0
    dbt_logallocs: high=0, low=106053545
    dbt_logallocs_at_recalc: high=-1, low=-1
    dbt_logdeallocs_at_recalc: high=-1, low=-1
    dbt_logfreespace_from_recalc=0

    Async Log service disabled 

    Database Disk Map:

    DMAPFM (0x10026de0000) contains 1 frame; UNRSVDFM (0x10012bfef88) contains 1 frame:
    lstart is logical page #; vstart is virtual (2K) page #; size is # of logical pages.

    dm_segmap: 0x00000003 (0x00000002 (SEG_DEFAULT), 0x00000001 (SYS_SEGMENT))
    dm_lstart=0 (dm_hi_lpage=2047999) dm_vstart=1090519040 (dm_hi_vpage=1094615039)
    dm_lsize=2048000   *dbt_unrsvd=91134

    dm_segmap: 0x00000004 (0x00000004 (LOG_SEGMENT))
    dm_lstart=10240000 (dm_hi_lpage=11263999) dm_vstart=503316480 (dm_hi_vpage=505364479)
    dm_lsize=1024000   *dbt_unrsvd=1020000

    DBCC execution completed. If DBCC printed error messages, contact a user with 
    System Administrator (SA) role.

Probleme mit dem keep count

Beim Versuchen von Datenbanken in Single User zu setzen oder einen dump zu laden kommt es zu Problemen mit dem keep count. Der ist in einigen älteren Versionen des ASEs durch einen Bug gelegentlch größer gleich 1, obwohl die Datenabnk nicht benutzt wird. Dadurch kann eine Datenbank nicht geladen oder in "single user" mode gebracht werden. Dann muss der db-Cache gelöscht werden. Das geht ab ASE Version v12.5.3 mit dem Kommando dbcc dbcacheremove().

    dbcc dbcacheremove(db_name)
    go
    Attempt to uncache the database 'db_name' with dbid 4.
    The descriptors keep count is 1 and the system tasks keep count is 0.
    The descriptors hot count is 0 and the detached keep count is 0.
    The per process keep count for spid 41 is 1.
    The database is set to current by spid 41.
    The database 'db_name' could not be uncached.
    
    DBCC execution completed. If DBCC printed error messages, contact a user with 
    System Administrator (SA) role.

In dem obigen Beispiel konnte die Datenbank nicht aus dem Cache entfernt werden. Sollte das beschriebene Problem bestehen bleiben, hilft gewöhnlich nur ein Reboot des Datenservers weiter. Benutzt man allerdings ASE ab den Versionen 12.5.4 ESD#1 oder 15.0.2, so kann man als weiteren Workaround dbcc dbreboot. nutzen. Wurde die Datenbank erfolgreich aus dem Cache entfernt, ist keep count auf 0 gesetzt und man kann die Datenbank nun laden oder in "single user mode" setzen.