db2利用离线备份重建数据库

环境:
PRO机器:生产环境,拥有正式数据
IVT机器:已经有数据库,根据PRO机器的离线备份文件重建现在的数据库



--首先断掉所有连接
bash-3.00$ db2 force applications all
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
bash-3.00$ db2 list applications
SQL1611W No data was returned by Database System Monitor.

--使用/tmp下面的备份镜像
bash-3.00$ db2 "restore db mtpdb from /tmp replace existing redirect without rolling forward"
SQL2539W Warning! Restoring to an existing database that is the same as the
backup image database. The database files will be deleted.
SQL1277W A redirected restore operation is being performed. Table space
configuration can now be viewed and table spaces that do not use automatic
storage can have their containers reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.

--查看现在恢复状态
bash-3.00$ db2 list utilities show detail

ID = 3
Type = RESTORE
Database Name = MTPDB
Partition Number = 0
Description = db
Start Time = 02/16/2011 16:48:46.187310
State = Executing
Invocation Type = User
Progress Monitoring:
Completed Work = 17330176 bytes
Start Time = 02/16/2011 16:48:46.187318

--确认恢复
bash-3.00$ db2 restore db mtpdb continue
DB20000I The RESTORE DATABASE command completed successfully.

--连接数据库
bash-3.00$ db2 connect to mtpdb

Database Connection Information

Database server = DB2/AIX64 9.5.5
SQL authorization ID = A1INMTP
Local database alias = MTPDB

--完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值