目录
- 一、下载Kingbase工具
- 二、客户端安装
- 三、数据库开发管理工具 KStudio
- 3.1 主界面
- 3.2 导出数据库建表语句DDL
- 3.3 导出数据
- 四、数据迁移工具 KDTS
- 4.1 启动KDTS
- 4.2 新建源数据库
- 4.3 新建目标数据库
- 4.4 迁移任务管理
一、下载Kingbase工具
kingbase数据库服务(内置了迁移工具)下载地址:https://www.kingbase.com.cn/xzzx/index.htm
Kingbase windows安装手册:https://help.kingbase.com.cn/v8/install-updata/install-windows/install-windows-3.html
二、客户端安装
不需要本地数据库服务,则仅需要 客户端安装 即可,
客户端安装成功后,包括如下工具:
- 数据库开发管理工具 KStudio
- 数据迁移工具 KDTS
三、数据库开发管理工具 KStudio
KStudio使用手册:https://help.kingbase.com.cn/v8/admin/general/kstudio/index.html
3.1 主界面
可通过该工具连接和管理Kingbase数据库,界面如下:
注: 第一眼顶部菜单像Navicat,继续使用会发现里面像DBeaver。
3.2 导出数据库建表语句DDL
进入数据库>选择模式>选择对应的表(支持多选)>右键 生成SQL>DDL:
生成建表语句如下:
3.3 导出数据
进入数据库>选择模式>选择对应的表(支持多选)>右键 导出数据:
继续选择导出至SQL ,之后一直下一步,可根据需要进行设置的调整:
四、数据迁移工具 KDTS
KDTS的具体使用可参见:https://help.kingbase.com.cn/v8/development/develop-transfer/kdts-plus/kdts-plus-3.html
4.1 启动KDTS
点击数据迁移工具图标会弹出启动命令窗口:
具体启动日志如下:
Active code page: 65001
kdts-app-console v1.0.1.10
jar name: kdts-app-console-1.0.1.10.jar
base path: D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB
bin path: D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB\bin
config path: D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB/conf
log dir: D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB/logs
log file: D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB/logs/kdts-app-console_2024-07-05_08-55-17.log
migration name: 2024-07-05_08-55-17
JAVA_OPTS: -server -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dcache_enable=true -Dconfig.path="D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB/conf" -Dlog.path="D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB/logs" -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl -Djava.security.properties=./conf/enableLegacyTLS.security -Duser.country=CN -Duser.language=zh -Djsse.enableCBCProtection=false --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED -XX:+UseG1GC -XX:G1ReservePercent=20 -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:G1HeapRegionSize=8M -XX:+SegmentedCodeCache -XX:+PrintCommandLineFlags -XX:+ExplicitGCInvokesConcurrent -Xms4G -Xmx4G -Dthread.jvmSize=4G
FreeMemory=10644M JavaMemory=4G ThreadConfig=
------------------------------------------------------------------------
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
------------------------------------------------------------------------
-XX:+ExplicitGCInvokesConcurrent -XX:G1ConcRefinementThreads=13 -XX:G1HeapRegionSize=8388608 -XX:G1ReservePercent=20 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=4294967296 -XX:MaxHeapSize=4294967296 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:-UseLargePagesIndividualAllocation
08:55:18.852 [main] INFO com.kingbase.kdts.DataMigrationApplication - PlatformClassLoader: jdk.internal.loader.ClassLoaders$PlatformClassLoader
08:55:18.852 [main] INFO com.kingbase.kdts.DataMigrationApplication - SystemClassLoader: jdk.internal.loader.ClassLoaders$AppClassLoader
08:55:18.852 [main] INFO com.kingbase.kdts.DataMigrationApplication - ContextClassLoader: org.springframework.boot.loader.LaunchedURLClassLoader
2024-07-05 08:55:19.421 INFO 3788 --- [ main] c.k.kdts.DataMigrationApplication : Starting DataMigrationApplication v1.0.1.10 using Java 11.0.2 on LAPTOP-N88GENG5 with PID 3788 (D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB\lib\kdts-app-console-1.0.1.10.jar started by luohq in D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB)
2024-07-05 08:55:19.437 INFO 3788 --- [ main] c.k.kdts.DataMigrationApplication : The following 1 profile is active: "default"
2024-07-05 08:55:20.645 INFO 3788 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2024-07-05 08:55:20.645 INFO 3788 --- [ main] o.a.coyote.http11.Http11NioProtocol : Initializing ProtocolHandler ["http-nio-8080"]
2024-07-05 08:55:20.645 INFO 3788 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-07-05 08:55:20.645 INFO 3788 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60]
2024-07-05 08:55:20.772 INFO 3788 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-07-05 08:55:20.772 INFO 3788 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1303 ms
2024-07-05 08:55:20.929 INFO 3788 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
2024-07-05 08:55:21.182 INFO 3788 --- [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:file:D:\programs\dev\kingbaseES\KESRealPro\V008R006C007B0012\ClientTools\guitools\KDts\KDTS-WEB/conf/h2/kdts'
2024-07-05 08:55:21.910 INFO 3788 --- [ main] o.a.coyote.http11.Http11NioProtocol : Starting ProtocolHandler ["http-nio-8080"]
2024-07-05 08:55:21.941 INFO 3788 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2024-07-05 08:55:21.941 INFO 3788 --- [ main] c.k.k.c.c.ThreadPoolManagerInitializer : init global thread pool manager, jvm memory is 4G
2024-07-05 08:55:22.020 INFO 3788 --- [ main] com.kingbase.thread.ThreadPoolImpl : Initializing thread pool...[metaWriteZ2A, metaReadZ2A, read, readZ2A, metaWrite, writeZ2A, write, writeLargeObject, metaRead], configuration file: kb-thread-config.xml
2024-07-05 08:55:22.052 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load Unix Socket driver begin
2024-07-05 08:55:22.083 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : Load JDBC driver[B] -- junixsocket 2.4.0:
2024-07-05 08:55:22.114 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : file:/D:/programs/dev/kingbaseES/KESRealPro/V008R006C007B0012/ClientTools/guitools/KDts/KDTS-WEB/drivers/junixsocket/junixsocket-common-2.4.0.jar
2024-07-05 08:55:22.114 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : file:/D:/programs/dev/kingbaseES/KESRealPro/V008R006C007B0012/ClientTools/guitools/KDts/KDTS-WEB/drivers/junixsocket/junixsocket-native-common-2.4.0.jar
2024-07-05 08:55:22.114 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load Unix Socket driver end
2024-07-05 08:55:22.114 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load Mysql 5.1 driver begin
2024-07-05 08:55:22.114 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : Load JDBC driver[B] -- mysql 5.5:
2024-07-05 08:55:22.114 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : file:/D:/programs/dev/kingbaseES/KESRealPro/V008R006C007B0012/ClientTools/guitools/KDts/KDTS-WEB/drivers/mysql/5.5/mysql-connector-java-5.1.47.jar
2024-07-05 08:55:22.131 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load Mysql 5.1 driver end
2024-07-05 08:55:22.147 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load Mysql 8.0 driver begin
2024-07-05 08:55:22.147 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : Load JDBC driver[B] -- mysql 8.0:
2024-07-05 08:55:22.147 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : file:/D:/programs/dev/kingbaseES/KESRealPro/V008R006C007B0012/ClientTools/guitools/KDts/KDTS-WEB/drivers/mysql/mysql-connector-java-8.0.23.jar
2024-07-05 08:55:22.162 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load Mysql 8.0 driver end
2024-07-05 08:55:22.162 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load Pg12 driver begin
2024-07-05 08:55:22.162 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : Load JDBC driver[B] -- postgresql 12:
2024-07-05 08:55:22.162 INFO 3788 --- [ main] com.kingbase.kdts.datasource.b : file:/D:/programs/dev/kingbaseES/KESRealPro/V008R006C007B0012/ClientTools/guitools/KDts/KDTS-WEB/drivers/postgresql/postgresql-42.2.19.jar
2024-07-05 08:55:22.178 INFO 3788 --- [ main] c.k.k.console.config.DriverInitListener : Load pg12 driver end
2024-07-05 08:55:22.194 INFO 3788 --- [ main] c.k.kdts.DataMigrationApplication : Started DataMigrationApplication in 3.329 seconds (JVM running for 3.888)
2024-07-05 08:55:22.194 INFO 3788 --- [ main] c.k.kdts.DataMigrationApplication : Version: 1.0.1.10 Build Time: 2022-10-21 (Core Version: 1.0.3.71)
2024-07-05 08:55:22.194 INFO 3788 --- [ main] c.k.kdts.DataMigrationApplication : Open 'http://localhost:8080' using a browser to access the application. The default username/password is kingbase/kingbase.
2024-07-05 08:55:44.256 INFO 3788 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-07-05 08:55:44.256 INFO 3788 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2024-07-05 08:55:44.273 INFO 3788 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
按照日志提示,可通过http://locahost:8080访问KDTS,
默认账号密码为:kingbase/kingbase:
Open 'http://localhost:8080' using a browser to access the application.
The default username/password is kingbase/kingbase.
4.2 新建源数据库
我本次的任务是将msyql数据库迁移到kingbase数据库中,即源数据库是mysql,目标数据库是kingbase。首先新建源源数据库:
4.3 新建目标数据库
其次,新建目标数据库,即目标kingbase数据库:
4.4 迁移任务管理
新建迁移任务,选择对应的源数据库和目标数据库,之后一直点击下一步,根据需要进行设置的调整即可:
之后点击 保存并迁移 即可完成迁移: