.unl 文件的命名约定

Naming convention of .unl files

我想了解在我的 Informix 数据库上使用 dbexport 后生成的 .unl 文件的命名约定适用的规则是什么。

我明白了:

我想了解这5个数字是什么意思。有没有办法保证列表是按字母顺序生成的?

卸载文件中使用的 5 位数字是 table 的 tabid

我认为没有办法保证列表是按字母顺序生成的。

The dbexport and dbimport utilities

获取 table 的 tabid 查询 systables 系统目录 table:

SELECT  tabname, tabid
FROM    systables
WHERE   tabname = '<TABNAME>';

对于给定的列表:

SELECT  tabname, tabid
FROM    systables
WHERE   tabname IN (
            '<TABNAME1>',
            '<TABNAME2>',
            '<TABNAME3>',
            ...
        )
ORDER BY tabid;

所有用户 tables:

SELECT  tabname, tabid
FROM    systables
WHERE   tabid > 99 
        AND tabtype = 'T'
ORDER BY tabid;

不用说你可以反向搜索 tabid:

SELECT  tabname, tabid
FROM    systables
WHERE   tabid = '<TABNAME>';

SELECT  tabname, tabid
FROM    systables
WHERE   tabid IN (
            101,
            102,
            103,
            ...
        )
ORDER BY tabid;

一种映射方式是:

SELECT  tabname, 
        tabid,
        RPAD(SUBSTR(tabname,0, 5), 5, '_')||tabid||'.unl' AS unl_file, 
FROM    systables
WHERE   tabid > 99 
        AND tabtype = 'T'
ORDER BY tabid;

关于这是否是一个好方法的问题,这取决于一些问题:

  • 源数据库有多少个table?
  • 您打算迁移多少 table?
  • 该过程应说明 table 与数据 (PK/FK/Triggers/...) 之间的关系。
  • 记住存储子句在使用 ss 选项时提到了数据库空间。
  • ...

例如,如果您有一个包含 1000 个 table 的数据库并且只需要 10 个,那么从数据的 dbschema and then perform an unload 中提取架构会更容易。

这是引擎附带的 Data migration utilities 列表中的 link。