其他数据库迁移达梦
<h2>问题1:回滚记录版本太旧,无法获取用户记录</h2>
<p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/2d2a701c246879d2b0378b899b726573" alt="" /></p>
<h2>解决方案:</h2>
<p>方法一:更改dm.ini中UNDO_RETENTION,适当放大该参数,改为1800秒,可以解决报回滚段太旧的问题</p>
<pre><code class="language-shell">cd /risen/soft/database/dmdbms/data/DMENG
#默认参数为90秒,改成1800秒
cat dm.ini |grep UNDO_RETENTION</code></pre>
<p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/31c6c26bc4346bc348712653016c6bfc" alt="" />
方法二:更改dm.ini中ENABLE_IGNORE_PURGE_REC,改为1可忽略该报错,继续执行解决报回滚段太旧的问题</p>
<pre><code class="language-shell">cd /risen/soft/database/dmdbms/data/DMENG
#默认参数为 0 ,改成 1 忽略报错
cat dm.ini |grep ENABLE_IGNORE_PURGE_REC</code></pre>
<p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/6a28c2a690b240f8cc0453b798903775" alt="" /></p>
<h2>问题2:列*长度超出定义</h2>
<p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/a57205a42ac574ab66e44d325b1d850d" alt="" /></p>
<h2>解决方法:</h2>
<p>登录DM数据库——模式——找到报错的那张表——右键——修改——找到相关列名,修改精度,一般是加倍
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/8701de59ad995fa611114341c23d9481" alt="" /></p>
<h2>问题3. 对象*约束表达式无效</h2>
<p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/55a7cff12ce84026837a4ebf0923b7d3" alt="" /></p>
<h2>解决方法:</h2>
<p>保存迁移错误日志,编辑,将<code>DEFAULT '0000-00-00 00:00:00'</code>改为<code>DEFAULT ' '</code>,再执行SQL即可
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/690c3e1d2483d8efed81ac864a3871c9" alt="" />
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0945846cbd4e566c5b9c72b5dc01afa8" alt="" /></p>
<h2>问题4.仅当指定列列表,且IDENTITY_INSERT为ON时,才能对自增列赋值</h2>
<p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/21c193e4180b28e0f477d8a33f38280b" alt="" /></p>
<h2>解决方案:</h2>
<p>去掉表的自增sql模板</p>
<pre><code>ALTER TABLE &quot;模式名&quot;.&quot;表名&quot; DROP IDENTITY;</code></pre>
<h3>批量去掉所有表的自增</h3>
<ul>
<li>
<p>如图所示选中所有表批量生成delete语句(此处不是执行删除)
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/01ea7bbf3b26f540fb36e5e223511739" alt="" /></p>
</li>
<li>
<p>在达梦查询窗口按<code>Ctrl+f</code>打开替换工具,把 "delete from" 批量替换成 "alter table"
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/50c9fc111e2a5df93d54d893e0120a45" alt="" /></p>
</li>
<li>
<p>把 ";" 批量替换成 " DROP IDENTITY;"
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/d2618872cea6775bf736cb293d8ec693" alt="" /></p>
</li>
<li>
<p>如图所示,如果报错提示"没有 IDENTITY 项"则直接删掉报错sql和已执行成功sql,继续执行剩余的命令,重复操作直到全部执行完毕
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/ec02b4a776c4fe0467d582f9c45cef08" alt="" /></p>
</li>
<li>验证
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/85c1e7dd544057c102dd52ac950909dc" alt="" /></li>
</ul>