Backup types for System Databases || SQL Server
Few days before me and my friend were
discussing about SQL related things, while discussion he asked me question like
how many types of backup we can take for system databases.
That question put me in thinking.
Because, I never thought much about different types of system database backups
and I believe many of us not so bother about knowing the same.
However, it is quite interesting to
know how many types of backups we can perform on system databases.
The direct answer for this question is
as below.
1. Master: Only
can take full Backup
2. Model: Full,
Differential and transaction log
3. MSDB: Full
and Differential
4. Tempdb: NA
Let’s try the practical.
Master:
Model:
MSDB:
Tempdb:
In Above screenshots we can see possible backup types.
If we can try using T-SQL then we will get error message.
EX:
Msg 3024, Level 16, State 0, Line 3
You can only perform a full backup of the master database. Use BACKUP DATABASE to back up the entire master database.
Msg 3013, Level 16, State 1, Line 3
BACKUP DATABASE is terminating abnormally.
You may find that recovery model for
every database can be changed. However, there is no need of that. Since, system databases are small in size and don’t get updated frequently. Hence, only full backup can
be maintained.
Interesting
ReplyDeletePlease let me know , why backup and restore of TempDB is not allowed.
ReplyDelete@Sanket : As we know, Temp DB is meant for storing temporary objects / operations like temporary variables (SP, tables, objects), sorting operation, indexing if SORT_IN_TEMPDB option used etc.
DeleteAlso, in every SQL restart temp DB get re-created. since, there is no IMP or useful data in tempDB, there is no use of DB backup.