What was am thinks was, is their any possibility to migrate the
storage without bringing down the sql?
I will rephrase this question thus:
Is their any possibility to migrate ONLINE tables (clustered / heap) to another filegroup
(=another files) ?
The answer is yes and it's very simple with Enterprise Edition. For example, assuming that current filegroup is CustomUserObjects
(D:\MSSQL\Data\DataFile.mdf
) and we have to move these tables to another filegroup NewCustomUserObjects
(G:\MSSQL\Data\DataFile.mdf
) then
[1] For clustered & nonclustered indexes could be used following approach:
CREATE UNIQUE CLUSTERED INDEX PK_TestTable_ID ON
dbo.TestTable(ID)
WITH
(
ONLINE = ON,
DROP_EXISTING = ON
)
ON NewCustomFileGroup
GO
The same approach could be used also for NONLCLUSTERED
indexes.
[2] For heap tables, one clustered index could be created (CREATE ... INDEX ... ONLINE = ON
) followed by a DROP INDEX ... ON ....
.
More details here.
This approach has few limitations. The most important are:
[1] Some indexes (ex. spatial & xml indexes) could not be moved ONLINE.
[2] It will leave BLOBs ([n]varchar(max)
, varbinary(max)
, xml
, etc.) values stored within old filegroup but there are some solutions.
[3] For FULL / BULK LOGGED databases, it will generate a lot of entries within database transaction log (ex. *.ldf
) thereby affecting all functionalities based on Tx log: log shipping, database mirroring, AO Availability Groups, transaction replication, Change Data Capture, etc.