Maintaining the transaction logfiles
The transaction log is a record of all the transactions that have been performed on the database. If not properly maintained, the transaction logfile can become very large. If the size of the transaction logfile reaches its maximum limit or the disk hosting file is running out of space, the user will receive an error and the system will not allow us to create new transactions. In this recipe we will see how to shrink the transaction logfile.
Getting ready
Make a complete backup of the database and store it in an offline location.
How to do it...
Open SQL Server Management Studio and connect to the server that holds the NAV database.
Click on New Query.
Then select the NAV database in the database dropdown.
Enter the following code in the query window:
BACKUP LOG <MyDatabase> WITH TRUNCATE_ONLY
Press F5 to run the query.
Delete the previous SQL statement from the Query window and add the following code:
DBCC SHRINKFILE (Logfilename, Newsize)
Press F5 to run...