25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF