Hello experts,
I'm having trouble getting around this issue. I am trying to restore a database and every time (via T-SQL or GUI), it stalls out at around 97%. I check sp_WhoIsActive and keep seeing this wait type:
PREEMPTIVE_OS_WRITEFILEGATHER
I tried the solution here but to no avail:
Does anyone have an idea of how to fix this? I did a restore yesterday without issue. It was a smaller db, but this current one, at around 30 GB, doesn't seem like it should be having this trouble.
Thanks for any help.
-- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
First thing I'd check for is the size of the log file being restored and then I'd check the original database to see the size and how many VLFs are in the file. Even if "Instant File Initialization" is enabled, the log file ends up going through a formatting process to create the VLFs.. If they number of VLFs had gotten out of hand because of poor growth settings, it can take a huge amount of time to restore the database.
Please see the following links for more reasons why proper growth patterns and VLFs are important.
http://3.209.169.194/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/
https://www.sqlskills.com/blogs/paul/important-change-vlf-creation-algorithm-sql-server-2014/
--Jeff Moden
Change is inevitable... Change for the better is not.
June 13, 2022 at 2:42 pm
Thanks so much, Jeff, I will review those articles.
Thanks again!
-- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
June 13, 2022 at 3:01 pm
Thanks so much, Jeff, I will review those articles.
Thanks again!
-- webrunner
My disclaimer is that I don't know if that's the actual problem. It's just one that people seem to forget about and it doesn't take much time to explore. Just go to the original database and type DBCC LogInfo WITH TABLERESULTS and see how many VLFs you have and what their sizes are. As of 2016 sp2 (IIRC), there's also a system DMV you can use...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 13, 2022 at 3:04 pm
Gotcha, Jeff, thanks for the disclaimer. At the very least I can use the info you provided to rule in or rule out the issue. Much appreciated.
-- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
June 13, 2022 at 5:34 pm
Sounds like the log file issue might be spot on according to the following link...
https://www.sqlskills.com/help/waits/preemptive_os_writefilegather/
--Jeff Moden
Change is inevitable... Change for the better is not.
June 13, 2022 at 5:44 pm
And make sure it is the log file. That is, make sure IFI is enabled so that SQL doesn't have to initialize all the data files too.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply