DB2离线备份恢复步骤和原理


[db2inst1@t3-dtpoc-dtpoc-web04 backup_images]$ db2 backup db test

Backup successful. The timestamp for this backup image is : 20230823103323
[db2inst1@t3-dtpoc-dtpoc-web04 backup_images]$ ls
TEST.0.db2inst1.DBPART000.20230823103323.001
[db2inst1@t3-dtpoc-dtpoc-web04 backup_images]$ pwd
/home/db2inst1/liys/backup_images

如果指定了into 则会使用的表空间目录和DBPATH
[db2inst1@t3-dtpoc-dtpoc-web04 backup_images]$ db2 restore db test from /home/db2inst1/liys/backup_images taken at 20230823103323 into test
SQL2539W  The specified name of the backup image to restore is the same as the 
name of the target database.  Restoring to an existing database that is the 
same as the backup image database will cause the current database to be 
overwritten by the backup version.
Do you want to continue ? (y/n) y
DB20000I  The RESTORE DATABASE command completed successfully.
[db2inst1@t3-dtpoc-dtpoc-web04 backup_images]$ 

如果不指定into 则可以指定ON和DBPATH目录,指定自动储存表空间目录和数据库目录
[db2inst1@t3-dtpoc-dtpoc-web04 backup_images]$ db2 restore db test from /home/db2inst1/liys/backup_images taken at 20230823103323 on  /testdata/db2inst1  SQL2539W  The specified name of the backup image to restore is the same as the 
name of the target database.  Restoring to an existing database that is the 
same as the backup image database will cause the current database to be 
overwritten by the backup version.
Do you want to continue ? (y/n) y
DB20000I  The RESTORE DATABASE command completed successfully.


[db2inst1@t3-dtpoc-dtpoc-web04 backup_images]$ db2 restore db test from /home/db2inst1/liys/backup_images taken at 20230823103323 on  /testdata/db2inst1 dbpath on /home/db2inst1
SQL2539W  The specified name of the backup image to restore is the same as the 
name of the target database.  Restoring to an existing database that is the 
same as the backup image database will cause the current database to be 
overwritten by the backup version.
Do you want to continue ? (y/n) y
DB20000I  The RESTORE DATABASE command completed successfully.

你可能感兴趣的:(数据库,java,mysql)