nzreplrestore command

Use the nzreplrestore command to restore the replication data (from some or all of the replicated databases) that is required to recover or initialize a replica. This command, along with the nzreplanalyze and nzreplbackup commands, is part of the recovery tool set for replication. For examples of tasks that require the analyze, backup, and restore process, see Adding an existing database to a replication set and Resynchronizing a replicated database.

Syntax

Use the following nzreplrestore command syntax to check the restore process without making changes to the system:
nzreplrestore -simulate [ -verbose ] -recoveryfile <fileName>
[ -dir <dirList> | -dirfile <fileName> | -connector <connName>
[ -connectorArgs <list> ] ] [ -u <userName> ] [ -pw <password> ]
[ -secret <secret> ]
Use the following syntax to restore the replication data that is required to recover or initialize a replica if you used the -rqm transfer option for the nzreplbackup command:
nzreplrestore -recoveryfile <fileName> [ -u <userName> ]
[ -pw <password> ] [ -secret <secret> ] [ -verbose ]
Use the following syntax to restore the replication data that is required to recover or initialize a replica if you did not use the -rqm transfer option for the nzreplbackup command:
nzreplrestore -recoveryfile <fileName> [ -dir <dirList> |
-dirfile <fileName> | -connector <connName>
[ -connectorArgs <list> ] ] [ -u <userName> ] [ -pw <password> ]
[ -secret <secret> ] [ -verbose ]

Options

The nzreplrestore command takes the following options:
-recoveryfile <fileName>
Specifies the name and location of the recovery file that the nzreplanalyze command created. If you used the -rqm option for the nzreplbackup command, specify the path name that was supplied in the output of the command. If you used the -dir or -dirfile option for the nzreplbackup command, specify the location to which you manually moved the recovery files.
-simulate
Determines the recovery needs without restoring from a backup. Results are output to the screen.
-dir <dirList>
Specifies the path names where the backup directories are stored. Enter full directory path names as a space-separated list.
-dirfile <fileName>
Specifies a file that contains a list of the backup source directories, one per line.
-connector <connName>
Names the connector from which you are retrieving the backup. These are the same connector options as those available to the nzbackup command. For details, see IBM Netezza System Administration. The default connector is the file system (used for the -dir or -dirfile option).
-connectorArgs <argList>
Specifies a colon-separated list of passthrough arguments for the connector. You must enclose the argument string in double quotation marks.
-u <username>
Specifies the Netezza® user name to connect to the database (NZ_ USER). If you do not set the NZ_USER variable in the environment, it must be specified, or the system reports an error.
-pw <password>
Specifies the user’s password (NZ_PASSWORD).
-secret <secret>
Specifies the string value that is needed to generate the 256-bit symmetric key that is used to decrypt the host key in the backed-up data. If you enter a string, it must be the same secret that you used for the nzreplbackup command. If you do not enter a string but used a secret for the nzreplbackup command, the nzreplrestore command fails.
-v[erbose]
Displays detailed command output, including internal SQL queries, analysis, and conclusions.

Usage

If you specified the -rqm option for the nzreplbackup command, the recovery file is copied into the /var/nzrepl directory on the replication queue manager. The path name is supplied in the nzreplbackup command output with the restore instructions. In this case, you do not need to specify a location option (-dir, -dirfile, or -connector) for the nzreplrestore command. By default, the system does the restore with the same number of streams that were used for the backup.

Unlike the nzreplanalyze and nzreplbackup commands, the restore activity on the replica node has no effect on the primary's replication state or its ability to process new update transactions. The replica remains in a suspended replication state until the restore from the backup is complete. When the restore is complete, the command does one of the following actions:
  • Reactivates the node if the node state was active before you began the restore
  • Displays the command syntax that is required to set the replica to an active state if the node state was suspended when you began the restore
After you activate it, the replica begins applying, in order, any transactions that occurred on the primary that were not yet applied.

For a complete example of replication backup and restore, see Examples in the nzreplanalyze command topic.

Examples

In the following example, the node was suspended when the restore began:
[nz@PTS100]$ nzreplrestore -recoveryfile /var/nzrepl/nzreplbackup/
2364/1378735450/my_recovery_file

2013-07-30 16:08:35.697208 EDT Info: Completed restores.
2013-07-30 16:08:35.697232 EDT Info: To restart replication, run:
  nzsql -c "alter replication node myREPLSET.myNode state active
In the following example, the node was active when the restore began:
[nz@PTS100]$ nzreplrestore -recoveryfile /var/nzrepl/nzreplbackup/
2364/1378735450/my_recovery_file
[nz@cdcntza1 ~]$ nzreplrestore -recoveryfile /var/nzrepl/
nzreplbackup/31244/1379613349/subrestore.xml
Suspending myREPLSET.myNode.
Dropping database DB_FST.
NOTICE: Database "DB_FST" is no longer replicated
Starting restore: -globals
Restore of global objects completed successfully.
Starting restore: -db DB_FST
Warning: User and group creation is skipped when restoring to a
replication replica node, or to a non-replicated database on a
primary node.
Restore of increment 1 from backupset 20130919175552 to database 'DB_
FST' committed.
Activating myREPLSET.myNode.
Completed restores.