SQL Certification - SPLessons

SQL Certification Backup and Restore

Home > Lesson > Chapter 36
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

SQL Certification Backup and Restore

Backup and Restore

shape Description

Databases are used to store huge amount of data and it becomes very crucial to Backup the data. In the event of some software or hardware failures, backup data can be used to recover the data. The current chapter Backup and Restore fundamentals provides the necessary security for protecting data stored in the Databases server.

shape Conceptual figure

Backing up sql database

shape Description

SQL database can be classified into 2 ways.

Replicate the database files

shape Description

SQL uses similar table arrangement on distant platforms, so copying SQL table and index files from one platform to another without any complications. Backing up SQL databases server, working test recovery procedures backups, and keeping copies of backups is secure, off-site location protects database from disastrous data loss.

Conveying tables to text files

shape Description

SQL DUMP is an accessible command that can be used to backup the SQL Database instantly to the text files. To use the SQLDump command it is mandatory to login to the System running the SQL Database.

shape Syntax

sqldump -u[username] -p[password] [database name]>[backupfile.sql]
Username => Database user name Password => User database password Database name => Name of the database Backupfile.sql => File name for user database backup.

shape Examples

By viewing the below example, the concept of single database, multiple database and all database backup can be understood easily. [sql] D:\Program Files\SQL\SQL Server 5.5\bin>sqldump -h 127.0.0.1 -u root -p employee; d:\backup\singleDBBackup.sql Enter password:********** d:\Program Files\MySQL\SQLServer 5.5\bin>sqldump -h 127.0.0.1 -u root -p --database employee sakila> d:\backup\multipleDBBackup.sql Warning: Using unique option prefix database instead of databases is deprecated and will be removed in future release.Please use the full name instead. Enter password:********** d:\Program Files\SQL\SQLServer 5.5\bin>sqldump -h 127.0.0.1 -u root -p --all-database> d:\backup\allDBBackup.sql Warning: Using unique option prefix all-database instead of all-databases is deprecated and will be removed in future release.Please use the full name instead. Enter password:********** Warning:Skipping the data of table sql event.specify the --events option explicit[/sql] In the above example, first employee table had been chosen for backup and all the data contained in employee database has been backup into another location in the server. In the same way multiple and all databases can be backup.

Summary

shape Key Points

  • SQL Backup and Restore - Used to recover the data from database server, if any technical problems arises.
  • Replication - Is nothing but coping data from the server.
  • Converting tables into files.