DB2离线全备份原路径恢复
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DB2离线全备份原路径恢复相关的知识,希望对你有一定的参考价值。
1.使用db2ckbkp -h <db_backup_file_name>检查备份文件
[[email protected] home]$ db2ckbkp -hDMSDEV.0.db2inst.NODE0000.CATN0000.20160513102947.001
===================== MEDIA HEADER REACHED: ===================== Server Database Name -- DMSDEV Server Database Alias -- DMSDEV Client Database Alias -- DMSDEV Timestamp -- 20160513102947 Database Partition Number -- 0 Instance -- db2inst Database Configuration Type -- 0 (Non-shared data) Sequence Number -- 1 Database Member ID -- 0 Release ID -- 0xD00 (DB2 v9.7) Database Seed -- 0x7903558C DB Comment‘s Codepage (Volume) --0 DB Comment (Volume) -- DB Comment‘s Codepage (System) --0 DB Comment (System) -- Authentication Value -- 255 (Not specified) Backup Mode -- 0 (Offline) Includes Logs -- 0 (No) Compression -- 0 (Uncompressed) Backup Type -- 0 (Database-level) Backup Granularity -- 0 (Non-incremental) Merged Backup Image -- 0 (No) Status Flags -- 0x1 Consistent onthis member System Catalogs in thisimage -- 1 (Yes) Catalog Partition Number -- 0 DB Codeset -- UTF-8 DB Territory -- LogID -- 1458720781 LogPath --/db2data/db2inst/NODE0000/SQL00002/SQLOGDIR/ Backup Buffer Size -- 16781312 (4097 4K pages) Number of Sessions -- 1 Platform -- 0x1E (Linux-x86-64) The properimage file name would be: DMSDEV.0.db2inst.DBPART000.20160513102947.001 [1] Buffersprocessed: ######################################################################################################################################################################################################################################## Image Verification Complete - successful.
2.新建数据库
新库与备份文件db2ckbkp的检查内容恢复一致
Instance -- db2inst Client Database Alias -- DMSDEV Timestamp -- 20160513102947 DB Codeset -- UTF-8 LogPath -- /db2data/db2inst/NODE0000/SQL00002/SQLOGDIR/
*强烈要求的注意事项:
(1)如果Instance名称不致,须新建与之一致的实例;
(2)要新建与原用户一致的home路径(以上则为/db2data)
--创建实例用户及fence用户
# su - root # useradd -m -gdb2iadm1 -d /home/db2inst db2inst # useradd -m -gdb2fadm1 -d /home/db2fenc db2fenc # passwd db2inst # passwd dbfenc
--创建新实例,与原实例命名一致
# su - root # cd/opt/ibm/db2/V10.5/instance # ./db2icrt -p 50100-u db2fenc db2inst
--创建新的数据库,与原数据库名一致
# su - db2inst # db2start # db2create database dmsdev using codesetutf-8 territory CN
--更改备份文件的所有权限
# su - root # chowndb2inst:db2iadm1 /home/DMSDEV.0.db2inst.NODE0000.CATN0000.20160513102947.001
--创建原实例home路径
# su - root # mkdir /db2data # chowndb2inst:db2iadm1 /db2data
--导入全备份文件
# su -db2inst # db2restore database dmsdev from /home taken at20160513102947 without rolling forward without prompting
--分配库的管理权限
# db2connect to dmsdev # db2grant dbadm on database to user dms
3.数据库配置工作
(1)修改/etc/service下的db2inst的端口号
(2)# db2setDB2COMM=tpcip
(3) # reboot
本文出自 “几缕萧雨锁清秋” 博客,请务必保留此出处http://joeyliu.blog.51cto.com/3647812/1785015
以上是关于DB2离线全备份原路径恢复的主要内容,如果未能解决你的问题,请参考以下文章