Backup

MySql

Run the command-line application:
mysqldump -u xstudio -p xstudio_db > /root/backup.sql

MariaDB

Run the command-line application:
mysqldump -u xstudio -p xstudio_db > /root/backup.sql

Oracle

Run the command-line application /home/oracle/exp:
  • > Username=xstudio
  • > Password=xstudiopwd
  • > Export file=backup.dmp

    (use all the default options)

  • > User to be exported=xstudio
  • Press <Return>
  • Press <Return>


SQL Server

Run the SQL Server Management program:
  • Select xstudio_db
  • Right-click > Tasks > Backup
  • Backup to: Disk
  • Add an entry: C:\backup.bak
  • Submit




Restore

MySql

Run the command-line application:
mysql -u xstudio -p xstudio_db < /root/backup.sql
(password=xstudiopwd)

MariaDB

Run the command-line application:
mysql -u xstudio -p xstudio_db < /root/backup.sql
(password=xstudiopwd)

Oracle

Delete and re-create an empty database (delete and re-create the user xstudio)
Run the command-line application /home/oracle/imp:
  • > Username=xstudio
  • > Password=xstudiopwd
  • > Import file=backup.dmp

    (use all the default options)

  • > User to be imported=xstudio
  • Press <Return>
  • Press <Return>


SQL Server

Run the SQL Server Management program:
  • Select xstudio_db
  • Right-click > Delete
    (WARNING: uncheck Delete backup and restore history information for databases and check Close existing connections)
  • Select Databases
  • Right-click > New Database
  • xstudio_db
  • Select xstudio_db
  • Right-click > Tasks > Restore > Database > From Device > File
  • Options: Overwrite the existing database=1
  • Submit




Automated Backup

This is mandatory to schedule a database backup on a daily basis.
There are many application working with the Database Server you picked that will do that for you easily.

If you're using MySql or MariaDb on a Linux server we suggest using AutoMySqlBackup.

The Install procedure may differ depending on the Linux distribution you're using but most of the time it will consist in these commands (executed as root):

With Apt-get (Debian, Ubuntu etc.):
apt-get update
apt-get install automysqlbackup
apt-get install bc
Edit /etc/default/automysqlbackup


All the backups can be found in /var/lib/automysqlbackup in the daily, weekly, monthly and latest folders.


It's also a good idea to copy your latest backup to another physical server (90% of the failures are storage failure!)



One last thing...

Check your backup regularly.

We really mean it! from time to time, pick a backup, restore it on a temporary database and check the data are there!