Invisible database - Can't drop

  • Hi,

    i was trying a database restore and it threw out Page errors.

    I had to restart the restore. But the database was in “Restoring..” state. I right clicked and deleted it on Mgmt Studio and it was gone.

    It doesn’t show in the SQL management studio.

    I thought it was ok and I tried the restore

    restore database DBNAME

    from disk='\\landbbackup1\e$\MonthEndBackups\DBNAME_20120810.BAK'

    with replace, recovery, stats=5, maxtransfersize=1048576

    I received this:

    Msg 3101, Level 16, State 1, Line 1

    Exclusive access could not be obtained because the database is in use.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

    Then try dropping using the command line.

    drop database DBNAME

    Got this:

    Msg 3702, Level 16, State 4, Line 1

    Cannot drop database "DBNAME" because it is currently in use.

    When I try to list all the databases in the insance, it doesn’t show this database at all

    SELECT NAME FROM sys.sysdatabases

    where name not in ('master', 'tempdb', 'model','msdb')

    So, I tried to take it offline:

    USE master

    ALTER DATABASE [DBNAME] SET OFFLINE WITH ROLLBACK IMMEDIATE

    No avail.

    Msg 5011, Level 14, State 6, Line 2

    User does not have permission to alter database 'DBNAME', the database does not exist, or the database is not in a state that allows access checks.

    Msg 5069, Level 16, State 1, Line 2

    ALTER DATABASE statement failed.

    How do I carry on the restore?

    Please help.

  • Sounds to me like the master database may be having a problem. Have you run diagnostics (DBCC CHECKDB, etc.) on master?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Thanks I am going to try that.

    There is one more database on the same instance. if the master DB is corrupted, will the other DB work?

  • DBCC CHECKDB(master) is running for last 7 hours.

    What do I do in this case? Is it possible to build this from scratch?

  • Do you have backups for the master database?

    Wait till it's done running, and if it's got problems, backups will be your easiest way to recover it, most likely.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 5 posts - 1 through 4 (of 4 total)

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