Subject Re: [firebird-support] Re: Backing up fdb excluding some tables
Author Helen Borrie
At 09:40 PM 23/12/2009, you wrote:
>Hi all,
>After some experiments i have a reasonable understanding of external tables now.
>Please correct me if i am wrong.
>Whatever data is in the table goes to the external file, and vice-versa. So at the time of backup, the table that is linked to the external file will be deleted, and then backup will be performed.

No. The table definition that you created with CREATE EXTERNAL TABLE will be backed up but no data is backed up. When the database is restored, the file specified in the FILE parameter must exist in the expected location, otherwise an exception will be raised during the restore. (I'm not certain, but I have a feeling that at some point this behaviour was improved, such that the restore would proceed despite a missing file and the exception occurs when the table is accessed.)

>Whereas at the time of restore, the table will be created with the data in the external file.

You can make it behave like this *if* you use the -co[nvert] switch when making the backup. At restore, the external table is converted to an internal table, with the data from the file as it was at the time of backup. The link to the external file is lost but the file is not deleted.

But (from your description of your requirements) it seems you won't want the -co[nvert] option. Rather, you will most likely want to do an ordinary backup, move the external file to an archive and recreate an empty file of the same name in the designated location before you restore. Don't try to move or edit the file while it is in use, of course: it will be locked until Firebird is no longer using it.

Please, would you not top-post. Trim your posts and respond to retained requotes in-line or at the end.

^ heLen ^