w*s 发帖数: 7227 | 1 hi i'm new to MS Sql 2012,
1. open MS Sql management studio
2. attach my db, say 1.mdf
3. modify it, save
4. detach 1.mdf
it complains "still in use"
if i close MSMS, and open it again, then i can detach it.
why ? | c*****d 发帖数: 6045 | 2 是不是这个1.mdf在被其他sql server用着?
【在 w*s 的大作中提到】 : hi i'm new to MS Sql 2012, : 1. open MS Sql management studio : 2. attach my db, say 1.mdf : 3. modify it, save : 4. detach 1.mdf : it complains "still in use" : if i close MSMS, and open it again, then i can detach it. : why ?
| w*s 发帖数: 7227 | 3 this is my local desktop, no other pcs connected.
【在 c*****d 的大作中提到】 : 是不是这个1.mdf在被其他sql server用着?
| i****a 发帖数: 36252 | 4 Yourself is connected to the database
[发表自未名空间手机版 - m.mitbbs.com] | w*s 发帖数: 7227 | 5 this is the part i don't understand, if i'm the only one using it in 1
single program, why cannot i detach it, why i have to close it 1st ?
【在 i****a 的大作中提到】 : Yourself is connected to the database : [发表自未名空间手机版 - m.mitbbs.com]
| l*****e 发帖数: 3343 | 6 because it is online -
SET OFFLINE WITH ROLLBACK IMMEDIATE
or you need to change DB access mode:
Use Master
Go
ALTER DATABASE YourDB
SET SINGLE_USER WITH Rollback Immediate
Go
SP_Detach_db
Go |
|