SQL backup , restore and scripts

 

SQL  Backup :

  • The backup copies the data or log records from database to device such as disc.
  • This copy can be used to restore or recover the data after failure.
  • Their are three main types of backup :

Full backup :

  • It is a backup of database which represent the whole database at the time the backup finished.
  • It contains all the data in a specific database or set of filegroups. 

Differential backup :

  • It is the backup based on latest full backup of complete or partial database.

Log backup :

  • It is the backup of transaction logs that have all log records that are not backed up in previous log backup.

Steps for back up database :

1) Connect to database and expand database, select the database which we want to backup :


2) Select the backup type:


3) You can add new destination and add .bak extension :


4) Click on "Ok" and the database backup completed :


5) You can check whether the backup is created successfully or not by going to destination folder :


SQL  Restore :

  • The restore is a process of restoring or recovering data from backup.
Steps for restoring database :

1) Click on database => Restore database :


2) Click on device and select backup device : 


3) Give name for database  :


4) Now database is restored successfully :


5) And refresh database to see restored database :


SQL  Scripts :

  • We can create or generate scripts for transferring database between instances.
  • SQL script is a set of SQL commands which are stored as a file in SQL scripts.
Steps for generating scripts :

1)  Click on database => Task => Generate scripts :


2) After clicking next, choose entire database or specific object :


3)  Click on save as script file and destination :


4)  We can see the scripts are saved, now click on finish :


5)  Open the destination folder and verify the script is generated or not :


6) Click on script file, we can see the set of commands :



      In this blog we have seen how to backup, restore and scripts in SQL. If you have any questions comment below.

Thank You!!!

For more understanding watch below video :

Comments

Popular posts from this blog

Day 3 : JavaScript

SQL Concepts-1

ASP .NET Session Management