Microsoft Sql Server 2008 Error 5171 Not Primary Database File
Contents |
(עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) Home20132010Other VersionsLibraryForumsGallery Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Asked by: mdf is not a error 5171 sql server 2008 r2 primary database file. (Microsoft SQL Server, Error: 5171) SQL Server > error 5171 sql server 2012 SQL Server Data Access Question 0 Sign in to vote Hi My database Drive got crashed systools sql recovery and eventually I have to recover the MDF's, LDF's from 3rd party recovery software. I dont have the backup of these databases. When trying to attach
Sql Recovery Software
these DB's in SQL Server 2008. I am getting this error TITLE: Microsoft SQL Server Management Studio ------------------------------ Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476 ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ E:\Data\Database.mdf is not a primary database file. (Microsoft error 5171 sql server 2005 SQL Server, Error: 5171) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=5171&LinkId=20476 Original Database is of SQL Server 2008 and restoring on the same version Friday, August 16, 2013 10:42 AM All replies 1 Sign in to vote Sadly I'm not sure there's anything you can do. It sounds like the data file has corrupted when the drive failed. If that is the case then I don't think there's any way you can get it running. All I can think of is to send the error to Paul Randal (www.sqlskills.com) because if it's possible to recover it then he'll be able to and he's pretty quick at responding to requests. However, you will get a lecture about not having backups... and quite rightly. Friday, August 16, 2013 10:58 AM 0 Sign in to vote Hello, On a first view I would guess your database file is damaged, but it will be difficult to validate this. You could may try the following: Cre
up Recent PostsRecent Posts Popular TopicsPopular Topics Home Search Members Calendar Who's On Home » SQL Server 2008 » Data Corruption (SS2K8 / SS2K8 R2) » How to how to recover mdf file from corrupted resolve error while attach MDF file... How to resolve error while attach MDF file Error
Sp_attach_single_file_db
(5171) Rate Topic Display Mode Topic Options Author Message tamil.selvanmcatamil.selvanmca Posted Friday, November 2, 2012 9:48 AM SSC-Addicted Group: General Forum Members
Stellar Phoenix Sql Recovery
Last Login: Tuesday, September 27, 2016 9:32 AM Points: 430, Visits: 105 While i try to attach the mdf file i got the error, The Error is: DatabaseName.mdf is not SQL Server Database Primary Data FileThe SQL https://social.technet.microsoft.com/Forums/office/en-US/5e952a15-90cb-47a5-8372-1cf854a4cacb/mdf-is-not-a-primary-database-file-microsoft-sql-server-error-5171 server Error No. 5171 Post #1380469 menon.satyenmenon.satyen Posted Friday, November 2, 2012 11:12 AM SSC Rookie Group: General Forum Members Last Login: Friday, August 26, 2016 4:06 PM Points: 25, Visits: 230 Hi,It could be corrupted. Try restoring from a full backup.RegardsSatyen Post #1380520 GilaMonsterGilaMonster Posted Saturday, November 3, 2012 2:16 AM SSC-Forever Group: General Forum Members Last Login: Today @ 9:32 AM Points: 45,423, Visits: 43,752 Restore from a full database backup Gail ShawMicrosoft http://www.sqlservercentral.com/Forums/Topic1380469-2893-1.aspx Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild: Discussions on DB performance with occasional diversions into recoverabilityWe walk in the dark places no others will enterWe stand on the bridge and no one may pass Post #1380677 davegeeitdavegeeit Posted Sunday, November 25, 2012 11:18 PM Forum Newbie Group: General Forum Members Last Login: Wednesday, December 5, 2012 12:06 AM Points: 4, Visits: 3 I found this website on the Google would be work for you. This website offering a free trial version of software, in trial version you can see the preview of recovered data.http://www.repairsqlserver.net/Thanks Post #1388436 ElliswhiteElliswhite Posted Saturday, May 10, 2014 2:26 AM SSC Rookie Group: General Forum Members Last Login: Wednesday, October 29, 2014 2:23 AM Points: 45, Visits: 54 If you persist error while attaching SQL MDF File that mean the MDF file is corrupted you need to restore it from full backup or use any SQL recovery application which provides to export MDF file directly to the SQL Server SSMS Expert Post #1569498 GilaMonsterGilaMonster Posted Saturday, May 10, 2014 3:31 AM SSC-Forever Group: General Forum Members Last Login: Today @ 9:32 AM Points: 45,423, Visits: 43,752 Please note: 2 year old thread. Gail ShawMicrosoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild: Discussions on DB performance with occasional diversions i
SQL database corruption is generally accompanied by various problems. These problems affect database availability and performance on a high scale. The level of corruption in the database decides upon the actual chances of recovery and http://www.stellarsqldatabaserecovery.com/repair-mssql-error5171.php how you can effectively resolve the issue averting every risk of potential data loss. Taking http://www.sqlserver-dba.com/2014/03/error-5171-mdf-is-not-a-primary-database-file.html a particular case, you may encounter an SQL Server login failure or may run into a situation wherein you are unable to restore MS SQL database files. Another issue could be that you cannot create 'tempdb' database or every time you try to attach your database, you are unable to do so. These problems are associated with SQL Error 5171 that states: sql server "Not a primary database file" This error primarily occurs due to invalid registry entries or damaged drivers. The scenarios discussed below are very likely to cause SQL error 5171. Case I Suppose you have MS SQL Server 2005 installed in your system. While using a mirrored database, you attempt to set your database online by executing the following command and receive error 5171. "ALTER DATABASE mydb SET online" In this case, you may use the error 5171 sql procedure given below to fix the issue: Set the database principal. Modify the file information using 'ALTER DATABASE MODIFY FILE' command. Stop the currently running instance of MS SQL Server. Copy your MDF and LDF database files to another directory. Restart the SQL Server and then attach the database files. But, you will surely lose database mirroring after the process. Case II Suppose you use MS SQL Server 2005. Now, you detach your database and upgrade to MS SQL Server 2008. After completing the installation, you try to attach the database again by adding the primary and secondary data files. In this process, you may encounter the below given error message: "M:\ABCDATA2\ABC_1.mdf is not a primary database file. (Microsoft SQL Server, Error: 5171)" As a resolution to the above problem, you can use 'sp_attach_db' for attaching the database. However, this method won't work, if you do not use 'sp_detach_db' for detaching the same database. Another possible remedy is to use 'CREATE DATABASE' command with the 'FOR ATTACH' clause. If problems still persist, you can use Stellar Phoenix SQL Recovery to resolve and repair SQL error 5171. Stellar Phoenix SQL Recovery is a comprehensive tool that embraces a multitude of powerful repair mechanisms to effectively recover every lost, deleted, or inaccessible object from the damaged SQL database. The software allows performing a precise recovery of tables, views, queries, stored procedures,
by FeedBurner SQLServer-DBA.com Links Recent Posts How can I tell if hyperthreading is on Windows 2012 How to schedule Powershell Script with Task Scheduler Lots of NULL values can cause trouble ALTER INDEX REBUILD clears sys.dm_db_index_usage_stats 7 mistakes DBAs make on CV or resume 5 ways globalisation has impacted IT Is a LOG BACKUP allowed on a SIMPLE RECOVERY database How to turn AUTO_SHRINK off 7 Essential Steps to Recover a Corrupt SQL Server Database DBA vacancy at Travelers - UK based Powered by TypePad Error 5171 – mdf is not a primary database file 24 March,2014 by Jack Vamvas Question: I’m getting a SQL Server Error 5171 error , when trying to attach an mdf. The message is "mdf is not a primary database file". How can I fix this issue? An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) D:\Data\mydb.mdf is not a primary database file. (Microsoft SQL Server, Error: 5171) Answer: My initial assumption is the database file is damaged. Confirming this assumption might be difficult. How to troubleshoot Error 5171 1) Check to see you have a valid backup. If so , restore from the backup device. Read more on disaster recovery. When you confirm there is a valid backup , discuss with business owners and operations staff the timelines for recovery. This is a critical step , as it is highly likely you will not be able to recover the file and to minimise downtime , preparing for a RESTORE could save you critical time. This step highlights the importance of a solid backup strategy supporting Recovery Point Objective 2) Another potential source of recovery may be mirrored drives as used in SAN replication. For example , if there is an asynchronous mirroring setup – then ensurin