HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Can I set a filegroup of database offline,change the location of files and bring it online again?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canthebringfilegroupagainonlinedatabaseofflinefilesand

Problem

I found that we can only take filegroup offline through t-sql,but to bring that filegroup online we need to restore the whole database.

Solution

There is no T-SQL command to take a filegroup offline, though an individual file can be set offline.

From the documentation, ALTER DATABASE File and Filegroup Options (Transact-SQL):


Use this option only when the file is corrupted and can be restored. A file set to OFFLINE can only be set online by restoring the file from backup. For more information about restoring a single file, see RESTORE (Transact-SQL).

To relocate files, follow the instructions in the documentation, or see the related Q & A:

How do I move SQL Server database files?

Context

StackExchange Database Administrators Q#154339, answer score: 7

Revisions (0)

No revisions yet.