Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Solution to the error of prompt 5173 in SQLSERVER database

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "solutions to 5173 errors in SQLSERVER database". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Yesterday, my colleague gave you a problematic database and asked me to fix it because the customer needs the database, which has only one mdf file and one ldf file.

I reported an error when I attached the database. The database is SQL2005.

Attached is a corrupted database file:

Because we have met before in the forum, so we will solve the problem according to the method of the forum, but the result is still not good.

Move the ldf file somewhere else, and then use the following SQL statement to rebuild the transaction log file when attaching

My database file is placed in C:\ Users\ Administrator\ Desktop\ new folder directory to copy the code as follows: USE [master] GO CREATE DATABASE [AdventureWorks2012] ON (FILENAME = NationC:\ Users\ Administrator\ Desktop\ New folder\ GPOSDB.mdf') FOR ATTACH_REBUILD_LOG GO

Error content: the copy code is as follows: 1 file activation failed. The physical file name'D:\ MSSSQL\ Data\ GPOSDB_log.LDF' may be incorrect. 2 the log cannot be regenerated because the database is not completely shut down. 3 message 1813, level 16, status 2, line 1 4 could not open the new database 'GPOSDB'. CREATE DATABASE aborted.

I'll try again according to this article now.

Http://www.blogjava.net/kent/articles/200991.html

First create an empty library of GPOSDB, and then stop the SQL service

Delete the log file GPOSDB_log.ldf of the database you just generated

Overwrite the database data file GPOSDB.mdf just generated with the GPOSDB.mdf file to be recovered

Then put the problematic GPOSDB.mdf file on disk D, because my new GPOSDB database is on disk D.

Start the SQL service

The article said that the database would be displayed for doubt, but mine did not show for doubt.

Set the database to allow direct operating system tables

Enter the following SQL statement in SSMS to copy the code as follows: USE master go sp_configure 'allow updates', 1 go RECONFIGURE WITH OVERRIDE go

Set GPOSDB to emergency repair mode to copy the code as follows: ALTER DATABASE [GPOSDB] SET EMERGENCY GO ALTER DATABASE GPOSDB SET SINGLE_USER GO UPDATE sysdatabases SET status =-32768 WHERE dbid = DB_ID ('GPOSDB') GO

But the error copy code is as follows: 1 message 259, level 16, status 1, line 1 does not allow ad hoc updates to the system directory.

An attempt was made to rebuild the log, but there was a syntax error. The copy code for that article is estimated to be SQL2000: 1 DBCC rebuild_log ('GPOSDB','D:\ GPOSDB_log.ldf') 2 GO1 message 2526, level 16, status 3, line 1 DBCC statement error. Please consult the documentation for the correct DBCC syntax and options.

Sure enough, it is.

-- * DBCC REBUILDLOG-- rebuild the SQL Server 2000 transaction log file

In fact, at the beginning of the step "setting the database to allow direct operating system tables", it was suspected that it was SQL2000, because SQL2005 or later could no longer modify the system tables.

Finally, put the transaction log file on disk D, and then use the following SQL statement to repair it. The copy code is as follows: ALTER DATABASE [GPOSDB] SET EMERGENCY GO ALTER DATABASE GPOSDB SET SINGLE_USER GO DBCC CheckDB (GPOSDB, REPAIR_ALLOW_DATA_LOSS) GO copy code: message 5173, level 16, status 1, line 2 one or more files do not match the main file of the database. If you are trying to attach a database, retry the operation with the correct file. If this is an existing database, the file may be corrupted and should be restored from a backup. The log file'D:\ GPOSDB_log.ldf' does not match the master file. The file may be from another database, or the log may have been regenerated previously. Message 5123, level 16, status 1, line 2 tries to open or create the physical file'D:\ MSSSQL\ Data\ GPOSDB_log.LDF', CREATE FILE encounters operating system error 3 (the system cannot find the specified path.) . Message 5024, level 16, status 2, line 2 cannot find the entry for the primary log file in sysfiles1. Unable to rebuild the log. Message 5028, level 16, status 2, line 2 the system cannot activate enough databases to rebuild the log. DBCC result of GPOSDB. CHECKDB found 0 allocation errors and 0 consistency errors in the database 'GPOSDB'. Message 7909, level 20, status 1, line 2 emergency mode repair failed. You must restore from the backup.

This is the end of the content of "solution to the 5173 error in the SQLSERVER database". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report