Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 13 total
Thread X-Copying tbl files?
Fri, May 29 2009 5:08 AMPermanent Link

"Hedley Muscroft"
Hi,

I have two identically structured databases and I simply want to copy the
contents of a table from one database to the other database.

With DBISAM I could simply copy over the .dat, .idx and .blb files,
overwriting the destination ones - no problem.

I understand that with EDB the actual table structures are now stored
separately in a catalog file (EDBDatabase.EDBCat) and that the .edbtbl,
..edbidx and .edbblb files are merely "containers" for data.

However, if the two databases are structurally completely identical,
shouldn't I be able to copy over the "container" files without a problem?

I have tried this, but it results in a 'metadata error' message. Is there
any quick way around this which will allow me to xcopy .edbtbl, .edbidx and
edbblb files?

Many thanks!

Hedley
Fri, May 29 2009 6:15 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Hedley


Try copying the catalog file .EDBCfg as well. This is the file that contains the table definitions and it needs to be in sync with the tables for things to work.

Roy Lambert
Fri, May 29 2009 10:07 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Roy,

The file that contains the catalog is, by default, "EDBDatabase.EDBCat".
".EDBCfg" is the default extension of the configuration file.

--
Fernando Dias
[Team Elevate]
Fri, May 29 2009 10:25 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Hedley,

You can't arbitrarily copy files between database directories except if you copy
*all files*, i.e. all table files, index files, blob files and the catalog file.

You can copy the contents of a single table to the same table in another
identical database by doing a backup of the source database and restoring only
the table you want into the destination database.


--
Fernando Dias
[Team Elevate]
Fri, May 29 2009 10:29 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Fernando


You're dead right - I looked i the wrong directory - thanks for the correction. Hopefully I haven't confused Hedley to much.

Roy Lambert
Fri, May 29 2009 3:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hedley,

As already noted, if you copy the .edbcat and all of the table files
(basically everything in the database directory), then you should be fine.

--
Tim Young
Elevate Software
www.elevatesoft.com

Sat, May 30 2009 7:46 AMPermanent Link

"Hedley Muscroft"
Hi Tim et al,

> As already noted, if you copy the .edbcat and all of the table files
> (basically everything in the database directory), then you should be fine.

Perhaps I may not have explained this correctly in the original post? I
*only* want to copy one table between databases. Both databases have
identical structures.

Specifically, I have a "Category" table which contains lists of Occupations,
Marital Statuses, Patient Statuses etc. etc.

This is a simple table with an ID and a VARCHAR value. Sometimes a customer
will create a NEW database but want to copy over all the categories from
another database.

In DBISAM, I just copied the Category.dat, Category.idx and Category.blb
files. If the database definition is IDENTICAL, shouldn't I just be able to
copy over Category.EDBTbl, Category.EDBIdx and Category.EDBBlb?

I have tried and I get a metadata error, which seems strange if both
databases have the same structure.

If the answer is simply that you can't xcopy individual table files over,
then what would you suggest as the easiest way to achieve this?

Many thanks!
Sat, May 30 2009 1:45 PMPermanent Link

Uli Becker
Hedley.

> Perhaps I may not have explained this correctly in the original post? I
> *only* want to copy one table between databases. Both databases have
> identical structures.

How about using a script like this:

SCRIPT
BEGIN
   use Database2;
   Execute Immediate 'Create Table TableToCopy as
     select * from Database1.OriginalTable with data';
END

Uli
Sun, May 31 2009 7:33 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Hedley

If the two catalog files are identical then you should (I have) indeed be able to just copy the data files over, but I doubt that they are. When you create a new database the tables will be version 1, if you make any alterations the version number will be different and its possibly this that prevents the simple copy operation.

If the two databases exist simultaneously and can be accessed simultaneously a simple INSERT INTO ... SELECT FROM operation should (I think) work. If not Export & Import will probably be the easiest way.

There have been posts about this before and Tim has been asked about a facility to bring tables and catalog into sync but I don't remember his reply. It might be "it'll be in 2.x" but I really can't recall.

Roy Lambert [Team Elevate]
Sun, May 31 2009 12:42 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Hedley Muscroft,

> Perhaps I may not have explained this correctly in the original post? I
> *only* want to copy one table between databases. Both databases have
> identical structures.

You have explained correctly, and I already gave you the answer: BACKUP and then
RESTORE only the table you want to copy.

INSERT ... SELECT may also work, as already suggested by Roy, provided that
there are no rows in the destination table that can collide with the inserted
rows, unless you delete all row before the insert - but that can also be a
problem if you have RI constraints defined.

So, in conclusion, my opinion is that the best is to BACKUP and then RESTORE the
 table you want to copy. You must however be aware that RESTORE doesn't verify
the existing referential integrity constraints, so if the destination database
already contains data and you have RI constraints defined, you may end up with
an inconsistent database state.

--
Fernando Dias
[Team Elevate]
Page 1 of 2Next Page »
Jump to Page:  1 2
Image