November 9, 2023 at 8:12 pm
I am using :
SQL Server 2017 Standard edition
Windows Server 2016 (Standard)
Database Size: 1.2TB
Used space from the Primary Data File: 300GB
Unused space in a Primary Data File : 874GB
Recovery Model: Simple
I am trying to shrink the Data file to 600GB by using a following Command:
DBCC SHRINKFILE (N'TestDB' , 614400)
And there is no blocking and no other activities are happening on this database.
The above shrink operation is been in the process since last 9hrs and still not completed. So can anyone tell me what needs to be done at this point of time.
How much time should be taken by this shrink operation?
Any best solution to do operation ?
Thanks for help
November 10, 2023 at 8:10 am
DBCC Shrinkfile is indeed a slow operation !
Things that make it even worse:
What's the result of this query ?
SELECT session_id
, request_id
, percent_complete
, estimated_completion_time
, DATEADD(ms, estimated_completion_time, GETDATE()) AS EstimatedEndTime
, start_time
, STATUS
, total_elapsed_time
, db_name(database_id) DbName
, last_wait_type
, wait_resource
, command
-- select *
FROM sys.dm_exec_requests
WHERE database_id = db_id('YourDb') ;
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
November 10, 2023 at 8:36 am
Thanks for the answer
As bellow the result of query
November 10, 2023 at 8:52 am
That doesn't tell much, does it ?
Maybe the SQLSkills blog and refs can give you a clue for the reason you just have to wait until it finishes ...
SQLSkills MEMORY_ALLOCATION_EXT
an article by Erik Darling about a troublesome case HASHBYTES Scalability In SQL Server 2017
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
November 20, 2023 at 5:44 pm
Shrink it in smaller chunks.
Google for a script to reduce it incrementally.
November 20, 2023 at 5:45 pm
Shrink it in smaller chunks.
Google for a script to reduce it incrementally.
https://www.sqlservercentral.com/blogs/sql-database-incremental-shrink-tsql
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply