SQL Server Performance

ALTER DATABASE failed

Discussion in 'General DBA Questions' started by buenowight, Jul 1, 2007.

  1. buenowight New Member

    Hi

    When I try to put the database in single user mode using this command:

    alter database mydatabase set SINGLE_USER with rollback immediate

    I am getting this erro message :

    Server: Msg 5061, Level 16, State 1, Line 16
    ALTER DATABASE failed because a lock could not be placed on database 'mydatabase'. Try again later.
    Server: Msg 5069, Level 16, State 1, Line 16
    ALTER DATABASE statement failed.

    ----------------

    also when i issue select * from sysprocesses where dbid = id_of_my_database,

    I get 0 rows.

    Aren't these conflicting restults??

    Can anyone suggest me a way out??

    Thanks.
  2. ranjitjain New Member

    I think this should be fine.
    Try this::
    USE MASTER
    Go
    alter database mydatabase set SINGLE_USER with rollback immediate
  3. satya Moderator

    If not you could try to restart SQL servers and attempt to keep it single-user mode immediately if you have any third party application to capture counters.

    Satya SKJ
    Microsoft SQL Server MVP
    Writer, Contributing Editor & Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
  4. Nikunj_352009 New Member

    Dear sir,
    i am open .mdf file because some error to this file is only read only please call me on this no any time : 091-9974145437
    Thanks
    Nikunj Patel
  5. joshgeake New Member

  6. Luis Martin Moderator

Share This Page