Oracle迁移到mysql-表结构的坑

news2024/11/18 10:34:51

1.mysql中id自增字段必须是整数类型

  id               BIGINT AUTO_INCREMENT not null,
2.VARCHAR2改为VARCHAR

3.NUMBER(16)改为decimal(16,0)

4.date改为datetime

5.mysql范围分区必须int格式,不能list类型

ERROR 1697 (HY000): VALUES value for partition 'P_SHENYANG' must have type INT

6.获取注释信息:参考

迁移oracle表注释列注释到mysql_在navicat中,oracle查询所有表的字段注释,并且将这些字段注释放到mysql库中对应表-CSDN博客 

ALTER TABLE SW_SWITCH COMMENT '交换节点(局向)';

ALTER TABLE SW_SWITCH MODIFY COLUMN code VARCHAR(64) COMMENT '交换节点编号';

 

7.auto_increment分区键字段值字段都得为主键

限制条件如下测试:

mysql> create table sw_decimal_res_bas
    -> (
    ->   id               BIGINT AUTO_INCREMENT not null,
    ->   zone_decimal       decimal(16,0),
    ->   ziguan            VARCHAR(16),
    ->   start_decimal      VARCHAR(16),
    ->   end_decimal        VARCHAR(16),
    ->   type              VARCHAR(16),
    ->   switch_tab        VARCHAR(50),
    ->   switch_id         decimal(16,0),
    ->   ziguan_discrip    VARCHAR(64),
    ->   open_time         VARCHAR(16),
    ->   lose_time         VARCHAR(16),
    ->   opreator          VARCHAR(16),
    ->   build_time        datetime,
    ->   area_id           VARCHAR(16),
    ->   notes             VARCHAR(128),
    ->   blank1            VARCHAR(255),
    ->   blank2            VARCHAR(255),
    ->   ne_id             decimal(16,0),
    ->   jx                VARCHAR(64),
    ->   countrytype       decimal(12,0),
    ->   server_areaid     INT,
    ->   kind              VARCHAR(16),
    ->   occtype           VARCHAR(16),
    ->   locationaddr      VARCHAR(128),
    ->   quality           VARCHAR(16),
    ->   switchcommandflag decimal(6,0) default 1,
    ->   physicalsegmentid decimal(16,0)
    -> )
    -> partition by range (SERVER_AREAID)
    -> (
    ->   partition P_SHENYANG values less than ('2102')
    -> ,
    ->   partition P_DALIAN values less than ('2103')
    -> ,
    ->   partition P_ANSHAN values less than ('2104')
    -> ,
    ->   partition P_FUSHUN values less than ('2105')
    -> ,
    ->   partition P_BENXI values less than ('2106')
    -> ,
    ->   partition P_DANDONG values less than ('2107')
    -> ,
    ->   partition P_JINZHOU values less than ('2108')
    -> ,
    ->   partition P_YINGKOU values less than ('2109')
    -> ,
    ->   partition P_FUXIN values less than ('2110')
    ->  ,
    ->   partition P_LIAOYANG values less than ('2111')
    ->  ,
    ->   partition P_PANJIN values less than ('2112')
    ->  ,
    ->   partition P_TIELING values less than ('2113')
    ->  ,
    ->   partition P_CHAOYANG values less than ('2114')
    ->  ,
    ->   partition P_HULUDAO values less than ('2115')
    ->  ,
    ->   partition P_OTHERS values less than (MAXVALUE)
    -> );
