Shrink DataBase log file - Sql 2012

Hi,
I had situation, when my log file size is increased and there is no space in my drive. so I could not able to login to Ax. I used the shrink data base file option to reduced the log file size.

For that, I have done below steps,
1) stopped my AOS service
2) Open SQL 2012 management studio
3) To set the Recovery model =  "SIMPLE" for your DB. (my case AxDevDB) (Choose Your DB, right click and go to properties and then go to Option tab to see the recovery model)
4) Right click the DB and choose SHRINK -> File and choose the AXDevDB_log file and press ok. (it will reduce 99% of the log file size).
5) To set back the Recovery model = "FULL" for your DB.
6) Start the AOS Service.

To run the SQL Script, use below,

USE AxDevDB;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AxDevDB
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AxDevDB_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE AxDevDB
SET RECOVERY FULL;
GO

Link:
https://technet.microsoft.com/en-us/library/ms189493(v=sql.105).aspx
Thanks,
Vijaykarthik

Comments

Popular posts from this blog

x++ code to Generate cheque for vendor payment journal

Copy favorites From one user to another user - Ax 2012

Import Procurement Hierarchy / Categories with out code in ax 2012