Restart your website using the steps in the.
The database being shrunk does not have to be in single-user mode; other users can be working in the database when the file is shrunk.
If you shrink a database repeatedly and notice that the database size grows again, this indicates that the space that was shrunk is required for regular operations.Target_size, is the size for the file in megabytes, expressed as an integer.Database_files catalog view is queried to obtain the file_id of the data file.A virtual log file that holds any active log records, that is, an active virtual log file, is part of the logical log, and it cannot be removed.For the purposes of this example, a data file is first created and it is assumed that the file contains data.File_idex system function or query the sys.Dbcc shrinkfile operations can be stopped at any point in the process, and any completed work is retained.This means that the shrink operation is blocked by snapshot transactions that have timestamps older than 109, which is the last transaction that the shrink operation completed.Truncating a data file The following photo story book app example truncates the primary data file in the AdventureWorks database.Dbcc shrinkfile (Test1data, emptyfile GO - Remove the data file from the database.Best Practices Consider the following information when you plan to shrink a file: A shrink operation is most effective after an operation that creates lots of unused space, such as a truncate table or a drop table operation.To allow the dbcc shrinkfile command to shrink the file, the file is first truncated by setting the database recovery model to simple.Emptyfile, migrates all data from the specified file to other files in the same filegroup.
If a target size is specified, a given shrink-file operation removes only enough inactive virtual log files to approach but not exceed the target size.How to Back Up a Domain Using Control Suite.Emptying a file The following example demonstrates the procedure for emptying a file so that it can be removed from the database.If insufficient free space is available, the shrink operation cannot reduce the file size any further.Ndf size 5MB GO - Empty the data file.For example, if a user specifies a target_size of 325 MB for our sample 600 MB file that contains six 100 MB virtual log files, the last two virtual log files are removed and the new file size is 400.Typically it is the log file that appears not to shrink.The message describes what actions are required to move the logical log out of the virtual logs at the end of the file.The File Does Not Shrink If the shrink operation runs without error, but the file does not appear to have changed in size, verify that the file has adequate free space to remove by performing one of the following operations: Run the following query.For more information, see (Transact-SQL notruncate, moves allocated pages from the end of a data file to unallocated pages in the front of the file with or without specifying target_percent.
This forces the end of the log file to the end of virtual log file.