Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2019-02-27 11:22:49 Link
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
_______________________________________________
Post Messages to: ProFox@leafe.com
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/500593bf5f84e661f7648a5121a41192@mbsoftwaresolutions.com
** 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.
Author: Charlie-gm
Posted: 2019-02-27 15:20:56 Link
Ok, I haven't done this in a while, but I think I have done this a few ways.
First, by "metadata" of the database, I assume you mean stored
procedures, maybe table triggers, database comment field?
I'll also assume you are trying to run from within an .exe (so commands
like COPY PROCEDURES TO... and APPEND PROCEDURES FROM ... will not be
available)
So...
1) if you know the "data model" of the dbc, you can open it like a table
- then look for the metadata items you want (the stored procedure code,
trigger code, etc). Do a SCATTER MEMO NAME ... Then open the other DBC
as a table and do an APPEND FROM NAME ... After everything is copied
that way I think you will want to do a PACK DATABASE or maybe VALIDATE
DATABASE on the backup. I seem to recall doing that.
2) after you've copied all the tables, copy the "database files" with
"COPY FILE <orig> TO <backup>" - copy the dbc, dct, and dcx this way.
Again a PACK or VALIDATE database may be needed afterwards. And of
course, be careful with this, test it out, etc. But I definitely used
this approach before.
3) if you are not worried about the tables being opened at the time of
doing the backup, you could just do the "COPY FILE <orig> TO <backup>" -
that command allows paths in the from/to. Also, I think it allows
wildcards, so you could do a complete copy in 1 command. Of course, the
downside is the assumption of files being closed.
-HTH,
-Charlie
On 2/27/2019 12:22 PM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
> 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: ProFox@leafe.com
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/ff594e8b-a5da-3f8d-99f4-e481899794fa@gmail.com
** 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.
Author: Peter Cushing
Posted: 2019-02-28 03:43:39 Link
On 27/02/2019 17:22, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
> 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.
>
An easy way to get a copy of the data is to have a copy of all the data
in another folder, then using your loop above, zap each table and append
from the live data. We use it here as a rough and ready backup during
the day, while people are in the system. Your copy then has all the
same meta data as the original.
Peter
This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email.
www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR.
Tel:0161 831 3700
Fax:0161 831 3715
London Office: 101 St. Martin's Lane,London, WC2N 4AZ Tel:0207 299 7960
_______________________________________________
Post Messages to: ProFox@leafe.com
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/ceec749d-28b9-1502-45bd-6796cdf6a135@whisperingsmith.com
** 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.
Author: Alan Bourke
Posted: 2019-02-28 04:17:19 Link
Copy and rename all the data and database container files.
For each DBF in the copied and renamed data, update the backlink so that it points at your copied and renamed DBC.
Open the copied and renamed DBC as a table, and update the metadata describing the tables to reflect their new names.
This is discussed here:
http://www.ml-consult.co.uk/foxst-47.htm
--
Alan Bourke
alanpbourke (at) fastmail (dot) fm
_______________________________________________
Post Messages to: ProFox@leafe.com
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/cebc2b5e-003a-4c60-a708-dbc46f11ba49@www.fastmail.com
** 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.
Author: Stephen Russell
Posted: 2019-02-28 06:08:31 Link
Why not make a compressed file of the entire folder where the data lies?
After file is created move it to a different machine off the network.
On Thu, Feb 28, 2019 at 4:17 AM Alan Bourke <alanpbourke@fastmail.fm> wrote:
> Copy and rename all the data and database container files.
>
> For each DBF in the copied and renamed data, update the backlink so that
> it points at your copied and renamed DBC.
> Open the copied and renamed DBC as a table, and update the metadata
> describing the tables to reflect their new names.
>
> This is discussed here:
>
> http://www.ml-consult.co.uk/foxst-47.htm
>
>
> --
> Alan Bourke
> alanpbourke (at) fastmail (dot) fm
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
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/CAJidMY+4Ekpeqrf0P4Z6U6PiXX7oGhYqkkDWypZ5PzB1w3Vczg@mail.gmail.com
** 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.
Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2019-02-28 15:37:06 Link
On 2019-02-28 04:43, Peter Cushing wrote:
> On 27/02/2019 17:22, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
>> 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.
>>
> An easy way to get a copy of the data is to have a copy of all the data
> in another folder, then using your loop above, zap each table and
> append
> from the live data. We use it here as a rough and ready backup during
> the day, while people are in the system. Your copy then has all the
> same meta data as the original.
Hi Peter,
I see no difference between my COPY TO <the backup folder table> versus
doing an APPEND FROM <Production table> from my backup table. ???
Am I mistaken?
tia,
--Mike
_______________________________________________
Post Messages to: ProFox@leafe.com
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/57548c2cb0741015511f60d8bcfd55b7@mbsoftwaresolutions.com
** 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.
Author: mbsoftwaresolutions@mbsoftwaresolutions.com
Posted: 2019-02-28 15:42:16 Link
On 2019-02-28 07:08, Stephen Russell wrote:
> Why not make a compressed file of the entire folder where the data
> lies?
> After file is created move it to a different machine off the network.
Because I think open DBFs would present a problem with that approach???
_______________________________________________
Post Messages to: ProFox@leafe.com
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/d75f9d1d4ae9647483d5aeb68ad52311@mbsoftwaresolutions.com
** 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.
Author: Stephen Russell
Posted: 2019-02-28 16:29:23 Link
Would the table or index not be included? I get backups of word and excel
files if they are open.
On Thu, Feb 28, 2019 at 3:40 PM <mbsoftwaresolutions@mbsoftwaresolutions.com>
wrote:
> On 2019-02-28 07:08, Stephen Russell wrote:
> > Why not make a compressed file of the entire folder where the data
> > lies?
> > After file is created move it to a different machine off the network.
>
>
> Because I think open DBFs would present a problem with that approach???
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
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/CAJidMY+TOxSCXKWE=Gd3Sw8gkVCkLNhy8Enm47v5AsSEXrTajw@mail.gmail.com
** 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.
Author: Tracy Pearson
Posted: 2019-02-28 16:33:14 Link
You'll have trouble the same way if a user is saving the Word or Excel file.
Writing to tables locks a portion of the table, and sometimes all of the
table which can cause copy failures..
You've been out of the VFP for a couple of years and haven't worked with
DBFs for longer.
We'll forgive your older age and forgetfulness.
Tracy
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Stephen
Russell
Sent: Thursday, February 28, 2019 5:29 PM
To: profoxtech@leafe.com
Subject: Re: Creating a copy of a database -- best practice?
Would the table or index not be included? I get backups of word and excel
files if they are open.
On Thu, Feb 28, 2019 at 3:40 PM
<mbsoftwaresolutions@mbsoftwaresolutions.com>
wrote:
> On 2019-02-28 07:08, Stephen Russell wrote:
> > Why not make a compressed file of the entire folder where the data
> > lies?
> > After file is created move it to a different machine off the network.
>
>
> Because I think open DBFs would present a problem with that approach???
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
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/000d01d4cfb5$9869ae80$c93d0b80$@powerchurch.com
** 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.
Author: Stephen Russell
Posted: 2019-02-28 16:46:15 Link
Turning 60 this year. :)
On Thu, Feb 28, 2019 at 4:33 PM Tracy Pearson <tracy@powerchurch.com> wrote:
> You'll have trouble the same way if a user is saving the Word or Excel
> file.
> Writing to tables locks a portion of the table, and sometimes all of the
> table which can cause copy failures..
> You've been out of the VFP for a couple of years and haven't worked with
> DBFs for longer.
> We'll forgive your older age and forgetfulness.
>
> Tracy
>
> -----Original Message-----
> From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of
> Stephen
> Russell
> Sent: Thursday, February 28, 2019 5:29 PM
> To: profoxtech@leafe.com
> Subject: Re: Creating a copy of a database -- best practice?
>
> Would the table or index not be included? I get backups of word and excel
> files if they are open.
>
>
>
>
>
> On Thu, Feb 28, 2019 at 3:40 PM
> <mbsoftwaresolutions@mbsoftwaresolutions.com>
> wrote:
>
> > On 2019-02-28 07:08, Stephen Russell wrote:
> > > Why not make a compressed file of the entire folder where the data
> > > lies?
> > > After file is created move it to a different machine off the network.
> >
> >
> > Because I think open DBFs would present a problem with that approach???
> >
[excessive quoting removed by server]
_______________________________________________
Post Messages to: ProFox@leafe.com
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/CAJidMYLsLfLRkMv1zvO1eAT8GTj9-bBODbtEHWbiXyVOrxQKzw@mail.gmail.com
** 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.