Friday, March 9, 2012

Detach database greyed out

I'm trying to detach a database and reattach to another server. When trying to detach it using Enterprise Manager, the command is greyed out. I've tried taking the database offline first but the command is still not enabled. I'm logged in as sysadmin. What gives?Why not use SP_DETACHDB From query analyzer?
And its better to use such admin. statements using QA than depending upon GUI>|||Is it one on the default dbs you are trying to detach? If it is, I don't think you can! There are ways around it though(copy the data and log files to where you want the new db), not supported though I suspect.|||Originally posted by Satya
Why not use SP_DETACHDB From query analyzer?
And its better to use such admin. statements using QA than depending upon GUI>

Satya,
I've tried this (SQL 2000) and I get an error message:

Database is in use. I can't figure out how to get it "out of use" ?

The actual database is on SQL 7 though...

..no, it's not one of the system databases but thanks for the tip!|||Then check the following :
use master
go
sp_who
... and check what process are using this database.
ANd kill those connections (SPID) using KILL statement and also keep the database in DBO use only just in case if any new connection/user will try to access.|||Originally posted by Satya
Then check the following :
use master
go
sp_who
... and check what process are using this database.
ANd kill those connections (SPID) using KILL statement and also keep the database in DBO use only just in case if any new connection/user will try to access.

DBO use only...you mean single user mode? SQL 7 doesn't support dbo only or, at least I can't find how to do that.|||Yes I was referring about DBO Use only.
You can do it from Enterprise Manager select the database properties and goto options tab to set it.
From Query analyzer you can set it using SP_DBOPTION, refer to books online for syntax and information.|||Originally posted by Satya
Yes I was referring about DBO Use only.
You can do it from Enterprise Manager select the database properties and goto options tab to set it.
From Query analyzer you can set it using SP_DBOPTION, refer to books online for syntax and information.

OK, the database is set to DBO use only. I'm working with the 2000 version of the database since the attach/detach doesn't seem to be supported at all in 7. Anyway, even with the DBO use only set, the cmd is still greyed out.

No comments:

Post a Comment