SQL Backup, Restore & Script Part V
SQL Backup :
- A copy of SQL server data that can be used to restore and recover the data after a failure.
- A backup of SQL Server data is created at the level of a database or one or more of its files or filegroups.
- Backup of a database can also be used to restore a copy the database to a new location.
1) Full Backup :
- Full Backup stores a full copy of a specific database at the point in time that the backup completed.
- It contains all the data in a specific database or set of filegroups.
2) Differential Backup :
- Full Backup stores a full copy of a specific database at the point in time that the backup completed.
3) 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 databases folder Right-click the databases and select Tasks and then select Back Up :
2) Select Full as the Backup type then click on Add to add a backup file :
3) Select backup file and assign to the file name with .bak extension & click ok :
4) Click ok again to create the backup :
5) Backup of Database completed successfully :
6) Open the destination folder and check the backup is created successfully :
SQL Restore :
- The Restore is a process of restoring or recovering data from backup.
Steps for Restore Database :
1) Connect to database and Right-Click on database then select restore database :
2) Click on device and click on Add to a add backup file :
3) Select backup file & click ok :
4) Click ok to create the restore file :
5) Assign name for restore database & click ok :
6) Database is restored successfully :
7) 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) Connect to database and Right-Click on the databases and select Tasks and then select Generate Scripts :
2) Select specific database object or click on tables :
3) After clicking next then Click on Advanced :
5) Save to new query window then click on next :
6) Scripts are save to click on finish :
7) Click on script file to the set of commands :
8) Open the destination folder and check the script is generated successfully :
Comments
Post a Comment