patternsqlMinor
Which of those parameters is default in DBCC SHRINKFILE command?
Viewed 0 times
thosedbccdefaultwhichcommandparametersshrinkfile
Problem
I know shrink isn't a good practice, but if I execute only ie:
NOTRUNCATE Moves allocated pages from a data file's end to unallocated
pages in a file's front with or without specifying target_percent. The
free space at the file's end isn't returned to the operating system,
and the file's physical size does not change. Therefore, if NOTRUNCATE
is specified, the file appears not to shrink.
NOTRUNCATE is applicable only to data files. The log files are not
affected.
This option isn't supported for FILESTREAM filegroup containers.
....
TRUNCATEONLY Releases all free space at the file's end to the
operating system but does not perform any page movement inside the
file. The data file is shrunk only to the last allocated extent.
target_size is ignored if specified with TRUNCATEONLY.
The TRUNCATEONLY option does not move information in the log, but does
remove inactive VLFs from the end of the log file. This option isn't
supported for FILESTREAM filegroup containers.
dbcc shrinkfile (filename,1024), which is the default? notruncate or truncateonly? I didn't find anything about it in documentation.NOTRUNCATE Moves allocated pages from a data file's end to unallocated
pages in a file's front with or without specifying target_percent. The
free space at the file's end isn't returned to the operating system,
and the file's physical size does not change. Therefore, if NOTRUNCATE
is specified, the file appears not to shrink.
NOTRUNCATE is applicable only to data files. The log files are not
affected.
This option isn't supported for FILESTREAM filegroup containers.
....
TRUNCATEONLY Releases all free space at the file's end to the
operating system but does not perform any page movement inside the
file. The data file is shrunk only to the last allocated extent.
target_size is ignored if specified with TRUNCATEONLY.
The TRUNCATEONLY option does not move information in the log, but does
remove inactive VLFs from the end of the log file. This option isn't
supported for FILESTREAM filegroup containers.
Solution
The default behavior is to do neither of those things. Both of those modifiers to the
By default,
The
The
DBCC SHRINKFILE command change the default behavior.By default,
DBCC SHRINKFILE will move data to the start of the file (in data files), then release free space from the end of the file (in both log files & data files).The
NOTRUNCATE option will only move data to the start of the file (in data files), without releasing free space from the end of the file. Because log files don't move data within the file, this option isn't meaningful when used on transaction log files.The
TRUNCATEONLY option will only release free space from the end of the file, without moving any data within the data file. Because log files don't move data within the file, this actually is the default behavior for log files.Context
StackExchange Database Administrators Q#316814, answer score: 8
Revisions (0)
No revisions yet.