Detach multiple databases
As part of my job, I often install new versions of Sitecore for testing, doing demonstrations, making proof-of-concepts, etc., etc. So over time, my SQL Server 2005 Express gets more and more databases attached.
This is not a problem in itself, but sometimes I like to clean things up, so the list of databases doesn't get too overwhelming. But I haven't found any way of detaching multiple databases in one operation. Quite annoying!
But now I found a tool that can do exactly what I need (and much more): Microsoft's SSEUtil.
With this command-line tool, I can simply execute a command like this to detach all databases in a specific folder:
sseutil -m -detach "c:\inetpub\wwwroot\scprinters151\Databases\*"
Or you can use the tool in console mode:
sseutil -m -c
1> !list
1. master
2. tempdb
3. model
4. msdb
5. c:\inetpub\wwwroot\scprinters3012\databases\sc53master.mdf
6. c:\inetpub\wwwroot\scprinters3012\databases\sc53core.mdf
(etc. etc.)
2> !detach "c:\inetpub\wwwroot\scprinters3012\*"
Detached 'c:\inetpub\wwwroot\scprinters3012\databases\sc53master.mdf'
Detached 'c:\inetpub\wwwroot\scprinters3012\databases\sc53core.mdf'
(etc. etc.)
Quick, easy, flexible. Makes me happy :o)
To read more about the tool, have a look at:
http://weblogs.asp.net/scottgu/archive/2005/12/15/433284.aspx
Notice: This article applies to Microsoft SQL Server 2005 Express Edition. Might also work with SQL Server 2005.
This is not a problem in itself, but sometimes I like to clean things up, so the list of databases doesn't get too overwhelming. But I haven't found any way of detaching multiple databases in one operation. Quite annoying!
But now I found a tool that can do exactly what I need (and much more): Microsoft's SSEUtil.
With this command-line tool, I can simply execute a command like this to detach all databases in a specific folder:
sseutil -m -detach "c:\inetpub\wwwroot\scprinters151\Databases\*"
Or you can use the tool in console mode:
sseutil -m -c
1> !list
1. master
2. tempdb
3. model
4. msdb
5. c:\inetpub\wwwroot\scprinters3012\databases\sc53master.mdf
6. c:\inetpub\wwwroot\scprinters3012\databases\sc53core.mdf
(etc. etc.)
2> !detach "c:\inetpub\wwwroot\scprinters3012\*"
Detached 'c:\inetpub\wwwroot\scprinters3012\databases\sc53master.mdf'
Detached 'c:\inetpub\wwwroot\scprinters3012\databases\sc53core.mdf'
(etc. etc.)
Quick, easy, flexible. Makes me happy :o)
To read more about the tool, have a look at:
http://weblogs.asp.net/scottgu/archive/2005/12/15/433284.aspx
Notice: This article applies to Microsoft SQL Server 2005 Express Edition. Might also work with SQL Server 2005.
1 Comments:
Hey Kim,
Unfortunately this useful tool is only for Express...
By Unknown, At 07:04
Post a Comment
Subscribe to Post Comments [Atom]
<< Home