What you will learn
A backup is useful only if it can be restored. You will preserve the source database, inspect a backup set, and create TutorialRestore with separate files. A copy-only full backup is suitable for this ad hoc test because it does not change the differential base of a scheduled backup strategy.
Before you begin
Use an isolated SQL Server 2022 Developer lab on host1.sample.com and a current SQL Server Management Studio client. Developer edition is for nonproduction use. Connect with a dedicated lab administrator for setup; application access is tested separately. The examples use TutorialDB and synthetic rows only. GO is a client batch separator, not a Transact-SQL statement. Sample paths are on the database server, not your workstation. TutorialDB and dbo.Events must exist. Create C:\SqlBackups and C:\SqlData on the server and grant the database service account access. TutorialRestore must not already exist; use a new backup filename and separate destination files.
1. Back up and inspect the media
BACKUP DATABASE TutorialDB
TO DISK=N'C:\SqlBackups\TutorialDB_copy.bak'
WITH COPY_ONLY,CHECKSUM,STATS=10;
RESTORE HEADERONLY FROM DISK=N'C:\SqlBackups\TutorialDB_copy.bak';
RESTORE FILELISTONLY FROM DISK=N'C:\SqlBackups\TutorialDB_copy.bak';
RESTORE VERIFYONLY FROM DISK=N'C:\SqlBackups\TutorialDB_copy.bak' WITH CHECKSUM;
Use a new file so the intended set has position 1. If media contains multiple backup sets, select the correct FILE position consistently. VERIFYONLY checks backup readability and completeness; it does not execute a full recovery or validate all logical database contents.
2. Restore with the actual logical names
USE master;
GO
RESTORE DATABASE TutorialRestore
FROM DISK=N'C:\SqlBackups\TutorialDB_copy.bak'
WITH FILE=1,
MOVE N'TutorialDB' TO N'C:\SqlData\TutorialRestore.mdf',
MOVE N'TutorialDB_log' TO N'C:\SqlData\TutorialRestore_log.ldf',
RECOVERY,STATS=10;
Replace the two logical names with FILELISTONLY results. Supply one MOVE for every file if the source has more than two. Confirm the destination paths are unused. WITH REPLACE is intentionally unnecessary for a new database.
3. Check structure and application data
DBCC CHECKDB(N'TutorialRestore') WITH NO_INFOMSGS;
SELECT event_id,message FROM TutorialRestore.dbo.Events;
SELECT name,state_desc FROM sys.databases WHERE name=N'TutorialRestore';
Compare the fixture with the source at the backup boundary, not with rows committed afterward. For a real application, include representative queries, permissions, integrity constraints, and dependent objects. SQL logins and SQL Agent jobs are instance resources and are not copied by a user-database restore.
4. Read the example output
The following is illustrative, normalized output, not a transcript from a customer system. Values depend on your release and lab state.
event_id message
1 ready
name state_desc
TutorialRestore ONLINE
CHECKDB with NO_INFOMSGS reports errors if found; the absence of informational messages is expected for a clean database.
Verify the result
Retain backup completion, restore completion, integrity-check results, and fixture comparison. Measure elapsed restore time against your recovery objective. Test full/differential/log sequences separately before claiming point-in-time recovery readiness.
Troubleshooting
A logical-file-name error requires FILELISTONLY, not a guessed filename. Access denied refers to the server service account. Encrypted backups require the appropriate certificate or key. A backup from a newer engine cannot simply be restored to an older engine.
Recovery and next steps
Keep the source intact and isolate TutorialRestore from application traffic. Remove the restored lab database only after recording results. Preserve required backup chains according to retention policy; deleting history is different from deleting media.