Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

:SQL SERVER BACKUP TYPES:-

1. FULL BACKUP
2. DIFF BACKUP
3. TRANSACTION LOG BACKUP
4. COPY ONLY BACKUP
5. FILE OF FILE GROUP BACKUP
6. STRIPED BACKUP
7. MIRRORED BACKUP
8. TAIL LOG BACKUP
9. PARTIAL BACKUP

1. FULL BACKUP:-

A full backup contains a copy of the entire database including used data pages and the log files written
during the backup.
A full backup doesn’t truncate the transaction log.
In other words, you cannot restore a differential backup or a transaction log backup without a full backup.

Take a full backup using SSMS.


Step 1. Open SSMS and connect to the SQL Server
Step 2. Expand Databases and select the required database.
Step 3. Right click on the database >> Tasks >> Backup
Step 4. In Back Up Database window, select the Backup Type as Full and under Destination, select Back
up to : Disk
Step 5. Select the Remove button
Step 6. Click on Add button to select the destination and name for the database backup file

Step 7. Select the required folder for the backup file and enter the file name with a .bak extension

Step 8. Click OK to end the backup process.

TAKE A FULL BACKUP USING T-SQL:-

Use AM_BILLING;
GO

BACKUP DATABASE AM_BILLING TO DISK ='E:\AM_BILLING.BAK'


GO

2.DIFFERENTIAL BACKUP:-
A differential backup contains only data that has been modified since the last full backup. Apart from this, a
differential backup is identical to a full backup.
i. Its contain all changes data and schema both .
ii. Its generates fastly.as compare to full backup.

Take a Differential backup using SSMS.

Step 1. Open SSMS and connect to the SQL Server


Step 2. Expand Databases and select the required database.
Step 3. Right click on the database >> Tasks >> Backup

Step 4. Select Differential as Backup Type, select Disk as the destination, and then click on
Add button to add the directory where the backup will be stored on your disk.
Step 5. Select the Remove button

Step 6. Click on Add button to select the destination and name for the database backup file

Step 7. Select the required folder for the backup file and enter the file name with a .diff extension

Step 8. Click OK to end the backup process.

TAKE A DIFF BACKUP USING T-SQL:-


Use AM_BILLING;
GO

BACKUP DATABASE AM_BILLING TO DISK ='E:\AM_BILLING.DIFF'WITH DIFFERENTIAL


GO

3.TRANSACTION LOG BACKUP:-


The log backup, as its name implies, backs up the transaction logs. This backup type is possible only with
full or bulk-logged recovery models.
A transaction log file stores a series of the logs that provide the history of every modification of data, in a
database.
A transaction log backup contains all log records that have not been included in the last transaction log
backup.

Take a transaction log backup using SSMS.

Step 1. Select Tasks > Backup


Step 2. Select "Transaction Log" as the backup type
Step 3. Select "Disk" as the destination
Step 4. Click on "Add..." to add a backup file and type "C:\
AdventureWorks.TRN" and click "OK"
Step 5. Click "OK" again to create the backup

TAKE A TRASACTION LOG BACKUP USING T-SQL:-

Use AM_BILLING;
GO

BACKUP LOG DATABASE AM_BILLING TO DISK ='E:\AM_BILLING.TRN'


GO

4.COPY ONLY BACKUP:-

A copy only backup is a SQL Server backup that is independent of the sequence of conventional
SQL Server backups. Usually, taking a backup changes the database and affects how later backups
are restored.

However, occasionally, it is useful to take a backup for a special purpose without affecting the
overall backup and restore procedures for the database. Copy-only backups serve this purpose.

Take a copy only backup using SSMS.

1. Launch SQL Server Management Studio (SSMS) and connect to your instance.

2. Right-click the database name you want to back up, select Tasks > Back Up…
3. In the pop-up window, select the Backup type (Full or Transaction Log. You cannot create a copy-only
differential backup).

4. Check Copy-only Backup option below Backup type.

5. Specify a Destination path to store backup files.


6. Click OK to execute the backup task.
TAKE A COPY ONLY BACKUP USING T-SQL:-

BACKUP DATABASE AM_BILLING TO DISK='E:\AM_BILLING.bak'


WITH COPY_ONLY;

COPY ONLY BACKUP FOR TRANSACTION LOG BACKUP:-


BACKUP LOG AM_BILLING TO DISK='E:\AM_BILLING.trn'
WITH COPY_ONLY;
5.FILE OF FILE GROUP BACKUP:-

The one advantage of using filegroup backups over file backups is that you can create a Read-Only filegroup
which means the data will not change. So instead of backing up the entire database all of the time you can
just backup the Read-Write filegroups.
A file group backup is beneficially when database have a read-write or read-only file groups.

TAKE A File Group Backup USING T-SQL:-


BACKUP DATABASE AM_BILLING
FILEGROUP = N 'ReadOnly' TO DISK =N 'E:\AM_BILLING _ReadOnly.bck'
WITH NOFORMAT, NOINIT, COMPRESSION , Stats=10
GO
6. Split/STRIPED BACKUP:-

A striped backup is simple a backup of your database that is spread across multiple files. Just like a database
can exist in multiple .mdf and .ndf files, a striped backup places some of your backup data in one file, and
some in another.

TAKE A STRIPED Backup USING T-SQL:-

BACKUP DATABASE AM_BILLING TO


DISK = N'E: \AM_BILLING1.bak',
DISK = N'D:\ AM_BILLING2.bak',
DISK = N'F:\ AM_BILLING3.bak',
DISK = N'L: \ AM_BILLING4.bak'
WITH NOFORMAT, NOINIT, NAME = N' AM_BILLING-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,
STATS = 10
GO
7. MIRRORED BACKUP:-

The idea behind is that you can backup to multiple locations and increase the protection level by having
additional copies of the backup set. In case one of the copies gets lost or corrupted, you can use the
mirrored copy to perform a restore.

TAKE A Mirrored Backup USING T-SQL:-

BACKUP DATABASE AM_BILLING


TO DISK = 'C:\backup\AM_BILLING.bak'
MIRROR
TO DISK = 'H:\backup\AM_BILLING.bak'
WITH FORMAT;
GO

8.TAIL LOG BACKUP:-


A tail-log backup captures any log records that have not yet been backed up (the tail of the log)
to prevent work loss and to keep the log chain intact. Before you can recover a SQL Server
database to its latest point in time, you must back up the tail of its transaction log
TAKE A TAIL LOG Backup USING T-SQL:-
BACKUP LOG AM_BILLING TO DISK = 'E:\AM_BILLINGtail.log 'WITH CONTINUE_AFTER_ERROR;
GO
9.PARTIAL BACKUP:-
This allows you to backup the PRIMARY filegroup, all Read-Write filegroups and any optionally specified files.
This is a good option if you have Read-Only filegroups in the database and do not want to backup the entire
database all of the time
Create a FULL PARTIAL backup Using TSQL command:-
BACKUP DATABASE AM_BILLING READ_WRITE_FILEGROUPS TO DISK = 'E:\AM_BILLING _Partial.BAK'
WITH NOFORMAT, NOINIT, COMPRESSION, STATS = 10
GO

Backup LSN Number Find


SELECT
database_name
,backup_size
,first_lsn
,last_lsn
,checkpoint_lsn
,database_backup_lsn
,database_creation_date
,backup_start_date
,backup_finish_date
FROM msdb.dbo.backupset

You might also like