Troubleshooting
Problem
How to restore specific tables from a combination of full, cumulative and incremental backups
Symptom
Cause
Restores of specific tables that need to replay multiple backups (i.e. a full backup plus cumulative and/or differential backups as well) cannot be done as several commands. All the incremental backup must be existed in the one nzrestore command.
Diagnosing The Problem
If you are restoring the whole database, you can restore each backup one at a time, so long as you keep the database locked. Locked means changes are not permitted, but selects are, so you can check if the rows/tables/etc you were expecting have been restored, and if not, restore some more incremental backups:
[nz@NZ-H1]$ nzrestore -db iii -dir /tmp/iii/full -lockdb 1
-increment 1
Restore of increment 1 from backupset 2014102453439 to database
'iii' committed.
[nz@NZ-H1]$ nzsql iii -c "select * from DROPPED_TABLE ;"
NOTICE: Database 'III' is available for read-only
C1
----
3
(1 row)
[nz@NZ-H1]$ nzrestore -db iii -dir /tmp/iii/cumulative -lockdb 1
-increment next
Restore of increment 2 from backupset 20141024053439 to database
'iii' committed.
[nz@NZ-H1]$ dbc "select * from DROPPED_TABLE order by c1;"
NOTICE: Database 'III' is available for read-only
C1
----
3
17
(2 rows)
[nz@NZ-H1]$ nzrestore -db iii -dir /tmp/iii/differential -lockdb 1
-increment rest
Restore of increment 3 from backupset 2014102453439 to database
'iii' committed.
Restore of increment 4 from backupset 2014102453439 to database
'iii' committed.
Restore of increment 5 from backupset 2014102453439 to database
'iii' committed.
[nz@NZ-H1]$ dbc "select * from DROPPED_TABLE order by c1;"
NOTICE: Database 'III' is available for read-only
C1
----
3
17
18
19
20
(5 rows)
[nz@NZ-H1]$ nzrestore -db iii -unlockdb
[nz@NZ-H1]$ dbc "select * from DROPPED_TABLE order by c1;"
C1
----
3
17
18
19
20
(5 rows)
However, if you are restoring specific tables, you will get errors from trying to restore incremental backups with different nzrestore commands. The -increment, -lockdb and -tables command line options are mutually exclusive:
[nz@NZ-H1]$ nzrestore -db iii -dir /tmp/iii/full -increment 1
-tables ONEROW -lockdb 1
Error: -lockdb only valid in restore operations that can be followed
by NEXT or REST.
[nz@NZ-H1]$ nzrestore -db iii -dir /tmp/iii/full -increment 1
-tables ONEROW
Restore of increment 1 from backupset 20141024053439 to database 'iii'
committed.
[nz@NZ-H1]$ nzrestore -db iii -dir /tmp/iii/cumulative -increment next
-tables ONEROW
Error: -increment NEXT/REST not valid with -contents, -noData, or -tables.
[nz@NZ-H1]$ nzrestore -db iii -dir /tmp/iii/cumulative -increment 2 -tables ONEROW
Error: Invalid backupset 20141024053439, first increment must be a full backup.
Resolving The Problem
You can restore specific tables from a full multiple backlups (i.e. full plus incrementals backups so long as all backup increments must be findable in the one command, like this one:
[nz@NZ35064-H1 iii]$ nzrestore -db iii -dir /tmp/iii/full
/tmp/iii/cumulative /tmp/iii/differential -tables ONEROW
Restore of increment 1 from backupset 2014102453439 to database 'iii'
committed.
Restore of increment 2 from backupset 2014102453439 to database 'iii'
committed.
Restore of increment 3 from backupset 2014102453439 to database 'iii'
committed.
Restore of increment 4 from backupset 2014102453439 to database 'iii'
committed.
Restore of increment 5 from backupset 2014102453439 to database 'iii'
committed.
Was this topic helpful?
Document Information
Modified date:
17 October 2019
UID
swg21688517