Error 5173 Sql Server 2008
Contents |
Recent PostsRecent Posts Popular TopicsPopular Topics Home Search Members Calendar Who's On Home sqlserver error 5173 » SQL Server 7,2000 » Administration » Attach a database error 5173 microsoft sql server error 5173 attaching database Attach a database error 5173 Rate Topic Display Mode Topic Options Author Message JC-170735JC-170735 Posted Wednesday, March sql server log file does not match the primary file 2, 2005 12:46 PM Forum Newbie Group: General Forum Members Last Login: Thursday, April 14, 2005 9:57 AM Points: 2, Visits: 1 We are trying to attach a database sql server error 5123 attach database from another server. We are running the same service pak as the other server. The files were detachedfrom the other server. We have both the .mdf and .ldf files, we can verify the files. However, when we try to attach the file we get the following error:Error 5173: Cannot associate files withdifferent databases.Does anyone know why we would
Sql Server Error 5123 Create Database
receive this error message or if we need to set some defaults prior to attaching the database?Any help would be appreciated.Thank You! Post #165155 wz700wz700 Posted Wednesday, March 2, 2005 3:54 PM Old Hand Group: General Forum Members Last Login: Monday, January 21, 2013 7:08 AM Points: 397, Visits: 17 From knowledge baseSQL Server does not allow you to attach a single file of a database that contains multiple files. The attach looks for all files that belong to the database during the attach and if it cannot find the files with the corresponding GUID, it fails the attach. Similarly, if you create a blank database with the same filenames and filegroups as the original database, replace some of the files, and then attempt to let SQL recover the database upon startup, recovery fails as indicated by the errorlog. Post #165230 Hanlie SteynbergHanlie Steynberg Posted Thursday, April 28, 2005 4:57 AM Forum Newbie Group: General Forum Members Last Login: Monday, December 3, 2007 11:20 PM Points: 1, Visits: 2 Does any one
SERVER - FIX - Error: One or more files do not match the primary file of the database November 11, 2014Pinal DaveSQL, SQL Server, SQL Tips and TricksNo CommentsWriting about SQL Server for close
Sql Error 5123 Access Denied
to 8 years, almost every single day means I get a error 5123 in sql server 2005 lot of questions from people on a daily basis. Though I try to answer as many as possible sql error 5123 create database (via email, blog, twitter and Facebook), I get many interesting questions. There are a variety of questions ranging from installation, scalability, performance, TSQL, new feature and a variety of http://www.sqlservercentral.com/Forums/Topic165155-5-1.aspx error messages. Recently I got an email which had below the question:Hi Pinal,I was given task to move the files for few databases and also to rename them. While doing this activity I did some mistake and few of my databases are not coming online. Here is the error I am getting for those databases.2014-10-20 17:52:39.08 spid37s Error: 5173, http://blog.sqlauthority.com/2014/11/11/sql-server-fix-error-one-or-more-files-do-not-match-the-primary-file-of-the-database/ Severity: 16, State: 1.2014-10-20 17:52:39.08 spid37s 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.2014-10-20 17:52:39.08 spid37s Log file ‘E:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\SQLAuth_log.ldf' does not match the primary file. It may be from a different database or the log may have been rebuilt previously. Can you please help me how I can resolve this issue and what needs to be done to mitigate?On further investigation of ERRORLOG it was found that we have “RECOVERY_PENDING” state for the database because recovery of database could not be complete. The cause of the error is all files which are getting used by database don’t belong to the same database. There is a safety mechanism in the database startup where it checks whether all files below to same database. This is so very important because we don’t want to override exis
SQL Server experts to answer whatever question you can come up with. Our new SQL Server Forums are live! Come on over! http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=70687 We've restricted the ability to create new threads on these forums. SQL Server https://ekasiswanto.wordpress.com/2009/02/13/resolving-sql-error-5173/ Forums Profile | ActiveTopics | Members | Search | ForumFAQ Register Now and get your question answered! Username: Password: Save Password Forgot your Password? All Forums SQL Server 2000 Forums SQL Server Administration (2000) URGENT: Recovery DB with no log file Reply to Topic Printer Friendly Author Topic BusmasterJones Starting sql server Member 4 Posts Posted-08/17/2006: 15:08:49 Server crashed and with it went the log files which were on the drive that failed. We are currently having trouble getting BAK files off the tape. The MDF files are all intact, but efforts to do any tricky reattaches are failing. I have tried:sp_attach_single_file_db @dbname = 'Op' , @physname = 'F:\Program Files\Microsoft SQL Server\MSSQL\Data\Op.MDF'which gives the sql server error error:Server: Msg 1813, Level 16, State 2, Line 1Could not open new database 'Op'. CREATE DATABASE is aborted.Device activation error. The physical file name 'F:\Program Files\Microsoft SQL Server\MSSQL\Data\Op_log.ldf' may be incorrect.There is a no log file, but I guess it is looking in the same directory as a default.Plan B: I create an Op db and dettach it. I copy the log file over to the location listed above and try the same command:sp_attach_single_file_db @dbname = 'Op' , @physname = 'F:\Program Files\Microsoft SQL Server\MSSQL\Data\Op.MDF'which gives the error:Server: Msg 5173, Level 16, State 1, Line 1Cannot associate files with different databases.Server: Msg 1813, Level 16, State 1, Line 1Could not open new database 'Op'. CREATE DATABASE is aborted.Log file 'F:\Program Files\Microsoft SQL Server\MSSQL\Data\Op_log.ldf' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.I just ran across db_rebuild_log() and DBCC REBUILD_LOG but need to read up on how these work. I plan to try them.In the meantime, can anyone given me a path they have used to take an MDF file with no LDF file and get it back up and
insight of this error type : The generic form is : Error 5173: Cannot associate files with different databases. There is no format specifier, so all failure in attaching any possibly corrupted database will end up with this message. One of the causes of this error is the mismatch of some ID internally maintained by SQL Server 2000 between the MDF and LDF file. This ID is in the form of GUID and is called binding ID in SQL Server terminology. This kind of checking is good, considering the possibility of associating the MDF with wrong LDF file and vice versa. But sometimes, this error can be a disaster when you absolutely sure that you have already make some necessary steps to verify that it is indeed the right binding between your MDF and LDF file, yet, SQL Server still complains that is different. In this case, you have to resort to manually verifying the internal GUID of your MDF and LDF file, the way SQL Server was doing it. The internal GUID of MDF and LDF file is located at file header page (page 0) in the file header record. The file header record offset location is determine by the one and only slot in row offset array (slot 0), at offset 0x1FFE, word size. Let's have a look of our troubling MDF file to get the row offset value : The slot 0 value : The m_tornBits value : Please beware that the byte at offset 0x1FFF is actually the torn bit, and in detached state, it tends to point to wrong value. So, you should perform some correction of this byte to obtain correct row offset location for the file header record. First, this value is masked with 0xFC with AND operation. This can be done by ubiquitous calculator program with scientific mode : 0x01 AND 01xFC = 0x00 Next the m_tornBits value 0x80102001 is right shifted by 0x1E, again this can be accomplished by calculator (make sure you checked the Inv to perform the Rsh operation, because default operation is Lsh) : 0x80102001 Rsh (right shift) 0x1E = 0x00000002. For those who are curious, the 0x1E value is the value that is used for torn page bits calculation. Because this is the last sector, it is right shifted with 0x1E, the previous sector with 0x1C, etc. Further information can be obtained from my post about fixing torn page value. This value is Or-ed with value obtained above : 0x02 Or 0x00 = 0x02. So, the correct value is 0x22D instead of 0x12D🙂 I will now copied this record location (offset 0x22D at page 0) to new location : As you can see, the internal GUID is located at offset 0x3B. Perform the same operation for page 0 for LDF file, compare and match the GUID, and re-attach the database. This time the database sh