Cannot Attach Database Sql Server 2008 Error 3415
Contents |
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack how to attach database in sql server 2008 without log file Overflow the company Business Learn more about hiring developers or posting ads with us how to attach database in sql server 2008 r2 Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database loi attach database sql server 2008 professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer how to attach adventureworks database in sql server 2008 The best answers are voted up and rise to the top Database cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery up vote 1 down vote favorite 1 I have received a database file and the instructions for loading it is to install SQL Server 2005 and then attach it using SQL Server Management Studio. After installing everything, I tried to
Attach Database Sql Server 2005
attach the MDF file but then it tells me that the directory lookup for the file "D:\{folderName}\{filename}.LDF" failed with the operating system error 21 (error not found) An LDF file did not come with the database, so presumably it should be generated automatically. Now, D drive is where my CD drive is, so it's not going to find anything there. Nor is it going to have any luck trying to create anything there. Why is it trying to look for a log file at a specific path? Why not where the database file is? How can I attach this database? UPDATE: I realized that when I select a database to attach, three entries appear under "database details". an MDF, NDF, and LDF. The LDF's "current file path" points to the D drive path above, so I removed it. This time, when I hit "OK", I get a different error message: Database cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery. File activation Failure. The physical name D:{folder}{file}.LDF may be incorrect. New log file "..." was created. (Microsoft SQL Server, Error: 3415) So now it creates a new log file in the same folder as the database file, which is great, but it se
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business
Attach Database Sql Server Express
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation attach database in sql server management studio Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like how to detach database in sql server 2008 you, helping each other. Join them; it only takes a minute: Sign up Error attaching a database (.mdf file) to SQL Server up vote 1 down vote favorite 1 I'm having trouble attaching a database DBName.mdf to http://dba.stackexchange.com/questions/63255/database-cannot-be-upgraded-because-it-is-read-only-or-has-read-only-files-make a network SQL Server. The admin can manually attach the database but if I try, I get the following error message. Database 'DBName' cannot be upgraded because it is read-only, has read-only files or the user does not have permissions to modify some of the files. Make the database or files writeable, and rerun recovery. (Microsoft SQL Server, Error: 3415) Here is my code: System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(); conn.ConnectionString = @"Server=" + SQLServerName + ";database=master;User http://stackoverflow.com/questions/15929043/error-attaching-a-database-mdf-file-to-sql-server ID=" + UserName + ";Pwd=" + Password; ; try { conn.Open(); System.Data.SqlClient.SqlCommand com = new System.Data.SqlClient.SqlCommand("CREATE DATABASE DBName ON ( FILENAME = '" + @"C:\DBName.mdf" + "' ), ( FILENAME = '" + @"C:\DBName_log.ldf" + "' ) FOR ATTACH", conn); com.ExecuteScalar(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); } Here is the details of SQL Server - Product - Microsoft SQL Server Express Edition (64-bit) - Version - 11.0.2218.0 I can create a new database just fine but cannot attach an existing database. What am I missing here? Any help will be appreciated. c# sql-server share|improve this question edited Apr 10 '13 at 18:40 asked Apr 10 '13 at 14:43 Butters 3372821 Could you try to do it "CREATE DATABASE DBName ON ( FILENAME = '" + @"C:\DBName.mdf" + "' ), ( FILENAME = '" + @"C:\DBName_log.ldf" + "' ) FOR ATTACH" manualy? Does it work? –Dimi Apr 10 '13 at 14:47 It gives the above error if I do it. If the admin of the machine of that SQL Server does it, it works fine. –Butters Apr 10 '13 at 14:54 So you need the admin credentials to do it. Are you using here conn.ConnectionString = @"Server=" + SQLServerName + ";database=master;User ID=" + UserName + ";Pwd=" + Password; ; an ADMIN login? Perhaps yo
Recent PostsRecent Posts Popular TopicsPopular Topics Home Search Members Calendar Who's On Home » SQL Server 2005 » Administering » Problem attaching 2000 db on 2005 Problem attaching 2000 db on 2005 Rate Topic Display http://www.sqlservercentral.com/Forums/Topic305008-146-1.aspx Mode Topic Options Author Message wcmasonwcmason Posted Wednesday, August 30, 2006 8:36 AM Forum Newbie Group: http://sqlmag.com/blog/beware-trying-upgrade-database-read-only-filegroup General Forum Members Last Login: Wednesday, March 30, 2016 3:41 PM Points: 3, Visits: 3 Hi All,I did a search on attach and couldn't find any mention of this problem. I have 3 databases running on MSDE on a remote computer. I detached them and copied them to my computer via a portable hard drive. I can attach them on my SQL 2000 server sql server via Enterprise Manager with no problems.I cannot attach them via SQL Server Management Studio Express to a local SQL 2005 instance when logged in as 'sa' or as any user. Through trial and error I found that if I login to SQL Server Management Studio Express using Windows Authentication, I can attach them but this will not help me because our accounting software needs to open them and do the conversion and it doesn't use WA mode.I hope this is making sql server 2008 sense. When I try to attach it logged in as 'sa', the error I get is: "Database 'amwsys' cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery. (Microsoft SQL Server, Error: 3415)" I have checked the readonly status and it is not read-only plus that doesn't stop it from mounting the other way. I checked all of teh links from the error messsage and there is no follow-up info.Thanks,Bill Mason Post #305008 Paulo L. G. GonçalvesPaulo L. G. Gonçalves Posted Wednesday, August 30, 2006 8:50 AM SSC Eights! Group: General Forum Members Last Login: Wednesday, June 24, 2015 5:38 PM Points: 970, Visits: 120 For me that doesn’t do any sense. I’ve do that operation for several times without any problem.Sorry to ask but did you check: If the data/log files are write protected. The database was on-line and running in the source server. The permissions of the accounts used for the processFeel free to contact me,PaLemail:pal_soft@hotmail.comwww: will be available soon
Post #305013 wcmasonwcmason Posted Wednesday, August 30, 2006 8:57 AM Forum Newbie Group: General Forum Members Last Login: Wednesday, March 30, 2016 3:41 PM Points: 3, Visits: 3 Hi Paul,Yes, I checked to make sure they are not write protected in the operating system and I checked the settings within the dbby attaching them in EnterpServer 2016 SQL Server 2014 SQL Server 2012 SQL Server 2008 AdministrationBackup and Recovery Cloud High Availability Performance Tuning PowerShell Security Storage Virtualization DevelopmentASP.NET Entity Framework T-SQL Visual Studio Business IntelligencePower BI SQL Server Analysis Services SQL Server Integration Services SQL Server Reporting Services InfoCenters Advertisement Home > Blogs > SQL Server Questions Answered > Beware of trying to upgrade a database with a read-only filegroup SQL Server Questions Answered Beware of trying to upgrade a database with a read-only filegroup Jun 19, 2012 by Paul S. Randal in SQL Server Questions Answered RSS EMAIL Tweet Comments 1 Question: We recently tried to attach a SQL Server 2008 R2 database to SQL Server 2012 and the upgrade failed because one of the filegroups in the database is set to read-only. When we tried to attach the database back to SQL Server 2008 R2 that failed as well. What did we do wrong? Answer: The simple answer is that upgrade does not work with read-only filegroups. I replicated the scenario described above and found that SQL Server 2012 leaves the database in an unusable state. If you try to take a SQL Server 2008R2 database with a read-only filegroup and attach it to SQL Server 2012, you’ll see the errors below: Starting up database 'paulsdb'. Recovery is writing a checkpoint in database 'paulsdb' (5). This is an informational message only. No user action is required. Database 'paulsdb' cannot be upgraded because it is read-only, has read-only files or the user does not have permissions to modify some of the files. Make the database or files writeable, and rerun recovery. However, trying to then attach the database back to SQL Server 2008R2 generates the following error: Could not open new database 'paulsdb'. CREATE DATABASE is aborted. Msg 3624, Level 20, State 1, Line 1 A system assertion check has failed. Check the SQL Server er