*** HUGE SQL Server Problem *** =(

  • My SQL Server 2000 keeps going into "single user" mode. I have to manually go on the server to fix it each time. I don't know when it happens until my client complains =(

    How can I fix this automatically?

    I think the problem is that the data is fragmented / corrupted but I am not sure. I was able to shrink the database (data and log files), but I don't know if this will fix the "single user" problem.

    Can anyone help?

  • Go look at your database integrity job. Does it have the option "automatically fix minor problems" checked? If so, uncheck it. Then do a full DBCC CheckDB and see how bad your corruption is.

    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
  • I have a database back up job with one step and the command:

    BACKUP DATABASE [myDBName] TO DISK = N'F:\myDBName' WITH INIT , NOUNLOAD , NAME = N'myDBName backup', NOSKIP , STATS = 10, NOFORMAT

    I don't do anything else ...

    In SQL 2000, how can I see if "automatically fix minor problems" is checked?

    Does "DBCC CheckDB" only check the database and not fix it? How long will it take to run? Will shrinking the database more help (log and data files)?

  • I'm not talking about your backup job.

    Look at your maintenance plans. Do you have any which have the database integrity task? If there are, does that task have 'automatically repair minor problems' checked?

    Shrinking won't help anything. It'll potentially hinder performance afterward.

    CheckDB without options just checks. That said, corruption will not alone make a database go into the single user state. Neither will fragmentation. The only thing which will make a database go into single user is something running ALTER DATABASE <database name> SET SINGLE_USER;

    While you're at it, search through jobs and procedures for anything that runs ALTER DATABASE.

    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
  • I don't think there are any maintenance plans. How do I check this, and also look for database integrity tasks ad see if "automatically repair minor problems" is checked?

    How will shrinking hinder performance? How do I search jobs and procedures for ALTER DATABASE?

  • There's a maintenance plans folder in Enterprise manager, you look through that. Check to see if any of your maintenance plans have the check database integrity task. If any do, check the task, see if the check box I mentioned is checked.

    You can get procedure definitions with sp_helptext, that can be inserted into a table which you can then query.

    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
  • In Enterprise Manager, there are no maintenance plans set up.

    I also returned no results for:

    SELECT object_name(id)

    FROM syscomments

    WHERE text LIKE '%alter database%'

    :unsure:

  • Then either there's an application that's sending that command to SQL, or someone's running it manually.

    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
  • There's no application that do this, and no one else has access to the database to run the command manually.

    We use full text index and rebuild our catalog every few hours, but I'm not sure if this is the cause of the problem:

    exec sp_fulltext_catalog 'MyCatalogName', 'start_incremental'

    I am out of ideas except that the database or indexes are corrupted? Any other ideas? I am really stuck here.

    ... should I still do a DBCC CheckDB now?

  • SQL doesn't randomly set databases to single user mode, the command is coming from somewhere. Either an application, a job or another user. Check the error log, consider running traces to catch the event.

    Regular checkDBs are part of database maintenance. If you're not doing them, why not?

    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
  • I've checked the error logs and the database goes into single-user mode either during or after a database backup or full index catalog rebuild.

    I am guessing this is happening because the server's resources are overloaded from applications, database usage, etc.

    What is the least resource intensive CheckDB command to run? Is there a way to see how long CheckDB will take without actually running it?

  • I remember when I first starting working with SQL Server, it was SQL Server 2000. We had a job that would restore the database to another environment and if an error occurred for some reason it would be set to single user.

    Maybe you are running out of disk space or something. If it is resources then probably need to invest in some more RAM.

  • Gail - CHECKDB found 0 allocation errors and 0 consistency errors.

    Brad - The database isn't restored to another environment, but I also heard this could cause it to go into single-user mode.

    It could be that the server needs more RAM. How can I confirm this?

  • Databases don't get set to single-user because a restore fails. It was probably set to single-user as part of the restore process because restoring a database requires sole access to the database.

    Performance problems don't set a database to single-user either.

    You should run a SQL trace on the Object:Altered event to determine what is setting the database to single user. Don't guess at it. Find the root problem and then you can fix it.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • RE: You should run a SQL trace on the Object:Altered event to determine what is setting the database to single user.

    Robert - I definitely need to figure out the problem so I can fix it. How do I do this?

Viewing 15 posts - 1 through 15 (of 32 total)

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