ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Life >

8985 error while SQL shrinking database

Saturday on July 4th, 2009Life

There is a database on the server that reaches 4GB, and its log files are also as high as 14GB. So I wanted to clear the log and compress the database. But when shrinking the database, error 8985 was displayed. After careful comparison, it was found that the displayed database file name was inconsistent with the actual database logical file name.

The file name implemented to display sms_data here is zsms_data

solution:
Use ALTER DATABASE database_name MODIFY FILE (NAME = logical_file_name, NEWNAME= new_logical_file_name) to modify the file name to be

consistent Use

ALTER DATABASE zsms MODIFY FILE (NAME = 'sms_data', NEWNAME= 'zsms_data')
Error: sms_data does not exist

, use

ALTER DATABASE zsms MODIFY FILE (NAME = 'zsms_data', NEWNAME= 'zsms_data')
Display successful

view The displayed file names are consistent.

Perform compression again, OK! Success! Shrink to 312M

------------

It is unclear why the names displayed are inconsistent. The possible reason is that the logical file name was changed when restoring data. It took most of a day, and there was very little relevant information online. Has no one ever encountered this problem before? Record the exam preparation here.

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/life/8985-error-while-SQL-shrinking-database.htm