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
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
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:
ALTER DATABASE [DBNAME] SET OFFLINE WITH ROLLBACK IMMEDIATE
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?
Thanks a lot for your time..