SQL Server Backup and Restore Interview Questions
Here are the list of SQL Server Backup and Restore Interview Questions which are asked in SQL Server DBA interviews.
1. How does the database recovery model impact database backups?
Ans:
First the database recovery model is responsible for the retention of the transaction log entries. So based on the setting determines if transaction log backups need to be issued on a regular basis i.e. every minute, five minutes, hourly, etc. in order to keep the transaction log small and/or maintain a log shipping solution.
-
Simple – Committed transactions are removed from the log when the check point process occurs.
-
Bulk Logged – Committed transactions are only removed when the transaction log backup process occurs.
-
Full – Committed transactions are only removed when the transaction log backup process occurs.
2. Is the native SQL Server 2005 backups are in clear text or in encrypted?
Ans:
With SQL Server 2008 is the introduction of natively encrypted database backups. Prior to SQL Server 2008 a third party product was necessary to encrypt the database backups.
3. How can I verify that backups are occurring on a daily basis?
Ans:
-
Check all backup jobs history
-
Review the SQL Server error log for backup related entries.
-
Query the msdb.dbo.backupset table for the backup related entries.
-
Review the file system where the backups are issued to validate they exist.
4. How do you know if your database backups are restorable?
Ans:
-
Issue the RESTORE VERIFYONLY command to validate the backup. For validating LiteSpeed backups use XP_restore_verifyonly
-
Randomly retrieve tapes from off site and work through the restore process with your team to validate the database is restored in a successful manner.
5. What are some common reasons why database restores fail?
Ans:
-
Sufficient space not available on drive
-
User may not have sufficient permissions to perform the restore
-
Unable to gain exclusive use of the database.
-
LSN’s are out of sequence so the backups cannot be restored.
-
Syntax error such as with the WITH MOVE command.
-
Version problem
-
Might be wrong backup location specified
-
Service account may not have permissions on backup folder
6. What are the permissions required to perform backup and Restore?
Ans:
The user must be a member of either of the below roles
Backup:
-
sysadmin – fixed server role
-
db_owner – fixed database role
-
db_backupoperator – fixed database role
Restore:
-
Sysadmin – fixed server role
-
Dbcreator – fixed server role
-
db_owner – fixed database role
7. How can you be notified if a native SQL Server database backup or restore fails via the native tools?
Ans:
-
Setup SQL Server Alerts to be sent to Operators on a failure condition.
-
Include RAISERROR or TRY\CATCH logic in your backup or restore code to alert on the failure.
8. Does all successful SQL Server backup entries can be prevented from writing to the SQL Server Error Log by a single trace flag?
Ans:
Yes – Just enable the trace flag 3226.
9. What are some common post restore processes?
Ans:
-
Sync the logins and users
-
Validate the data is accurate by running dbcc commands
-
Notify the team\user community
-
Cleanse the data to remove sensitive data i.e. SSN’s, credit card information, customer names, personal information, etc.
-
Change database properties i.e. recovery model, read-only, etc.
10. Explain how you could automate the backup and restore process?
Ans:
-
Backups can be automated by using a cursor to loop through each of the databases and backup each one
-
Restores can also be automated by looping over the files, reading from the system tables (backup or log shipping) or reading from a table as a portion of a custom solution
11. What is the database that has the backup and restores system tables? What are the backup and restore system tables? What do each of the tables do?
Ans:
The MSDB database is the database with the backup and restores system tables. Here are the backup and restore system tables and their purpose:
-
backupfile – contains one row for each data file or log file backed up
-
backupmediafamily – contains one row for each media family
-
backupmediaset – contains one row for each backup media set
-
backupset – contains one row for each backup set
-
restorefile – contains one row for each restored file
-
restorefilegroup – contains one row for each restored filegroup
-
restorehistory – contains one row for each restore operation
12. How can full backups be issued without interrupting the LSN’s?
Ans:
Issue the BACKUP command with the COPY_ONLY option
13. How is a point in time recovery performed?
Ans: