Examples of the nzrestore command
Deployment options: Netezza Performance Server for Cloud Pak for Data System
Netezza Performance Server for Cloud Pak for Data
The following are several examples of the nzrestore command.
- To restore the database db1 from the /home/user/backups
directory.
nzrestore -db db1 -u user -pw password -dir /home/user/backups -v
Example:[Restore Server] : Starting the restore process [Restore Server] : Reading schema from /home/user/backups/Netezza/hostid/DB1/20090116125619/1/FULL [Restore Server] : Restoring schema [Restore Server] : Start restoring the data, compressed format. [Restore Server] : Restoring data from /home/user/backups/Netezza/hostid/DB1/20090116125619/1/FULL [Restore Server] : Restoring AAA [Restore Server] : Restoring BBB [Restore Server] : Restoring sales % [Restore Server] : Restoring views, users, groups, permissions Restore of increment 1 from backupset 20090116125619 to database 'DB1' committed.
- To restore only the schema (objects and user permissions, but not the table and view data) of
db1 to a new, empty database that is named new_db1.
nzrestore -db new_db1 -sourcedb db1 -noData -u user -pw password -dir /home/user/backups
- To restore the users, groups, and privileges in the system
catalog.
nzrestore -globals -u user -pw password -dir /home/user/backups
This command restores the users, groups, and global privileges as defined in the system catalog. If a user or group currently exists in the system catalog, the command grants any additional privileges as defined in the backup. The command does not revoke any current privileges that are not also defined in the backup.
- To list all of the objects such as tables, synonyms, user-defined objects, and others that were
saved in a database backup, use the nzrestore -contents command as
follows.
nzrestore -contents -db dev -dir /net/backupsvr/nzbackups Database: TPCH_TEST List of relations Oid | Type | Name -----------+----------------+----------------------------- 210854 | SEQUENCE | MY_SEQ 203248 | TABLE | NATION 203264 | TABLE | REGION 203278 | TABLE | PART 203304 | TABLE | SUPPLIER 203326 | TABLE | PARTSUPP 203344 | TABLE | CUSTOMER 203368 | TABLE | ORDERS 203394 | TABLE | LINEITEM 210853 | SYNONYM | MY_ORDERS 217345 | FUNCTION | ORDERCONV(CHARACTER VARYING(ANY))
- If a restore operation fails or is canceled, the target database might remain in a locked state.
You can use the -unlockdb option of the command to unlock the target
database.
nzrestore -db myrestoredb -unlockdb