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.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Detach multiple db's

Author  Topic 

mojo1979
Starting Member

3 Posts

Posted - 2011-11-10 : 13:53:41
Hi,

I have around 100 db's attached to my SQL 2008 server. I want to detach around 50 of these and archive them onto a file share. I obviously don't want to do one at a time and would prefer to script it somehow.

All 50 databases are located in the same folder - i.e 2009-01.

Any help would be appreciated.

Cheers

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-11-10 : 14:36:09
Why not just save your backups? You ARE taking backups right?
Go to Top of Page

mojo1979
Starting Member

3 Posts

Posted - 2011-11-10 : 14:42:30
Yes dbs are backed up to disk every night via HP data protector (backups which i dont have easy access to - another team in another country deals with that).

I want to move these dbs to free up disk space as a quick and easy solution to a disk space problem.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-11-10 : 15:00:36
You want to move them to a remote file server and bring them back online?

Not a good idea, and not possible by defualt, though there is a trace flaf you can use to override the default behavior.

You can query sys.master_files to automate your detach script.

If you just want to archive 'em, take backups (preferrably with compression), archive the backups and drop the database.
Go to Top of Page

mojo1979
Starting Member

3 Posts

Posted - 2011-11-10 : 15:09:51
The dbs won't be brought back online, they'll stay detached.

I'll take a look at sys.master_files.

Thanks
Go to Top of Page
   

- Advertisement -