You obtain a database's state of restoration by querying the recovery metadata that the database engine, backup tool, or hosting platform exposes during and after a restore: restore history, in-progress restore status, log-apply position, and consistency checks. The exact source depends on where the restore runs. A self-managed SQL Server reads sys.dm_exec_requests and msdb restore history; PostgreSQL reads pg_stat_progress_copy-style progress views, pg_stat_activity, and recovery signals; MySQL reads performance_schema and the error log; cloud platforms expose a restore or instance status API. The key condition is that "state of restoration" means one of three different things, and mixing them up is the most common source of wrong answers: the status of the restore operation, the point in time the data reflects, and whether the restored data is complete and verified.
This guide treats those as three separate questions, gives the commands for each major engine, and shows how to confirm success rather than trust a green checkmark.
First, Separate the Three Meanings of "State of Restoration"
Before running anything, decide which question you're actually answering. The word "restoration" in database work refers to at least three measurable states, and each has its own source.
The restore operation status answers: is the restore still running, did it fail, how far along is it? This lives in the engine's process and request views, the tool's job log, or the platform's control-plane API.
The recovery point answers: what moment does the restored data represent? This is the backup's finish time plus any transaction logs or WAL applied afterward. It is a timestamp and a log sequence, not a percentage.
The data integrity state answers: is the restored copy complete, consistent, and caught up with its recovery target? This is verified by consistency checks, comparing object counts or checksums, and confirming the database is out of recovery mode and accepting writes.
A restore can be 100 percent copied, 100 percent "succeeded" in the console, and still be the wrong recovery point or an inconsistent copy. Treat the three checks as a sequence, not alternatives.
The second prerequisite is knowing which restore type you're dealing with, because the metadata differs:
Full restore from a backup file — engine-level progress views and backup history. Point-in-time restore (PITR) — the same, plus a stop-at timestamp or log sequence number. Snapshot or clone restore — usually a platform or storage-layer status, often with no log replay. Logical restore (dump/import, pg_restore, mysqldump reload) — tool output and table-level verification, not engine recovery views. Disaster recovery failover — replication or availability-group state, not a restore job at all.
Identify the type first; the wrong view will report "nothing running" even while a logical restore is quietly churning.
Reading Restore Progress in SQL Server
SQL Server exposes restore progress through dynamic management views and keeps a durable record in msdb. You need at least VIEW SERVER STATE permission, and sysadmin or the dbcreator role to see some restore details.
Check what is running right now
A row with command = 'RESTORE DATABASE' and percent_complete climbing confirms a restore is active. estimated_completion_time is in milliseconds and is a rough projection, not a promise; it recalculates as the restore advances. A RESTORE that is replaying logs shows RESTORE LOG.
If the query returns nothing, the restore is either finished, failed, or running under a different session that your permissions cannot see. That is the first fork in troubleshooting.
Check the durable restore history
msdb records every restore, finished or failed:
restore_type values are D (database), L (log), F (file), G (filegroup), V (verify only). stop_at is the point-in-time target if you used STOPAT. The companion msdb.dbo.backupset table gives the source backup's backup_finish_date and first_lsn/last_lsn, which is how you reconstruct the actual recovery point.
To see exactly what was restored and from where:
Confirm the database actually recovered
A completed restore leaves the database in a recovered, writable state unless you used NORECOVERY or STANDBY. Check:
state_desc = 'ONLINE' and user_access_desc = 'MULTI_USER' mean the restore finished and recovery ran. RESTORING means log replay is still pending or you deliberately left it in NORECOVERY for a later log restore. RECOVERY_PENDING usually signals missing log files or a failed undo phase.
Success check: run DBCC CHECKDB('YourDatabase') WITH NO_INFOMSGS;. A clean run returns nothing and confirms structural consistency. This is the only check that distinguishes "the restore finished" from "the restored pages are sound."
Reading Recovery and Restore State in PostgreSQL
PostgreSQL doesn't have a single "restore percent" view for physical recovery; the recovery state is inferred from process activity, control functions, and server settings. Logical restores (pg_restore or psql replaying a dump) are visible through activity views instead.
Physical recovery in progress
While a standby or a PITR restore is replaying WAL, check:
pg_stat_wal_receiver shows the last WAL location received and when, so you can tell whether replay is advancing. On the recovery target itself, pg_is_in_recovery() returns true until promotion. Track replay position with:
The gap between received and replayed LSN is your lag. pg_last_xact_replay_timestamp() tells you the timestamp of the last transaction applied, which is the closest thing to your current recovery point.
If the server has a recovery.signal or standby.signal file, it will not come out of recovery on its own; check the file's presence and the recovery_target_* settings in postgresql.conf or postgresql.auto.conf. A PITR restore that never promotes usually has a wrong target name, a target time beyond the available WAL, or a missing archive segment.
Logical restore in progress
For a pg_restore or dump replay, PostgreSQL 14 and later expose copy progress:
This gives per-table byte progress during COPY-based restore. Combine it with:
A long-running session with wait_event_type = 'IO' during a restore is normal; a session stuck on Lock usually means a conflicting connection is blocking a table.
Confirm the restored cluster is complete
Postgres does not record a restore history table by default. Verification is behavioral:
1: Confirm the server is out of recovery: SELECT pg_is_in_recovery(); returns false. 2: Confirm the target time: compare pg_last_xact_replay_timestamp() to your intended recovery_target_time. 3: Check object counts against the source: SELECT count(*) FROM pg_class WHERE relkind = 'r'; and compare per schema. 4: Run VACUUM (VERIFY) on selected tables (PostgreSQL 12+ validates page structure without a full rewrite) or compare pg_dump --schema-only output of source and target.
Success check: source and target schema dumps match, row counts are within expected tolerance, and a handful of application-level queries return expected results. That last step catches the case where the restore "succeeded" but stopped before your target transaction.
Reading Restore State in MySQL and MariaDB
MySQL's restore picture depends on the method. A physical restore from a backup tool has its own status; a logical reload of a mysqldump file is visible as running sessions.
Logical reload progress
During a mysqldump reload, one thread typically executes statements serially. STATE values such as "executing" or "Opening tables" move forward; a thread frozen at the same state with a growing TIME usually indicates a lock wait or a slow DDL statement.
MySQL 8.0 exposes performance schema instrumentation that can show statement counts:
This does not tell you restore percent, but it confirms which tables are being written and whether I/O is progressing.
Error log as the authoritative record
MySQL and MariaDB do not maintain a restore-history system table. The error log is the practical record: a successful mysqldump reload typically ends with the dump's final statement and no errors, while failures appear as ERROR lines. Check the log location with:
Then tail that file. This is a file-system check, so it requires OS access or a managed platform's log viewer.
Confirm the reload is complete
For logical restores:
1: Compare table counts: SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'yourdb'; 2: Compare row counts for key tables against the source dump's recorded counts, or against the source server if it still exists. 3: Run CHECK TABLE on the most important tables; CHECKSUM TABLE db.t1 on both source and target gives a stronger comparison. 4: Confirm binary log position on the target if you plan to resume replication: SHOW MASTER STATUS; and compare to the source's position at dump time.
Success check: CHECK TABLE returns status = OK for all tables and checksums match. Because restoring a logical dump is statement replay, a partially applied dump can leave a structurally valid but incomplete database — row counts are the check that catches it.
Reading Restore State on Cloud Platforms (AWS, Azure, GCP)
Managed services replace engine-level views with control-plane status, and the engine views may be unavailable or partially restricted during restore. The general pattern across all three is: a restore is a separate resource (or a point-in-time operation attached to the instance), and its status comes from an API, CLI, or console rather than from SQL.
AWS RDS and Aurora. Restores from snapshots appear as events and as instance status. Use aws rds describe-db-instances --db-instance-identifier your-instance and read DBInstanceStatus — values like creating, backing-up, available, or restoring describe the operation; available means the instance is accepting connections. aws rds describe-events --source-identifier your-instance --source-type db-instance gives timestamped events such as "Restored from snapshot" or "DB instance restarted." For point-in-time restores, RestoreDBInstanceToPointInTime creates a new identifier, and the effective recovery point is the RestoreTime you requested, not the time the API completed. Check LatestRestorableTime on the source to know the newest recoverable point.
Azure SQL Database. A restore operation is a long-running operation with a status endpoint: after initiating Restore-AzSqlDatabase or the equivalent ARM operation, poll the operation with Get-AzSqlDatabaseRestorePoint for available restore points and check the database's Status property (Online, Restoring, RecoveryPending) via Get-AzSqlDatabase. Azure exposes RestoreInProgress and LastRestoreTime style properties on the database resource; the definitive signal is Status = Online plus a successful connection and query.
Google Cloud SQL. gcloud sql operations list --instance=your-instance shows RESTORE operations with status RUNNING, DONE, and any error. gcloud sql instances describe your-instance reports state: RUNNABLE versus MAINTENANCE/PENDING_CREATE. For point-in-time recovery, the operation records the pointInTime target.
The universal cloud caution: "operation complete" and "database usable" are not identical. A completed restore operation can still be followed by engine startup and recovery. Poll the database's own status until it accepts your connection and returns one expected row.
Verifying the Recovery Point and Data Integrity
This is the step most people skip, and it's where a "successful" restore quietly fails. The operation status tells you the pipeline finished; it does not tell you the data is what you wanted.
Establish the expected recovery point before restoring. Write down the target: a timestamp for PITR, a log sequence number or LSN, or the backup's finish time. Then compare it to what you actually observe:
SQL Server: compare msdb.dbo.restorehistory.stop_at or the applied last_lsn in backupset to the target. If you used STOPAT, confirm the restored data includes the last transaction you expected and not one beyond it. PostgreSQL: pg_last_xact_replay_timestamp() is the last applied transaction time; it should be at or just before your recovery_target_time. Cloud: the platform's recorded RestoreTime or pointInTime is the contract; verify an application row with a known timestamp exists.
Check data completeness, not just structure. Run a row-count comparison against the source or a known baseline; check that the newest expected record exists; and if your application has a heartbeat or sequence table, confirm the last value matches. A table-by-table checksum (CHECKSUM TABLE in MySQL, pg_checksums or a hash query in PostgreSQL, a HASHBYTES aggregate in SQL Server) catches silent truncation.
Run engine consistency checks before releasing the database. DBCC CHECKDB in SQL Server, VACUUM (VERIFY) or a full pg_dump round-trip in PostgreSQL, and CHECK TABLE in MySQL. These are slow on large databases, so schedule them for the restore-validation window, not production hours.
Success check overall: the recovery point matches the target within one transaction, row counts match baseline, consistency checks pass, and one representative application query returns the expected result. Only then should the restored database receive traffic or be promoted.
Troubleshooting: Symptoms, Likely Causes, and Reversible Checks
Restore problems fall into recognizable patterns. Start with the reversible checks — read-only queries and log inspection — before changing configuration.
Symptom: no restore process is visible anywhere, but the console or job log said it started. Likely causes: you're connected to the wrong instance (a restore creates a new database or instance), your permissions hide the session, or the operation is running at a layer the engine can't see (cloud control plane, storage snapshot). Reversible check: query the restore history table on the target instance, list pg_stat_activity or sys.dm_exec_requests on the target, and check the platform's operation status. Do not restart the service to "refresh" status; you may interrupt a restore that is actually progressing.
Symptom: percent complete is stuck or estimated_completion_time grows. Likely causes: I/O saturation, a slow media device, or (PostgreSQL logical restore) a lock wait blocking a table. Reversible check: sample the view twice a minute apart and compare the actual percent_complete or bytes processed; check wait_event / wait_type for I/O or lock waits. Stop condition: if progress has not moved at all for longer than your restore SLA and the wait is not a resolvable lock, engage the DBA or platform support rather than killing the session — killing a restore mid-log-replay can leave the database in RESTORING and require a full redo.
Symptom: restore finished but the database is in RESTORING / RECOVERY_PENDING / pg_is_in_recovery() returns true. Likely causes: you restored with NORECOVERY intentionally, a transaction log is missing, or a PITR target was never reached. Reversible check: confirm all required log backups or WAL segments exist and were applied in order; check the engine error log for the missing segment name; verify the target time is within the recovery window. Stop condition: if the required archive is missing, the restore cannot proceed to your target and must be rerun from an earlier point — a decision for the data owner, not an ad hoc fix.
Symptom: restore reports success but row counts are short. Likely causes: a logical dump partially applied and the tool exited without error, a STOPAT target was earlier than intended, or a table was skipped by a filter. Reversible check: compare per-table counts against the source baseline; inspect the restore log for skipped objects or ERROR lines that the tool ignored. Re-run the missing portion if the tool supports resuming; otherwise rerun the restore after correcting the target.
Symptom: consistency check fails after a "successful" restore. Likely causes: corrupt backup media, bit rot during copy, or a storage-layer snapshot inconsistency. Do not put this database into service. Reversible check: verify the backup's own integrity (SQL Server RESTORE VERIFYONLY, PostgreSQL pg_verifybackup, MySQL mysqlbackup --validate for physical backups), then re-restore from a known-good copy. If the source backup fails verification, escalate to the backup owner.
Knowing When to Stop and Escalate
Some restore decisions are not reversible in the way query tuning is. Escalate to the database owner or platform support, rather than improvising, when: the required log or WAL segment for your recovery target is missing and the target cannot be met; a DBCC CHECKDB, VACUUM (VERIFY), or CHECK TABLE reports corruption after a verified-good backup; a restore has been killed or interrupted mid-log-replay and left the database in an ambiguous state; or the restored data passes consistency checks but fails application-level validation in a way you cannot trace.
The reason to stop there is that the next actions — restoring to a different point, promoting a standby, discarding a copy — change the data of record. Those calls belong to whoever owns recovery objectives, not to whoever happens to be at the terminal.
For ordinary restores, though, the workflow is calm and mechanical: identify the restore type, read the operation status from the right view or API, confirm the recovery point against the target, run a consistency check, and verify one real query. Do those in order and the "state of restoration" stops being a mystery and becomes four measured answers: in progress or done, at what point in time, structurally sound, and functionally correct.