Subject Re: script for nbackup
Author hvlad
--- In firebird-support@yahoogroups.com, "davidwilder_13" <davidwilder13@...> wrote:
>
> Hi Ann,
>
> I work with Robert. We assumed this worked after running a quick test;
> 1. Create test.fdb, create table and insert 2 records
> 2. Lock database
> #./nbackup -U BASX -P **** -L ../data/test.fdb
> 3 Copy database to temp location
> #cp ../data/test.fdb ../data/temp/test.fdb
> 4. inserted a few more records into the original database which created a merge file
> 5. Set state of backup database to normal with nbackup
> #./nbackup -U BASX -P **** -F ../data/temp/test.fdb
> 6. Backup and restore
> #./gbak -b -t -v -user BASX -pas **** "../data/temp/test.fdb" "../data/temp/test.gbk"
> #./gbak -c -p 16384 -v -user BASX -pas **** ../data/temp/test.gbk ../data/temp/testnew.gdb
> 7. Then Shutdown service and swap the databases
> #/etc/intit.d/firebird stop
> #mv ../data/temp/testnew.gdb ../data/test.fdb
> #/etc/intit.d/firebird start
> 8. Then merge changes back in with nbackup
> #./nbackup -U BASX -P **** -N ../data/test.fdb

This step should fail as just restored database is not in stalled mode.
You missed something. Or you found a bug (i don't think so).

> After this we found the merge file was deleted and we had all 6 records in the new database.

It is impossible.

Regards,
Vlad

PS

> 1. Create test.fdb, create table and insert 2 records
...\bin>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'test.fdb';
SQL> create table t (id int);
SQL> insert into t values(1);
SQL> insert into t values(2);
SQL> commit;
SQL> exit;

> 2. Lock database
...\bin>nbackup -L TEST.FDB

> 3 Copy database to temp location
...\bin>copy TEST.FDB TEST_2.FDB
1 file(s) copied.

> 4. inserted a few more records into the original database which created a merge file
...\bin>isql TEST.FDB
Database: TEST.FDB
SQL> insert into t values(10);
SQL> insert into t values(11);
SQL> insert into t values(12);
SQL> insert into t values(13);
SQL> commit;
SQL> select * from t;

ID
============
1
2
10
11
12
13

SQL> exit;

> 5. Set state of backup database to normal with nbackup
...\bin>nbackup -F TEST_2.FDB

> 6. Backup and restore
...\bin>gbak -b TEST_2.FDB TEST_2.FBK
...\bin>gbak -r TEST_2.FBK TEST_3.FDB

> 7. Then Shutdown service and swap the databases
...\bin>ren TEST.FDB TEST_0.FDB
...\bin>ren TEST_3.FDB TEST.FDB

> 8. Then merge changes back in with nbackup
...\bin>nbackup -N TEST.FDB
[
PROBLEM ON "end backup".
unsuccessful metadata update
-Database is not in the physical backup mode
SQLCODE:-607
]
Failure: Database error