db2利用离线备份重建数据库
环境:PRO机器:生产环境,拥有正式数据
IVT机器:已经有数据库,根据PRO机器的离线备份文件重建现在的数据库
--首先断掉所有连接
bash-3.00$ db2 force applications all
DB20000IThe FORCE APPLICATION command completed successfully.
DB21024IThis command is asynchronous and may not be effective immediately.
bash-3.00$ db2 list applications
SQL1611WNo data was returned by Database System Monitor.
--使用/tmp下面的备份镜像
bash-3.00$ db2 "restore db mtpdb from /tmp replace existing redirect without rolling forward"
SQL2539WWarning!Restoring to an existing database that is the same as the
backup image database.The database files will be deleted.
SQL1277WA 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.
DB20000IThe 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
DB20000IThe 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
--完成
页:
[1]