Tuesday, March 27, 2012
can't backup DB after detach/attach
back it up.
When I do it manually it flashes very quickly saying that it has finished,
but the backup file is only 0 KB. When I run it as part of a maintenance plan
I am getting the following error in the logs:
[2] Database myDB: Verifying Backup...
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3201: [Microsoft][ODBC SQL
Server Driver][SQL Server]Cannot open backup device
'F:\sqlBackups\myDB\myDB_db_200512131435.BAK'. Device error or device
off-line. See the SQL Server error log for more details.
[Microsoft][ODBC SQL Server Driver][SQL Server]VERIFY DATABASE is
terminating abnormally.
I am able to backup other databases on this instance so I am not sure why
this one is being so persnickity. Please let me know if you have any ideas.
Thanks.
well , have you read error log file ?
"Robert Kinesta" <RobertKinesta@.discussions.microsoft.com> wrote in message
news:9D5E94FC-5BAC-424E-8FAE-72B4908248BF@.microsoft.com...
>I moved a database to a new cluster using detach/attach. Now I am unable to
> back it up.
> When I do it manually it flashes very quickly saying that it has finished,
> but the backup file is only 0 KB. When I run it as part of a maintenance
> plan
> I am getting the following error in the logs:
> [2] Database myDB: Verifying Backup...
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3201: [Microsoft][ODBC
> SQL
> Server Driver][SQL Server]Cannot open backup device
> 'F:\sqlBackups\myDB\myDB_db_200512131435.BAK'. Device error or device
> off-line. See the SQL Server error log for more details.
> [Microsoft][ODBC SQL Server Driver][SQL Server]VERIFY DATABASE is
> terminating abnormally.
>
> I am able to backup other databases on this instance so I am not sure why
> this one is being so persnickity. Please let me know if you have any
> ideas.
> Thanks.
sql
can't backup DB after detach/attach
back it up.
When I do it manually it flashes very quickly saying that it has finished,
but the backup file is only 0 KB. When I run it as part of a maintenance pla
n
I am getting the following error in the logs:
[2] Database myDB: Verifying Backup...
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3201: [Microsoft]
91;ODBC SQL
Server Driver][SQL Server]Cannot open backup device
'F:\sqlBackups\myDB\myDB_db_200512131435
.BAK'. Device error or device
off-line. See the SQL Server error log for more details.
[Microsoft][ODBC SQL Server Driver][SQL Server]VERIFY DATABASE i
s
terminating abnormally.
I am able to backup other databases on this instance so I am not sure why
this one is being so persnickity. Please let me know if you have any ideas.
Thanks.well , have you read error log file ?
"Robert Kinesta" <RobertKinesta@.discussions.microsoft.com> wrote in message
news:9D5E94FC-5BAC-424E-8FAE-72B4908248BF@.microsoft.com...
>I moved a database to a new cluster using detach/attach. Now I am unable to
> back it up.
> When I do it manually it flashes very quickly saying that it has finished,
> but the backup file is only 0 KB. When I run it as part of a maintenance
> plan
> I am getting the following error in the logs:
> [2] Database myDB: Verifying Backup...
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3201: [Microsoft]
[ODBC
> SQL
> Server Driver][SQL Server]Cannot open backup device
> 'F:\sqlBackups\myDB\myDB_db_200512131435
.BAK'. Device error or device
> off-line. See the SQL Server error log for more details.
> [Microsoft][ODBC SQL Server Driver][SQL Server]VERIFY DATABASE
is
> terminating abnormally.
>
> I am able to backup other databases on this instance so I am not sure why
> this one is being so persnickity. Please let me know if you have any
> ideas.
> Thanks.
can't backup DB after detach/attach
back it up.
When I do it manually it flashes very quickly saying that it has finished,
but the backup file is only 0 KB. When I run it as part of a maintenance plan
I am getting the following error in the logs:
[2] Database myDB: Verifying Backup...
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3201: [Microsoft][ODBC SQL
Server Driver][SQL Server]Cannot open backup device
'F:\sqlBackups\myDB\myDB_db_200512131435.BAK'. Device error or device
off-line. See the SQL Server error log for more details.
[Microsoft][ODBC SQL Server Driver][SQL Server]VERIFY DATABASE is
terminating abnormally.
I am able to backup other databases on this instance so I am not sure why
this one is being so persnickity. Please let me know if you have any ideas.
Thanks.well , have you read error log file ?
"Robert Kinesta" <RobertKinesta@.discussions.microsoft.com> wrote in message
news:9D5E94FC-5BAC-424E-8FAE-72B4908248BF@.microsoft.com...
>I moved a database to a new cluster using detach/attach. Now I am unable to
> back it up.
> When I do it manually it flashes very quickly saying that it has finished,
> but the backup file is only 0 KB. When I run it as part of a maintenance
> plan
> I am getting the following error in the logs:
> [2] Database myDB: Verifying Backup...
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3201: [Microsoft][ODBC
> SQL
> Server Driver][SQL Server]Cannot open backup device
> 'F:\sqlBackups\myDB\myDB_db_200512131435.BAK'. Device error or device
> off-line. See the SQL Server error log for more details.
> [Microsoft][ODBC SQL Server Driver][SQL Server]VERIFY DATABASE is
> terminating abnormally.
>
> I am able to backup other databases on this instance so I am not sure why
> this one is being so persnickity. Please let me know if you have any
> ideas.
> Thanks.
Can't Attach to DB File using SSMS
Hi all,
I have "SQL Server Express" as well as SSMS-E installed on the same machine. I am trying to get SSMS-E to connect to a database (i.e., an .MDF file) that resides in a folder on the desktop.
After establishing a connection to my "SQL Server Express" instance within SSMS-E, I right-click on "Databases", in the "Object Explorer" window and select "Attach..." and click the "Add..." button. The resulting dialog box opens in the directory:
"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data" where I see several MDF files. But as I said, my MDF is not in this directory - it's on the desktop.
If I try to navigate to the proper directory on the desktop I see no MDF files. In fact, I cannot even navigate past my username -- that is, I cannot even navigate to the desktop, let alone folders on the desktop. I don't know why.
Of course I *could* put the MDF file in the SQL-E approved directory but shouldn't I just be able to navigate to it using SSMS-E? Incidentally, I *AM* able to connect to the database on my desktop if I use Visual Studio and I specify "UserInstance=true". Not specifying "UserInstance=true" results in this error:
An attempt to attach an auto-named database for file C:\Documents and Settings\Robin\Desktop\MyCompany.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Can someone explain what might be causing the problem with SSMS-E, and, for that matter, why it's necessary to specify "UserInstance=true" in Visual Studio?
Thanks so much. I hope these are not too many questions.
Robin
You are attempting to attach a file that is located in a 'protected' storage area -specifically your private 'Desktop'. That file would not be available to other users of the computer. You can attach it to a user instance since that user instance will be restricted for your use only and other users could not access it.
If you want to attach the file to the server, move the file from your 'Desktop' to a storage area accessible for all users of SQL Server.
Sunday, March 25, 2012
Can't attach to database
Hi,
I have a database that I developed using both Toad for SQL and SQL Server Managment Studio.
All was working fine. I could connect to the database with one of the above and also run two an applications I developed (one in C# and One in VB.NET using VS Express) using the standard SQLConnection class.
the following connection string worked fine...
Server="(local)"; Trusted_Connection="yes"; Database="CDEvolution";
Now, for one reason or another I decided to create a new data source in my Visual Studio project and pointed it to the database fine.
At first it seemed ok as I could see all tables from teh database. However somethign strage has happened. I now can't access the database in TOAD or SQL Server Managment Studio. I also couldn't connect using the above string.
I finally managed to get the two appllications I developed to access database using the following connection string...
Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL\Data\CDEvolution.mdf;Integrated Security=True;Connect Timeout=6000;User Instance=True;
and the applications work fine, however I can access the database using the DB tools.
In SQL Server Managment Studio I remove the database and tried to attach it again but I keep getting the following error message...
Could not find row in sysindexes for database ID 5, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.Could not open new database 'C:\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL\DATA\CDEVOLUTION.MDF'. CREATE DATABASE is aborted. (.Net SqlClient Data Provider)
Any ideas on how I can get access back?
Cheers in advance,
Kevin
The latter error looks similar to what you get if you try to attach a SQL 2005 database to a SQL 2000 instance. SQL 2000 will not work with databases that have been upgraded to SQL 2005.|||Hi,
Thanks for the response. before all this happened I was connecting to the database using SQL Manager Studio with no problems. This all started when I created a data source connection to the database in Visual Studio Express. After that I needed to change the connection string if I wanted to connect at run time using SQLConnection and have still not been able to connect using any of the DB managment tools.
Cheers,
Kevin
|||This error is from SQL 2000, not SQL 2005, and incidates you are trying to attach a SQL 2005 database to SQL 2000.
Could not find row in sysindexes for database ID 5, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'C:\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL\DATA\CDEVOLUTION.MDF'. CREATE DATABASE is aborted. (.Net SqlClient Data Provider)
When you attached the databaes to Visual Studio Express, it would have been upgraded to SQL 2005 format and can no longer be used by SQL 2000.
|||Thanks,
I was under the impression that SQL Express was 2005, I will look into it further and see what I can find.
Cheers,
Kevin.
|||Sorted!
It seems that another instance of the SQL server has been created called SQLEXPRESS and you have the option to connect to it when the application starts.
Once I connected It created a new folder called MSSQL.1 (MSSQL already exists) so I simply coppied the database files into the new folder and attached them. So now I should be able to change to application to connect at the new location and I should be good to go.
Cheers,
YNWA
Kevin.
Can't Attach sqlexpress db
Hi,
After having published the timetracker starterkit from visual studio 2005 to local wwwroot,
I try to access my homepage with ie.
But still get the same error message :
An attempt to attach an auto-named database for file C:\Documents and Settings\Emmanuel\My Documents\Visual Studio 2005\WebSites\GestWares\App_Data\TimeTracker.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
This is how i configure my web.config :
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|\TimeTracker.mdf;User Instance=true"/>
<add name="aspnet_staterKits_TimeTracker" connectionString="Data Source=.\SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|\TimeTracker.mdf;User Instance=true"/>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\TimeTracker.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
Has someone any idea how my connectionstrings statement has to look like?
thanks in advance.
Manu.
Hi,
Refer below links for work around.
http://www.aspspider.com/resources/Resource170.aspx
http://www.sqljunkies.com/WebLog/ktegels/archive/2005/11/15/17401.aspx
http://www.ozzu.com/ftopic43909.html
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=989092&SiteID=1
Hemantgiri S. Goswami
Can't attach db - says read-only
SQL novice here.
I had a SQL Server 2000 machine that died, but it had some
data I need, so i pulled the drive, found the SQL data folder
and copied it to a network location.
On my SQL Server 2003 machine runnig SQL Server Express, I
right click on Databases, select Attach, point to the database
I want, and the process fials saying the data is read-only, make
it read write and try again.
Problem is, the files are not read-only. I checked and reset
them several times, and each attempt fails with the same message.
How can I attach this database to my sql server?
Thanks,
kpg
There is a article on Microsoft's web site that briefly discusses this issue
on SQL 2005 Express:
http://msdn2.microsoft.com/en-us/library/bb264564.aspx
If you've already checked the permissions on the file, see if you can check
the permissions you have on the database server and folder where the file is
being written to. Your permissions may be different than what they were on
the original DB server.
"kpg*" wrote:
> Hi all,
> SQL novice here.
> I had a SQL Server 2000 machine that died, but it had some
> data I need, so i pulled the drive, found the SQL data folder
> and copied it to a network location.
> On my SQL Server 2003 machine runnig SQL Server Express, I
> right click on Databases, select Attach, point to the database
> I want, and the process fials saying the data is read-only, make
> it read write and try again.
> Problem is, the files are not read-only. I checked and reset
> them several times, and each attempt fails with the same message.
> How can I attach this database to my sql server?
> Thanks,
> kpg
>
|||> There is a article on Microsoft's web site that briefly discusses this
> issue on SQL 2005 Express:
> http://msdn2.microsoft.com/en-us/library/bb264564.aspx
> If you've already checked the permissions on the file, see if you can
> check the permissions you have on the database server and folder where
> the file is being written to. Your permissions may be different than
> what they were on the original DB server.
Thank you * 100!
I copied the db file into the data folder of the sql 2005 instance
and yes, I was able to attach it. So it was a folder permission
issue.
Thanks again!
kpg
sql
Can't attach db - says read-only
SQL novice here.
I had a SQL Server 2000 machine that died, but it had some
data I need, so i pulled the drive, found the SQL data folder
and copied it to a network location.
On my SQL Server 2003 machine runnig SQL Server Express, I
right click on Databases, select Attach, point to the database
I want, and the process fials saying the data is read-only, make
it read write and try again.
Problem is, the files are not read-only. I checked and reset
them several times, and each attempt fails with the same message.
How can I attach this database to my sql server?
Thanks,
kpgThere is a article on Microsoft's web site that briefly discusses this issue
on SQL 2005 Express:
http://msdn2.microsoft.com/en-us/library/bb264564.aspx
If you've already checked the permissions on the file, see if you can check
the permissions you have on the database server and folder where the file is
being written to. Your permissions may be different than what they were on
the original DB server.
"kpg*" wrote:
> Hi all,
> SQL novice here.
> I had a SQL Server 2000 machine that died, but it had some
> data I need, so i pulled the drive, found the SQL data folder
> and copied it to a network location.
> On my SQL Server 2003 machine runnig SQL Server Express, I
> right click on Databases, select Attach, point to the database
> I want, and the process fials saying the data is read-only, make
> it read write and try again.
> Problem is, the files are not read-only. I checked and reset
> them several times, and each attempt fails with the same message.
> How can I attach this database to my sql server?
> Thanks,
> kpg
>|||> There is a article on Microsoft's web site that briefly discusses this
> issue on SQL 2005 Express:
> http://msdn2.microsoft.com/en-us/library/bb264564.aspx
> If you've already checked the permissions on the file, see if you can
> check the permissions you have on the database server and folder where
> the file is being written to. Your permissions may be different than
> what they were on the original DB server.
Thank you * 100!
I copied the db file into the data folder of the sql 2005 instance
and yes, I was able to attach it. So it was a folder permission
issue.
Thanks again!
kpg
Can't attach db - says read-only
SQL novice here.
I had a SQL Server 2000 machine that died, but it had some
data I need, so i pulled the drive, found the SQL data folder
and copied it to a network location.
On my SQL Server 2003 machine runnig SQL Server Express, I
right click on Databases, select Attach, point to the database
I want, and the process fials saying the data is read-only, make
it read write and try again.
Problem is, the files are not read-only. I checked and reset
them several times, and each attempt fails with the same message.
How can I attach this database to my sql server?
Thanks,
kpgThere is a article on Microsoft's web site that briefly discusses this issue
on SQL 2005 Express:
http://msdn2.microsoft.com/en-us/library/bb264564.aspx
If you've already checked the permissions on the file, see if you can check
the permissions you have on the database server and folder where the file is
being written to. Your permissions may be different than what they were on
the original DB server.
"kpg*" wrote:
> Hi all,
> SQL novice here.
> I had a SQL Server 2000 machine that died, but it had some
> data I need, so i pulled the drive, found the SQL data folder
> and copied it to a network location.
> On my SQL Server 2003 machine runnig SQL Server Express, I
> right click on Databases, select Attach, point to the database
> I want, and the process fials saying the data is read-only, make
> it read write and try again.
> Problem is, the files are not read-only. I checked and reset
> them several times, and each attempt fails with the same message.
> How can I attach this database to my sql server?
> Thanks,
> kpg
>|||> There is a article on Microsoft's web site that briefly discusses this
> issue on SQL 2005 Express:
> http://msdn2.microsoft.com/en-us/library/bb264564.aspx
> If you've already checked the permissions on the file, see if you can
> check the permissions you have on the database server and folder where
> the file is being written to. Your permissions may be different than
> what they were on the original DB server.
Thank you * 100!
I copied the db file into the data folder of the sql 2005 instance
and yes, I was able to attach it. So it was a folder permission
issue.
Thanks again!
kpg
Can't Attach Database using SQL Server Management Studio Express
I am having a problem Attaching, well actually not being able to see a database when attempting to attach it. I suspect this is more of a security issue rather than a problem with Management Studio, but I can't figure out what is happening.
If I copy a database to Documents and Settings\All Users\... and attempt to attach I can see the file in the selection tree. This also is the case if I copy it to Documents and Settings\Default User\... But if I copy it to Documents and Settings\ADynarski\... which is the account I normally log into, when I expand the folder in the selection tree, nothing is visible. And the same thing occurs if I copy the file to Documents and Settings\Guest\...
I've looked at the security settings and everything appears to be normal. This is on a box with XP Home and SQL Server Express. Can anyone tell me what I'm missing?
Thanks,
Al
What is the account your SQL Server service running under?
If it's domain account, make sure the account has access to the folder you are trying attach database from.
|||Thanks for your input. It is a domain account and the account does have access to the folder. What is really strange is that I used Visual Web Developer Express to create the database in C:\Documents and Settings\Al Dynarski\My Documents\... and it functions properly. But logged into the same account, Server Management Studio sees nothing in the folder C:\Documents and Settings\Al Dynarski or below. I can copy the database out to another folder and then use Server Manangement Studio to work on it. Very strange. I'll continue to look around. Thanks again.|||Why are you copying the database files to a user folder rather than a common system folder ? If you want to attach the database files not via the userinstance feature, the SQL Server Service need to have access to the specified file for the database, so make sure that the service the SQL Server Account is running on, has access to this file destination.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||Thanks for your suggestion. I don't want to have to copy it; I only tried that to be sure it was in fact a valid database. And I agree with your assessment about SQL service having access rights to the folder containing the database. My problem appears to be figuring out why it doesn'tI got it working. I switched SQL Server Express to Local System Login and I now can see the database files and attach them. Since this server instance is just for my local testing, this configuration should work for me. Thanks to all for your suggestions.
Al
|||Hi Al,
I am having the same problem.... how do you switch SQL Server Express to Local System Login, and in doing so what else does this affect?
Thanks,
Claude.
|||Go to the SCM (Service Control Manager) of Windows, sleect the service you want to change the logon settings for, right click properties, go to the LogOn Tab and change the account to "Local System". Keep in min d that the service needs a restart after changing the settings.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
Hi Claude,
The solution Jens indicated is exactly what I did.
Good Luck!
Al
Can't attach database after server crash?
I have a database I was working on a few months ago. The server it was on
crashed before I could get backups of it but I managed to get the original
database
file before anything happened to it. When the server was redone, the
usernames were changed a little and I now have a different windows username.
I wouldn't
think this would matter since the sql server uses windows security to sign
in anyways. Either way, I have tried to attach the database and I keep
getting
this error:
Attach database failed for Server 'ANDY\SQLEXPRESS'.
(Microsoft.SqlServer.Express.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
The file "C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
compressed but does not reside in a read-only database or filegroup. The
file must be
decompressed.
Could not open new database 'EternityRecords'. CREATE DATABASE is aborted.
(Microsoft SQL
Server, Error: 5118)
Any ideas how to fix this? I suppose I can redo if I had to since there was
only 3 tables in there but it is annoying that I have to redo the whole
thing
anytime something small happens...> The file "C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
> compressed but does not reside in a read-only database or filegroup. The
> file must be
> decompressed.
NTFS compressed files on writable file groups are not supported, hence the
error.
Try decompressing the file. Navigate to the mdf file using Windows Explorer
and select Properties-->Advanced and uncheck the compress option. Same with
the log file (ldf).
Hope this helps.
Dan Guzman
SQL Server MVP
"Sunfire" <a_borka@.sbcglobal.net> wrote in message
news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
> Hi...
> I have a database I was working on a few months ago. The server it was on
> crashed before I could get backups of it but I managed to get the original
> database
> file before anything happened to it. When the server was redone, the
> usernames were changed a little and I now have a different windows
> username. I wouldn't
> think this would matter since the sql server uses windows security to sign
> in anyways. Either way, I have tried to attach the database and I keep
> getting
> this error:
> Attach database failed for Server 'ANDY\SQLEXPRESS'.
> (Microsoft.SqlServer.Express.Smo)
> Additional information:
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.Express.ConnectionInfo)
> The file "C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
> compressed but does not reside in a read-only database or filegroup. The
> file must be
> decompressed.
> Could not open new database 'EternityRecords'. CREATE DATABASE is aborted.
> (Microsoft SQL
> Server, Error: 5118)
> Any ideas how to fix this? I suppose I can redo if I had to since there
> was only 3 tables in there but it is annoying that I have to redo the
> whole thing
> anytime something small happens...
>|||I will check it out and let you know what happens. You might have saved my
neck...
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
> NTFS compressed files on writable file groups are not supported, hence the
> error.
> Try decompressing the file. Navigate to the mdf file using Windows
> Explorer and select Properties-->Advanced and uncheck the compress option.
> Same with the log file (ldf).
>
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
> news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
>|||Hi... I tried your idea of unchecking the compress this file box in the
database file and its log file. I tried to attach it again and I get the
following message:
Attach database failed for Server 'ANDY\SQLEXPRESS'.
(Microsoft.SqlServer.Express.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
One or more files do not match the primary file of the database. If you are
attempting to attach
a database, retry the operation with the correct files. If this is an
existing database, the file may
be corrupted and should be restored from a backup. (Microsoft SQL Server,
Error: 5173)
Does this mean I have to redo my database by hand? I don't have any backup
of it and I have no idea what is wrong now. Any ideas?
"Sunfire" <a_borka@.sbcglobal.net> wrote in message
news:ua7zYRA4HHA.600@.TK2MSFTNGP05.phx.gbl...
>I will check it out and let you know what happens. You might have saved my
>neck...
>
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
>|||You can try sp_attach_db and specify the path & file name for *all* the data
base files (mdf, ldf and
possibly ndf). If you are sure you got the path correct and still get some s
trange error, you are
most probably in trouble. Attaching is only supported if you did a clean det
ach first, if you
didn't, well, these things can happen.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Sunfire" <a_borka@.sbcglobal.net> wrote in message news:OiwlJjA4HHA.5740@.TK2MSFTNGP03.phx.gb
l...
> Hi... I tried your idea of unchecking the compress this file box in the da
tabase file and its log
> file. I tried to attach it again and I get the following message:
> Attach database failed for Server 'ANDY\SQLEXPRESS'. (Microsoft.SqlServer.
Express.Smo)
> Additional information:
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.Express.ConnectionInfo)
> One or more files do not match the primary file of the database. If you ar
e attempting to attach
> a database, retry the operation with the correct files. If this is an exi
sting database, the file
> may
> be corrupted and should be restored from a backup. (Microsoft SQL Server,
Error: 5173)
> Does this mean I have to redo my database by hand? I don't have any backup
of it and I have no
> idea what is wrong now. Any ideas?
>
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message news:ua7zYRA4HHA.600@.TK
2MSFTNGP05.phx.gbl...
>|||Guess it's back to the drawing board then...sigh... At least the DB wasn't
very huge...grin
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23Hx6l7B4HHA.5844@.TK2MSFTNGP02.phx.gbl...
> You can try sp_attach_db and specify the path & file name for *all* the
> database files (mdf, ldf and possibly ndf). If you are sure you got the
> path correct and still get some strange error, you are most probably in
> trouble. Attaching is only supported if you did a clean detach first, if
> you didn't, well, these things can happen.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
> news:OiwlJjA4HHA.5740@.TK2MSFTNGP03.phx.gbl...
>|||... and you now know to do your backups regularly... ;-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Sunfire" <a_borka@.sbcglobal.net> wrote in message news:%23V$7AlC4HHA.484@.TK2MSFTNGP06.phx.g
bl...
> Guess it's back to the drawing board then...sigh... At least the DB wasn't
> very huge...grin
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:%23Hx6l7B4HHA.5844@.TK2MSFTNGP02.phx.gbl...
>
Can't attach database after server crash?
I have a database I was working on a few months ago. The server it was on
crashed before I could get backups of it but I managed to get the original
database
file before anything happened to it. When the server was redone, the
usernames were changed a little and I now have a different windows username.
I wouldn't
think this would matter since the sql server uses windows security to sign
in anyways. Either way, I have tried to attach the database and I keep
getting
this error:
Attach database failed for Server 'ANDY\SQLEXPRESS'.
(Microsoft.SqlServer.Express.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
The file "C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
compressed but does not reside in a read-only database or filegroup. The
file must be
decompressed.
Could not open new database 'EternityRecords'. CREATE DATABASE is aborted.
(Microsoft SQL
Server, Error: 5118)
Any ideas how to fix this? I suppose I can redo if I had to since there was
only 3 tables in there but it is annoying that I have to redo the whole
thing
anytime something small happens...> The file "C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
> compressed but does not reside in a read-only database or filegroup. The
> file must be
> decompressed.
NTFS compressed files on writable file groups are not supported, hence the
error.
Try decompressing the file. Navigate to the mdf file using Windows Explorer
and select Properties-->Advanced and uncheck the compress option. Same with
the log file (ldf).
Hope this helps.
Dan Guzman
SQL Server MVP
"Sunfire" <a_borka@.sbcglobal.net> wrote in message
news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
> Hi...
> I have a database I was working on a few months ago. The server it was on
> crashed before I could get backups of it but I managed to get the original
> database
> file before anything happened to it. When the server was redone, the
> usernames were changed a little and I now have a different windows
> username. I wouldn't
> think this would matter since the sql server uses windows security to sign
> in anyways. Either way, I have tried to attach the database and I keep
> getting
> this error:
> Attach database failed for Server 'ANDY\SQLEXPRESS'.
> (Microsoft.SqlServer.Express.Smo)
> Additional information:
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.Express.ConnectionInfo)
> The file "C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
> compressed but does not reside in a read-only database or filegroup. The
> file must be
> decompressed.
> Could not open new database 'EternityRecords'. CREATE DATABASE is aborted.
> (Microsoft SQL
> Server, Error: 5118)
> Any ideas how to fix this? I suppose I can redo if I had to since there
> was only 3 tables in there but it is annoying that I have to redo the
> whole thing
> anytime something small happens...
>|||I will check it out and let you know what happens. You might have saved my
neck...
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup. The
>> file must be
>> decompressed.
> NTFS compressed files on writable file groups are not supported, hence the
> error.
> Try decompressing the file. Navigate to the mdf file using Windows
> Explorer and select Properties-->Advanced and uncheck the compress option.
> Same with the log file (ldf).
>
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
> news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
>> Hi...
>> I have a database I was working on a few months ago. The server it was on
>> crashed before I could get backups of it but I managed to get the
>> original database
>> file before anything happened to it. When the server was redone, the
>> usernames were changed a little and I now have a different windows
>> username. I wouldn't
>> think this would matter since the sql server uses windows security to
>> sign in anyways. Either way, I have tried to attach the database and I
>> keep getting
>> this error:
>> Attach database failed for Server 'ANDY\SQLEXPRESS'.
>> (Microsoft.SqlServer.Express.Smo)
>> Additional information:
>> An exception occurred while executing a Transact-SQL statement or batch.
>> (Microsoft.SqlServer.Express.ConnectionInfo)
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup. The
>> file must be
>> decompressed.
>> Could not open new database 'EternityRecords'. CREATE DATABASE is
>> aborted. (Microsoft SQL
>> Server, Error: 5118)
>> Any ideas how to fix this? I suppose I can redo if I had to since there
>> was only 3 tables in there but it is annoying that I have to redo the
>> whole thing
>> anytime something small happens...
>>
>|||Hi... I tried your idea of unchecking the compress this file box in the
database file and its log file. I tried to attach it again and I get the
following message:
Attach database failed for Server 'ANDY\SQLEXPRESS'.
(Microsoft.SqlServer.Express.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
One or more files do not match the primary file of the database. If you are
attempting to attach
a database, retry the operation with the correct files. If this is an
existing database, the file may
be corrupted and should be restored from a backup. (Microsoft SQL Server,
Error: 5173)
Does this mean I have to redo my database by hand? I don't have any backup
of it and I have no idea what is wrong now. Any ideas?
"Sunfire" <a_borka@.sbcglobal.net> wrote in message
news:ua7zYRA4HHA.600@.TK2MSFTNGP05.phx.gbl...
>I will check it out and let you know what happens. You might have saved my
>neck...
>
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup. The
>> file must be
>> decompressed.
>> NTFS compressed files on writable file groups are not supported, hence
>> the error.
>> Try decompressing the file. Navigate to the mdf file using Windows
>> Explorer and select Properties-->Advanced and uncheck the compress
>> option. Same with the log file (ldf).
>>
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
>> news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
>> Hi...
>> I have a database I was working on a few months ago. The server it was
>> on crashed before I could get backups of it but I managed to get the
>> original database
>> file before anything happened to it. When the server was redone, the
>> usernames were changed a little and I now have a different windows
>> username. I wouldn't
>> think this would matter since the sql server uses windows security to
>> sign in anyways. Either way, I have tried to attach the database and I
>> keep getting
>> this error:
>> Attach database failed for Server 'ANDY\SQLEXPRESS'.
>> (Microsoft.SqlServer.Express.Smo)
>> Additional information:
>> An exception occurred while executing a Transact-SQL statement or batch.
>> (Microsoft.SqlServer.Express.ConnectionInfo)
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup. The
>> file must be
>> decompressed.
>> Could not open new database 'EternityRecords'. CREATE DATABASE is
>> aborted. (Microsoft SQL
>> Server, Error: 5118)
>> Any ideas how to fix this? I suppose I can redo if I had to since there
>> was only 3 tables in there but it is annoying that I have to redo the
>> whole thing
>> anytime something small happens...
>>
>|||You can try sp_attach_db and specify the path & file name for *all* the database files (mdf, ldf and
possibly ndf). If you are sure you got the path correct and still get some strange error, you are
most probably in trouble. Attaching is only supported if you did a clean detach first, if you
didn't, well, these things can happen.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Sunfire" <a_borka@.sbcglobal.net> wrote in message news:OiwlJjA4HHA.5740@.TK2MSFTNGP03.phx.gbl...
> Hi... I tried your idea of unchecking the compress this file box in the database file and its log
> file. I tried to attach it again and I get the following message:
> Attach database failed for Server 'ANDY\SQLEXPRESS'. (Microsoft.SqlServer.Express.Smo)
> Additional information:
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.Express.ConnectionInfo)
> One or more files do not match the primary file of the database. If you are attempting to attach
> a database, retry the operation with the correct files. If this is an existing database, the file
> may
> be corrupted and should be restored from a backup. (Microsoft SQL Server, Error: 5173)
> Does this mean I have to redo my database by hand? I don't have any backup of it and I have no
> idea what is wrong now. Any ideas?
>
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message news:ua7zYRA4HHA.600@.TK2MSFTNGP05.phx.gbl...
>>I will check it out and let you know what happens. You might have saved my neck...
>>
>> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
>> news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
>> The file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup. The file must be
>> decompressed.
>> NTFS compressed files on writable file groups are not supported, hence the error.
>> Try decompressing the file. Navigate to the mdf file using Windows Explorer and select
>> Properties-->Advanced and uncheck the compress option. Same with the log file (ldf).
>>
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "Sunfire" <a_borka@.sbcglobal.net> wrote in message news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
>> Hi...
>> I have a database I was working on a few months ago. The server it was on crashed before I
>> could get backups of it but I managed to get the original database
>> file before anything happened to it. When the server was redone, the usernames were changed a
>> little and I now have a different windows username. I wouldn't
>> think this would matter since the sql server uses windows security to sign in anyways. Either
>> way, I have tried to attach the database and I keep getting
>> this error:
>> Attach database failed for Server 'ANDY\SQLEXPRESS'. (Microsoft.SqlServer.Express.Smo)
>> Additional information:
>> An exception occurred while executing a Transact-SQL statement or batch.
>> (Microsoft.SqlServer.Express.ConnectionInfo)
>> The file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup. The file must be
>> decompressed.
>> Could not open new database 'EternityRecords'. CREATE DATABASE is aborted. (Microsoft SQL
>> Server, Error: 5118)
>> Any ideas how to fix this? I suppose I can redo if I had to since there was only 3 tables in
>> there but it is annoying that I have to redo the whole thing
>> anytime something small happens...
>>
>>
>|||Guess it's back to the drawing board then...sigh... At least the DB wasn't
very huge...grin
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23Hx6l7B4HHA.5844@.TK2MSFTNGP02.phx.gbl...
> You can try sp_attach_db and specify the path & file name for *all* the
> database files (mdf, ldf and possibly ndf). If you are sure you got the
> path correct and still get some strange error, you are most probably in
> trouble. Attaching is only supported if you did a clean detach first, if
> you didn't, well, these things can happen.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
> news:OiwlJjA4HHA.5740@.TK2MSFTNGP03.phx.gbl...
>> Hi... I tried your idea of unchecking the compress this file box in the
>> database file and its log file. I tried to attach it again and I get the
>> following message:
>> Attach database failed for Server 'ANDY\SQLEXPRESS'.
>> (Microsoft.SqlServer.Express.Smo)
>> Additional information:
>> An exception occurred while executing a Transact-SQL statement or batch.
>> (Microsoft.SqlServer.Express.ConnectionInfo)
>> One or more files do not match the primary file of the database. If you
>> are attempting to attach
>> a database, retry the operation with the correct files. If this is an
>> existing database, the file may
>> be corrupted and should be restored from a backup. (Microsoft SQL Server,
>> Error: 5173)
>> Does this mean I have to redo my database by hand? I don't have any
>> backup of it and I have no idea what is wrong now. Any ideas?
>>
>> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
>> news:ua7zYRA4HHA.600@.TK2MSFTNGP05.phx.gbl...
>>I will check it out and let you know what happens. You might have saved
>>my neck...
>>
>> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
>> news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup.
>> The file must be
>> decompressed.
>> NTFS compressed files on writable file groups are not supported, hence
>> the error.
>> Try decompressing the file. Navigate to the mdf file using Windows
>> Explorer and select Properties-->Advanced and uncheck the compress
>> option. Same with the log file (ldf).
>>
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
>> news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
>> Hi...
>> I have a database I was working on a few months ago. The server it was
>> on crashed before I could get backups of it but I managed to get the
>> original database
>> file before anything happened to it. When the server was redone, the
>> usernames were changed a little and I now have a different windows
>> username. I wouldn't
>> think this would matter since the sql server uses windows security to
>> sign in anyways. Either way, I have tried to attach the database and I
>> keep getting
>> this error:
>> Attach database failed for Server 'ANDY\SQLEXPRESS'.
>> (Microsoft.SqlServer.Express.Smo)
>> Additional information:
>> An exception occurred while executing a Transact-SQL statement or
>> batch.
>> (Microsoft.SqlServer.Express.ConnectionInfo)
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup.
>> The file must be
>> decompressed.
>> Could not open new database 'EternityRecords'. CREATE DATABASE is
>> aborted. (Microsoft SQL
>> Server, Error: 5118)
>> Any ideas how to fix this? I suppose I can redo if I had to since
>> there was only 3 tables in there but it is annoying that I have to
>> redo the whole thing
>> anytime something small happens...
>>
>>
>>
>|||... and you now know to do your backups regularly... ;-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Sunfire" <a_borka@.sbcglobal.net> wrote in message news:%23V$7AlC4HHA.484@.TK2MSFTNGP06.phx.gbl...
> Guess it's back to the drawing board then...sigh... At least the DB wasn't
> very huge...grin
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:%23Hx6l7B4HHA.5844@.TK2MSFTNGP02.phx.gbl...
>> You can try sp_attach_db and specify the path & file name for *all* the
>> database files (mdf, ldf and possibly ndf). If you are sure you got the
>> path correct and still get some strange error, you are most probably in
>> trouble. Attaching is only supported if you did a clean detach first, if
>> you didn't, well, these things can happen.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
>> news:OiwlJjA4HHA.5740@.TK2MSFTNGP03.phx.gbl...
>> Hi... I tried your idea of unchecking the compress this file box in the
>> database file and its log file. I tried to attach it again and I get the
>> following message:
>> Attach database failed for Server 'ANDY\SQLEXPRESS'.
>> (Microsoft.SqlServer.Express.Smo)
>> Additional information:
>> An exception occurred while executing a Transact-SQL statement or batch.
>> (Microsoft.SqlServer.Express.ConnectionInfo)
>> One or more files do not match the primary file of the database. If you
>> are attempting to attach
>> a database, retry the operation with the correct files. If this is an
>> existing database, the file may
>> be corrupted and should be restored from a backup. (Microsoft SQL Server,
>> Error: 5173)
>> Does this mean I have to redo my database by hand? I don't have any
>> backup of it and I have no idea what is wrong now. Any ideas?
>>
>> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
>> news:ua7zYRA4HHA.600@.TK2MSFTNGP05.phx.gbl...
>>I will check it out and let you know what happens. You might have saved
>>my neck...
>>
>> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
>> news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup.
>> The file must be
>> decompressed.
>> NTFS compressed files on writable file groups are not supported, hence
>> the error.
>> Try decompressing the file. Navigate to the mdf file using Windows
>> Explorer and select Properties-->Advanced and uncheck the compress
>> option. Same with the log file (ldf).
>>
>> --
>> Hope this helps.
>> Dan Guzman
>> SQL Server MVP
>> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
>> news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
>> Hi...
>> I have a database I was working on a few months ago. The server it was
>> on crashed before I could get backups of it but I managed to get the
>> original database
>> file before anything happened to it. When the server was redone, the
>> usernames were changed a little and I now have a different windows
>> username. I wouldn't
>> think this would matter since the sql server uses windows security to
>> sign in anyways. Either way, I have tried to attach the database and I
>> keep getting
>> this error:
>> Attach database failed for Server 'ANDY\SQLEXPRESS'.
>> (Microsoft.SqlServer.Express.Smo)
>> Additional information:
>> An exception occurred while executing a Transact-SQL statement or
>> batch.
>> (Microsoft.SqlServer.Express.ConnectionInfo)
>> The file "C:\Program Files\Microsoft SQL
>> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
>> compressed but does not reside in a read-only database or filegroup.
>> The file must be
>> decompressed.
>> Could not open new database 'EternityRecords'. CREATE DATABASE is
>> aborted. (Microsoft SQL
>> Server, Error: 5118)
>> Any ideas how to fix this? I suppose I can redo if I had to since
>> there was only 3 tables in there but it is annoying that I have to
>> redo the whole thing
>> anytime something small happens...
>>
>>
>>
>>
>sql
Can't attach database after server crash?
I have a database I was working on a few months ago. The server it was on
crashed before I could get backups of it but I managed to get the original
database
file before anything happened to it. When the server was redone, the
usernames were changed a little and I now have a different windows username.
I wouldn't
think this would matter since the sql server uses windows security to sign
in anyways. Either way, I have tried to attach the database and I keep
getting
this error:
Attach database failed for Server 'ANDY\SQLEXPRESS'.
(Microsoft.SqlServer.Express.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
The file "C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
compressed but does not reside in a read-only database or filegroup. The
file must be
decompressed.
Could not open new database 'EternityRecords'. CREATE DATABASE is aborted.
(Microsoft SQL
Server, Error: 5118)
Any ideas how to fix this? I suppose I can redo if I had to since there was
only 3 tables in there but it is annoying that I have to redo the whole
thing
anytime something small happens...
> The file "C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
> compressed but does not reside in a read-only database or filegroup. The
> file must be
> decompressed.
NTFS compressed files on writable file groups are not supported, hence the
error.
Try decompressing the file. Navigate to the mdf file using Windows Explorer
and select Properties-->Advanced and uncheck the compress option. Same with
the log file (ldf).
Hope this helps.
Dan Guzman
SQL Server MVP
"Sunfire" <a_borka@.sbcglobal.net> wrote in message
news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
> Hi...
> I have a database I was working on a few months ago. The server it was on
> crashed before I could get backups of it but I managed to get the original
> database
> file before anything happened to it. When the server was redone, the
> usernames were changed a little and I now have a different windows
> username. I wouldn't
> think this would matter since the sql server uses windows security to sign
> in anyways. Either way, I have tried to attach the database and I keep
> getting
> this error:
> Attach database failed for Server 'ANDY\SQLEXPRESS'.
> (Microsoft.SqlServer.Express.Smo)
> Additional information:
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.Express.ConnectionInfo)
> The file "C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\EternityRecords.mdf" is
> compressed but does not reside in a read-only database or filegroup. The
> file must be
> decompressed.
> Could not open new database 'EternityRecords'. CREATE DATABASE is aborted.
> (Microsoft SQL
> Server, Error: 5118)
> Any ideas how to fix this? I suppose I can redo if I had to since there
> was only 3 tables in there but it is annoying that I have to redo the
> whole thing
> anytime something small happens...
>
|||I will check it out and let you know what happens. You might have saved my
neck...
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
> NTFS compressed files on writable file groups are not supported, hence the
> error.
> Try decompressing the file. Navigate to the mdf file using Windows
> Explorer and select Properties-->Advanced and uncheck the compress option.
> Same with the log file (ldf).
>
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
> news:uiWHH6$3HHA.4672@.TK2MSFTNGP05.phx.gbl...
>
|||Hi... I tried your idea of unchecking the compress this file box in the
database file and its log file. I tried to attach it again and I get the
following message:
Attach database failed for Server 'ANDY\SQLEXPRESS'.
(Microsoft.SqlServer.Express.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
One or more files do not match the primary file of the database. If you are
attempting to attach
a database, retry the operation with the correct files. If this is an
existing database, the file may
be corrupted and should be restored from a backup. (Microsoft SQL Server,
Error: 5173)
Does this mean I have to redo my database by hand? I don't have any backup
of it and I have no idea what is wrong now. Any ideas?
"Sunfire" <a_borka@.sbcglobal.net> wrote in message
news:ua7zYRA4HHA.600@.TK2MSFTNGP05.phx.gbl...
>I will check it out and let you know what happens. You might have saved my
>neck...
>
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:OZCATAA4HHA.5724@.TK2MSFTNGP05.phx.gbl...
>
|||You can try sp_attach_db and specify the path & file name for *all* the database files (mdf, ldf and
possibly ndf). If you are sure you got the path correct and still get some strange error, you are
most probably in trouble. Attaching is only supported if you did a clean detach first, if you
didn't, well, these things can happen.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Sunfire" <a_borka@.sbcglobal.net> wrote in message news:OiwlJjA4HHA.5740@.TK2MSFTNGP03.phx.gbl...
> Hi... I tried your idea of unchecking the compress this file box in the database file and its log
> file. I tried to attach it again and I get the following message:
> Attach database failed for Server 'ANDY\SQLEXPRESS'. (Microsoft.SqlServer.Express.Smo)
> Additional information:
> An exception occurred while executing a Transact-SQL statement or batch.
> (Microsoft.SqlServer.Express.ConnectionInfo)
> One or more files do not match the primary file of the database. If you are attempting to attach
> a database, retry the operation with the correct files. If this is an existing database, the file
> may
> be corrupted and should be restored from a backup. (Microsoft SQL Server, Error: 5173)
> Does this mean I have to redo my database by hand? I don't have any backup of it and I have no
> idea what is wrong now. Any ideas?
>
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message news:ua7zYRA4HHA.600@.TK2MSFTNGP05.phx.gbl...
>
|||Guess it's back to the drawing board then...sigh... At least the DB wasn't
very huge...grin
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23Hx6l7B4HHA.5844@.TK2MSFTNGP02.phx.gbl...
> You can try sp_attach_db and specify the path & file name for *all* the
> database files (mdf, ldf and possibly ndf). If you are sure you got the
> path correct and still get some strange error, you are most probably in
> trouble. Attaching is only supported if you did a clean detach first, if
> you didn't, well, these things can happen.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Sunfire" <a_borka@.sbcglobal.net> wrote in message
> news:OiwlJjA4HHA.5740@.TK2MSFTNGP03.phx.gbl...
>
|||... and you now know to do your backups regularly... ;-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Sunfire" <a_borka@.sbcglobal.net> wrote in message news:%23V$7AlC4HHA.484@.TK2MSFTNGP06.phx.gbl...
> Guess it's back to the drawing board then...sigh... At least the DB wasn't
> very huge...grin
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:%23Hx6l7B4HHA.5844@.TK2MSFTNGP02.phx.gbl...
>
Can't attach database
HI all, I'm trying to move a mdf from a dev machine onto a production server and when I try to re-attach I keep getting the following error " ...the mdf file is not a primary database file" ...and it won't attach.
It's SS2005, does anyone know why this error occurs.
Thanks
How did you detach the original database?|||Thanks for the prompt Euan, I just found out the database wasn't detached properly, they just burned it onto a CD directly!..hopefully the correctly detached one will be OK.
Can't attach database
HI all, I'm trying to move a mdf from a dev machine onto a production server and when I try to re-attach I keep getting the following error " ...the mdf file is not a primary database file" ...and it won't attach.
It's SS2005, does anyone know why this error occurs.
Thanks
How did you detach the original database?|||Thanks for the prompt Euan, I just found out the database wasn't detached properly, they just burned it onto a CD directly!..hopefully the correctly detached one will be OK.
Cant attach database
I've created a database inside my ASP.net project, the database is in the App_Data folder as exepcted.
I can't run the aspnet_regsql until I have attached it using SQL Server Management Studio, but when I try to attach the database it doesn't let me navigate through my folders properly.
The database is in C:\Users\Wardie\Documents\FirstProject\App_Data but SQL SMS only lets me navigate to the folder C:\Users\Wardie and no further for some reason, meaning I can't attach the database and can't use the aspnet_regsql service to create the membership tables.
Does anyone know how to fix this?
I had this problem and discovered that SQL Server Management Studio doesnt navigate long directory paths off windows user directories like "My Documents". I ended up creating all my web projects in a sub directory off C:\ something like C:\My Websites\Web1\App_Data\MyDatabase.MDF will work fine. Sorry, but as far as I'm aware you'll have to move your project directory to a shorter path off the root directory.
|||I guess i'll just have to do the same then, cheers smc.
A bit of a stupid thing though isn't that really?
|||I agree. There's probably a logical reason... maybe its to do with virtual paths that are used for user "My Directory" folders not being supported. I.e. the "My Documnets" directory is actually something like "C:\Documents and Settings\UserName\My Documents"
Please mark as answered if I was helpful in someway to you.
Can't Attach a Deleted Database
don't have a backup and your mdf/ldf files are both
damaged, you are hosed.
I've heard there are so-called 'recovery experts' out
there. But I've never used them.
If there is a chance they'll come back asking for backups
and unless they've given you okay to not have any backups,
make regular backups regardless.
Linchi
>--Original Message--
>We accidentally deleted a development database from our
SQL2K server. We don't have a valid backup (never made
one because it was in development). I was able to recover
the .mdf and .ldf files but SQL won't allow us to attach
them (invalid files or page fault data). Everything seems
to indicate that this can't be done but I'm hoping
somebody out there has the solution. Thanks, Roni.
>.
>|||Hi Roni,
Unfortunately, there is no recommended method of recovering the database if
there was no backup. It seems that you recovered the MDF/LDF files and
tried to attach the database. I would like to know how you attached the
database? Could you tell me the detailed error message?
Please make ensure that the specified MDF file is correct. In the case, if
the MDF file is incorrect, it is hard to recover the database.
For additional information regarding attaching database via Enterprise
Manager, please refer to the article on the SQL Server Books Online.
Topic: "How to attach and detach a database (Enterprise Manager)"
In Query Analyzer, please try to use sp_attach_db stored procedure to
attach database. Do any error messages occur? If so please provide the
detailed error message.
If we still fail to attach the database, please try to use
sp_attach_single_db stored procedure. Do any error messages occur? If so,
please provide the detailed error message.
For addition information regarding these stored procedure, please refer to
the following articles on SQL Server Books Online.
Topic: "sp_attach_single_file_db"
Topic: "sp_attach_db"
Thanks for your understanding.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.|||I want to thank all of you, who took time to respond to this message. Shortly after I posted my inquiry, management authorized the $250 for a call to Product Support. We were unable to get the database back from the .mdf and .ldf files using any of the techniques, which were submitted. Having consulted with the highest levels of support, the consensus was that the file headers were corrupt (perhaps as part of the simple act of deletion), and were, therefore, unusable.
There was some talk about third-party recovery services, but it just appeared to be costly, require a lot of time and still may not work. We decided to go back to a 5-week old, valid backup and start work from there.
BTW, because MS wasn't able to fix the problem, I will be recieving a refund on the $250 charge.
Again, thank you all for your time and consideration.
Roni Hourihane|||Hi Roni,
Thanks for your feedback. It lets us know the status of this issue. Please
feel free to post in the group if you would like further assistance.
Thanks for using MSDN newsgroup again.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.sql
Cant attach a database using MSDE deployment toolkit
sample programs provided by Mario S. Almost everything is
fine when I want to create a database, add tables, and
etc. but I am unable to attach a database.
On one instance called "george" i have created a database
called "lawncare" and moved it to the C: drive. I am using
the same embedded resource file "DBInstall.sql" that is
used in the examples (and which works for creating tables,
etc) but I receive the following error message:
"An exception occured in the ONAfterInstall event handler
of DBInstaller.CustomInstaller.
>Line 2: Incorrect systax near 'go'
Line 4: Incorrect syntax near 'go'"
The script I am using in the resource file is:
set nocount off
go
exec sp_attach_single_file_db @.dbname = 'lawncare',
@.physname = 'c:\lawncare_Data.mdf'
go
If, in the same resource file I were to use this script:
CREATE TABLE [dbo].[City] (
[CityId] [int] IDENTITY (0, 1) NOT NULL ,
[Description] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
The table would be created just fine...(the routine
substitutes ";" for "go" when reading the text to execute.)
Any help would be appreciated.
Thanks
NJ
NJ,
Your sql is working fine, I tried it and it worked. But make sure that this database that you are trying to attach is actually detached from somewhere before. The sp_attach_single_file_db works with databases which are detached from somewhere. Also mak
e sure that your log file is at c:\ drive too .
let me know if it doesn't work.
dev
Can't attach a database during an install
I have a Wise for Windows Installer package that will install SQL Express 2005 and then attach a database. In order to keep consistent I am placing the new .MDF file in C:\Program Files\Microsoft SQL Server\MSSQL$INSTANCE\data. If the folders don't exists I create them. Well, on one test machine I create the folder and copy the MDF to the directory and then use 'osql' to attach the database but I am getting this error:
Msg 5173, Level 16, State 1, Server SREXROAT2\FHMOBILE, Line 1 One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup. Msg 1813, Level 16, State 2, Server [COMPUTERNAME], Line 1 Could not open new database '[DATABASE NAME]'. CREATE DATABASE is aborted. Log file '[LOG FILE NAME]' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.
Does anyone know how to get around this? It works on our other test machines with the same database.
hi,
a dumb question of mines... did you try with another copy of the installer package? is it corrupt?
regards
|||You should be installing both the .MDF and the .LDF.
|||The problem, besides not attaching correctly, was that the MDF file was attached to a different location and a different name so that when I would attach it during the install it would try and create the log file in the wrong spot and this case it already existed.Can't attach a database because of security
I am having some issues with SQL Express not being able to create a database because the SQL Express account doesn't have permission. During the install I have the user select the local system account. Even then it doesn't work. If I would go into the folder with the database and give the standard users full control the database will attach.
Is there a way to handle this? I have one install doing all of the work so the user really can't interact with the file system during the install. I am looking at Xcacls as a possible solution but is there something I can do in SQL to fix this?
From BOL under Securing Data and Log Files:
Scenario
The following scenario demonstrates the permissions that are set when a database is created, and modified when the database is detached, and attached.
User1, a member of the dbcreator fixed server role, creates the database Sales that has files e:\Data\Sales.mdf and f:\Log\Sales.ldf. At the time the database is created, the MSSQLSERVER service account is SQLServiceAccount2, a local account. Full Control permissions on the database and log files are granted to SQLServiceAccount2 and members of the Windows Administrators group.
A decision is made to move the Sales database to another instance of SQL Server on the same server. Admin3, a member of the sysadmin fixed server role, detaches the database. The Database Engine sets the permissions on the Sales.mdf and Sales.ldf files so that only the Admin3 account has permissions to access the files.
Admin3 connects to the other instance of SQL Server, SalesServer. The MSSQLSERVER service account for the SalesServer instance is SQLSalesServiceAccount. Admin3, a SQL Server administrator on this instance, attaches the Sales database. Full Control permissions are granted to SQLSalesServiceAccount and members of the
xcalcs may be the way to go here.
hth,
-Steven Gott
S/DET
SQL Server
|||I don't see how the BOL entry answers the question. Unless I am missing something the entry has more to do with the actual database permissions as opposed to the permissions to create the log file during the attach process. If I give everyone access to the folder that contains the MDF file I am able to attach it. So that would tell me that SQL Server itself doesn't have permission to the folder.
I tried this on a few other machines and during the install I make sure the local system account is used for the SQL server and it works. I am not sure why the first machine is having such issues.
|||Evan,
The SQL Service account should always be able to create databases and the only reason I can think of that would cause a database to fail to attach is that the ACLs on the database file itself is preventing the attach.
On the machine where this repros what is the service account SQL Express is running under?
What is the error message?
Are you executing sp_attach_db or calling create database for attach?
thanks,
-Steven Gott
S/DET
SQL Server
|||I talked to the guy with the messed up computer and he said he did go into the registry and delete some of those entries so I have no clue what that could mess up.
The SQL is running under the local system account. I know when I first got to the machine I changed the log on for the service to local system checkbox and it wouldn't start. I wonder if those are connected.
|||Unfortunately it seems from your description (manually deleted registry entries) that it may b a non-supported configuration and most likely we will not be able to be of much help as it will be really hard for us to find the root cause of the problem under these circumstances.I would suggest contacting MS support.
I would also like to highly recommend against arbitrarily making manual modifications on SQL Server resources (such as registry keys, ACLs, files, etc.) unless it is documented and/or you know how it will affect SQL Server. If you still need to make such modification I strongly suggest making a backup of any important information you may have on the system and document the modification you are making in order to revert back to a well-known state in case the change doesn’t work as you expected
Thanks a lot,
-Raul Garcia
SDE/T
SQL Server Engine