How to remove the log file of the MSSQL database. (dbname_log.ldf)
Select the database > Right click > tasks > Backup (take a backup of the database for the safety)
Select the database > Right click > tasks > New query > change the db to offline using the below command.
USE master
GO
ALTER DATABASE YourDatabaseName
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
Then detach the database
Select the database >> Right click >> tasks >> Detach
Then remove the ldf log file of the db(for safety do back the file)
Go to C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA (may change according to the configuration)
==> db_name_log.ldf <==
Attach the database
Go to the top >> Right click on the "Databases" >> attach >>
Add >>
Select the prefered database's .mdf file >> OK.
Then you can see both the mdf and ldf file (near ldf file, a message will be there as it is not found. select the ldf file and proceed to remove >> Then click OK.
Post A Comment:
0 comments: