{"id":93318,"date":"2022-01-13T11:01:26","date_gmt":"2022-01-13T11:01:26","guid":{"rendered":"https:\/\/www.stellarinfo.com\/blog\/?p=93318"},"modified":"2025-04-10T10:02:29","modified_gmt":"2025-04-10T10:02:29","slug":"rebuild-sql-database-with-corrupted-or-deleted-log-file","status":"publish","type":"post","link":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/","title":{"rendered":"How to Rebuild SQL Database with Corrupted or Deleted Log File?"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><?xml encoding=\"utf-8\" ?><h2 class=\"wp-block-heading\" id=\"overview-of-the-issue\">Overview of the Issue<\/h2><p>Every SQL database comprises of three file types viz. Main or Primary Database files (.mdf), Secondary database files (.ndf) and Transactional Log files (.ldf). While the main database files and secondary files are used to store database objects like tables, views, indexes, etc., the log files (.ldf) store the transactional logs and changes made by every transaction. The SQL server engine reads the complete log files and performs the recovery process when the SQL Server is started. However, if the reading or recovery process fails, the database remains offline, and it is marked&nbsp;&lsquo;<a href=\"https:\/\/www.stellarinfo.com\/blog\/recover-sql-database-from-suspect-mode\/\" target=\"_blank\" rel=\"noreferrer noopener\">Suspect<\/a>&rsquo;&nbsp;or&nbsp;&lsquo;Recovery Pending&rsquo;&nbsp;as per the stage at which failure occurred. This article will discuss the probable causes for corrupt log files, and then we will discuss the solutions to rebuild the SQL database.<\/p><h2 class=\"wp-block-heading\" id=\"reasons-for-corrupt-transactional-log-files\">Reasons for Corrupt Transactional Log Files<\/h2><p>The transaction log files are record files of the SQL database and are critical for recovery. Several reasons may render the log files in the SQL database corrupt. These reasons include:<\/p><ol class=\"wp-block-list\">\n<li>Unexpected termination or forced system shutdown.<\/li>\n\n\n\n<li>Malware or virus attacks on the system, causing file damage or making the database inaccessible.<\/li>\n\n\n\n<li>Increased size of log files resulting in lack of free space and exceeded configured maximum file size.<\/li>\n\n\n\n<li>Configuration issues with the I\/O subsystem used to host the system and user database files.<\/li>\n\n\n\n<li>Changes in the SQL Server Account.<\/li>\n\n\n\n<li>Accidental data deletion.<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"ways-to-rebuild-sql-database-with-corrupt-or-deleted-log-files\">Ways to Rebuild SQL Database With Corrupt or Deleted Log Files<\/h2><p>Before we start with any method, it is important to check the SQL Server error logs and events logs and if you come across an error caused due to hardware issues, you need to get it repaired and see if the problem is resolved. If there is no hardware issue, start with the methods below:<\/p><h3 class=\"wp-block-heading\" id=\"h-method-1-recover-database-from-an-existing-backup\">Method 1 &ndash; <strong>Recover Database from an Existing Backup<\/strong><\/h3><p>To recover a database from an existing backup follow the steps described below:<\/p><p><strong>Step 1: <\/strong>Launch the <strong>&lsquo;SQL Server Management Studio&rsquo;<\/strong> (SSMS).<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"459\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/1-4.png\" alt=\"open ssms\" class=\"wp-image-93330 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/1-4.png 436w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/1-4-285x300.png 285w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/1-4-380x400.png 380w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/figure><p><strong>Step 2: <\/strong>Right-click on the <strong>Databases<\/strong> and select <strong>&lsquo;Restore Database&rsquo;<\/strong>.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"492\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/2-4.png\" alt=\"restore database\" class=\"wp-image-93331 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/2-4.png 442w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/2-4-270x300.png 270w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/2-4-380x423.png 380w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/figure><p><strong>Step 3:<\/strong> In the <strong>&lsquo;Source&rsquo; <\/strong>section on <strong>&lsquo;General&rsquo; <\/strong>page, specify the source and location.<\/p><p><strong>Step 4: <\/strong>Select the database to be restored from the drop-down list.<\/p><p><strong>Note:<\/strong> If you can&rsquo;t find your intended database, it means the backup for it has not been created, and the current method can&rsquo;t be used to repair your database.<\/p><p><strong>Step 5: <\/strong>Click the [<strong>&hellip;]<\/strong> button to open the &lsquo;<strong>Select Backup Devices&rsquo; <\/strong>box and choose the <strong>&lsquo;Backup Media Type&rsquo; <\/strong>from the drop-down list.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"494\" height=\"367\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture.png\" alt=\"choose backup media type\" class=\"wp-image-93332 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture.png 494w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture-300x223.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture-380x282.png 380w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/figure><p><strong>Step 6: <\/strong>Click <strong>&lsquo;Add&rsquo;<\/strong> to open a dialogue box describing what you can select to restore.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"494\" height=\"367\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture1.png\" alt=\"add backup file\" class=\"wp-image-93333 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture1.png 494w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture1-300x223.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/Capture1-380x282.png 380w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/figure><p><strong>Step 7: <\/strong>Once you are done with selecting the options in &lsquo;<strong>Backup Media&rsquo;<\/strong> list, click &lsquo;<strong>OK&rsquo;<\/strong> to return to the &lsquo;<strong>General&rsquo;<\/strong> page.<\/p><p><strong>Step 8: <\/strong>Select the database name you want to restore from the list box.<\/p><p><strong>Step 9:<\/strong> Leave the <strong>&lsquo;Restore to&rsquo; <\/strong>option set at<strong> &lsquo;To the last backup taken&rsquo; <\/strong>or select a backup of your choice from the <strong>&lsquo;Timeline&rsquo; <\/strong>and click <strong>&lsquo;OK&rsquo;<\/strong>.<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"472\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/123.png\" alt=\"database restore options\" class=\"wp-image-93334 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/123.png 858w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/123-300x165.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/123-768x422.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/123-380x209.png 380w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/123-550x303.png 550w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/123-800x440.png 800w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/figure><p><strong>Step 10<\/strong>: Select the backups to restore from the <strong>&lsquo;Backup Sets to Restore&rsquo; <\/strong>grid and click <strong>&lsquo;OK&rsquo;<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-method-2-rebuild-damaged-or-corrupted-transaction-log-file\">Method 2 &ndash; Rebuild Damaged or Corrupted Transaction Log file<\/h3><p>To rebuild a corrupt or damaged SQL Server log file, you need to put the database in Emergency mode. First, make sure that your data has backup and follow the steps below:<\/p><p><strong>Step 1: <\/strong>Use the below command to set your database in &lsquo;<strong>Emergency Mode&rsquo;.<\/strong><\/p><pre class=\"wp-block-code command_container\"><code>USE master\nGO\nALTER DATABASE [Database_name] SET EMERGENCY\nGO\nALTER DATABASE [Database_name] SET SINGLE_USER\nGO<\/code><\/pre><p><strong>Step 2: <\/strong>Now that the database is set to Single User mode, execute the <strong>DBCC CHECKDB<\/strong> command with <strong>REPAIR_ALLOW_DATA_LOSS <\/strong>option.<\/p><pre class=\"wp-block-code command_container\"><code>DBCC CHECKDB ([DATABASE_NAME], REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS, ALL ERRORMSGS;\nGO<\/code><\/pre><p><strong>Caution<\/strong>! It is important to know that you might lose data while executing the DBCC CHECKDB command with REPAIR_ALLOW_DATA_LOSS option.<\/p><blockquote class=\"note_alert\">\n<p><strong>Note: <\/strong>If the corruption still exists, use the following query to rebuild the log file. Before running this query, put the database to Offline Mode and change the name of the corrupt log file.<\/p>\n<\/blockquote><pre class=\"wp-block-code command_container\"><code>ALTER DATABASE [original_log_file_name] REBUILD LOG ON (NAME= logicalname, FILENAME=&rsquo;C:\\Program Files\\Microsoft SQL Server\\MSSQLn.MSSQLSERVER\\MSSQL\\DATA\\file_name.ldf&rsquo;)<\/code><\/pre><p>If this method seems a bit difficult and you wish to adopt an easier and effective method then follow the next method.<\/p><h3 class=\"wp-block-heading\" id=\"h-method-3-repair-the-sql-database-using-stellar-repair-for-ms-sql\">Method 3 &ndash; Repair the SQL Database Using Stellar Repair for MS SQL<\/h3><p>Use a <a href=\"https:\/\/www.stellarinfo.com\/sql-database-repair.php\" target=\"_blank\" rel=\"noreferrer noopener\">SQL Repair tool<\/a> like Stellar Repair for MS SQL to restore the database without any complexities. The software uses advanced algorithms to repair corrupt MDF and NDF files. Once repaired, a new transaction log file (.ldf) is created. Follow the steps below to repair and rebuild your SQL log file:<\/p><p><strong>Step 1:<\/strong> Download the Stellar Repair for MS SQL.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/cloud.stellarinfo.com\/StellarRepairforMSSQL-Blog.exe\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"72\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2021\/12\/free-download-1-3.png\" alt=\"Stellar\" class=\"wp-image-91223 apply-gradient-on-post-images\"><\/a><\/figure>\n<\/div><p><strong>Step 2: <\/strong>Once download is complete, run the software. This opens a <strong>&lsquo;Select Database&rsquo; <\/strong>window with options to browse or find the corrupt MDF file.<\/p><figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"582\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-1024x582.png\" alt=\"options to select corrupt mdf file\" class=\"wp-image-93365 apply-gradient-on-post-images\" style=\"width:768px;height:437px\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-1024x582.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-300x170.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-768x436.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-380x216.png 380w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-550x312.png 550w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-800x454.png 800w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1-1160x659.png 1160w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/select-the-corrupt-sql-database-file-img-1.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>Step 3: <\/strong>Once you have located the file click the <strong>&lsquo;Repair&rsquo; <\/strong>tab at the bottom right corner of the window to start the repairing process.<\/p><p><strong>Step 4:<\/strong> A preview of the repaired database and its components get displayed.<\/p><figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"584\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-1024x584.png\" alt=\"preview of repaired sql databaae components\" class=\"wp-image-93366 apply-gradient-on-post-images\" style=\"width:768px;height:438px\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-1024x584.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-300x171.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-768x438.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-380x217.png 380w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-550x314.png 550w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-800x456.png 800w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6-1160x662.png 1160w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/preview-repaired-db-objects-6.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>Step 5:<\/strong> After verifying the data, click <strong>&lsquo;Save&rsquo;<\/strong>.<\/p><figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"770\" height=\"148\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/save-option-in-sql-repair.png\" alt=\"save option in Stellar Repair for MS SQL\" class=\"wp-image-93367 apply-gradient-on-post-images\" style=\"width:578px;height:111px\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/save-option-in-sql-repair.png 770w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/save-option-in-sql-repair-300x58.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/save-option-in-sql-repair-768x148.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/save-option-in-sql-repair-380x73.png 380w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/save-option-in-sql-repair-550x106.png 550w\" sizes=\"auto, (max-width: 770px) 100vw, 770px\" \/><\/figure><p><strong>Step 6: <\/strong>To proceed with the repaired database saving process, choose any of these options: <\/p><ul id=\"block-1e0446f9-81e6-4c6b-a86d-af8e76427c21\" class=\"wp-block-list\">\n<li><strong>New Database<\/strong> &ndash; This option saves the data in a new database with &lsquo;Recovered&rsquo; prefixed to the database name.<\/li>\n\n\n\n<li><strong>Live Database<\/strong> &ndash; This option saves the repaired database in an existing database.<\/li>\n\n\n\n<li><strong>Other Formats<\/strong> &ndash; Using this option, you can save the repaired data in file formats like CSV, HTML, or XLS.<\/li>\n<\/ul><figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"582\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-1024x582.png\" alt=\"repaired database saving options\" class=\"wp-image-93368 apply-gradient-on-post-images\" style=\"width:768px;height:437px\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-1024x582.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-300x171.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-768x437.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-380x216.png 380w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-550x313.png 550w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-800x455.png 800w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7-1160x660.png 1160w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/saving-options-7.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>Step 7: <\/strong>Enter details to connect to your SQL Server instance, select the location to save the repaired file, then click &lsquo;<strong>Next<\/strong>&lsquo;.<\/p><figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"582\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-1024x582.png\" alt=\"connect to sql server \" class=\"wp-image-93369 apply-gradient-on-post-images\" style=\"width:768px;height:437px\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-1024x582.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-300x170.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-768x436.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-380x216.png 380w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-550x312.png 550w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-800x454.png 800w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8-1160x659.png 1160w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/connect-to-server-8.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p><strong>Step 8: <\/strong>Choose any of these saving modes:<\/p><ul class=\"wp-block-list\">\n<li><strong>Fast Saving<\/strong> &ndash; Use this mode for saving a large-sized repaired database. This option saves the data first and indexes later for faster database restore.<\/li>\n\n\n\n<li><strong>Standard Saving<\/strong> &ndash; If you need to save the data and indexes together, select the &lsquo;Standard Saving&rsquo; mode.<\/li>\n<\/ul><figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"583\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-1024x583.png\" alt=\"Stellar\" class=\"wp-image-93370 apply-gradient-on-post-images\" style=\"width:768px;height:437px\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-1024x583.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-300x171.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-768x437.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-380x216.png 380w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-550x313.png 550w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-800x456.png 800w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9-1160x661.png 1160w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/file-saving-mode-9.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>Step 9: Once the database is saved, <strong>&lsquo;File saved successfully&rsquo; <\/strong>message appears. <\/p><h2 class=\"wp-block-heading\" id=\"to-conclude\"><strong>To Conclude<\/strong><\/h2><p>It is pertinent to highlight that there are very scarce methods to repair SQL Server databases. Furthermore, even those available methods may be quite hectic to follow. Therefore, it is easier and more convenient to follow the next option and repair your SQL database using Stellar Repair for MS SQL. It provides a simplified yet effective user interface and recovers all database components such as schemas, triggers, tables, keys, etc., with utmost accuracy. Moreover, once you have your main data files and secondary data files repaired, you will have access to the corrupt or deleted transaction log files (.ldf) as well.<\/p><h3 class=\"wp-block-heading\" id=\"h-faqs\"><strong>FAQs<\/strong><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Overview of the Issue Every SQL database comprises of three file types&hellip; <a class=\"more-link\" href=\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\">Continue reading <span class=\"screen-reader-text\">How to Rebuild SQL Database with Corrupted or Deleted Log File?<\/span><\/a><\/p>\n","protected":false},"author":34,"featured_media":93352,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-93318","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-recovery","entry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Rebuild SQL Database with Corrupted or Deleted Log File?<\/title>\n<meta name=\"description\" content=\"This blog discusses the possible reasons for log file corruption and solutions to rebuild a SQL database with corrupted or deleted log files.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Rebuild SQL Database with Corrupted or Deleted Log File?\" \/>\n<meta property=\"og:description\" content=\"This blog discusses the possible reasons for log file corruption and solutions to rebuild a SQL database with corrupted or deleted log files.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Stellar Data Recovery Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-13T11:01:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-10T10:02:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Charanjeet Kaur\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Charanjeet Kaur\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\"},\"author\":{\"name\":\"Charanjeet Kaur\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/4bcf0d3fb4f61fce73560518655de4f2\"},\"headline\":\"How to Rebuild SQL Database with Corrupted or Deleted Log File?\",\"datePublished\":\"2022-01-13T11:01:26+00:00\",\"dateModified\":\"2025-04-10T10:02:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\"},\"wordCount\":1063,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg\",\"articleSection\":[\"SQL Database Repair\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\",\"name\":\"How to Rebuild SQL Database with Corrupted or Deleted Log File?\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg\",\"datePublished\":\"2022-01-13T11:01:26+00:00\",\"dateModified\":\"2025-04-10T10:02:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/4bcf0d3fb4f61fce73560518655de4f2\"},\"description\":\"This blog discusses the possible reasons for log file corruption and solutions to rebuild a SQL database with corrupted or deleted log files.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg\",\"contentUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg\",\"width\":1000,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.stellarinfo.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Rebuild SQL Database with Corrupted or Deleted Log File?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/\",\"name\":\"Stellar Data Recovery Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/4bcf0d3fb4f61fce73560518655de4f2\",\"name\":\"Charanjeet Kaur\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a4660bcceddd78a5c4de4caf8ed709c17893427075cd639070c6dc090adc520f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a4660bcceddd78a5c4de4caf8ed709c17893427075cd639070c6dc090adc520f?s=96&d=mm&r=g\",\"caption\":\"Charanjeet Kaur\"},\"description\":\"Charanjeet is a Technical Content Writer at Stellar\u00aewho specializes in writing about databases, e-mail recovery, and e-mail migration solutions. She loves researching and developing content that helps database administrators, organizations and novices to fix multiple problems related to MS SQL and MySQL databases and Microsoft Exchange.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/charanjeet-kaur-1b791920\/\"],\"url\":\"https:\/\/www.stellarinfo.com\/blog\/author\/charanjeet\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Rebuild SQL Database with Corrupted or Deleted Log File?","description":"This blog discusses the possible reasons for log file corruption and solutions to rebuild a SQL database with corrupted or deleted log files.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/","og_locale":"en_US","og_type":"article","og_title":"How to Rebuild SQL Database with Corrupted or Deleted Log File?","og_description":"This blog discusses the possible reasons for log file corruption and solutions to rebuild a SQL database with corrupted or deleted log files.","og_url":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/","og_site_name":"Stellar Data Recovery Blog","article_published_time":"2022-01-13T11:01:26+00:00","article_modified_time":"2025-04-10T10:02:29+00:00","og_image":[{"width":1000,"height":600,"url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg","type":"image\/jpeg"}],"author":"Charanjeet Kaur","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Charanjeet Kaur","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#article","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/"},"author":{"name":"Charanjeet Kaur","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/4bcf0d3fb4f61fce73560518655de4f2"},"headline":"How to Rebuild SQL Database with Corrupted or Deleted Log File?","datePublished":"2022-01-13T11:01:26+00:00","dateModified":"2025-04-10T10:02:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/"},"wordCount":1063,"commentCount":0,"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg","articleSection":["SQL Database Repair"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/","url":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/","name":"How to Rebuild SQL Database with Corrupted or Deleted Log File?","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage"},"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg","datePublished":"2022-01-13T11:01:26+00:00","dateModified":"2025-04-10T10:02:29+00:00","author":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/4bcf0d3fb4f61fce73560518655de4f2"},"description":"This blog discusses the possible reasons for log file corruption and solutions to rebuild a SQL database with corrupted or deleted log files.","breadcrumb":{"@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#primaryimage","url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg","contentUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/01\/How-to-rebuild-SQL-database-with-corrupted-or-deleted-log-file.jpg","width":1000,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/www.stellarinfo.com\/blog\/rebuild-sql-database-with-corrupted-or-deleted-log-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.stellarinfo.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Rebuild SQL Database with Corrupted or Deleted Log File?"}]},{"@type":"WebSite","@id":"https:\/\/www.stellarinfo.com\/blog\/#website","url":"https:\/\/www.stellarinfo.com\/blog\/","name":"Stellar Data Recovery Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/4bcf0d3fb4f61fce73560518655de4f2","name":"Charanjeet Kaur","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a4660bcceddd78a5c4de4caf8ed709c17893427075cd639070c6dc090adc520f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a4660bcceddd78a5c4de4caf8ed709c17893427075cd639070c6dc090adc520f?s=96&d=mm&r=g","caption":"Charanjeet Kaur"},"description":"Charanjeet is a Technical Content Writer at Stellar\u00aewho specializes in writing about databases, e-mail recovery, and e-mail migration solutions. She loves researching and developing content that helps database administrators, organizations and novices to fix multiple problems related to MS SQL and MySQL databases and Microsoft Exchange.","sameAs":["https:\/\/www.linkedin.com\/in\/charanjeet-kaur-1b791920\/"],"url":"https:\/\/www.stellarinfo.com\/blog\/author\/charanjeet\/"}]}},"_links":{"self":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/93318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/comments?post=93318"}],"version-history":[{"count":29,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/93318\/revisions"}],"predecessor-version":[{"id":180565,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/93318\/revisions\/180565"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media\/93352"}],"wp:attachment":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media?parent=93318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/categories?post=93318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/tags?post=93318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}