Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove existing log file and create new log file in sql server

Tags:

I have log file which is grown to 1TB. I have no need of log file. Just want to delete the old log file and create a new one instead of old log file.

How can I achieve that ? will it cause any other problem? pleas help.

like image 487
vignesh Avatar asked Jul 19 '18 10:07

vignesh


2 Answers

Right mouse button on the database and

TASKS -> SHRINK -> FILES

Then choose the option that interests you

More :

https://docs.microsoft.com/en-us/sql/relational-databases/databases/shrink-a-file?view=sql-server-2017

like image 168
Killer Queen Avatar answered Sep 28 '22 18:09

Killer Queen


I made a backup of the database (very important just in case something fails or trying something else you brake up things!) and then I detached and reatached the database, but deleting the ldf file from the reataching window. This creates a new ldf file as expected in the original database but empty.

enter image description here

More details here: https://inapp.com/delete-sql-server-database-transaction-log-file/

like image 41
Juan Ignacio Avendaño Huergo Avatar answered Sep 28 '22 17:09

Juan Ignacio Avendaño Huergo