In my SQL, a table has corrupted. When renaming or removing it, I get this message:
Possible schema corruption. Run DBCC CHECKCATALOG. A severe error occurred on the current command. The results, if any, should be discarded.
I did tried DELETE
, TRUNCATE
and DROP
but none of these works.
This corrupted table exist in every backup file. The data inside this table is not important, but the main point is to recreate it. How do I removing this corrupted/damaged table?
3条答案
按热度按时间zengzsys1#
Please try the following in order to remove a corruption from a table:
It indeed worked for me.
All the Best...!!!
rlcwz9us2#
http://www.sqlskills.com/blogs/paul/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort/
Hack the system tables to get the database into EMERGENCY mode. Use the undocumented and unsupported DBCC REBUILD_LOG command to build a new transaction log. Run DBCC CHECKDB with the REPAIR_ALLOW_DATA_LOSS option to fix up corruptions in the data files – both those that may have caused the issue, and those caused by rebuilding the transaction log (e.g. because an active transaction altering the database structure was lost). Figure out what data was lost or is transactionally inconsistent (e.g. because a transaction altering multiple tables was lost) as far as your business logic is concerned Take the database out of EMERGENCY mode And then all the other stuff like root-cause analysis and getting a better backup strategy
pgx2nnw83#
If there is schema corruption in SQL server database you can try some some steps to remove it.
DBCC CHECKCATALOG('Name of database')
EXEC sp_MSforeachtable 'IF OBJECT_ID(''?'') = YourObjectID EXEC(''DROP TABLE ?'')'
SELECT *FROM sys.tables WHERE name = 'TableName'
By these steps you can remove the corrupted table from database. I hope this will help you!!