You are not logged in.
Pages: 1
Hi!
I'm testing the backup and restore available in TSQLRestServerDB class and am having some problems, I wonder if I'm using the correct form!
Problem: My support is not restored, this code causes the restoration is canceled:
if (Self=nil) or (DB=nil) or not IdemPChar(pointer(ContentToRestore),'SQLITE FORMAT 3') then
exit; // invalid restore contente
In unit mORMotSQLite3
I use this code to execute the backup:
procedure TForm2.Button6Click(Sender: TObject);
var
sBackupName: String;
oFileBackup: TStream;
begin
sBackupName := '.\database\'+FormatDateTime('yyyymmddHHmmsszzz', Now)+'_' + ExtractFileName(oServer.DB.FileName) + '.bkp';
oFileBackup := TFileStream.Create(sBackupName, fmCreate);
if (oServer.Backup(oFileBackup)) then
Memo1.Lines.Add('Backup: ' + oServer.DB.FileName + ' -> ' + sBackupName);
oFileBackup.Free;
end;
And this is the code that execute the restore:
procedure TForm2.Button9Click(Sender: TObject);
begin
// EdtBackup contains the path to the backup file
if (oServer.Restore(EdtBackup.Text)) then
Memo1.Lines.Add('Restore: ' + EdtBackup.Text + ' -> ' + oServer.DB.FileName);
end;
What am I doing wrong?
My database has 110MB...
Thanks...
Offline
I have more problems, now with TSQLRestServerDB.BackupGZ(), we executed four backups:
- Database with 1,05 GB -> Generate Backup file with 106 MB - Is OK
- Database with 2,77 GB -> Generate Backup file with 273 MB - Is OK
- Database with 3,95 GB -> Generate Backup file with 388 MB - Is OK
- Database with 5,13 GB -> Generate Backup file with 502 MB - Is OK
Now the restoration using TSQLRestServerDB.RestoreGZ():
- Backup file with 106 MB -> Generate database file with 1,05 GB - Is OK
- Backup file with 273 MB -> NOT GENERATE DATABASE (not restored)
- Backup file with 388 MB -> NOT GENERATE DATABASE (not restored)
- Backup file with 502 MB -> NOT GENERATE DATABASE (not restored)
If I'm debugging the application I get the following notification:
EAssertionFailed with message ‘Assertion failure (d:\mORMot\lib\SynZip.pas, line 1122)’
If I run the demo application (execute .exe) the exception is not presented (reported), but the backup is not restored.
Do you have any suggestions?
Thanks!
Offline
Backup/restore is not working as expected, due to problems of SQLite3 itself when you use virtual tables (as our mORMot core does).
We reported it several times on the forum.
The easiest is to backup/restore it at file level, before opening and after closing the database.
You can find in our SynZip unit all you need for it.
Or use the SynLZ compression functions available in SynCommons, if you want something faster.
Offline
Hello AB,
Can I use journal or walmode to implement a real-time backup?
I would like to restore a database using a physical backup plus a journal or wal file.
Is it possible (that even with the problems in backup / restore process sqlite already reported)?
Offline
Pages: 1