SQL Server adds file group and data files in the existing database
usecurrent_db -enter the current operation database
GO
Alter DataBase Current_db Add FileGroup FG1 -Add FG1 file group to Current_db database
GO -batch processing
Alter DataBase Current_DB Add File -Add data files to the newly -built file group
((
name = 'fg1_e_currentdb_data',
FILENAME = 'E: \ Project \ fg1',
size = 5MB,
filegrowth = 10%
) To fileGroup FG1
GO
Alter database curren_db
Modify FileGroup FG1 DEFAULT -Set the FG1 file group as the default file group
GO
Create a new database specified file combination file (there are multiple files in the file group)
Create Database MultipleFileGroups on Primary
((
- Primary file group
Name = 'MultipleFileGroups',
FILENAME = 'C: \ Program Files \ Microsoft SQL Server \ MSSQL11.SQL2012 \ MSSQL \ Data \ MultipleFileGroups.mdf'
Size = 5MB,
Maxsize = unlimited,
Filegrowth = 1024KB
),,
- Secondary file group
Filegroup filegroup1
((
- 1ST FILE in the First Secondary File Group
Name = 'MultipleFileGroups1',
FILENAME = 'C: \ Program Files \ Microsoft SQL Server \ MSSQL11.SQL2012 \ MSSQL \ Data \ MultipleFileGroups1.ndf'
Size = 1MB,
Maxsize = unlimited,
Filegrowth = 1024KB
),,
((
- 2ND FILE in the FIRSTASTATARY FILE Group
Name = 'MultipleFileGroups2',
FILENAME = 'C: \ Program Files \ Microsoft SQL Server \ MSSQL11.SQL2012 \ MSSQL \ Data \ MultipleFileGroups2.ndf'
Size = 1MB,
Maxsize = unlimited,
Filegrowth = 1024KB
Cure
Log on
((
- Log File
Name = 'MultipleFileGroups_log',
FILENAME = 'C: \ Program Files \ Microsoft SQL Server \ MSSQL11.SQL2012 \ MSSQL \ Data \ MultipleFileGroups.ldf'
Size = 5MB,
Maxsize = unlimited,
Filegrowth = 1024KB
Cure
GO
Create a specified file group
Create Table Customers
((
FirstName Char (50) Not Null,
LastName Char (50) not null,
Address char (100) NULL,
Zipcode char (5) not null,
Rating int NOT NULL,
Modifydate Datetime Not Null,
Cure
On [filegroup1] -specified file group
GO
-Added when adding indexes, specified the file group to be stored
Create NonClusTex IDX_ON_ON_OTHER_FILEGROUE on ProductDemo (UPCODE) on AddFileGroup -the red part is the protagonist, specified in the file group.
-If the file group is not specified, it is stored in the default file group
Create NonClustered Index IDX_ON_OTHER_FILEGROUE on ProductDemo (UPCODE)
HDU 1028 IGNATIUS and the Princess III mother function water question, everyone pays attention, I want to start the mother function ~~ lionel
2023-03-16