Sunday, May 31, 2026

Backup types in SQL server



1) full 
2) differential
3) tlog
4) tail log

--for full backup 
 its include entire backup of your database.

 query= backup database DB_name
              to disk='filepath\filename\fileextention.bak',


--for differential backup
  its include all changes from last full backup to till this point.

 query=- backup database DB_name
               to disk='filepath\filename\fileextention.bak',
               with differential

--for t log backup 
  its include all changes from latest any backup till this point.

 query=- Backup log DB_name
                to disk='filepath\filename\fileextention.trn',


-- for tail log backup

  Tail log backup is not a special type of backup. It's just a log backup with no recovery,database will be goes into non operating mode it means non accessible mode.
  
 query=- backup log DB_name
              to disk='filepath\filename\fileextention.trn',
              with no_truncate, norecovery


--- retention period 

 How much old data that you to retain it is called as retention period. 
 generally for daily backup strategy we keep thee days retention period.


OTHER TYPE OF BACKUP
1) mirror backup
2) split backup
3) copy only backup


1) Mirror Backup :- when you want copy of database with different drive in one query that time we use this 
   backup

 query=  Backup database (DB_name)
              to disk= 'filepath\filename\fileextention.bak',
              mirror to= 'filepath\filename\fileextention.bak',
              mirror to = 'filepath\filename\fileextention.bak'
      we can take only 3 mirror copys.

2) split Backup = when you want to have  fast backup of your database that time use this backup.

 query= Backup database (DB_Name)
             to disk = 'filepath\filename\fileextention.bak',
             Disk ='filepath\filename\fileextention.bak',
             Disk = ''filepath\filename\fileextention.bak'

3) copy_only Backup =- when we want to have a  backup without breaking lsn chain that time we take this backup.

  query=  Backup database (DB_name)
                to disk = 'filepath\filename\fileextention.bak'
               with copy_only

No comments:

Post a Comment

Backup types in SQL server

1) full  2) differential 3) tlog 4) tail log --for full backup   its include entire backup of your database.  query= backup database DB_name...