Bobcares

wesupport

CLIENT AREACall Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193

Need help?

Our experts have had an average response time of 13.52 minutes in October 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

SQL Server Error 5009 – Different scenarios and Fix

by | Apr 9, 2021

Stuck with SQL Server Error 5009? We can help you.

Recently, one of our customers tried to add a log file to a database and then extend the size of it to a specific value.

He came across SQL Server error 5009 while creating the log file and got the same again while extending the size of this file.

As part of our Server Management Services, we assist our customers with several SQL queries.

In this article, let us see how to fix Microsoft SQL Server Error 5009.

 

Microsoft SQL Server Error 5009 While Adding Database File

During a recent migration, we had to load huge data in a SQL Server database on the target server.

To optimize data load performance, we created a database with the final size on the destination server. Post import the final size of the database was around 800 GB.

In order to reduce the time we made some configuration changes. Extending database file size was one way to reduce data load time.

We decided to add another log file on a separate drive considering extensive log growth during data load. However, while doing this, we came across the error:

SQL Server Error 5009

If there is not enough permission to create the file in the given location, it can cause this error.

In order to solve this, our Support Techs suggest doing the following:

  1. Set the Operating system permission on the .ldf file to full permission for the login account and SQL Server service account.
  2. Change the location to the path where we have enough permission to create or add database files.

 

Microsoft SQL Server Error 5009 While Extending the Size of Log File

On the other hand, when we extend the size of the log file we may come across the error.

One of our customers assigned a bigger value to each data and log file. It was a success because Instant File Initialization (IFI) was already enabled to skip the zeros process on storage.

However, the error occurs again while we increase the size of log files. IFI does not work for transaction log files. So, extending the size of log files will take a lot of time.

Msg 5009, Level 16, State 9, Line 1
One or more files listed in the statement could not be found or could not be initialized.

To fix this error, we pass a small value to extend the file size, instead of passing a huge value in a single go.

Reducing the value while extending the log file fixes the issue and log files can extend to their future size successfully.

 

Microsoft SQL Server Error 5009 While Removing Database File

Sometimes, this error occurs while removing a logical file in SQL Server.

Whenever we add any database file, its entry captures in system catalog files. If we try to delete any database file there is a possibility that the logical name of the file that we try to remove is not unique in the system catalog tables.

In order to fix this, our Support Techs suggest the steps given below:

  1. Create a new logical file with a different name and the same data type.
    ALTER DATABASE [Bob]
    ADD FILE ( NAME = N’Bob_Logical_Name_New’, FILENAME = N’T:\DATA\Bob_file4.ndf’, SIZE = 10MB, MAXSIZE = 100MB)
  2. Now we remove the logical file we created in step 1, as in the following example:
    ALTER DATABASE [Bob] REMOVE FILE [Bob_Logical_Name_New]
  3. Run a transaction log backup of the database.
  4. Now we remove the logical file that we were trying to remove earlier.

[Need help with the fix? We’d be happy to assist]

 

Conclusion

To conclude, SQL Server Error 5009 error occurs while adding or removing a database file or extending the database file size. Here’s how to fix them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags