Migrate DB2 v9 on windows to

DB2 v10.5 on linux

1.export

db structure from windows server(use “-m” to generate statistics info):

db2look -d -f -l -e –x [-m]

-o .ddl

2.export

sequences:

db2 " select 'drop sequence

'||rtrim(seqschema)||'.'||seqname||';' from syscat.sequences where seqschema

not like 'SYS%'" | findstr drop > dropseq.sql

db2 "select 'select ''create sequence

'||rtrim(seqschema)||'.'||seqname||' minvalue '''||'||char(nextval for

'||rtrim(seqschema)||'.'||seqname||')||'';'' from syscat.sequences fetch first

1 row only;' from syscat.sequences where seqschema not like 'SYS%'"| findstr create > t.sql

db2 -tf t.sql | findstr create >

crtseq.sql

3.export

data from windows server:

db2move export

4.record

all the tables with "generated always" column:

db2 "export to genalwy.txt of del

Select distinct tabschema||'\".\"'||tabname from SYSCAT.COLUMNS

where generated='A'"

5.copy

all above to linux server.

6.modify

.ddl, change tablespace container from windows style to linux and

remove all the "create sequence" statements.

7.create

database on Linux server:

db2 create db using codeset

GBK territory CN……

8.create

db structure using .ddl(ignore errors like create syscat/systool tablespace):

db2 -tvf .ddl > .log

run this command several times to make sure

all the views are created.

9.create

sequences

db2 -tvf crtseq.sql

10.remove all the lines in the

"db2move.lst" file(generated automatically when export data on

windows server) which contain tables in the "genalwy.txt" file, and

put them in another file "genalwylst.txt":

mv db2move.lst db2move.lst.bak

sed -e

"s/\"\"/\"/g" < genalwy.txt >genalwy2.txt

grep -v -f genalwy2.txt db2move.lst.bak

> db2move.lst

grep -f genalwy2.txt db2move.lst.bak >

genalwylst.txt

11.Load data on Linux server:

db2move load -co NONRECOVERABLE

–lo replace

12.generate sql to load tables with

"generated always" column:

cat genalwylst.txt |sed -e "s/[\"

]//g"|sed -e "s/\!/ /g"|awk '{print "load from

"$2," of ixf modified by identityoverride savecount 1000 messages

"$3"\n insert into "$1" NONRECOVERABLE ; \n"}'

>loadgenalwy.sql

13.load tables with "generated

always" column:

db2 -tvf loadgenalwy.sql

14.generate check constraint sql:

db2 "select 'set integrity for

'||rtrim(tabschema)||'.'||tabname||'immediate checked;' from syscat.tables where status = 'C'" | grep

integrity >chkcnst.sql

15.set table from "check pending" to

normal:

db2 -tvf chkcnst.sql

if there are still some table are in

check pending state, put voilated rows in exception table:

db2 "select 'create table

'||rtrim(tabschema)||'.'||rtrim(tabname)||'_EXCPT like '||rtrim(tabschema)||'.'||tabname||'immediate checked;' from syscat.tables where

status = 'C'" | grep integrity >crtexcpttbl.sql

db2 "select 'set integrity for

'||rtrim(tabschema)||'.'||tabname||'immediate checked for exception in '||rtrim(tabschema)||'.'||tabname||'

use '||rtrim(tabschema)||'.'||rtrim(tabname)||'_EXCPT;' from syscat.tables

where status = 'C'" | grep integrity >chkcnst_excpt.sql

db2 -tvf crtexcpttbl.sql

db2 -tvf chkcnst_excpt.sql

16.change start values of "generated by

default" columns:

db2 "Select 'select ''alter table

'||rtrim(tabschema)||'.'||tabname||' alter column '||colname||' restart with

''||'||'char(max('||colname||')+1)||'';'' from

'||rtrim(tabschema)||'.'||tabname||';' from SYSCAT.COLUMNSwhere generated in ('D','A')" |grep

alter > t.sql

db2 -tf t.sql |grep alter>t2.sql

db2 -tvf t2.sql

17.runstat(optional, do it if you didn’t run

db2look with -m)

db2 “select 'runstats on table

'||trim(t.TABSCHEMA)||'.'||trim(t.TABNAME)||' with distribution and index all tablesample

system(10);' from syscat.tables T where t.TABSCHEMA not like 'SYS%'”|grep runstats>runstat.sql

db2 –tvf runstat.sql

db2 windows linux,Migrate DB2 v9 on windows to DB2 v10.5 on linux相关推荐

  1. Linux下数百种Windows软件的免费替代品列表

    Linux下数百种 Windows 软件的免费替代品列表 程序所执行任务的描述 Windows Linux 1) 网络连接 网页浏览器 微软 IE,网景 Netscape / Mozilla, Ope ...

  2. windows增量到linux,Beyond Compare 3在windows和linux下实现提取增量包

    需求:要实现在windows或linux下的自动对比打得WAR包,进行增量发布(缺点就是只能增量部署增加的和修改的,对删除的不能进行减量部署) 具体实现:利用Beyond Compare 3来实现,功 ...

  3. Linux哪个和Windows很像,Linuxfx - 这套Linux操作系统看起来和Windows 10非常类似

    正如你在截图中所看到的那样,Linuxfx的外观和感觉与Windows 10非常类似,甚至还可以得到一个带有Windows开始按钮的开始菜单,然而,这个实际上可能是一个问题,因为微软可能不喜欢在另一个 ...

  4. 当年嵌入式系统为什么选了Linux,而没有选Windows?

    点击上方"视学算法",选择"星标"公众号 重磅干货,第一时间送达 来自:strongerHuang,黄工 整理 链接:http://c.biancheng.ne ...

  5. 如何在 Linux 上永久挂载一个 Windows 共享

    导读 如果你已经厌倦了每次重启 Linux 就得重新挂载 Windows 共享,读读这个让共享永久挂载的简单方法. 在 Linux 上和一个 Windows 网络进行交互从来就不是件轻松的事情.想想多 ...

  6. linux容器怎么运行到windows,如何在 Windows 上运行 Linux 容器?

    首先,我们来做一下准备工作,计算机的大概配置内存8GB和64 位的计算机,可以运行 Windows 10 或 Windows Server.已经加入了 Windows 预览体验计划(Insider), ...

  7. windows服务又界面吗_详解远程桌面协议, Linux 和 Windows 间的远程桌面互相访问(RDP、VNC协议)...

    前言:远程协议有很多,本文只讨论几种主要的,另外由于Windows之间的远程桌面工具实在是太多了,这里就不再说明,主要以Windows和Linux之间的互相访问来说明. 一.常见的远程协议及特点 目前 ...

  8. linux中计算高斯的进程,linux下运行高斯比windows的优势

    转引自GaussianFAQ第一章第四节 (1.4) 难道非要用Linux算高斯吗?Windows算高斯的缺陷是什么? 后续问题:听说Linux很难的.我是电脑小白,在Windows上都不太懂,只会最 ...

  9. 华为云服务器linux切换账号,华为云Windows服务器如何切换为Linux系统?

    目前大多数建站程序都跟 Linux 系统比较契合,效率最高,所以老古一直都建议各位站长想要购买云服务器建站就首选 Linux(CentOS)系统,然后安装一个宝塔 Linux 面板就可以轻松简单管理云 ...

  10. linux文字模式怎么传文件夹,虚拟机VMWare文本模式Linux 与 Windows 文件互传

    虚拟机无桌面的Linux 与 物理机Windows 文件互传有很多种方法,现在先说一种通过共享文件夹的形式,其他方法后续再补充 1.     背景 1)        虚拟机系统:VMWare无桌面的 ...

最新文章

  1. HDU-3480 Division (四边形不等式优化DP)
  2. java file函数_java File类的使用以及一些函数
  3. Django 中间件
  4. mongodb php 安装配置,MongoDB 基本安装配置
  5. Spring4Shell的漏洞原理分析
  6. python新闻评论分析_从新闻文章中提取评论
  7. SpringCloud 入门教程(一): 服务注册
  8. 腾讯开源大规模X光预训练模型及代码 |MICCAI 2020
  9. 如何在服务器响应后返回值,如何从异步调用返回响应?
  10. java创建一个单链表,接受输入的数据,并输出
  11. php中获取不到当前元素,PHP 中数组获取不到元素
  12. Mysql函数和存储过程
  13. c语言 四层电梯算法,电梯算法c语言
  14. EDM营销常见问题之邮件被退回原因剖析
  15. Codeforces Round #717 (Div. 2)-A. Tit for Tat-题解
  16. Android省市县三级联动 真实项目抽出 调用只需3行代码
  17. 通过明道云实现培训机构客户管理
  18. Python Crypto.Cipher加密包
  19. KunlunBase集群管理接口
  20. SSH服务器CBC加密模式漏洞(CVE-2008-5161)

热门文章

  1. Windows10浏览器被劫持时,一种解决方法。
  2. The following signatures couldn‘t be verified because the public key is not available: NO_PUBKEY
  3. 【VOLTE】【SRVCC】 SRVCC TO 3GPP
  4. 全自动加药装置详细介绍
  5. 一个人赶着鸭子去每个村庄卖,每经过一个村子卖去所赶鸭子的一半又一只。这样他经过了七个村子后还剩两只鸭子,问他出发时共赶多少只鸭子?经过每个村子卖出多少只鸭子以及角谷定理的计算
  6. Borůvka算法与异或生成树
  7. 千人虚拟社交体验,多人元宇宙场景真的可行么?
  8. MySQL 之 The definition of table 'p' prevents operation UPDATE on table 'post'.
  9. charles 修改responses属性
  10. 树莓派CM4官方底板的双路摄像头使用