January 16, 2018 at 8:12 am
jjimenez-1040959 - Tuesday, January 16, 2018 8:04 AMJeff Moden - Tuesday, January 16, 2018 7:32 AMjjimenez-1040959 - Tuesday, January 16, 2018 5:10 AMIn SSMS
-Right click / properties on the database
-In files section check the initial size and set it to a lower value
-Click OkNow the shrink file/database will work
I always appreciate an answer even if it's a bit late. Just so you know, your responding to a post that's over 9 years old. 😉
I know, but I find the post today with the same problem.
And was a little confused to see everybody telling "no you should not shrink database! Its bad ! gnagnagna " but without answering to the real question.
I think that it good for the comunity to share when a solution is found.Bye
Yep... very much appreciated and that's why I said what I said. Also, you forgot one of the important parts for the solution. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
January 16, 2018 at 10:15 am
Before shrinking, find out how much free space each data file has. Here is a query (with slight modification) from Glenn Berry to help.
If there is only 200GB free space and you are trying to shrink by 250GB, SHRINKFILE will not work. So it is important to find out how much free space you have. Also, if the data file is too fragmented, it will not work either even if there is free space.
USE <your_700GB_db_name>
GO
SELECT f.name AS [File Name] , f.physical_name AS [Physical Name],
CAST((f.size/128.0) AS DECIMAL(15,2)) AS [Total Size (MB)],
CAST(f.size/128.0 - CAST(FILEPROPERTY(f.name, 'SpaceUsed') AS int)/128.0 AS DECIMAL(15,2)) AS [Free Space (MB)],
CAST (CAST(f.size/128.0 - CAST(FILEPROPERTY(f.name, 'SpaceUsed') AS int)/128.0 AS DECIMAL(15,2)) * 100 / CAST((f.size/128.0) AS DECIMAL(15,2)) AS DECIMAL(5,2)) AS [% Free],
f.[File_ID], fg.name AS [Filegroup], f.is_percent_growth As [Growth By %], f.growth/128 AS [Growth Size (MB)], fg.is_default, fg.is_read_only
FROM sys.database_files AS f WITH (NOLOCK)
LEFT OUTER JOIN sys.filegroups AS fg WITH (NOLOCK)
ON f.data_space_id = fg.data_space_id
ORDER BY f.[file_id] OPTION (RECOMPILE);
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply