Oracle迁移到mysql-表结构的坑

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> 

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【leetcode热题】填充每个节点的下一个右侧节点指针

给定一个 完美二叉树 ,其所有叶子节点都在同一层,每个父节点都有两个子节点。二叉树定义如下: struct Node {int val;Node *left;Node *right;Node *next; } 填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到…

Linux线程同步(2)死锁与互斥锁

死锁(Deadlock)是指两个或两个以上的进程(或线程)在执行过程中,由于竞争资源或者由于彼此通信而造成的一种阻塞的现象,若无外力作用,它们都将无法推进下去。此时称系统处于死锁状态或系统产生了…

【Linux进阶之路】Socket —— “UDP“ “TCP“

文章目录 一、再识网络1. 端口号2. 网络字节序列3.TCP 与 UDP 二、套接字1.sockaddr结构2.UDP1.server端1.1 构造函数1.2 Init1.3 Run 2.客户端1.Linux2.Windows 3.TCP1. 基本接口2. 客户端3. 服务端1.版本12.版本23.版本34.版本4 三、守护进程尾序 一、再识网络 1. 端口号 在…

RT-Thread 时钟 timer delay 相关

前言 此处,介绍对delay 时钟 timer 这几部分之间的关联和相关的知识点;本来只是想介绍一下 delay的,但是发现说到delay 不先 提到 先验知识 晶振\时钟\时钟节拍\定时器 好像没法解释透彻,所以就变成了 晶振\时钟\时钟节拍\定时器\delay 的很简单的概括一遍;并附带上能直接运行的…

【数据结构】链式队列

链式队列实现&#xff1a; 1.创建一个空队列 2.尾插法入队 3.头删法出队 4.遍历队列 一、main函数 #include <stdio.h> #include "./3.linkqueue.h" int main(int…

备考2025年AMC8数学竞赛:2000-2024年AMC8真题练一练

我们今天来随机看五道AMC8的真题和解析&#xff0c;对于想了解或者加AMC8美国数学竞赛的孩子来说&#xff0c;吃透AMC8历年真题是备考最科学、最有效的方法之一。 为帮助孩子们更高效地备考&#xff0c;我整理了2000-2004年的全部AMC8真题&#xff0c;并且独家制作了多种在线练…

Rust通用代码生成器莲花发布红莲尝鲜版二十一发布介绍视频,前端代码生成物大翻新

Rust通用代码生成器莲花发布红莲尝鲜版二十一发布介绍视频&#xff0c;前端代码生成物大翻新 Rust通用代码生成器发布了红莲尝鲜版二十一的最新介绍视频&#xff0c;前端代码生成物大翻新。视频请见&#xff1a; Rust通用代码生成器&#xff1a;莲花&#xff0c;红莲尝鲜版二…

构建生物医学知识图谱from zero to hero (3):生物医学命名实体识别和链接

生物医学实体链接 🤓现在是激动人心的部分。对于NLP和命名实体识别和链接的新手,让我们从一些基础知识开始。命名实体识别技术用于检测文本中的相关实体或概念。例如,在生物医学领域,我们希望在文本中识别各种基因、药物、疾病和其他概念。 生物医学概念提取 在这个例子中…

爬虫知识--03

数据存mysql import requests from bs4 import BeautifulSoup import pymysql# 链接数据库pymysql conn pymysql.connect(userroot,password"JIAJIA",host127.0.0.1,databasecnblogs,port3306, ) cursor conn.cursor() cursor conn.cursor()# 爬数据 res request…

Linux之ACL访问控制列表

一、ACL权限的介绍 1.1 什么是ACL 访问控制列表&#xff08;ACL&#xff09;是一种网络安全技术&#xff0c;它通过在网络设备&#xff08;如路由器、交换机和防火墙&#xff09;上定义一系列规则&#xff0c;对进出接口的数据包进行控制。这些规则可以包含“允许”&…

计算机网络面经_体系结构一文说清

编辑&#xff1a;平平无奇的羊 目录 基础 1. 计算机网络结构体系 三种模型之间的区别&#xff1a; 如何背诵&#xff1a; 进阶 OSI七层模型&#xff1a; TCP/IP四层模型&#xff1a; TCP/IP五层模型 总结 字节实习生为大家带来的是计算机网络面经系列博文&#xff0c;由浅…

线性代数:向量、张量、矩阵和标量

线性代数&#xff1a;向量、张量、矩阵和标量 背景 在线性代数中&#xff0c;向量、张量、矩阵和标量都属于基础概念&#xff0c;特别是最近AI的爆火&#xff0c;向量和张量的概念也越来越普及&#xff0c;本文将介绍下这些基本概念。 1. 标量&#xff08;Scalar&#xff0…

【Java网络编程06】HTTPS原理

1. HTTPS基本概念 HTTPS&#xff1a;HTTPS也是一个应用层协议&#xff0c;它在HTTP协议的基础上引入了一个加密层——SSL协议&#xff0c;区别就在于HTTP协议是基于明文传输的&#xff08;不安全&#xff09;&#xff0c;使用HTTPS加密就能在一定程度上防止数据在传输过程中被…

c# 类的介绍及延伸

类介绍 类的定义是以关键字 class 开始&#xff0c;后跟类的名称。 类属于引用类型&#xff0c;只能通过new方式创建。 如果类定义中没有指定基类&#xff0c;那其基类为system.object // <访问修饰符> class class类名 <access specifier> class class_name { //…

华为配置WDS手拉手业务示例

配置WDS手拉手业务示例 组网图形 图1 配置WDS手拉手业务示例组网图 业务需求组网需求数据规划配置思路配置注意事项操作步骤配置文件 业务需求 企业用户通过WLAN接入网络&#xff0c;以满足移动办公的最基本需求。但企业考虑到AP通过有线部署的成本较高&#xff0c;所以通过建立…

golang 监听ip数据包(golang纯享版)

golang 监听ip数据包(golang纯享版) 【注】本机编译运行平台为linux&#xff0c;如需测试代码请移至linux平台进行代码测试 本文以ip4 作为案例进行包抓取示范&#xff0c;ip6抓取与ip4方式异曲同工&#xff0c;可自行举一反三得出 第一步&#xff0c;通过wireshark抓包拿到…

第四十二回 假李逵翦径劫单身 黑旋风沂岭杀四虎-python读写csv和json数据

李逵答应了宋江三件事&#xff1a;不可吃酒&#xff0c;独自前行&#xff0c;不带板斧。李逵痛快答应了&#xff0c;挎一口腰刀&#xff0c;提着朴刀&#xff0c;带了一锭大银子&#xff0c;三五个小银子就下山去了。 宋江放心不下&#xff0c;于是请同乡朱贵也回家一趟&#…

spring boot3登录开发-3(账密登录逻辑实现)

⛰️个人主页: 蒾酒 &#x1f525;系列专栏&#xff1a;《spring boot实战》 &#x1f30a;山高路远&#xff0c;行路漫漫&#xff0c;终有归途。 目录 前置条件 内容简介 用户登录逻辑实现 创建交互对象 1.创建用户登录DTO 2.创建用户登录VO 创建自定义登录业务异…

Vue模板引用之ref特殊属性

1. 使用实例 <template><input ref"input" name"我是input的name" /><br /><ul><li v-for"arr in array" :key"arr" id"111" ref"itemRefs">{{arr}}</li></ul> </…

windows11本地深度学习环境搭建Anacond,keras,tensorflow,pytorch, jupyter notebook

前言 工欲善其事&#xff0c;必先利其器。 第一步 安装Anaconda 下载地址&#xff1a; https://www.anaconda.com/download 路径默认 这里都勾选上 然后会卡在这里&#xff0c;卡很久&#xff0c;不用管&#xff0c;等着就行 第二步 配置环境 conda env list 列出所有…