Database Backup REPORT - Updated
Database Backup REPORT - Updated
Topics covered
A backup is a copy of data from your database that can be used to reconstruct that
data. Backups can be divided into physical backups and logical backups.
Physical backups are backups of the physical files used in storing and recovering
your database, such as datafiles, control files, and archived redo logs. Ultimately,
every physical backup is a copy of files storing database information to some
other location, whether on disk or some offline storage such as tape.
Logical backups contain logical data (for example, tables or stored procedures)
exported from a database with an Oracle export utility and stored in a binary file,
for later re-importing into a database using the corresponding Oracle import
utility.
Why do we need to backup database
Data loss can happen in many ways, the most common causes are physical failure
of your PC, accidental error, theft or disasters like fire, flood and dropped coffee
mugs! It is also common for data to be saved to just one place, like ‘My
Documents’ on your PC’s hard drive. Which means that if this data were to be
accidentally changed or deleted it would take considerable time and expense to
restore it.
Using mysqldump and
mysqlhotcopy
1. Find the Program Data folder on your computer. It is hidden in your C:/ . Or if your Program
Data is not hidden, you can go to this directory ( C:\ProgramData\MySQL\MySQL Server 5.1\data ).
Now you can see all your database. You can backup it by copying the folder on your flash drives
and bring it back whenever something bad happens.
Mysqldump
Syntax
mysql –u[user name] -p[password] [database name] < C:\[filename].sql
Restore multiple databases
mysql –u[user name] –p[password] [database name1]_ [database name2] < C:\
[filename].sql
Restore all databases
mysql –u[user name] –p[password] --databases [database name1]_ [database name2]
< C:\[filename].sql
Single database
Multiple databases
All databases