sqlschool.gr logo

articles

Articles of SQLschool.gr Team

Failed to generate a checkpoint in a database

Antonios Chatzipavlis
Sunday 13 June 2021

Πρόσφατα κλήθηκα να διορθώσω μια corrupted database με αρκετά μεγάλο αριθμό corrupted pages. Η διαδικασία επιδιόρθωσης ήταν επίπονη και πήρε αρκετές ημέρες αλλά τελικά ολοκληρώθηκε.

Με την ολοκλήρωση της διαδικασίας ζήτησα να γίνει full backup καθώς τα ήδη υπάρχοντα backups ήταν και αυτά corrupted καθώς περιείχαν τις corrupted pages.

Κατά την διάρκεια του full backup όμως εμφανίστηκε ένα νέο μήνυμα λάθους που έλεγε το εξής:

Error: 5901, Severity: 16, State: 1
One or more recovery units belonging to database ‘ΧΧΧΧ’ failed to generate a checkpoint. This is typically caused by lack of system resources such as disk or memory, or in some cases due to database corruption. Examine previous entries in the error log for more detailed information on this failure. The log scan number (ΧΧΧΧΧ:ΧΧΧ:Χ) passed to log scan in database ‘ ΧΧΧΧ ‘ is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.

Πραγματικά το λάθος αυτό δεν ήταν κάτι που περίμενα να δω μπροστά μου αλλά θυμήθηκα μια περίπτωση που το είχα ξαναδεί σε διαφορετική όμως περίπτωση και δεν μου φάνηκε λογικό αλλά το μύνημα ήταν ξεκάθαρο καθώς αναφέρει και database corruption.

Αρχικά έκανα ένα έλεγχο στο transaction log και αυτό δεν έδειξε κάποιο πρόβλημα.

Στην συνέχεια έκανα manual execution της διαδικασίας CHECKPOINT όπου έβγαζε το λάθος αυτό.

Η επόμενη κίνηση ήταν να δω το log_reuse_wait_desc field στην συγκεκριμένη database κάνοντας χρήση ενός SELECT * FROM sys.databases.

Το αποτέλεσμα που επέστεψε το συγκεκριμένο field ήταν "REPLICATION" αλλά η βάση δεν συμμετείχε σε κάποιο replication. Εντυπωσιακό. Πρέπει να πω ότι στο παρελθόν στην συγκεκριμένη database είχαν γίνει κάποιες προσπάθειες για mirroring αλλά και πάλι δεν υπήρχε ούτε αυτό.

Αφού έψαξα αναλυτικά ώστε να επιβεβαιώσω τις σκέψεις μου αποφάσισα να εκτελέσω την sp_removedbreplication καθώς κάπου υπήρχε "σκαλωμένο" κάποιο flag που όμως δεν εμφανίζονταν πουθενά.

SQL Script

EXEC sp_removedbreplication N‘ΧΧΧΧ’

Το αποτέλεσμα μετά την εκτέλεση ήταν να "ξεσκαλώσει" η διαδικασία του checkpoint και να μπορεί να γίνει το backup.


//Antonios Chatzipavlis

Antonios Chatzipavlis

Antonios Chatzipavlis

Antonios Chatzipavlis is a highly experienced Data Solutions Consultant and Trainer. He has been working in the IT industry since 1988, holding various roles such as senior developer, IT Manager, Data & AI Solutions Architect and Consultant.

Since 1995, Antonios has focused on modern technologies and software development tools, primarily by Microsoft. He has specialized in Data & AI since 2000, with expertise in Microsoft Data Platform (SQL Server, Azure SQL Databases, Azure Synapse Analytics, Microsoft Fabric, Power BI, AI) and Databricks.

Antonios is also a Microsoft Certified Trainer (MCT) for over 25 years, has been recognized as a Microsoft Most Valuable Professional (MVP) in Data Platform since 2010 and he is in the Data Expert 40 Powerlist 2024 by Boussias. He is the co-founder and visionary behind XLYTiCA, a company dedicated to Data & AI solutions.

Episode

Task Flows in Microsoft Fabric

image

More Episodes...

Tip

Get Certified: Become a Fabric Data Engineer

More Tips...

Become a member

If you want to receive updates from us become a member to our community.

Connect

Explore

Learn


sqlschool.gr © 2010-2025 All rights reserved

This site uses cookies for operational and analytics purposes only. By continuing to browse this site, you agree to their use.