使用 IBM Lift CLI 从本地系统装入数据
IBM Lift CLI 是免费的地面到云数据迁移工具,可将数据从本地系统安全地移动到 IBM Cloud上托管的 IBM® Db2® Warehouse on Cloud 套餐。 IBM Lift CLI 可用于 IBM Cloud上托管的 Flex One,Flex 和 Flex Performance 套餐。
Lift 应用程序将数据从表 1 中列出的各种数据源迁移到 IBM Cloud。
IBM Cloud 上的目标数据库 | 数据源 |
---|---|
IBM Db2 Warehouse on Cloud | IBM Db2 |
IBM Db2 Warehouse | |
IBM Integrated Analytics System | |
IBM PureData System for Analytics | |
Oracle Database | |
Microsoft SQL Server | |
CSV 文件格式 |
当数据源为 IBM Db2,IBM Db2 Warehouse,IBM Integrated Analytics System或 IBM PureData System for Analytics时,使用 Lift 迁移数据将分两个阶段进行:
- 迁移源数据库的表结构
- 将数据移入 Db2 Warehouse on Cloud
迁移表结构
使用以下提升 ddl 命令示例迁移表结构,该示例从源数据库中抽取数据定义语言 (DDL) 并将其应用于目标数据库:
% lift ddl --migrate --source-schema <source-schema-name> --source-object <source-object-name>
--source-database <source-database-name> --source-user <source-user-name>
--source-password <source-password> --source-host <source-database-host-name>
--source-database-port <source-database-port> --source-database-type <source-database-type>
--target-user <target-user-name> --target-password <target-password>
--target-host <target-database-host-name>
有关更多可用命令选项,请运行 lift ddl -- help 命令。
移动数据
通过运行以下 lift extract 命令示例,将表数据抽取到 CSV 文件中:
% lift extract --source-schema <source-schema-name> --source-table <source-table-name>
--source-database <source-database-name> --source-host <source-host-name>
--source-user <source-user-name> --source-password <source-password>
--source-database-port <source-database-port> --source-database-type <ias/db2/db2w>
--file <path-to-csv-file>
-source-database-type 命令选项的 ias,db2和 db2w 设置用于指定特定源数据库类型。
通过运行以下 lift put 命令示例,移动 CSV 文件并将其登台到目标数据库的登录区域中:
% lift put --file <path-to-csv-file> --target-user <target-user-name>
--target-password <target-password> --target-host <target-database-host-name>
通过运行以下提升装入命令示例,将 CSV 文件中的数据装入到目标数据库中:
% lift load --filename <csv-file-name> --target-schema <target-schema-name>
--target-table <target-table-name> --file-origin <extract-ias/extract-db2/extract-db2w>
--target-user <target-user-name> --target-password <target-password>
--target-host <target-database-host-name>
-- file-origin 命令选项的 extract-ias,extract-db2和 extract-db2w 设置用于指定使用 lift extract 命令从特定数据库中抽取 CSV 文件。
完成这些步骤后,您可以对数据运行查询。
在表结构到位后,您可以开始移动数据。 Lift CLI 会将表中的数据抽取到 CSV 文件中,将该文件移动到网络上,并将其登台到目标数据库的登录区域中,然后将数据装入到数据库中。
要下载并安装 Lift,请参阅 IBM Db2 Download Center: Download Lift。