ERROR 1697 (HY000): VALUES value for partition 'P_SHENYANG' must have type INT
mysql> 
mysql> create table sw_decimal_res_bas
    -> (
    ->   id               BIGINT AUTO_INCREMENT not null,
    ->   zone_decimal       decimal(16,0),
    ->   ziguan            VARCHAR(16),
    ->   start_decimal      VARCHAR(16),
    ->   end_decimal        VARCHAR(16),
    ->   type              VARCHAR(16),
    ->   switch_tab        VARCHAR(50),
    ->   switch_id         decimal(16,0),
    ->   ziguan_discrip    VARCHAR(64),
    ->   open_time         VARCHAR(16),
    ->   lose_time         VARCHAR(16),
    ->   opreator          VARCHAR(16),
    ->   build_time        datetime,
    ->   area_id           VARCHAR(16),
    ->   notes             VARCHAR(128),
    ->   blank1            VARCHAR(255),
    ->   blank2            VARCHAR(255),
    ->   ne_id             decimal(16,0),
    ->   jx                VARCHAR(64),
    ->   countrytype       decimal(12,0),
    ->   server_areaid     INT,
    ->   kind              VARCHAR(16),
    ->   occtype           VARCHAR(16),
    ->   locationaddr      VARCHAR(128),
    ->   quality           VARCHAR(16),
    ->   switchcommandflag decimal(6,0) default 1,
    ->   physicalsegmentid decimal(16,0)
    -> )
    -> partition by range (SERVER_AREAID)
    -> (
    ->   partition P_SHENYANG values less than (2102)
    -> ,
    ->   partition P_DALIAN values less than (2103)
    -> ,
    ->   partition P_ANSHAN values less than (2104)
    -> ,
    ->   partition P_FUSHUN values less than (2105)
    -> ,
    ->   partition P_BENXI values less than (2106)
    -> ,
    ->   partition P_DANDONG values less than (2107)
    -> ,
    ->   partition P_JINZHOU values less than (2108)
    -> ,
    ->   partition P_YINGKOU values less than (2109)
    -> ,
    ->   partition P_FUXIN values less than (2110)
    ->  ,
    ->   partition P_LIAOYANG values less than (2111)
    ->  ,
    ->   partition P_PANJIN values less than (2112)
    ->  ,
    ->   partition P_TIELING values less than (2113)
    ->  ,
    ->   partition P_CHAOYANG values less than (2114)
    ->  ,
    ->   partition P_HULUDAO values less than (2115)
    ->  ,
    ->   partition P_OTHERS values less than (MAXVALUE)
    -> );
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
mysql> 
mysql> 
mysql> create table sw_decimal_res_bas
    -> (
    ->   id               BIGINT AUTO_INCREMENT not null,
    ->   zone_decimal       decimal(16,0),
    ->   ziguan            VARCHAR(16),
    ->   start_decimal      VARCHAR(16),
    ->   end_decimal        VARCHAR(16),
    ->   type              VARCHAR(16),
    ->   switch_tab        VARCHAR(50),
    ->   switch_id         decimal(16,0),
    ->   ziguan_discrip    VARCHAR(64),
    ->   open_time         VARCHAR(16),
    ->   lose_time         VARCHAR(16),
    ->   opreator          VARCHAR(16),
    ->   build_time        datetime,
    ->   area_id           VARCHAR(16),
    ->   notes             VARCHAR(128),
    ->   blank1            VARCHAR(255),
    ->   blank2            VARCHAR(255),
    ->   ne_id             decimal(16,0),
    ->   jx                VARCHAR(64),
    ->   countrytype       decimal(12,0),
    ->   server_areaid     INT,
    ->   kind              VARCHAR(16),
    ->   occtype           VARCHAR(16),
    ->   locationaddr      VARCHAR(128),
    ->   quality           VARCHAR(16),
    ->   switchcommandflag decimal(6,0) default 1,
    ->   physicalsegmentid decimal(16,0)
    -> )
    -> partition by range (id,SERVER_AREAID)
    -> (
    ->   partition P_SHENYANG values less than (2102)
    -> ,
    ->   partition P_DALIAN values less than (2103)
    -> ,
    ->   partition P_ANSHAN values less than (2104)
    -> ,
    ->   partition P_FUSHUN values less than (2105)
    -> ,
    ->   partition P_BENXI values less than (2106)
    -> ,
    ->   partition P_DANDONG values less than (2107)
    -> ,
    ->   partition P_JINZHOU values less than (2108)
    -> ,
    ->   partition P_YINGKOU values less than (2109)
    -> ,
    ->   partition P_FUXIN values less than (2110)
    ->  ,
    ->   partition P_LIAOYANG values less than (2111)
    ->  ,
    ->   partition P_PANJIN values less than (2112)
    ->  ,
    ->   partition P_TIELING values less than (2113)
    ->  ,
    ->   partition P_CHAOYANG values less than (2114)
    ->  ,
    ->   partition P_HULUDAO values less than (2115)
    ->  ,
    ->   partition P_OTHERS values less than (MAXVALUE)
    -> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',SERVER_AREAID)
(
  partition P_SHENYANG values less than (2102)
,
  partition P' at line 31
mysql> create table sw_decimal_res_bas
    -> (
    ->   id               BIGINT AUTO_INCREMENT not null,
    ->   zone_decimal       decimal(16,0),
    ->   ziguan            VARCHAR(16),
    ->   start_decimal      VARCHAR(16),
    ->   end_decimal        VARCHAR(16),
    ->   type              VARCHAR(16),
    ->   switch_tab        VARCHAR(50),
    ->   switch_id         decimal(16,0),
    ->   ziguan_discrip    VARCHAR(64),
    ->   open_time         VARCHAR(16),
    ->   lose_time         VARCHAR(16),
    ->   opreator          VARCHAR(16),
    ->   build_time        datetime,
    ->   area_id           VARCHAR(16),
    ->   notes             VARCHAR(128),
    ->   blank1            VARCHAR(255),
    ->   blank2            VARCHAR(255),
    ->   ne_id             decimal(16,0),
    ->   jx                VARCHAR(64),
    ->   countrytype       decimal(12,0),
    ->   server_areaid     INT,
    ->   kind              VARCHAR(16),
    ->   occtype           VARCHAR(16),
    ->   locationaddr      VARCHAR(128),
    ->   quality           VARCHAR(16),
    ->   switchcommandflag decimal(6,0) default 1,
    ->   physicalsegmentid decimal(16,0),PRIMARY KEY (id)
    -> )
    -> partition by range (SERVER_AREAID)
    -> (
    ->   partition P_SHENYANG values less than (2102)
    -> ,
    ->   partition P_DALIAN values less than (2103)
    -> ,
    ->   partition P_ANSHAN values less than (2104)
    -> ,
    ->   partition P_FUSHUN values less than (2105)
    -> ,
    ->   partition P_BENXI values less than (2106)
    -> ,
    ->   partition P_DANDONG values less than (2107)
    -> ,
    ->   partition P_JINZHOU values less than (2108)
    -> ,
    ->   partition P_YINGKOU values less than (2109)
    -> ,
    ->   partition P_FUXIN values less than (2110)
    ->  ,
    ->   partition P_LIAOYANG values less than (2111)
    ->  ,
    ->   partition P_PANJIN values less than (2112)
    ->  ,
    ->   partition P_TIELING values less than (2113)
    ->  ,
    ->   partition P_CHAOYANG values less than (2114)
    ->  ,
    ->   partition P_HULUDAO values less than (2115)
    ->  ,
    ->   partition P_OTHERS values less than (MAXVALUE)
    -> );
ERROR 1503 (HY000): A PRIMARY KEY must include all columns in the table's partitioning function (prefixed columns are not considered).
mysql> create table sw_decimal_res_bas
    -> (
    ->   id               BIGINT AUTO_INCREMENT not null,
    ->   zone_decimal       decimal(16,0),
    ->   ziguan            VARCHAR(16),
    ->   start_decimal      VARCHAR(16),
    ->   end_decimal        VARCHAR(16),
    ->   type              VARCHAR(16),
    ->   switch_tab        VARCHAR(50),
    ->   switch_id         decimal(16,0),
    ->   ziguan_discrip    VARCHAR(64),
    ->   open_time         VARCHAR(16),
    ->   lose_time         VARCHAR(16),
    ->   opreator          VARCHAR(16),
    ->   build_time        datetime,
    ->   area_id           VARCHAR(16),
    ->   notes             VARCHAR(128),
    ->   blank1            VARCHAR(255),
    ->   blank2            VARCHAR(255),
    ->   ne_id             decimal(16,0),
    ->   jx                VARCHAR(64),
    ->   countrytype       decimal(12,0),
    ->   server_areaid     INT,
    ->   kind              VARCHAR(16),
    ->   occtype           VARCHAR(16),
    ->   locationaddr      VARCHAR(128),
    ->   quality           VARCHAR(16),
    ->   switchcommandflag decimal(6,0) default 1,
    ->   physicalsegmentid decimal(16,0),PRIMARY KEY (id,SERVER_AREAID)
    -> )
    -> partition by range (SERVER_AREAID)
    -> (
    ->   partition P_SHENYANG values less than (2102)
    -> ,
    ->   partition P_DALIAN values less than (2103)
    -> ,
    ->   partition P_ANSHAN values less than (2104)
    -> ,
    ->   partition P_FUSHUN values less than (2105)
    -> ,
    ->   partition P_BENXI values less than (2106)
    -> ,
    ->   partition P_DANDONG values less than (2107)
    -> ,
    ->   partition P_JINZHOU values less than (2108)
    -> ,
    ->   partition P_YINGKOU values less than (2109)
    -> ,
    ->   partition P_FUXIN values less than (2110)
    ->  ,
    ->   partition P_LIAOYANG values less than (2111)
    ->  ,
    ->   partition P_PANJIN values less than (2112)
    ->  ,
    ->   partition P_TIELING values less than (2113)
    ->  ,
    ->   partition P_CHAOYANG values less than (2114)
    ->  ,
    ->   partition P_HULUDAO values less than (2115)
    ->  ,
    ->   partition P_OTHERS values less than (MAXVALUE)
    -> );
Query OK, 0 rows affected (0.03 sec)

mysql> 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1466962.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

应急响应实战笔记03权限维持篇(3)

0x00 前言 攻击者在获取服务器权限后,会通过一些技巧来隐藏自己的踪迹和后门文件,本文介绍Linux下的几种隐藏技术。 0x01 隐藏文件 Linux 下创建一个隐藏文件:touch .test.txt touch 命令可以创建一个文件,文件名前面加一个 点…

使用pygame 编写俄罗斯方块游戏

项目地址:https://gitee.com/wyu_001/mypygame/tree/master/game 可执行程序 这个游戏主要使用pygame库编写俄罗斯方块游戏,demo主要演示了pygame开发游戏的主要设计方法和实现代码 下面是游戏界面截图 游戏主界面: 直接上代码&#xff1a…

RabbitMQ 部署方式选择

部署模式 RabbitMQ支持多种部署模式,可以根据应用的需求和规模选择适合的模式。以下是一些常见的RabbitMQ部署模式: 单节点模式: 最简单的部署方式,所有的RabbitMQ组件(消息存储、交换机、队列等)都运行在…

Redis可视化工具——RedisInsight

文章目录 1. 下载2. 安装3. RedisInsight 添加 Redis 数据库4. RedisInsight 使用 RedisInsight 是 Redis 官方出品的可视化管理工具,支持 String、Hash、Set、List、JSON 等多种数据类型的管理,同时集成了 RedisCli,可进行终端交互。 1. 下载…

数组与指针相关

二级指针与指针数组 #include <stdio.h> #include <stdlib.h> int main() { // 定义一个指针数组&#xff0c;每个元素都是一个指向int的指针 int *ptr_array[3]; // 为指针数组的每个元素分配内存 ptr_array[0] malloc(2*sizeof(int)); ptr_array[1] m…

转运机器人,AGV底盘小车:打造高效、精准的汽车电子生产线

为了满足日益增长的市场需求&#xff0c;保持行业领先地位&#xff0c;某汽车行业电子产品企业引入富唯智能AMR智能搬运机器人及其智能物流解决方案&#xff0c;采用自动化运输措施优化生产节拍和搬运效率&#xff0c;企业生产效率得到显著提升。 项目背景&#xff1a; 1、工厂…

PyTorch概述(二)---MNIST

NIST Special Database3 具体指的是一个更大的特殊数据库3&#xff1b;该数据库的内容为手写数字黑白图片&#xff1b;该数据库由美国人口普查局的雇员手写 NIST Special Database1 特殊数据库1&#xff1b;该数据库的内容为手写数字黑白图片&#xff1b;该数据库的图片由高…

GitCode配置ssh

下载SSH windows设置里选“应用” 选“可选功能” 添加功能 安装这个 坐等安装&#xff0c;安装好后可以关闭设置。 运行 打开cmd 执行如下指令&#xff0c;启动SSH服务。 net start sshd设置开机自启动 把OpenSSH服务添加到Windows自启动服务中&#xff0c;可避免每…

mysql的日志文件在哪?

阅读本文之前请参阅----MySQL 数据库安装教程详解&#xff08;linux系统和windows系统&#xff09; MySQL的日志文件通常包括错误日志、查询日志、慢查询日志和二进制日志等。这些日志文件的位置取决于MySQL的安装和配置。以下是一些常见的日志文件位置和如何找到它们&#xff…

【kubernetes】二进制部署k8s集群之,多master节点负载均衡以及高可用(下)

↑↑↑↑接上一篇继续部署↑↑↑↑ 之前已经完成了单master节点的部署&#xff0c;现在需要完成多master节点以及实现k8s集群的高可用 一、完成master02节点的初始化操作 二、在master01节点基础上&#xff0c;完成master02节点部署 步骤一&#xff1a;准备好master节点所需…

调用 Python 函数遗漏括号 ( )

调用 Python 函数遗漏括号 1. Example - error2. Example - correctionReferences 1. Example - error name "Forever Strong" print(name.upper()) print(name.lower)FOREVER STRONG <built-in method lower of str object at 0x0000000002310670>---------…

【ArcGIS】利用高程进行坡度分析:区域面/河道坡度

在ArcGIS中利用高程进行坡度分析 坡度ArcGIS实操案例1&#xff1a;流域面上坡度计算案例2&#xff1a;河道坡度计算2.1 案例数据2.2 操作步骤 参考 坡度 坡度是地表单元陡缓的程度&#xff0c;通常把坡面的垂直高度和水平距离的比值称为坡度。 坡度的表示方法有百分比法、度数…

单片机04__基本定时器__毫秒微秒延时

基本定时器__毫秒微秒延时 基本定时器介绍&#xff08;STM32F40x&#xff09; STM32F40X芯片一共包含14个定时器&#xff0c;这14个定时器分为3大类&#xff1a; 通用定时器 10个 TIM9-TIM1和TIM2-TIM5 具有基本定时器功能&#xff0c; 还具有输入捕获&#xff0c;输出比较功…

yarn install:unable to get local issuer certificate

一、问题描述 今天在Jenkins上发布项目时&#xff0c;遇到一个报错&#xff1a; error Error: unable to get local issuer certificateat TLSSocket.onConnectSecure (node:_tls_wrap:1535:34)at TLSSocket.emit (node:events:513:28)at TLSSocket._finishInit (node:_tls_w…

PLC_博图系列☞基本指令“取反RLO”

PLC_博图系列☞基本指令“取反RLO” 文章目录 PLC_博图系列☞基本指令“取反RLO”背景介绍取反RLO说明示例 关键字&#xff1a; PLC、 西门子、 博图、 Siemens 、 取反RLO 背景介绍 这是一篇关于PLC编程的文章&#xff0c;特别是关于西门子的博图软件。我并不是专业的PLC…

谷歌Gemma开源了

1、Gemma的表现 自从大模型横空出世之后&#xff0c;大部分大模型都是闭源的&#xff0c;只有少部分模型选择开源。谷歌推出了全新的开源模型系列Gemma&#xff0c;相比谷歌之前的 Gemini模型&#xff0c;Gemma 更加轻量&#xff0c;可以免费使用&#xff0c;模型权重也一并开…

详解编译和链接!

目录 1. 翻译环境和运行环境 2. 翻译环境 2.1 预处理 2.2 编译 2.3 汇编 2.4 链接 3. 运行环境 4.完结散花 悟已往之不谏&#xff0c;知来者犹可追 创作不易&#xff0c;宝子们&#xff01;如果这篇文章对你们…

Vue+SpringBoot打造开放实验室管理系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、研究内容2.1 实验室类型模块2.2 实验室模块2.3 实验管理模块2.4 实验设备模块2.5 实验订单模块 三、系统设计3.1 用例设计3.2 数据库设计 四、系统展示五、样例代码5.1 查询实验室设备5.2 实验放号5.3 实验预定 六、免责说明 一、摘…

多窗口编程

六、多窗口编程 QMessageBox消息对话框&#xff08;掌握&#xff09; QMessageBox继承自QDialog&#xff0c;显示一个模态对话框。用于用户前台信息通知或询问用户问题&#xff0c;并接收问题答案。 QDialog的Qt源码中&#xff0c;派生类往往都是一些在特定场合下使用的预设好的…

【Vuforia+Unity】AR03-圆柱体物体识别(Cylinder Targets)

1.创建数据库模型 这个是让我们把生活中类似圆柱体和圆锥体的物体进行AR识别所选择的模型 Bottom Diameter:底部直径 Top Diameter:顶部直径 Side Length:圆柱侧面长度 请注意&#xff0c;您不必上传所有三个部分的图片&#xff0c;但您需要先为侧面曲面关联一个图像&#…