Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to backup and restore a database table.

Posted on 1998-01-30
3
Medium Priority
?
192 Views
Last Modified: 2010-04-04
I am kind of stuck (AGAIN)


I am currently using a paradox table and would like to if possible
backup and restore a table on disk.

I have thought of using the BatchMove by setting it mode property to baCopy but I was not sure if it allowed you to backup the table to disk.

P.S. A small bit a code if possible would be appreciated....




0
Comment
Question by:delbrad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
d4jaj1 earned 200 total points
ID: 1358052
Batchmove will do.  If the table doesn't exist, it will create it for you.  Although batchmove (baCopy) works, I prefer to do a regular DOS copy to move all of the files from one directory to another (your Backup directory).  I prefer this method because the batchmove doesn't copy the referential integrity, indexes, validity checks, etc., just the table's structure.  Using the DOS method allows you to keep your tables and other of their associated files in tact.

In terms of code, I would suggest a REALLY good Freeware component that automatically gets all fields specified in a MASK, e.g., Customers.*, and moves/copies them to a directory.  It's called FileOps and can be found at Torry's Delphi website.  If you can't find it there, add I comment and I'll send it to you.

If your set on using the batchmove, first create the table like your existing table and perform the move.  You will have to add val checks & ref-integrity yourself.

try
 with table1 do //your existing table
 begin
 fielddefs.update;
 indexdefs.update;
 end;
 tempdb := ttable.create(nil);  // create a new table from scratch to look just like your existing table
 with tempdb do begin
 DataBaseName := table1.databasename;
 tableName := 'backup.db';
 TableType := table1.tabletype;
 fielddefs.assign(table1.fielddefs);
 indexdefs.assign(table1.indexdefs);
 createtable;
 open;
 end;
 table1.batchmove(temdb, batcopy)
 tempdb.free;
except
 raise;
 end;

Any questions, please add a comment.  Good Luck!

Jay
0
 

Author Comment

by:delbrad
ID: 1358053
To  d4jaj1

Went to Torry's Delphi Page and could not find the freeware component called FileOps

Could you send it to me at

delbrad@brigadoon.com

thank you

P.S. will also try provide code to see which one I like the best...
0
 
LVL 3

Expert Comment

by:d4jaj1
ID: 1358054
Will send it to you.  The code for the Batchmove is above, the FileOperations component has an example program (source code included) in the zip file.  It is compatible with D2 & D3.

Good Luck.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question