If for some reasons the database gets corrupted or gets lost, one can restore the database from the backup file. The syntax for command to restore database to a previous state is:
The image_file_name is the arguŽment where location and name are of the backed up file that was made using BACKUP DATABASE command. Using RESTORE command, whatever that was backed up using BACKUP DATABASE command will get restored to the state when backup was performed. The user who performs the restoring of the database must have the CREATE or equivalent rights to perform the task.
As backup tasks can be done online, restore cannot be done online as, RESTORE is classified under DDL stateŽment because it alters the structure of database. Thus "Online Restore" is not possible as during restore some table locks will be caused so that the data could be written to the tables from the backup file.
To restore the "world" database, we first changed the database workspace and then dropped the database by using following command:
As we have saved the backup of the "world" database in location in C drive as "world-db. backup" , we will pass this as argument to the RESTORE command as follows:
We have used this online backup utility for databases using MyISAM storage engines. Even if the database has multiple storage engines for different tables, the backup can be performed. Suppose, if there is just one table of InnoDB type, then while performing baCKUp, the MyISAM tables will be backed up in native format while the table in InnoDB type will be backed up in logically-based backup format.