Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 5 of 5 total |
Restore Backup to a different directory? |
Thu, Oct 14 2010 12:41 AM | Permanent Link |
Fred H. | Is it possible to restore a DBISAM Backup file to a different (empty) directory?
I've tried and I keep getting the - you can't do this because the dataset/database is closed error. I've set the Database directory as the new empty folder as I don't see anywhere else to put the "target" directory. Therefore, it looks as though once the Restore method is fired....it wants to be connected to existing table(s) when doing the restore. I don't have a problem if the tables reside in the same directory as the backup file = works fine, but I'd like to try to take the backup file and restore all the tables to a completely new empty directory. I'm looking at this as a means to "copy" just the main files of the database to a separate location without the many backup files for all the tables. As well as possibly using it as a container for new empty databases. Thanks, Fred |
Thu, Oct 14 2010 1:51 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Fred,
<< Is it possible to restore a DBISAM Backup file to a different (empty) directory? >> Sure, I do it all of the time. << I've tried and I keep getting the - you can't do this because the dataset/database is closed error. >> Make sure that the TDBISAMDatabase component that you're using for the restore is open before calling the Restore method. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Oct 14 2010 3:54 PM | Permanent Link |
Fred H. | That's great news, Tim...and I'm eager to get this working now! BUT!...still running into issues.
So now...before I run the Restore routine....I closed the table and query (I'm only just testing it out on a simple form). Set the Database directory as the "target directory", open the Database...Run the Restore.....and boom, get the below error message now. What the heck does that mean? There is no Engine or Session component on the form....only a Database, 1 Table and 1 Query. "Project Test.exe raised exception class EDatabaseError with message 'Cannot perform this operation on an inactive session'." So needless to say I'm stumped again.... |
Thu, Oct 14 2010 5:01 PM | Permanent Link |
Raul Team Elevate | Fred N Huston Jr wrote:
> Set the Database directory as the "target directory", open the > Database...Run the Restore.....and boom, get the below error message > now. What the heck does that mean? There is no Engine or Session > component on the form....only a Database, 1 Table and 1 Query. There always is a default session if you don't set one. Here is a very trivial example (with no error handling )for restoring an existing backup (sample is basically a copy from DBISAM manual). It assumes: 1. you have TDBISAMDatabase component on form named DBISAMDatabase 2. you have an existing backup file in c:\temp\lastbackup.bkp that contains at least 2 tables named customers and vendors 3. you have a empty folder C:\Temp\newdb you wish to restore the data to. I'm setting the DatabaseName and Directory in code but if you set it on component then don't bother with them. here is sample code: ///======== code begin =========== DBISAMDatabase.Connected := false; DBISAMDatabase.DatabaseName := 'myRestoreDB'; DBISAMDatabase.Directory := 'C:\Temp\newdb'; DBISAMDatabase.Connected := true; TablesToRestore:=TStringList.Create; try TablesToRestore.Add('customers'); TablesToRestore.Add('vendors'); if DBISAMDatabase.Restore('c:\temp\lastbackup.bkp',TablesToRestore) then ShowMessage('Restore complete') else ShowMessage('Restore failed'); finally TablesToRestore.Free; end; ///======== code end =========== Raul |
Fri, Oct 15 2010 9:00 AM | Permanent Link |
Fred H. | Raul - thanks so much for the code....it's pretty much straight-forward and basically had the same thing, more or less.
So trying it yesterday, I kept running into the same Inactive Session error.....slept on it and this morning went through all the code on the page again....and voila...there she was - "Session.AddPassword" under the BeforeConnect event. Commented it out...and boom, everything works as it should! whew....that was driving me nuts! That's another reason why I want to remove the friggin' passwords I set on all the tables as they just keep getting in my way! LOL Anyway....many thanks to both you and Tim for helping out on this. I'm not a guru programmer so appreciate everyone's patience. All the best, Fred |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |