Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Shrink Log File in SQL Navision

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Shrink log file in SQL (Navision)

Steps to shrink log file in a Navision SQL database. This procedure applies for a one off case, such as the first time you convert a C/SIDE database to a SQL database in this case you have no need for the LOG file backup, and just want to shrink the file. Before starting this process, make certain you have created a full backup.

Open SQL Server Management Studio Locate the database. Click the "New Query" button to open a new query window, making sure that the right database is selected in the database dropdown box Run the following query BACKUP LOG MyDatabaseName WITH TRUNCATE_ONLY (where MyDatabaseName is the name of your database)

This command removes all active transactions from the transaction log, without actually creating a backup file. It leaves the file size intact, so in effect it reduces the portion of the file that is in use. Basically truncating the log file turns it into a largely empty file. The next step is to decrease the file size to a manageable size. DBCC SHRINKFILE(MyDatabaseName_log,<filesize>) (where MyDatabaseName_log is the logical file name, and <filesize> is the target size in MB) The log file has now been shrunk. Note that the log file will start expanding in normal operation, depending on the way the database is defined. Make sure that the transaction log file is big enough to store all transactions for the normal period between backups. Makes sure that you take peak system loads into consideration when determining the target size.

You might also like