![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM Client/Server » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Mon, Jun 18 2012 12:53 AM | Permanent Link |
Mathias Burbach | Hello Folks!
I am fairly new to DBISAM. I want to backup a database on a "remote" server. Actually the backup tool shall run as a scheduled task, connect to the "remote" server on RemoteAddress 127.0.0.1 and do the backup. In the documentation for TDBISAMDatabase.Backup it says: "The Backup method cannot be run when a transaction is currently active for the database. You can inspect the InTransaction property to determine if a transaction is currently active for the database. When the backup executes, it obtains a read lock for the entire database that prevents any sessions from performing any writes to any of the tables in the database until the backup completes." I tried to accommodate this by asking for any active transaction: procedure TdmoMain.BackupDB; var sBackupName: string; stlTablesToBackup: TStrings; iAttemptNo: Word; begin sBackupName := Format('%s\%s\%s.bkp', [FBackupBaseDirectory, FormatDateTime('YYYY-MM', Date), FormatDateTime('DDHHNNSS', Now)]); ForceDirectories(ExtractFileDir(sBackupName)); stlTablesToBackup := TStringList.Create; try dbsTest.Open; try dbsTest.Session.GetTableNames(dbsTest.DatabaseName, stlTablesToBackup); iAttemptNo := 0; while (iAttemptNo < FNumberOfAttempts) do begin if dbsAIMS.InTransaction then begin Sleep(FWaitSecondsBetweenAttempts * 1000); Inc(iAttemptNo); end else begin dbsTest.Backup(sBackupName, EmptyStr, FCompressionMode, stlTablesToBackup); iAttemptNo := FNumberOfAttempts; end; end; finally dbsTest.Close; end; finally stlTablesToBackup.Free; end; end; If I have another transaction open on that server - let's say in Database System Utility - it doesn't detect that open transaction and proceeds to try a backup. But then, when the Backup method is called, it will wait until the last transaction has been closed on that particular server before it can create the read lock for the entire DB. There is no exception and I can't seem to find a setting to set a timeout value for the wait period until a read lock can be created. How should I avoid a backup call that will wait indefinitely? Thanks for a short answer in advance. Salut, Mathias |
Tue, Jun 19 2012 6:22 AM | Permanent Link |
Jose Eduardo Helminsky HPro Informatica | Mathias
I will assume you are not using restrictive transaction (only a few tables and not the entire database). Just try to open one table exclusivelly. If it fails, another process/user is using it. Eduardo |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |