The following articles mainly describe the correct operation procedure for backing up a multi-partition database in DB2, as well as the detailed description of the actual operations involved in backing up a multi-partition database in DB2, the following is a detailed description of the main content of the article.
Partition, database
Cataloguing partition:
- Catalog database partition number = 0
This is the directory partition.
Disconnect all connections.
- DB2 force applications all
- DB2_all "<<+0<DB2 backup database sample to d:\data compress"
- DB2_all "<<-0<DB2 backup database sample to d:\data compress"
- DB2_all "<<+0< DB2 restore db sample from d:\data taken at 20090212141538 replace existing "
- DB2_all "<<-0< DB2 restore db sample from d:\data taken at 20090212141630 replace existing"
- replace existing
- If a database with the same alias as the target database alias already exists, this parameter specifies
- that the restore utility is to replace the existing database with the restored database. This is useful
- for scripts that invoke the restore utility, because the command line processor will not prompt the
- user to verify deletion of an existing database. If the WITHOUT PROMPTING parameter is specified,
- it is not necessary to specify REPLACE EXISTING, but in this case, the operation will fail if events occur that normally require user intervention.
To back up all the partitions in the partitioned database, we can use the role of DB2_all. Add DB2_all to the front of the statement and reference the statement in "". This statement can be executed on each partition of an instance without repeatedly issuing the same command for each partition. BACKUP can be used to operate the partitioned database in this way, except for the cataloguing partition. Because DB2 requires exclusive partitioning during backup or recovery, you must complete the backup operation before backing up other partitions.
In addition, in the "" statement after DB2_all, we can start with the following method to specify the partition for the command:
<+ Partition Number <: indicates that subsequent commands act on the partition.
<-Partition Number <: indicates that subsequent commands act on partitions other than this partition.
| <-Partition Number <or <-Partition Number;: indicates that the subsequent backup commands of the DB2 multi-partition Database Act on other partitions except the partition,
In parallel.
In conclusion, the command for backing up data in a partitioned database is as follows ):
1. No parallel operation is required:
When the backup operation does not require parallel operations, there is no need to operate the cataloguing partitions first. At this time, you can use a command to perform backup operations.
DB2_all "DB2 backup database <DATABASE alias> TO <path/Device Name>"
2. Use parallel operations:
DB2_all "<+ 0 <DB2 backup database <DATABASE alias> TO <path/Device Name>" in windows)
DB2_all "| <-0 <DB2 backup database <DATABASE alias> TO <path/Device Name>"
Or
DB2_all "<-0 <; DB2 backup database <DATABASE alias> TO <path/Device Name>"
That is, the backup operation is performed on the-0 partition of the cataloguing partition first, and then the operations are performed on other partitions except the cataloguing partition at the same time to shorten the operation time, this reflects the superiority of the partitioned database.
- DB2 force applications all
- DB2_all "<<+0<DB2 connect to churndb;DB2 backup database churndb to /DB2log/DB2buckup compress;DB2 terminate"
- DB2_all "<<-0<DB2 connect to churndb;DB2 backup database churndb to /DB2log/DB2buckup compress;DB2 terminate"
The above content is a description of the Multi-partition database backup in DB2, hoping to help you in this regard.