I think you must dump in ascii, then restore. WRITE ALL OUTPUT(DIR='$2/$1', CONTENT=TRUE);
Attached are 2 scripts, which may get you close. One dumps a DB, the other will restore from the dump. -- gsbr...@umich.edu
backupDBviadump.sh
Description: Binary data
#!/usr/bin/perl -w #!+ restorebackupDBviadump.pl # # FUNCTIONAL AREA OR ABSTRACT: # Restores a Frontbase DB from an ascii dump. T # # ENVIRONMENT/PROJECT: # nucptdb # # PATH: # /usr/local/etc/ # # LAUNCH METHOD: # /usr/local/etc/restorebackupDBviadump.pl -c(=create the DB) -f /path/to/schema.sql # # OUTPUT: # db restored # # # MODIFIED BY: # VERS DATE AUTH. REASON # 1.0 10/1/09 GSB Original # # # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE. # !-*/ $dbglev = 1; # global debug level, select the debug level of info, more at higher levels # global debuglevel -- level of info to log, 0=none, 1=some, 2=more, 3=most # !++___________________________ Function lines _______________________________*/ # sub dbg # - debug print { # /*INPUT PARAMETERS: my ($plev) = $_[0]; # print level, rest is printed if dbglev>=plev # FUNCTIONAL DESCRIPTION: # prints the rest of @_, if dbglev>=plev, dbg(2," call x",$x); # gets printed if global dbglev is 2 or more. # !--*/ if ( $plev <= $dbglev ) { #shift @_; print @_, "\n"; } } #/*eofunc*/ use Getopt::Std; # for line options our ($opt_f); getopts('cf:'); dbg( 2, "input file spec $opt_f" ); defined $opt_f or die "Bad input file specification: use -f !\n/usr/local/etc/restorebackupDBviadump.pl -c(=create the DB) -f /path/to/schema.sql\n"; ( $opt_f =~ m|^/.*/schema.sql| ) or die "Bad input file specification: $opt_f \nMust be complete file name of schema.sql file\n"; my $iis = `whoami`; chomp $iis; ( $iis eq "root" ) or die "\n$iis, you must be root! try again!\n"; # rework $opt_f my @dirloc = split "/", $opt_f; dbg( 2, @dirloc ); my $dbname = $dirloc[ @dirloc - 2 ]; my $schema = $dirloc[ @dirloc - 1 ]; pop @dirloc; pop @dirloc; #unshift push pop my $newdirloc = join "/", @dirloc; dbg( 2, "new dirloc = $newdirloc, dbname is $dbname, and schema at $schema" ); open( INPUT, "<$opt_f" ) or die "Can't open $opt_f for reading! \n"; open( OUTPUT, ">$newdirloc/$dbname/newschema.sql" ) or die "Can't open file $newdirloc/$dbname/newschema.sql"; # SETUP get a temp file to hold output use IO::File; use POSIX qw(tmpnam); my $time = scalar localtime; print "\nRestore Frontbase DB $dbname from $opt_f \n$time\n"; while ( $line = <INPUT> ) { if ( $line =~ m|FILE = '([^']*)/$dbname/[^']*'| ) { print $1, "\n"; print $line; $line =~ s|$1|$newdirloc|; print $line; } print OUTPUT $line; } close OUTPUT; # add CREATE DATABASE? my $createdatabase = "" ; if(defined $opt_c && $opt_c == 1){ print "Will create the database\n"; $createdatabase = "CREATE DATABASE $dbname;\n" ; } my $command = "echo Running script, $newdirloc/$dbname/newschema.sql; /Library/Frontbase/bin/sql92 <<eocommand $createdatabase CONNECT TO $dbname user _system ; SCRIPT $newdirloc/$dbname/newschema.sql; EXIT eocommand "; print "The script will be:\n$command\n"; system $command ; exit;
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com