Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 原oracle数据库有大量的存储过程,请问怎么快速转到tidb?
[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?
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.
Not supported. Change the program.
Are you an OceanBase expert?
You can only consider migrating the business, TiDB currently does not support it.
Suggestions are as follows:
- Organize business scenarios
- Verify the data model
- Check all strong references and strong constraints
- Check all application scenarios of stored procedures
- 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.
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.
How does it feel to use OceanBase?
TiDB does not support stored procedures; it is generally recommended to implement them in the application.
Stored procedures are not supported, you can only rewrite.
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.
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?
Then you should go to Oceanbase. It claims to be 90% compatible with Oracle 11g. It supports stored procedures, functions, and everything.
Is it that after learning so much about TiDB, you find it hard to give up? Haha.
Stored procedures are too counterintuitive. For the sake of technological progress and social development, it’s better to rewrite them all.
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.
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.
I remember that TiDB does not support stored procedures, right?
Currently working on migration, other functions are manageable, but is there any better solution for rollup besides union all?
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.