Mike,

I am assuming that the backup has to happen while the tables are in use (or
you would just copy over the data folder via windows.)
\
Creating the DBC programmatically should be easy (I seem to remember there
is an option in VFP that generates the code to do so - which includes all
the rules, RI, structures, etc. )  Just no data.  You could use this to
create a destination with no data and then append the source data to the
empty backup tables.

This would create a very clean, packed, set of data.  

Of course, it's not that simple if anyone is using it at the time.  

You probably want to lock the source tables (and related) before appending.
Or if you have a last modified record in the tables, use that to check for
any changes since the data was copied.  Or you might use cursors/views so
that changes made by others don't affect you while copying.  In fact, if you
use a view or have buffering on, once the append is complete, you can check
for changes.  

Anyway, I am sure you will find something that works best for you,


Fletcher

Fletcher Johnson
[email protected]
LinkedIn.com/in/FletcherJohnson
twitter.com/fletcherJ
strava.com/athletes/fletcherjohnson
408-946-0960 - work
408-781-2345 - cell

-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, February 27, 2019 9:23 AM
To: ProFox
Subject: Creating a copy of a database -- best practice?

I can easily do something like this:

CREATE DATABASE C:\Backup\MyDBC.dbc
OPEN DATABASE C:\Production\MyDBC.dbc
liNumTables = adbobjects(laTables,'TABLE')
for ii = 1 to liNumTables
   lcFile = forceext("C:\BACKUP\" + laTables[ii],'dbf')
   use laTables[ii]
   copy to (lcFile) database C:\Backup\MyDBC.dbc with cdx
   use
endfor


..and that would get me a copy of all of the tables with their indexes. 
  Great.  But what's the easiest way to get all of the DBC meta-data into 
that new Backup database copy?  I can't USE the MyDBC.dbc and do a COPY 
TO as that only makes the result a DBF and FPT.

Trying to think about a good disaster recovery plan (besides using 
CleverFox from Rick Schummer and Frank Perez...which is probably the 
best option!) for automating backups at the client who just got that 
ransomware virus.

tia,
--Mike

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to