SQL Express 2005 Database Read-Only Problem
-
Hi, I have a problem with attaching databases to Microsoft SQL Server Express 2005, databases are attached as Read-Only even I'm using Management Studio or sp_attach_db stored procedure. Can you help me??
-
Hi, I have a problem with attaching databases to Microsoft SQL Server Express 2005, databases are attached as Read-Only even I'm using Management Studio or sp_attach_db stored procedure. Can you help me??
One possibility is that the database is marked read-only before detach. If the database isn't in restoring state (everything is fine after attach), could you simply set it to read-write state:
ALTER DATABASE DatabaseName SET READ_WRITE;
The need to optimize rises from a bad design. My articles[^]
-
One possibility is that the database is marked read-only before detach. If the database isn't in restoring state (everything is fine after attach), could you simply set it to read-write state:
ALTER DATABASE DatabaseName SET READ_WRITE;
The need to optimize rises from a bad design. My articles[^]
Hi Mika, thanx for reply I cannot change database to be read write when I tried your code I received the following errors:
Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "D:\>> DatabaseName.mdf". Operating system error 5: "5(error not found)".Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "D:\>> DatabaseName.ldf". Operating system error 5: "5(error not found)".File activation failure. The physical file name ">> DatabaseName.ldf" may be incorrect.
Msg 945, Level 14, State 2, Line 1
Database 'DatabaseName' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.My database is a valid database copied from another machine on witch it works fine.
-
Hi, I have a problem with attaching databases to Microsoft SQL Server Express 2005, databases are attached as Read-Only even I'm using Management Studio or sp_attach_db stored procedure. Can you help me??
Is the database file's attribute set to readonly?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
Hi Mika, thanx for reply I cannot change database to be read write when I tried your code I received the following errors:
Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "D:\>> DatabaseName.mdf". Operating system error 5: "5(error not found)".Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "D:\>> DatabaseName.ldf". Operating system error 5: "5(error not found)".File activation failure. The physical file name ">> DatabaseName.ldf" may be incorrect.
Msg 945, Level 14, State 2, Line 1
Database 'DatabaseName' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.My database is a valid database copied from another machine on witch it works fine.
Ahmad Safwat wrote:
Database 'DatabaseName' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.
In the ALTER command, replace the DatabaseName with the actual database name and try again. Now you tried to set options for database named DatabaseName. For example if your database is named
Test
then the command would be:ALTER DATABASE
Test
SET READ_WRITE;The need to optimize rises from a bad design. My articles[^]
-
Ahmad Safwat wrote:
Database 'DatabaseName' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.
In the ALTER command, replace the DatabaseName with the actual database name and try again. Now you tried to set options for database named DatabaseName. For example if your database is named
Test
then the command would be:ALTER DATABASE
Test
SET READ_WRITE;The need to optimize rises from a bad design. My articles[^]
I'm sorry it was the weak end, and I was unable to follow up the thread
Mika Wendelius wrote:
replace the DatabaseName with the actual database name
I understood you first time and this is what I exactly did, and received the previous errors. And my database is a valid database copied from another machine on witch it works fine.
-
I'm sorry it was the weak end, and I was unable to follow up the thread
Mika Wendelius wrote:
replace the DatabaseName with the actual database name
I understood you first time and this is what I exactly did, and received the previous errors. And my database is a valid database copied from another machine on witch it works fine.
Ok, The error message you got when trying to set read_write is quite odd. It clearly states that your physical files are not in good condition or not found. - are there any suspicious messages in the error log when you attach the database? - also check that the file attributes are correct on both physical files (not read-only and not system)
The need to optimize rises from a bad design. My articles[^]
-
Ok, The error message you got when trying to set read_write is quite odd. It clearly states that your physical files are not in good condition or not found. - are there any suspicious messages in the error log when you attach the database? - also check that the file attributes are correct on both physical files (not read-only and not system)
The need to optimize rises from a bad design. My articles[^]
!!! S U R P R I S E !!! The problem has been solved by changing "Log On" type of SQL Server Service from "Network Service" to "Local System". Now, I changed "Log On" type back to "Network Service" and still no problem !!! Can anybody explain that to me??
-
!!! S U R P R I S E !!! The problem has been solved by changing "Log On" type of SQL Server Service from "Network Service" to "Local System". Now, I changed "Log On" type back to "Network Service" and still no problem !!! Can anybody explain that to me??
Local system has all the privileges for the computer whereas privileges for Network Service are limited. There are several reasons to this. Your datafiles in the db you attached may have had restrictions at file level which are now corrected, the directory where the files reside may have had a privilege problem etc. Didn't the errorlog say anything when you attached the database for the first time?
The need to optimize rises from a bad design. My articles[^]