Page 1 of 1
Backup an entire database
Posted: Tue 08 Jan 2013 14:19
by ads42
Hi,
what is the simple way to back an entire database ?
The structure of the database may vary, and the name/number of tables also.
So table name or parameters should be retrieved automatically.
Same question for restoring the database.
Regards
Armindo
Re: Backup an entire database
Posted: Wed 09 Jan 2013 12:55
by AndreyZ
Hello,
To create a full database backup, we suggest you to use the TMyDump component. TMyDump creates a SQL script that contains the structure of the tables and theirs data. Here is a code example of the TMyDump usage:
backup:
Code: Select all
MyDump1.BackupToFile('C:\backup.sql');
restore:
Code: Select all
MyDump1.RestoreFromFile('C:\backup.sql');
For more information about TMyDump, please refer to the MyDAC documentation.
Re: Backup an entire database
Posted: Thu 10 Jan 2013 10:05
by ads42
Thanks Andrey.
Re: Backup an entire database
Posted: Thu 10 Jan 2013 10:56
by AndreyZ
If any other questions come up, please do not hesitate to contact us.
Re: Backup an entire database
Posted: Mon 26 Aug 2013 17:02
by ads42
I can backup and restore my database, except that I have a big problem, all accents are replaced by stranger char.
So the datas of the databse is corrupted.
my database is ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
I'm wondering if the dump file is saved as a utf8 file ?
any idea of how to solve this ?
Regards
Re: Backup an entire database
Posted: Tue 27 Aug 2013 10:02
by DemetrionQ
Hello.
To solve the issue, you should set the TMyConnection.Options.UseUnicode property to False, and the TMyConnection.Options.Charset property - to 'utf8'. For example:
Code: Select all
MyConnection1.Options.UseUnicode := False;
MyConnection1.Options.Charset := 'utf8';
MyDump1.Connection := MyConnection1;
MyDump1.BackupToFile('C:\backup.txt');
Re: Backup an entire database
Posted: Tue 27 Aug 2013 14:09
by ads42
Thanks it works now.

Re: Backup an entire database
Posted: Tue 27 Aug 2013 14:17
by DemetrionQ
If any other questions come up, please contact us.
Re: Backup an entire database
Posted: Thu 29 Aug 2013 19:54
by ads42
Hi,
The problem is that I have to disconnect to the database for backup/restoring, then changing the TMyConnection properties because if I use the same settings I will have strange char in my DB controls this time.
Then after using backup/restore I will have to set back the older properties...
Isn't there a way to have right datas at the same time in backup/restore and in DB controls ?
Thanks
Re: Backup an entire database
Posted: Fri 30 Aug 2013 10:52
by DemetrionQ
You can perform database backup/restore via a separate connection, having created a new TMyConnection object.
Re: Backup an entire database
Posted: Fri 30 Aug 2013 11:36
by ads42
That's what I've finally done.
Thanks
Re: Backup an entire database
Posted: Fri 30 Aug 2013 13:03
by DemetrionQ
If any other questions come up, please contact us.
Best regards,
Demetrion
Devart Team