Bobcares

How to fix SQL Server Error 9002

by | Apr 12, 2021

Wondering how to fix SQL Server Error 9002? We can help you.

Often in SQL server, when a log file gets filled up with transaction logs, it shows SQL Server Error 9002.

Usually, the transaction logs get filled when the SQL server database is online or if it is in recovery mode.

Here at Bobcares, we often get requests from our customers to fix similar errors as a part of our Server Management Services.

Today let’s see how our Support Engineers fix SQL Server Error 9002 when the transaction logs are full in a log file.

How to fix SQL Server Error 9002: The transaction log for database is full

A typical Error 9002 will look like the one given below:

SQL Server Error 9002

We can do the following steps to fix this error:

1. First create a backup and truncate the transaction logs
2. Make the log space available
3. Move log file to another disk drive
4. After that increase the size of the log file
5. Add another log file on a separate disk
6. Finally complete or kill a long-running transaction

1. Create a backup and truncate the transaction logs

If our database is in full or bulk-logged recovery model and if the transaction log is not backed up, we must take the backup of transaction logs and allow Database Engine to truncate the transaction logs to the point of the last backup.

This will free some space for new transactions.

2. Make the disk space available

We can do this by deleting or moving some other files on which the transaction log file is contained.

3. Move log file to another disk drive

If we are not able to make the disk space available for the drive on which our transaction log file is contained, we can try to move the log file on another disk with available space.

We must keep in mind the following points while doing this:

1. We have to ensure that the other disk has enough space for new transaction logs.

2. We can detach the database by using the following command:

sp_detach_db

3. This action will make the log file unavailable as long as we do not re-attach it.

4. For reattaching the database, we can execute the following:

sp_attach_db

4. Increase the size of the log file

If we have enough space on the log disk, then we can increase its size.

To increase the size of the log file, we can either do any of the following:

1. Produce a single growth increment
2. Enable autogrow by the ALTER DATABASE statement

5. Add or enlarge the log file

We can also add an additional log file for the database and gain more space.

1. To add another log file on a separate disk, use ALTER DATABASE ADD LOG FILE.
2.  Use MODIFY FILE clause of the ALTER DATABASE to enlarge the log file.

6. Complete or kill a long-running transaction

Discovering long-running transactions

A very long-running transaction can cause the transaction log to fill.

For checking long-running transactions, we can use one of the following:

1.sys.dm_tran_database_transactions

or

2.  DBCC OPENTRAN

Kill a transaction

It will be better to end the process if it’s taking too long.

We can use the KILL statement for doing this.

[Need assistance? We can help you]

Conclusion

In short, we saw how to fix SQL Server Error 9002, also we saw the steps that our Support Engineers follow to fix this issue for our customers.

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 *

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

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

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

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