1. Use Oracle transfer
KingbaseESV8R2 only supports migration from Oracle, so migrate MySQL to Oracle first.
Problems in migrating to Oracle:
1.Oracle has a maximum 30-digit limit on table names
2.invalid hex number, invalid hexadecimal
3.Table The data is empty and it reports "cannot insert NULL into
4. The index name is too long
There are many problems when migrating MySQL to Oracle, and the adjustment is very troublesome; when Oracle migrates to Kingbase, sometimes the table migration will not work. Successful, but can be successful again after multiple attempts.
2. Use KingbaseESV8R3 transfer
After contacting Jincang technical staff, I learned that there is a new version V8R3, but it cannot be used in the production environment, it can be used for testing, and supports MySQL direct migration to V8R3.
Therefore, you need to reinstall a virtual machine. During the installation process, you cannot install R2 and R3 at the same time, and use the R3 migration tool for data migration. Please select Select All when migrating the source database to migrate settings such as views, indexes, foreign keys, and default values.
Problems in migrating to V8R3:
1.tinyint(1) is mapped to boolean after migration, even if it has been mapped in the migration tool, but still the same.
So after migration, you need to change the table field type. If there is a default value, you must also change the default value.
Although the annotation has been selected during the migration process, the default value is used. Object Manager still cannot display comments for fields. Hover the mouse on the table name to view the comments on the table. No way to view it yet.
After modifying the tinyint(1) problem, you can select the database in the R3 object manager for logical backup.
Then use R2’s object manager to perform logical restoration.
3. Other questions
1.Auto-increment
MySQL auto-increment is different from Kingbase auto-increment; Kingbase auto-increment is the same as Oracle, both are implemented by defining a sequence. .
If we currently use kingbaseV8R3 for transfer, migrating mysql to r3 will help us create the sequence and fill in the default values of the fields to achieve auto-increment.
The following is the manual way to use auto-increment:
Create a SEQUENCE first, name it test_id_SEQ, set the starting value here to 101
CREATE SEQUENCE test_id_SEQ START 101;
and then add fields that require auto-increment After adding
NEXTVAL('test_id_SEQ'::REGCLASS)
to the default value and using the insert statement, the field ID of the test table will start to increase from 101
INSERT INTO test (name) values('1');
Before deleting the sequence, you need to delete the default value in the field. Delete the sequence
DROP SEQUENCE test_id_SEQ
2.uuid
kingbase does not have a uuid function, and the execution error
select replace(uuid(), '-', '') as id from dual
is replaced by
select SYS_GUID_NAME() as id from dual;
for the time being. After all, the uuid of mysql and kingbase Different generation rules
4. Discovered SQL problems
1.Cannot use `distinguishing keyword
2.Function IFNULL changes to NVL
3. All fields need to be displayed in group by
4.sql cannot appear!=''
, no error will be reported, but the execution result is null. In Kingbase, an empty string is equivalent to null
5. The function IF is changed to NVL2. Kingbase can only judge whether it is null
6. The field type is string but the time is stored, and I want to format the time. You need to convert the time to a timestamp first, and then format it into a string
SELECT to_char(to_timestamp('2020-02-20 15:35:44', 'YYYY-MM-DD HH24:MI:SS'),'MM-DD')
7. You cannot use double quotes ""
, use single quotes ''
instead of
8. Cannot use count('')
9. Time formatting, addition and subtraction
limit_time = limit_time (now() - apply_time)
MySQL:
limit_time = date_add( limit_time, INTERVAL ( SELECT TimeStampDiff( DAY, now(), apply_time ) ) + 1 DAY )
Kingbase: The trouble lies in the conversion of time and string. First format the timestamp into a string, and then convert the time back to add or subtract
limit_time = limit_time + (to_date(to_char(now(),'YYYY-MM-DD'),'YYYY-MM-DD') - to_date(to_char(apply_time,'YYYY-MM-DD'),'YYYY-MM-DD') + integer '1')
10. The table name and the system view may have the same name, so add schema name. Table name
to distinguish
11. Change is_delete = false to is_delete = 0. If the field value is 0, false cannot be used. filter
The above is the detailed content of How to migrate MySQL to KingbaseESV8R2. For more information, please follow other related articles on the PHP Chinese website!

The main difference between MySQL and SQLite is the design concept and usage scenarios: 1. MySQL is suitable for large applications and enterprise-level solutions, supporting high performance and high concurrency; 2. SQLite is suitable for mobile applications and desktop software, lightweight and easy to embed.

Indexes in MySQL are an ordered structure of one or more columns in a database table, used to speed up data retrieval. 1) Indexes improve query speed by reducing the amount of scanned data. 2) B-Tree index uses a balanced tree structure, which is suitable for range query and sorting. 3) Use CREATEINDEX statements to create indexes, such as CREATEINDEXidx_customer_idONorders(customer_id). 4) Composite indexes can optimize multi-column queries, such as CREATEINDEXidx_customer_orderONorders(customer_id,order_date). 5) Use EXPLAIN to analyze query plans and avoid

Using transactions in MySQL ensures data consistency. 1) Start the transaction through STARTTRANSACTION, and then execute SQL operations and submit it with COMMIT or ROLLBACK. 2) Use SAVEPOINT to set a save point to allow partial rollback. 3) Performance optimization suggestions include shortening transaction time, avoiding large-scale queries and using isolation levels reasonably.

Scenarios where PostgreSQL is chosen instead of MySQL include: 1) complex queries and advanced SQL functions, 2) strict data integrity and ACID compliance, 3) advanced spatial functions are required, and 4) high performance is required when processing large data sets. PostgreSQL performs well in these aspects and is suitable for projects that require complex data processing and high data integrity.

The security of MySQL database can be achieved through the following measures: 1. User permission management: Strictly control access rights through CREATEUSER and GRANT commands. 2. Encrypted transmission: Configure SSL/TLS to ensure data transmission security. 3. Database backup and recovery: Use mysqldump or mysqlpump to regularly backup data. 4. Advanced security policy: Use a firewall to restrict access and enable audit logging operations. 5. Performance optimization and best practices: Take into account both safety and performance through indexing and query optimization and regular maintenance.

How to effectively monitor MySQL performance? Use tools such as mysqladmin, SHOWGLOBALSTATUS, PerconaMonitoring and Management (PMM), and MySQL EnterpriseMonitor. 1. Use mysqladmin to view the number of connections. 2. Use SHOWGLOBALSTATUS to view the query number. 3.PMM provides detailed performance data and graphical interface. 4.MySQLEnterpriseMonitor provides rich monitoring functions and alarm mechanisms.

The difference between MySQL and SQLServer is: 1) MySQL is open source and suitable for web and embedded systems, 2) SQLServer is a commercial product of Microsoft and is suitable for enterprise-level applications. There are significant differences between the two in storage engine, performance optimization and application scenarios. When choosing, you need to consider project size and future scalability.

In enterprise-level application scenarios that require high availability, advanced security and good integration, SQLServer should be chosen instead of MySQL. 1) SQLServer provides enterprise-level features such as high availability and advanced security. 2) It is closely integrated with Microsoft ecosystems such as VisualStudio and PowerBI. 3) SQLServer performs excellent in performance optimization and supports memory-optimized tables and column storage indexes.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.