Answered by:
Ldf elimination scenario

Question
-
Hi, Thank you for the scenario below
Existing Database and Detect It
And create a new ldf file
And attach it
Check and solve by step
Provide all possible problems
Pivot
Sunday, September 2, 2018 12:00 PM
Answers
-
Why? Is it too big? So you can you use DBCC SHRINKFILE command
Anyway
You need detach the database and then remove .LDF file ( think about again) , then attach the database with only single file
https://www.sqlserverlogexplorer.com/how-to-attach-mdf-file-without-ldf-file/
Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance
SQL Server Integration Services: Business Intelligence
- Marked as answer by MohammadBayat Monday, September 3, 2018 5:50 AM
- Unmarked as answer by MohammadBayat Monday, September 3, 2018 12:54 PM
- Marked as answer by MohammadBayat Monday, September 3, 2018 12:57 PM
Sunday, September 2, 2018 1:00 PMAnswerer
All replies
-
sorry what was the question?
Are you asking on adding an extra log file for the db?
like
Read this to understand why its not recommended
https://www.sqlskills.com/blogs/paul/multiple-log-files-and-why-theyre-bad/
If your attempt is to associate a new log file for the db while attaching
see
https://www.mssqltips.com/sqlservertip/3579/how-to-attach-a-sql-server-database-without-a-transaction-log-and-with-open-transactions/
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
- Edited by Visakh16MVP Sunday, September 2, 2018 12:06 PM
Sunday, September 2, 2018 12:04 PM -
No, I wanted to delete the previous file altogether and add a new file log
Pivot
Sunday, September 2, 2018 12:49 PM -
Why? Is it too big? So you can you use DBCC SHRINKFILE command
Anyway
You need detach the database and then remove .LDF file ( think about again) , then attach the database with only single file
https://www.sqlserverlogexplorer.com/how-to-attach-mdf-file-without-ldf-file/
Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance
SQL Server Integration Services: Business Intelligence
- Marked as answer by MohammadBayat Monday, September 3, 2018 5:50 AM
- Unmarked as answer by MohammadBayat Monday, September 3, 2018 12:54 PM
- Marked as answer by MohammadBayat Monday, September 3, 2018 12:57 PM
Sunday, September 2, 2018 1:00 PMAnswerer -
No, I wanted to delete the previous file altogether and add a new file log
Pivot
Hmm
Delete existing log?
Why?
Are you constantly doing log backups?
what is the recovery model used for the db?
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook PageSunday, September 2, 2018 1:20 PM -
I was asked to do this any way that I have, and my recovery method is Full Recovery
Pivot
Sunday, September 2, 2018 1:46 PM -
>I was asked to do this any way that I have
Perhaps the instructions were unclear, or the person asking doesn't understand how SQL Server works.
You never remove the log file in SQL Server. If for some strange reason you had multiple log files, you can remove all but one. But for each SQL Server database a single database log file is cleared and reused.
See Transaction Log Physical Architecture
Microsoft Technology Center - Dallas
My blog- Edited by davidbaxterbrowneMicrosoft employee Sunday, September 2, 2018 4:18 PM
- Proposed as answer by Will_KongMicrosoft contingent staff Monday, September 3, 2018 2:18 AM
Sunday, September 2, 2018 4:18 PM -
I was asked to do this any way that I have, and my recovery method is Full Recovery
Pivot
Hi Pivot,
Since your SQL Sever recovery model is full recovery mode, you couldn't delete transaction log file any more. Because Full recovery mode requires transaction log file to restore. Based on this, I think you need to read these articles for better understanding, please see:
Recovery Model Overview ( Please turn to full recover mode section)
Full Database Backups (SQL Server)
Complete Database Restores (Full Recovery Model)
Best Regards,
Will
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Monday, September 3, 2018 2:18 AM -
To do this we first simplify it. Once we have separated and done, we will complete the re- Full
Pivot
Monday, September 3, 2018 3:39 AM -
In the organization I work, I do not have permission to use the order of DBCC SHRINKFILE
Pivot
Monday, September 3, 2018 4:03 AM