Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
toddhd
Yak Posting Veteran
55 Posts |
Posted - 2004-11-02 : 13:13:00
|
| I am a webmaster/programmer. I keep a local copy of my application and database on my laptop, and sometimes need to "synch" that info up to the main IIS and SQL Server. Enterprise Managers "export" capability is a tricky thing - if I don't do everything perfectly, then I wind up with duplicate records, missing records, errors - it's a mess. So I've found it much easier just to backup the database on my laptop, then restore it on the server. Quick and easy, no mistakes.But lately I have a problem. When I go to restore the backup on the server, it gives a message that says something like "sql database state cannot be changed while other users are using the database". I'm not sure how this happens, as I'm the only person using this database, even on the main server. If I right click on the database and try to take it offline, I get the same message.The only way I seem to be able to get around this message is to stop/start SQL server, but that's a feasable solution, as there are many users that use other databases on this server.Is there a way to convince Enterprise Manager to let me take the database offline without restarting the SQL server? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-11-02 : 13:20:48
|
| tryselect spid from master..sysprocesses where dbid = db_id('mydb')then you can kill those spids.You will probably find that it's one of your processes that's doing it.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
toddhd
Yak Posting Veteran
55 Posts |
Posted - 2004-11-02 : 13:27:22
|
quote: Originally posted by nr tryselect spid from master..sysprocesses where dbid = db_id('mydb')then you can kill those spids.You will probably find that it's one of your processes that's doing it.
Assume I'm fairly SQL stupid from an Admin POV, cause I am. :)I ran the statement above (changing mydb to my database name of course) and it spat back about nine numbers. What are those, and how do I shut them down? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2004-11-02 : 13:40:56
|
sp_murder.... Nice!!Some alternative sp names (According to Websters)If you want to make it your own :)sp_annihilationsp_assassinationsp_big_chillsp_bloodsp_bloodshedsp_bump_offsp_butcherysp_capital_murdersp_carnagesp_crimesp_deathsp_destructionsp_dispatchingsp_dust_offsp_felonysp_foul_playsp_hitsp_homicnesp_kiss_offsp_knifingsp_liqunationsp_lynchingsp_manslaughtersp_massacresp_offsp_offingsp_one_way_ticketsp_shootingsp_slayingsp_taking_outsp_terrorismsp_the_businesssp_the_workssp_wasting |
 |
|
|
toddhd
Yak Posting Veteran
55 Posts |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-11-02 : 22:32:40
|
<laughing with teary eyes> , i think he has a point, coz MS named it KILL.quote: Originally posted by ehorn sp_murder.... Nice!!Some alternative sp names (According to Websters)If you want to make it your own :)sp_annihilationsp_assassinationsp_big_chillsp_bloodsp_bloodshedsp_bump_offsp_butcherysp_capital_murdersp_carnagesp_crimesp_deathsp_destructionsp_dispatchingsp_dust_offsp_felonysp_foul_playsp_hitsp_homicnesp_kiss_offsp_knifingsp_liqunationsp_lynchingsp_manslaughtersp_massacresp_offsp_offingsp_one_way_ticketsp_shootingsp_slayingsp_taking_outsp_terrorismsp_the_businesssp_the_workssp_wasting
--------------------keeping it simple... |
 |
|
|
|
|
|
|
|