1:社区版4.3.0.1
2:问题:使用obdumper导出序列的START WITH不是库当前的序列值,导致迁移部署时序列冲突
序列ddl如下
CREATE SEQUENCE seq_person_global_id
START WITH 4000000000350000000 INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 NOCYCLE CACHE 1000 NOORDER;
导出脚本如下
/data/ob-loader-dumper-4.3.1.1-RELEASE/bin/obdumper -h **** -P 2881 -u root@cscs -p ‘****’ -D cs_task --all --ddl --skip-check-dir --file-path ${v_path}/all_dumplist/metadata
当前值应该是
obclient [cs_info_dw]> select seq_person_global_id.nextval;
±--------------------+
| nextval |
±--------------------+
| 4000000000358564251 |
±--------------------+
1 row in set (0.000 sec)
4:疑问为啥导出的创建序列ddl start with不是当前值,是OBDUMPER工具的问题吗?有啥解决办法
加入导出参数试一下呢–sequence '**sequence_name [, sequence_name…]
一样的有问题,如下,是mysql租户的
[root@oceanbase test]# /data/ob-loader-dumper-4.3.1.1-RELEASE/bin/obdumper -h **** -P 2881 -u root@cscs -p ‘*****’ -D cs_info_dw --sequence ‘seq_person_global_id’ --ddl --skip-check-dir --file-path /export/test
2025-01-07 11:00:37 [INFO] Parsed args:
[–ddl] true
[–file-path] /export/test
[–host] *******
[–port] 2881
[–user] root@cscs
[–password] ******
[–database] cs_info_dw
[–sys-user] root
[–sequence] [seq_person_global_id]
[–skip-check-dir] true
2025-01-07 11:00:38 [INFO] Log files will be written to /export/test/logs
2025-01-07 11:00:38 [INFO] Trying to establish JDBC connection to root@cscs
…
2025-01-07 11:00:38 [INFO] Server Mode: OBMYSQL-4.3.0.1
2025-01-07 11:00:38 [INFO] Querying SEQUENCE
definitions…
2025-01-07 11:00:38 [INFO] Generate 1 dump tasks finished. Total Elapsed: 3.016 ms
2025-01-07 11:00:38 [INFO] Start 32 schema dump threads for 1 dump tasks finished.
2025-01-07 11:00:38 [INFO] Query 0 dependencies elapsed 83.20 ms
2025-01-07 11:00:38 [INFO] Query 1 sequences elapsed 18.10 ms
2025-01-07 11:00:38 [INFO] Dump [SEQUENCE] seq_person_global_id to "/export/test/data/cs_info_dw/SEQUENCE/seq_person_global_id-schema.sql " finished
2025-01-07 11:00:39 [INFO] ---------- Finished Tasks: 1 Running Tasks: 0 Progress: 100.00% ----------
2025-01-07 11:00:39 [INFO]
All Dump Tasks Finished:
No.# | Type | Name | Count | Status
1 | SEQUENCE | seq_person_global_id | 1 -> 1 | SUCCESS
Total Count: 1 End Time: 2025-01-07 11:00:39
2025-01-07 11:00:39 [INFO] Dump schema finished. Total Elapsed: 1.055 s
2025-01-07 11:00:39 [INFO] System exit 0
[root@oceanbase test]# ls -rlt
总用量 0
drwxrwxrwx 1 root root 158 1月 7 10:59 logs
drwxr-xr-x 1 root root 20 1月 7 11:00 data
[root@oceanbase test]# cd data/cs_info_dw/SEQUENCE/
[root@oceanbase SEQUENCE]# ls -rlt
总用量 4
-rw-r–r-- 1 root root 152 1月 7 11:00 seq_person_global_id-schema.sql
[root@oceanbase SEQUENCE]# cat seq_person_global_id-schema.sql
CREATE SEQUENCE seq_person_global_id
START WITH 4000000000350000000 INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 NOCYCLE CACHE 1000 NOORDER;[root@oceanbase SEQUENCE]#
当前的序列应该是
obclient [cs_info_dw]> select seq_person_global_id.nextval;
±--------------------+
| nextval |
±--------------------+
| 4000000000358564301 |
±--------------------+
1 row in set (0.000 sec)
obclient [cs_info_dw]>