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 <db_name>则会使用<db_name>的表空间目录和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 <db_name>则可以指定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.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值