Thor Logo dbatools

FileGroup

Add-DbaDbFile

the dbatools team + Claude

Add-DbaDbFile View Source the dbatools team + Claude Windows, Linux, macOS Synopsis Adds data files to existing filegroups in SQL Server databases. Description Adds new data files (.mdf or .ndf) to existing filegroups in SQL Server databases. This is essential after creating new filegroups (especially MemoryOptimizedDataFileGroup for In-Memory OLTP) because filegroups cannot store data until they contain at least one file. The function supports all filegroup types including standard row data, FileStream, and memory-optimized storage, with automatic path resolution to SQL Server default data directories when no explicit path is specified.

Read more

New-DbaDbFileGroup

Adam Lancaster, github.com/lancasteradam

New-DbaDbFileGroup View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Creates new filegroups in SQL Server databases for custom data storage organization. Description Creates a new filegroup for the specified database(s), supporting standard row data, FileStream, and memory-optimized storage types. This is useful when you need to separate table storage across different disk drives for performance optimization, implement compliance requirements, or organize data by department or function. The filegroup is created empty and requires adding data files with Add-DbaDbFile before it can store data.

Read more

Remove-DbaDbFileGroup

Adam Lancaster, github.com/lancasteradam

Remove-DbaDbFileGroup View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Removes empty filegroups from SQL Server databases. Description Removes one or more filegroups from SQL Server databases after validating they contain no data files. This command is useful for cleaning up unused filegroups after moving data to different filegroups or during database reorganization projects. The function performs safety checks to ensure filegroups are empty before removal and provides detailed error messages if removal fails due to dependencies or constraints.

Read more