Status in sysdatabases

  • I am trying to compare configurations between 2 databases. I went to sysdatabases and they have 2 different status, db1 = 0 what is this mean and db2 = 16 what is this mean? Should I go any other sys tables and check for configurations? Thank you

  • Straight from Books Online:

    status

    Status bits, some of which can be set by using ALTER DATABASE as noted:

    1 = autoclose (ALTER DATABASE)

    4 = select into/bulkcopy (ALTER DATABASE using SET RECOVERY)

    8 = trunc. log on chkpt (ALTER DATABASE using SET RECOVERY)

    16 = torn page detection (ALTER DATABASE)

    32 = loading

    64 = pre recovery

    128 = recovering

    256 = not recovered

    512 = offline (ALTER DATABASE)

    1024 = read only (ALTER DATABASE)

    2048 = dbo use only (ALTER DATABASE using SET RESTRICTED_USER)

    4096 = single user (ALTER DATABASE)

    32768 = emergency mode

    4194304 = autoshrink (ALTER DATABASE)

    1073741824 = cleanly shutdown

    Multiple bits can be ON at the same time.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • What is 0 means ?Thank you

  • It's a bitmask. A bit value of 1 means that the option is set, 0 means not set. So the decimal value 0 means that all of the bits are 0 which means that none of the options are set.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank you, Do I need to set? What is the purpose to set status in sysdatabases? My db2 is to 16 which means torn page detection (ALTER DATABASE). Can you explain more what is this mean and what is the purpose for the db to be set for this option. We are having problems with this db and I am trying to see if our configuration is correct.

  • Look in books online for "Torn Page Protection" to see what it is and what it's there for.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • here's a SQL i made way back when, base don the bits booksonline tells us for the status:

    SELECT 'name: ' + [name] + CHAR(13) +

    'autoclose: '+ MIN(CASE status & 1 WHEN 1 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'SELECT into/bulkcopy: '+ MIN(CASE status & 4 WHEN 4 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'trunc. log on chkpt: '+ MIN(CASE status & 8 WHEN 8 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'torn page detection: '+ MIN(CASE status & 16 WHEN 16 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'loading: '+ MIN(CASE status & 32 WHEN 32 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'pre recovery: '+ MIN(CASE status & 64 WHEN 64 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'recovering: '+ MIN(CASE status & 128 WHEN 128 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'Falset recovered: '+ MIN(CASE status & 256 WHEN 256 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'offline: '+ MIN(CASE status & 512 WHEN 512 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'read only: '+ MIN(CASE status & 1024 WHEN 1024 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'dbo use only: '+ MIN(CASE status & 2048 WHEN 2048 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'single user: '+ MIN(CASE status & 4096 WHEN 4096 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'emergency mode: '+ MIN(CASE status & 32768 WHEN 32768 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'autoshrink: '+ MIN(CASE status & 4194304 WHEN 4194304 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'cleanly shutdown: '+ MIN(CASE status & 1073741824 WHEN 1073741824 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'ANSI null default: '+ MIN(CASE status2 & 16384 WHEN 16384 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'concat null yields null: '+ MIN(CASE status2 & 65536 WHEN 65536 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'recursive triggers: '+ MIN(CASE status2 & 131072 WHEN 131072 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'default to local cursor: '+ MIN(CASE status2 & 1048576 WHEN 1048576 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'quoted identifier: '+ MIN(CASE status2 & 8388608 WHEN 8388608 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'cursor close on commit: '+ MIN(CASE status2 & 33554432 WHEN 33554432 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'ANSI nulls: '+ MIN(CASE status2 & 67108864 WHEN 67108864 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'ANSI warnings: '+ MIN(CASE status2 & 268435456 WHEN 268435456 THEN 'True' ELSE 'False' END) + CHAR(13) +

    'full text enabled: '+ MIN(CASE status2 & 536870912 WHEN 536870912 THEN 'True' ELSE 'False' END) + CHAR(13) + CHAR(13)

    FROM master..sysdatabases

    GROUP BY [name]

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I didn't find any information about Torn Page Protection, I need to know why my db is set to true in status of sysdatabases and why my other db is to 0 and what is the purpose is doing that?

  • Krasavita (7/14/2009)


    I didn't find any information about Torn Page Protection

    http://msdn.microsoft.com/en-us/library/aa933082(SQL.80).aspx

    I need to know why my db is set to true in status of sysdatabases and why my other db is to 0 and what is the purpose is doing that?

    Torn page detection is by default on in SQL 2000. For it to be off on a database, someone turned the option off. Why, I can't say.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • its a bit field: the database with status= zero has no flags turned on.

    the database with status=16 has one flag turned on: torn page detection.

    WHY one is different than the other isn't really important...we cannot explain what happened to your database...but we can explain what the current status is.

    if they need to be the same, then simply toggle the flags that are appropriate.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply