How to quickly migrate a large number of stored procedures from the original Oracle database to TiDB?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 原oracle数据库有大量的存储过程,请问怎么快速转到tidb?

| username: TiDBer_dcuQrLR7

[TiDB Usage Environment] Development Environment
[TiDB Version] Not very clear
[Encountered Problem: Problem Phenomenon and Impact]
There is a project that is about to start using TiDB, but a situation has been encountered. The original project used Oracle and wrote a large number of stored procedures. Currently, if TiDB is to be used, these stored procedures must be migrated. Does anyone have relevant experience?

| username: 裤衩儿飞上天 | Original post link

  1. TiDB currently does not support stored procedures.
  2. You can keep an eye on the new version.
  3. You can implement the stored procedure on the business side.
| username: tidb菜鸟一只 | Original post link

You can only rewrite it because TiDB does not support stored procedures. If you originally used MySQL, migrating to TiDB is very convenient. However, if you originally used Oracle, I personally think OceanBase would be a bit more convenient with fewer changes needed.

| username: 考试没答案 | Original post link

Not supported. Change the program.

| username: 考试没答案 | Original post link

Are you an OceanBase expert?

| username: xfworld | Original post link

You can only consider migrating the business, TiDB currently does not support it.

Suggestions are as follows:

  1. Organize business scenarios
  2. Verify the data model
  3. Check all strong references and strong constraints
  4. Check all application scenarios of stored procedures
  5. Use intermediate services to replace the corresponding logic of stored procedures, strong constraints, and strong references…

The entire process will be quite painful… However, after the overall migration is completed, there will be significant improvements in scalability and performance.

| username: tidb菜鸟一只 | Original post link

No, I’ve just used it. OceanBase’s Oracle mode can be compatible with most Oracle syntax, requiring minimal modifications to the application. We originally migrated our application database from Oracle to OceanBase for localization.

| username: Raymond | Original post link

How does it feel to use OceanBase?

| username: tony5413 | Original post link

TiDB does not support stored procedures; it is generally recommended to implement them in the application.

| username: 胡杨树旁 | Original post link

Stored procedures are not supported, you can only rewrite.

| username: TiDBer_dcuQrLR7 | Original post link

The difficulty is that there is currently no business, so I can only rewrite the super long stored procedures. Moreover, many Oracle functions are not supported, so I have to use alternatives. I’m not very familiar with Oracle, so I have to learn each one as I encounter it.

| username: TiDBer_dcuQrLR7 | Original post link

I found a comparison of functions and syntax differences between Oracle and TiDB, but it’s not very comprehensive. Are there more documents sharing rewriting experiences?

| username: 考试没答案 | Original post link

Then you should go to Oceanbase. It claims to be 90% compatible with Oracle 11g. It supports stored procedures, functions, and everything.

| username: 考试没答案 | Original post link

Is it that after learning so much about TiDB, you find it hard to give up? Haha.

| username: TiDBer_dcuQrLR7 | Original post link

:joy: Stored procedures are too counterintuitive. For the sake of technological progress and social development, it’s better to rewrite them all.

| username: 考试没答案 | Original post link

The value of stored procedures: DBAs can act as programmers and achieve certain functions. Development DBAs. However, it is a big pitfall for later migration and transformation.

| username: TiDBer_jYQINSnf | Original post link

You only mentioned the value to DBAs.
The value to actual business is: reducing data transmission back and forth, and placing some computations on the database side. Suitable for more complex SQL.

| username: liuis | Original post link

I remember that TiDB does not support stored procedures, right?

| username: TiDBer_dcuQrLR7 | Original post link

Currently working on migration, other functions are manageable, but is there any better solution for rollup besides union all?

| username: xfworld | Original post link

When updating a single data source, asynchronously refreshing other multiple data formats can address your concerns. However, the intermediate service will become a bit more complex.

But the performance will improve, and it is decoupled, which does not affect scalability.