{"id":451,"date":"2018-08-20T13:15:01","date_gmt":"2018-08-20T13:15:01","guid":{"rendered":"https:\/\/www.pcvita.com\/blog\/?p=451"},"modified":"2021-12-18T10:20:07","modified_gmt":"2021-12-18T04:50:07","slug":"fix-sql-server-error-1813","status":"publish","type":"post","link":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html","title":{"rendered":"SQL Attach Database Error 1813: How to Get Rid of This"},"content":{"rendered":"<div class=\"alert alert-danger\" role=\"alert\">\n<p><i>\u201cI attached log file to the SQL Server and I received an error message saying \u201cSQL Attach Database Error 1813\u201d I do not know why it is showing SQL Server error 1813. The database seems fine to me but showing this error. Please tell me solution to get rid of this error message.\u201d<\/i><\/p>\n<\/div>\n<p>If you are looking for a solution to solve SQL Server error 1813, this is the perfect place. In this write-up, we will share workarounds that can be used to fix SQL Server Error 1813 Attach Database<\/p>\n<p>First, let us learn what could be the possible reason for getting the SQL error message 1813.<\/p>\n<h2 class=\"heading-style\">SQL Attach Database Error 1813 \u2013 Cause<\/h2>\n<p>The reason for this error is simple and straightforward. If a user attempts to attach any corrupt database file to new SQL Server, they will get SQL Server error 1813. In order to know its remedial method, go to the next section.<\/p>\n<h2 class=\"heading-style\">SQL Server Error 1813 Attach Database \u2013 Quick way to Fix<\/h2>\n<p>Since the error is occurring due to the damaged log files of SQL database, the option we have is to rebuild the database. Then it will become corruption-free and operational. Here is the manual technique to fix SQL Server Error 1813 Attach Database<\/p>\n<p><strong>Caution:<\/strong> This process is quite long and users need to perform each and every step attentively to achieve the desired result.<\/p>\n<p><b>Manual Process of Fixing SQL Server Error 1813<\/b><\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li>First, create a new database. This database must have the same name as the one you want to fix. Also make sure that names of MDF and LDF files stay similar to the earlier ones.<\/li>\n<li>Close any running instances of SQL Server.<\/li>\n<li>Now, you have to move the original SQL MDF file to the new location and replace the newly created MDF file.<\/li>\n<li>Delete the LDF file from the new SQL database.<\/li>\n<li>Now start SQL Server and You will notice that the database will be notified as marked as Suspect.<\/li>\n<li>Run these commands to make sure you will be allowed to upgrade values in the System tables of Master database.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<pre><code>USE MASTER\r\nGO\r\nsp_CONFIGURE \u2018allow updates\u2019, 1\r\nRECONFIGURE WITH OVERRIDE\r\nGO<\/code><\/pre>\n<ol>\n<li>Set Emergency mode for the SQL Server.\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>This command will display the present status of the database.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code>SELECT * FROM alldatabases WHERE name= Database_Name<\/code><\/pre>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Run this command to update one row of the database.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code>BEGIN\r\nUPDATE alldatabases\r\nSET status = 32768\r\nWHERE name = \u2018Database_Name\u2019\r\nCOMMIT TRAN<\/code><\/pre>\n<\/li>\n<li>Restart SQL Server.<br \/>\n<strong>Note:<\/strong> This is a compulsory step of this method. If it is not done, SQL Server will encounter an error.<\/li>\n<li>Go to SQL Server Management Studio\u2019s query window to execute the \u2018DBCC command.\u2019 This will result in creating a new log file.<br \/>\n<strong>Note\u2013<\/strong> This new LDF file should bear the same name of the recently deleted LDF file.<\/p>\n<pre><code>DBCC TRACEON (3604)\r\nDBCC REBUILD_LOG(Database_Name, \u2018C:\\Database_Name_log.ldf \u2018)\r\nGO<\/code><\/pre>\n<\/li>\n<li>Reset the database status by running the command:<\/li>\n<li>\n<pre><code>sp_RESETSTATUS Database_Name\r\nGO<\/code><\/pre>\n<\/li>\n<li>Turn off \u2018system tables\u2019 update of Master database by running this script:\n<pre><code>USE MASTER\r\nGO\r\nsp_CONFIGURE \u2018allow updates\u2019, 0\r\nRECONFIGURE WITH OVERRIDE\r\nGO<\/code><\/pre>\n<\/li>\n<li>Change the database status to the Single user mode.\n<pre><code>sp_DBOPTION \u2018Database_Name\u2019 , \u2018single user\u2019 , \u2018true\u2019<\/code><\/pre>\n<\/li>\n<li>If the database is still not running on multi-user mode, run this command:\n<pre><code>sp_DBOPTION \u2018Database_Name\u2019 , \u2018single user\u2019 , \u2018false\u2019<\/code><\/pre>\n<\/li>\n<\/ol>\n<h3 class=\"heading-style\">Resolve SQL Server Error 1813 Attach Database &#8211; Short and Simple Way<\/h3>\n<p>As we can see, the above-mentioned method is a lengthy process and requires the attention of the user while performing step by step process. So here is a simple and quick solution that is equally effective. Users can opt for <a href=\"https:\/\/www.pcvita.com\/sql-database-recovery.html\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>SQL Recovery Tool<\/strong><\/a>. The software removes all types of corruption from MDF and NDF files. Use this application and quickly fix SQL Server error 1813.<\/p>\n<p><a class=\"btn btn-success btn-lg btn-md-block p-3 text-white\" href=\"https:\/\/systoolskart.com\/download\/SYS1S2Q7L\/18\">Download<\/a> <a class=\"btn btn-lg btn-md-block text-white\" style=\"background: #ff6800; color: #fff !important;\" href=\"https:\/\/systoolskart.com\/buy\/SYS1S2Q7L\/18\" target=\"_blank\" rel=\"noopener noreferrer\"> Purchase Now<\/a><\/p>\n<h3 class=\"heading-style\">Conclusion:<\/h3>\n<p>The blog covers the SQL Server Error 1813 attach database. The error occurs when you try to attach corrupted log to SQL Server. The blog discusses the manual as well as an automated approach to resolve SQL Server error 1813.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201cI attached log file to the SQL Server and I received an error message saying \u201cSQL Attach Database Error 1813\u201d <\/p>\n","protected":false},"author":17,"featured_media":451,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[313],"class_list":["post-451","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","tag-sql-attach-database-error-1813"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What to Do to Fix SQL Server Error 1813 Attach Database<\/title>\n<meta name=\"description\" content=\"Check out the resolution to fix SQL Server Error 1813 Attach Database. Read what could be the possible cause of getting SQL Attach database error.\" \/>\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.pcvita.com\/blog\/fix-sql-server-error-1813.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What to Do to Fix SQL Server Error 1813 Attach Database\" \/>\n<meta property=\"og:description\" content=\"Check out the resolution to fix SQL Server Error 1813 Attach Database. Read what could be the possible cause of getting SQL Attach database error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html\" \/>\n<meta property=\"og:site_name\" content=\"PCVITA Official Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-20T13:15:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-18T04:50:07+00:00\" \/>\n<meta name=\"author\" content=\"Mohit Jha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mohit Jha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html\"},\"author\":{\"name\":\"Mohit Jha\",\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/#\\\/schema\\\/person\\\/46d7590809ce0596a0f14a1fbc5d56fe\"},\"headline\":\"SQL Attach Database Error 1813: How to Get Rid of This\",\"datePublished\":\"2018-08-20T13:15:01+00:00\",\"dateModified\":\"2021-12-18T04:50:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html\"},\"wordCount\":595,\"image\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdnxtra.com\\\/feature\\\/sql-attach-database-error-1813.jpg\",\"keywords\":[\"SQL Attach Database Error 1813\"],\"articleSection\":[\"General\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html\",\"url\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html\",\"name\":\"What to Do to Fix SQL Server Error 1813 Attach Database\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdnxtra.com\\\/feature\\\/sql-attach-database-error-1813.jpg\",\"datePublished\":\"2018-08-20T13:15:01+00:00\",\"dateModified\":\"2021-12-18T04:50:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/#\\\/schema\\\/person\\\/46d7590809ce0596a0f14a1fbc5d56fe\"},\"description\":\"Check out the resolution to fix SQL Server Error 1813 Attach Database. Read what could be the possible cause of getting SQL Attach database error.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html#primaryimage\",\"url\":\"https:\\\/\\\/cdnxtra.com\\\/feature\\\/sql-attach-database-error-1813.jpg\",\"contentUrl\":\"https:\\\/\\\/cdnxtra.com\\\/feature\\\/sql-attach-database-error-1813.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/fix-sql-server-error-1813.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pcvita.com\\\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Attach Database Error 1813: How to Get Rid of This\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/\",\"name\":\"PCVITA Official Blog\",\"description\":\"Technology Solution that Matters\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/#\\\/schema\\\/person\\\/46d7590809ce0596a0f14a1fbc5d56fe\",\"name\":\"Mohit Jha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a4339547039990f13c5d3fd6ffce8722244e886b0d2b3fb9867d307b00d81ada?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a4339547039990f13c5d3fd6ffce8722244e886b0d2b3fb9867d307b00d81ada?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a4339547039990f13c5d3fd6ffce8722244e886b0d2b3fb9867d307b00d81ada?s=96&d=mm&r=g\",\"caption\":\"Mohit Jha\"},\"description\":\"Mohit is a Microsoft-certified expert who has assisted thousands of clients with Outlook &amp; Microsoft Office 365 issues. He enjoys writing on email clients as well as data migration. He is always excited about giving troubled readers the most up-to-date knowledge, explanation, and refinements.\",\"sameAs\":[\"https:\\\/\\\/in.linkedin.com\\\/in\\\/mohitkumarjha\",\"https:\\\/\\\/www.pcvita.com\\\/assets\\\/author\\\/mohit.png\"],\"url\":\"https:\\\/\\\/www.pcvita.com\\\/blog\\\/author\\\/mohit\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What to Do to Fix SQL Server Error 1813 Attach Database","description":"Check out the resolution to fix SQL Server Error 1813 Attach Database. Read what could be the possible cause of getting SQL Attach database error.","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.pcvita.com\/blog\/fix-sql-server-error-1813.html","og_locale":"en_US","og_type":"article","og_title":"What to Do to Fix SQL Server Error 1813 Attach Database","og_description":"Check out the resolution to fix SQL Server Error 1813 Attach Database. Read what could be the possible cause of getting SQL Attach database error.","og_url":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html","og_site_name":"PCVITA Official Blog","article_published_time":"2018-08-20T13:15:01+00:00","article_modified_time":"2021-12-18T04:50:07+00:00","author":"Mohit Jha","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mohit Jha","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html#article","isPartOf":{"@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html"},"author":{"name":"Mohit Jha","@id":"https:\/\/www.pcvita.com\/blog\/#\/schema\/person\/46d7590809ce0596a0f14a1fbc5d56fe"},"headline":"SQL Attach Database Error 1813: How to Get Rid of This","datePublished":"2018-08-20T13:15:01+00:00","dateModified":"2021-12-18T04:50:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html"},"wordCount":595,"image":{"@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html#primaryimage"},"thumbnailUrl":"https:\/\/cdnxtra.com\/feature\/sql-attach-database-error-1813.jpg","keywords":["SQL Attach Database Error 1813"],"articleSection":["General"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html","url":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html","name":"What to Do to Fix SQL Server Error 1813 Attach Database","isPartOf":{"@id":"https:\/\/www.pcvita.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html#primaryimage"},"image":{"@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html#primaryimage"},"thumbnailUrl":"https:\/\/cdnxtra.com\/feature\/sql-attach-database-error-1813.jpg","datePublished":"2018-08-20T13:15:01+00:00","dateModified":"2021-12-18T04:50:07+00:00","author":{"@id":"https:\/\/www.pcvita.com\/blog\/#\/schema\/person\/46d7590809ce0596a0f14a1fbc5d56fe"},"description":"Check out the resolution to fix SQL Server Error 1813 Attach Database. Read what could be the possible cause of getting SQL Attach database error.","breadcrumb":{"@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html#primaryimage","url":"https:\/\/cdnxtra.com\/feature\/sql-attach-database-error-1813.jpg","contentUrl":"https:\/\/cdnxtra.com\/feature\/sql-attach-database-error-1813.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pcvita.com\/blog\/fix-sql-server-error-1813.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pcvita.com\/blog"},{"@type":"ListItem","position":2,"name":"SQL Attach Database Error 1813: How to Get Rid of This"}]},{"@type":"WebSite","@id":"https:\/\/www.pcvita.com\/blog\/#website","url":"https:\/\/www.pcvita.com\/blog\/","name":"PCVITA Official Blog","description":"Technology Solution that Matters","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pcvita.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.pcvita.com\/blog\/#\/schema\/person\/46d7590809ce0596a0f14a1fbc5d56fe","name":"Mohit Jha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a4339547039990f13c5d3fd6ffce8722244e886b0d2b3fb9867d307b00d81ada?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a4339547039990f13c5d3fd6ffce8722244e886b0d2b3fb9867d307b00d81ada?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a4339547039990f13c5d3fd6ffce8722244e886b0d2b3fb9867d307b00d81ada?s=96&d=mm&r=g","caption":"Mohit Jha"},"description":"Mohit is a Microsoft-certified expert who has assisted thousands of clients with Outlook &amp; Microsoft Office 365 issues. He enjoys writing on email clients as well as data migration. He is always excited about giving troubled readers the most up-to-date knowledge, explanation, and refinements.","sameAs":["https:\/\/in.linkedin.com\/in\/mohitkumarjha","https:\/\/www.pcvita.com\/assets\/author\/mohit.png"],"url":"https:\/\/www.pcvita.com\/blog\/author\/mohit"}]}},"_links":{"self":[{"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/posts\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":0,"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/posts\/451\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/posts\/451"}],"wp:attachment":[{"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/media?parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/categories?post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pcvita.com\/blog\/wp-json\/wp\/v2\/tags?post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}