| 
                
Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | PhilipRodStarting Member
 
 
                                        1 Post | 
                                            
                                            |  Posted - 2014-09-22 : 08:12:40 
 |  
                                            | Hi All,By mistake i delete database from sql server. Due to which the the mdf and ldf file of the datbase are removed from my system. Then i used file recover utility and retrived my mdf and ldf files.But now i am not able to attach those files into databse. These mdf and ldf files has been corrupted. Now how can i recover my data from those mdf and ldf files.Please answer me if you have any solution on this problem. |  |  
                                    | tkizerAlmighty SQL Goddess
 
 
                                    38200 Posts | 
                                        
                                          |  Posted - 2014-09-22 : 12:54:15 
 |  
                                          | Restore the database using RESTORE DATABASE command. You'll need to reference your last SQL Server backup, likely bak extension.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |  
                                          |  |  |  
                                    | BrandMonStarting Member
 
 
                                    2 Posts | 
                                        
                                          |  Posted - 2014-09-24 : 13:02:18 
 |  
                                          | When you try to attach a MDF database to SQL Server and get the error "xxx.mdf is not a primary database file", then for most of the cases, that means your MDF file is corrupt or damaged.There are two possible solutions based on the situation:If the corruption is not severe, then you can use the SQL Server build-in command DBCC CheckDB to correct the errors.SQL Server Recovery Toolbox is powerful MS SQL MDF recovery tool, providing a reliable protection for database administrators. The highest efficiency of SQL database restoration program allows offering the following advantages for all users:Works with databases that consist from several files, mdf and ndf;Flexible, easy and friendly interface, guiding database administrators through all steps of repair;Fixes data types, tables, views, stored functions and procedures, triggers, indexes, restrictions and keys;Fully compatible with Windows 7 and earlier versions of this OS;unspammedAs you can look for the answer here: http://www.filerepairforum.com/forum/databases/databases-aa/mysql/191-myfilename-mdf-is-not-a-primary-database-file-does-it-mean-the-file-is-corruptedHope this will help. Good luck! |  
                                          |  |  |  
                                    | clubshrivelStarting Member
 
 
                                    4 Posts | 
                                        
                                          |  Posted - 2014-10-07 : 21:58:55 
 |  
                                          | Thanks for the post, I really need this information, this will help alot. :) |  
                                          |  |  |  
                                |  |  |  |  |  |