Thursday, April 19, 2018

small test on the Netezza database using nz_backup

Problem:
I did  test on the nz_backup for backup  & restore.
steps:
1)took backup of table using nz_backup
2)restore the table using nz_restore ,it went fine
3)but the pre-request is the table to be available,if the table structure is NOT available it should throw the error.
4)when I change the table name on target it throws the error,if the source table & target  table name differant it should throw the error.
5)but there is a work around for this,if you take the backup if table TBL1 and backup piece should  be TBL1_1 and if the same table does not exist on the target ,it will throw the error,so the work around would be change the backup file name  according to Target table name.
lets say target table would be TBL2 then backup file should be TBL2_1


nz_backup -db NZ_DB1 -t Table_ACCOUNT_BK  -format binary -dir /nz/migration -thread 1

nz_restore -db NZ_DB1 -t Table_ACCOUNT_BK  -format binary -dir /nz -thread 1

nz_restore -db NZ_DB1 -t Table_ACCOUNT_BK1  -format binary -dir /nz -thread 1


NZ_DB1(ADMIN)=> create table Table_ACCOUNT_BK1 as select * from Table_ACCOUNT_BK where 1=2;
INSERT 0 0
NZ_DB1(ADMIN)=> \q
nz@nz_server_name:/nz> nz_restore -db NZ_DB1 -t Table_ACCOUNT_BK1  -format binary -dir /nz -thread 1

nz_restore of database NZ_DB1 started on 2018-04-18 15:20:44

                         NZ_HOST:
                         NZ_USER: admin
                     NZ_DATABASE: NZ_DB1
                Backup Directory: /nz
                   Backup Format: binary
                   Custom Script:
                    # Of Threads: 1
                Using stableTXid: 0
       The lastTXid assigned was: 0
                      Debug Mode: Disabled

=======================================================================================

ERROR: Unable to load table Table_ACCOUNT_BK1
ERROR: Missing data file: /nz/Table_ACCOUNT_BK1.1

ERROR: 0 tables were processed !!

       No tables (matching your specifications) were found.
       Or, perhaps this database account doesn't have access to those tables.

=======================================================================================

nz_restore of database NZ_DB1 finished on 2018-04-18 15:20:44

     Total # of tables processed: 0
     Total # of seconds elapsed : 0

=======================================================================================

*****
***** ERROR
*****
***** Problems were encountered during the running of this script.
***** Inspect the output from this script for more details.
***** Following is a list of tables that encountered problems.
*****

Table_ACCOUNT_BK1

nz@nz_server_name:/nz> ls -ltr
t
-rw-r--r--  1 nz    nz    195775113 Apr 18 15:17 Table_ACCOUNT_BK.1
nz@nz_server_name:/nz> cp -p Table_ACCOUNT_BK.1 Table_ACCOUNT_BK1.1
nz@nz_server_name:/nz> nz_restore -db NZ_DB1 -t Table_ACCOUNT_BK1  -format binary -dir /nz -thread 1

nz_restore of database NZ_DB1 started on 2018-04-18 15:22:00

                         NZ_HOST:
                         NZ_USER: admin
                     NZ_DATABASE: NZ_DB1
                Backup Directory: /nz
                   Backup Format: binary
                   Custom Script:
                    # Of Threads: 1
                Using stableTXid: 0
       The lastTXid assigned was: 0
                      Debug Mode: Disabled

=======================================================================================

Info:  table 1 of 1                                               Table_ACCOUNT_BK1
Info:  restore process started                                    2018-04-18 15:22:00
Info:  # of bytes to be read                                      195,775,113
Info:  reloading data              ( thread 1 of 1 )
Info:  data flowing ...
Info:  reload finished             ( thread 1 of 1 )   seconds    12
Info:  reload results              ( thread 1 of 1 )              INSERT 0 18025675
Info:  data flow finished
Info:  restore process ended                                      2018-04-18 15:22:12
Info:  rate     (restore file size / # of seconds elapsed)        16,314,592
Info:  # of records reloaded                                      18,025,675
Info:  # of seconds elapsed                                       12

=======================================================================================

nz_restore of database NZ_DB1 finished on 2018-04-18 15:22:12

     Total # of tables processed: 1
     Total # of records reloaded: 18,025,675
     Total # of seconds elapsed : 12

     TOTAL restore file size    : 195,775,113
     rate  (bytes per second)   : 16,314,592

=======================================================================================

nz@nz_server_name:/nz>

No comments:

Post a Comment