Heterogeneous Database Switching Access System and Method

By designing a heterogeneous database switching access system, the compatibility and performance problems between domestic databases and ORACLE databases are solved, efficient database switching access is achieved, and the transformation costs and risks are reduced, and business stability and data synchronization are ensured.

CN115934755BActive Publication Date: 2025-07-18北京景尧科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310032099.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2025-07-18
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

In the prior art, the compatibility and execution performance of domestic databases are not up to standard, resulting in inefficient database replacement access, and traditional transformation solutions pose high costs and potential business interruption risks.

Method used

Design a heterogeneous database switching access system, including business application program interface, bus client, server connector, SQL converter, log extractor and dual write executor. By analyzing and translating query statements, smooth switching between domestic databases and ORACLE databases is achieved to ensure data synchronization and query statement compatibility.

Benefits of technology

It improves the efficiency of switching access of heterogeneous databases, reduces the cost of transformation, reduces the risk of business interruption, and ensures the stability and performance of data access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115934755B_ABST
    Figure CN115934755B_ABST
Patent Text Reader

Abstract

This application relates to the technical field of heterogeneous databases, and discloses a heterogeneous database switching access system and method. The system includes: a business application programming interface, a bus client, a domestic database, and an ORACLE database, a server connector, a statement converter, a log extractor, and a dual-write executor. The bus client receives access from the business application programming interface and obtains the server connector address. The server connector connects to the bus client, searches for target data in the global cache. If the target data does not exist in the global cache, the domestic database query statement is parsed and translated through the statement converter. The statement converter connects to the log extractor and the dual-write executor, connects to all databases, performs log extraction and verification, and stores the data in all databases. Access the domestic database to obtain data. By verifying data synchronization, and at the same time the statement converter ensures query statement compatibility, improving the efficiency of heterogeneous database switching access.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of heterogeneous databases, and particularly to a heterogeneous database switching access system and method. Background Art

[0002] The core business systems of industries such as finance, operators, energy, government and enterprises, and the military are all developed based on ORACLE, resulting in a strong association and tight coupling dependence of the business on ORACLE. The requirement for database localization is to directly replace the existing ORACLE database with a domestic database. There are two traditional solutions for replacing ORACLE with a domestic database. The first is application-side transformation: modifying the application program, but this will involve hundreds of applications to be modified, and the problem of SQL statement compatibility needs to be solved. At the same time, the modification will inevitably involve testing and trial operation, and neither the time cost nor the money cost can be borne by the customer. At the same time, there are unknown risks such as potential bugs not found in the rewritten application program. For the 7x24-hour non-stop business, there is a hidden danger of business interruption. The second is database-side optimization: the domestic database directly compatible with all the syntax of ORACLE, but currently the domestic database cannot catch up with the decades of technical accumulation of ORACLE in the short term, which affects the progress of database localization replacement. Secondly, there are also two major risk points. The first is that the SQL statements of the domestic database are not up to standard in compatibility with ORACLE SQL; the second is that the execution performance of the SQL statements of the domestic database is not up to standard. Therefore, innovative research on the existing problems of heterogeneous database technology has great research significance.

[0003] The above content is only used to assist in understanding the technical solution of the present invention, and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main object of the present invention is to provide a heterogeneous database switching access system and method, aiming to solve the problem in the prior art that the SQL statements of the domestic database are not up to standard in compatibility with ORACLE SQL, and the execution performance of the SQL statements is not up to standard, resulting in low efficiency of database replacement access.

[0005] To achieve the above object, the present invention provides a heterogeneous database switching access system. The heterogeneous database switching access system includes a business application program interface, a bus client, a data bus, a domestic database, and an ORACLE database connected in sequence. The data bus includes: a server connector, an SQL converter, a log extractor, and a dual-write executor. The bus client also communicates with a connection distribution center, and the server connector is connected to a global cache;

[0006] The bus client is used to receive access from the business application program interface and obtain the connection address and connection port of the server connector allocated by the connection distribution center;

[0007] The server connector is used to connect to the bus client, check whether the target data exists in the global cache. If the target data does not exist in the global cache, it is parsed and translated through the SQL converter to obtain a domestic database query statement.

[0008] The SQL converter is used to connect to the log extractor and the dual-write executor, access the domestic database through the domestic database query statement, and obtain the target data.

[0009] The log extractor and the dual-write executor are used to connect to the ORACLE database and the domestic database, perform log extraction and verification, and store the data in the domestic database and the ORACLE database.

[0010] Optionally, the business application is further used to create a connection string.

[0011] The bus client is used to access the connection distribution center according to the connection string and obtain an available address.

[0012] The bus client is further used to access the server connector according to the available address and obtain a standard query statement.

[0013] The server connector is used to obtain the query statement, search for the target data through the global cache using the standard query statement. If the target data is found in the global cache, the target data is transmitted back to the bus client through the data bus.

[0014] Optionally, the server connector is further used to, if the target data is not found in the global cache, send the standard query statement to the SQL converter.

[0015] The SQL converter is used to parse and translate the standard query statement into a domestic database query statement, send the domestic database query statement to the domestic database for data search, obtain the target data, and transmit the target data back to the bus client through the data bus.

[0016] Optionally, the log extractor is further used to extract operation logs from the domestic database in real time, separate the domestic database query statements in the operation logs, and send them to the SQL converter.

[0017] The SQL converter is further used to parse and translate the domestic database query statement into a standard query statement, and send the standard query statement to the dual-write executor.

[0018] The double-write actuator is further configured to receive the standard query statement and send it to the ORACLE database for execution;

[0019] The data bus is further configured to compare in real time whether the data in the domestic database and the ORACLE database is synchronized. In the case of data asynchrony, search for the target standard query statement in the log extractor and send it to the ORACLE database for execution.

[0020] Optionally, the log extractor is configured to obtain the latest read and write logs;

[0021] The data bus is configured to determine whether the domestic database and the ORACLE database are synchronized and whether the data in the ORACLE database is complete based on the read and write logs; when the data in the domestic database and the ORACLE database is complete, stop all business application programs and the data bus read and write processes, so that the domestic database and the ORACLE database are in a static state;

[0022] The data bus is further configured to configure the numbers of the primary database and the standby database. At this time, the primary database number is the ORACLE data number, and the standby database number is the domestic database number;

[0023] The data bus is further configured to replace the primary database information number with the standby database information number through the data bus. At this time, the primary database number is the domestic database number, and the standby database number is the ORACLE data number.

[0024] Optionally, the business application program is configured to obtain the performance information of the domestic database. In the case where the performance information does not meet the standard, stop all business application programs and the data bus read and write processes;

[0025] The data bus is further configured to replace the primary database information number with the standby database information number through the data bus. At this time, the primary database number is the ORACLE data number, and the standby database number is the domestic database number.

[0026] Optionally, the business application program is configured to obtain the performance information of the domestic database. In the case where the performance information meets the standard, create a preset time; when accessing the domestic database reaches the preset time, stop the data bus;

[0027] The business application program is further configured to remove the data bus dependency package and directly use the domestic database connection string and the domestic database dependency package.

[0028] In addition, to achieve the above object, the present invention further provides a heterogeneous database switching access method. The heterogeneous database switching access method is applied to the heterogeneous database switching access system. The method includes:

[0029] The bus client receives access from the service application interface and obtains the connection address and connection port of the server connector allocated by the connection distribution center;

[0030] The server connector connects to the bus client, checks whether the target data exists in the global cache. If the target data does not exist in the global cache, the domestic database query statement is parsed and translated through the SQL converter;

[0031] The SQL converter connects to the log extractor and the dual-write executor, accesses the domestic database through the domestic database query statement, and obtains the target data;

[0032] The log extractor and the dual-write executor are connected to the ORACLE database and the domestic database to perform log extraction and verification, and store the data in the domestic database and the ORACLE database.

[0033] Optionally, checking whether the target data exists in the global cache includes:

[0034] Create a connection string;

[0035] Access the connection distribution center according to the connection string to obtain available addresses;

[0036] Access the server connector according to the available address and obtain the standard query statement;

[0037] Obtain the query statement, search for the target data through the global cache using the standard query statement. If the target data is found in the global cache, the target data is transmitted back to the bus client through the data bus.

[0038] Optionally, after searching for the standard query statement through the global cache, it further includes:

[0039] If the target data is not found in the global cache, send the standard query statement to the SQL converter;

[0040] Parse and translate the standard query statement into a domestic database query statement, send the domestic database query statement to the domestic database for data search, obtain the target data, and transmit the target data back to the bus client through the data bus.

[0041] The heterogeneous database switching access system and method proposed by the present invention receive access from a service application interface through the bus client, and obtain the connection address and connection port of the server connector allocated by the connection distribution center; the server connector connects to the bus client, and checks whether the target data exists in the global cache. If the target data does not exist in the global cache, it is parsed and translated through the SQL converter to obtain a domestic database query statement; the SQL converter connects to the log extractor and the dual-write executor, accesses the domestic database through the domestic database query statement to obtain the target data; the log extractor and the dual-write executor connect to the ORACLE database and the domestic database to perform log extraction and verification, and store the data in the domestic database and the ORACLE database. By verifying data synchronization and ensuring query statement compatibility through the statement converter, the domestic database is smoothly replaced, and the efficiency of heterogeneous database switching access is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is a structural block diagram of the first embodiment of the heterogeneous database switching access system of the present invention;

[0043] Figure 2 It is a structural block diagram of the second embodiment of the heterogeneous database switching access system of the present invention;

[0044] Figure 3 It is a structural block diagram of the third embodiment of the heterogeneous database switching access system of the present invention;

[0045] Figure 4 It is a structural block diagram of the fourth embodiment of the heterogeneous database switching access system of the present invention;

[0046] Figure 5 It is an architecture diagram before replacing the domestic database in an embodiment of the heterogeneous database switching access system of the present invention;

[0047] Figure 6 It is an architecture diagram after replacing the domestic database in an embodiment of the heterogeneous database switching access system of the present invention;

[0048] Figure 7 It is a schematic flow diagram of the first embodiment of the heterogeneous database switching access method of the present invention;

[0049] Figure 8 It is a schematic flow diagram of the second embodiment of the heterogeneous database switching access method of the present invention.

[0050] The realization, functional characteristics and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0051] It should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.

[0052] Refer to Figure 1 , Figure 1 which is a structural block diagram of the first embodiment of the heterogeneous database switching access system of the present invention.

[0053] The heterogeneous database switching access system includes a service application program interface 10, a bus client 20, a data bus 30, a domestic database 40, and an ORACLE database 50 that are connected in sequence. The data bus 30 includes: a server connector 60, an SQL converter 70, a log extractor 80, and a dual-write executor 90. The bus client 20 also communicates with a connection distribution center 100, and the server connector 60 is connected to a global cache 110;

[0054] In this embodiment, the bus client 20 is configured to receive access from the service application program interface 10 and obtain the connection address and connection port of the server connector allocated by the connection distribution center 100.

[0055] It can be understood that the bus client 20 standardizes the development language driver program interface. Since different development languages use different development driver program interfaces, for example: the JAVA language implements the JDBC standard interface, and the C language implements the ODBC standard interface. Therefore, the driver interface of the development language needs to be standardized. The bus client 20 is mainly used to obtain the connection address and connection port of the server connector 60, the bus execution SQL statement interface, the bus SQL statement result interface, and the bus metadata interface. The above interfaces are called when the bus executes data query and result acquisition.

[0056] In this embodiment, the server connector 60 is configured to connect to the bus client 20, check whether the target data exists in the global cache 110. If the target data does not exist in the global cache 110, the domestic database query statement is parsed and translated through the SQL converter 70.

[0057] It can be understood that the server connector 60 maintains multiple long connections with the bus client 20, distributes different bus client requests to different contexts, and ensures that requests are isolated from each other. For example, if the bus client 20 requests the bus to execute an SQL statement service, the server connector 60 distributes the request to the following context to search for data in the global cache 110. If the data is found, there is no need to perform a database search, and the data in the global cache can be directly obtained. If the data does not exist in the global cache, the SQL converter 70 parses and translates the statement, and performs a data search in the primary database. The purpose of the server connector 60 to isolate requests is to avoid mutual influence between service requests. Without isolation, if a problem occurs in a certain service, the stability of the entire bus system will be affected.

[0058] In this embodiment, the SQL converter 70 is used to connect the log extractor 80 and the dual-write executor 90, access the domestic database 40 through the domestic database query statement, and obtain the target data.

[0059] It can be understood that the SQL converter 70 parses and translates the SQL statement and executes the corresponding statement through the corresponding database. This is because the domestic database 40 cannot be compatible with the SQL syntax of the ORACLE database 50. Therefore, it is necessary to translate it into the SQL syntax that the domestic database can recognize in advance through the SQL converter 70 before data query can be performed.

[0060] In this embodiment, the log extractor 80 and the dual-write executor 90 are used to connect the ORACLE database 50 and the domestic database 40, perform log extraction and verification, and store the data in the domestic database 40 and the ORACLE database 50.

[0061] It can be understood that the log extractor 80 obtains the SQL statements modified in the primary database in real time and replays them to the standby database through the dual-write executor 90. At this time, the standby database refers to the ORACLE database 50. Through the above method, it is possible to switch to the standby database at the lowest cost and the fastest speed.

[0062] Furthermore, the business application program 10 is also used to obtain the performance information of the domestic database 40. When the performance information meets the standard, a preset time is created; when accessing the domestic database 40 reaches the preset time, the data bus is stopped; the business application program 10 is also used to remove the data bus 30 dependency package and directly use the domestic database connection string and the domestic database dependency package.

[0063] It can be understood that after replacing the main database with the domestic database 40, the business application 10 calls the data of the domestic database 40 through the interface, obtains the usage of the data of the domestic database 40, and measures its usage performance. If the throughput, response time, concurrency, etc. meet the standards, it means that the data usage of the main database meets the operation requirements of the business application 10, and then the data bus 30 can be removed and the dual-database mode is no longer used.

[0064] In the specific implementation, after the domestic database 40 goes online, the data of the two databases is kept synchronized and meets the preset number of days. On the day of application release, the dual-database mode stops with the application, and the data bus also stops. The business application 10 removes the bus dependency package and uses the domestic database connection string and the domestic database dependency package at the same time. After starting the business application 10, it completely depends on the domestic database 40 to obtain data.

[0065] In this embodiment, the bus client 20 receives the access of the business application interface 10, and obtains the connection address and connection port of the server connector allocated by the connection distribution center 100; the server connector 60 is connected to the bus client 20 to check whether the target data exists in the global cache 110. If the target data does not exist in the global cache, the SQL converter 70 is used to parse and translate to obtain a domestic database query statement; the SQL converter 70 is connected to the log extractor 80 and the dual-write executor 90, and accesses the domestic database 40 through the domestic database query statement to obtain the target data; the log extractor 80 and the dual-write executor 90 are connected to the ORACLE database 50 and the domestic database 40 for log extraction and verification, and store the data in the domestic database 40 and the ORACLE database 50. By verifying the data synchronization, and at the same time the statement converter ensures the query statement compatibility, the domestic database is smoothly replaced, and the access efficiency of heterogeneous database switching is improved.

[0066] Refer to Figure 2 , Figure 2 FIG. is the structural block diagram of the second embodiment of the heterogeneous database switching access system of the present invention. Based on the above first embodiment, the second embodiment of the heterogeneous database switching access system of the present invention is proposed.

[0067] In this embodiment, the business application 10 is further used to create a connection string.

[0068] It can be understood that the purpose of creating the connection string is to connect to the database.

[0069] In this embodiment, the bus client 20 is used to access the connection distribution center 100 according to the connection string to obtain an available address.

[0070] It can be understood that for the bus client 20 to access the server connector 60, it needs to obtain the address and interface of the target server connector 60. Therefore, it is necessary to connect to the allocation center 100 to allocate an address for the bus client 20.

[0071] In a specific implementation, the bus client accesses the connection allocation center 100 according to the connection string. The connection string contains the IP and port of the connection allocation center 100. The connection allocation center 100 will allocate an available address for the data bus 30, including the IP and port. The bus client 20 will establish a long connection to the data bus 30 and maintain the connection, and send the SQL statement to the server connector 60 for execution when it is necessary to execute the SQL statement.

[0072] In this embodiment, the bus client 20 is further configured to access the server connector 60 according to the available address and obtain a standard query statement.

[0073] In a specific implementation, the business application 10 executes SQL statements through standard JDBC and ODBC. The bus client 20 sends the SQL statement and parameters to the server connector 60 and waits for the bus execution result.

[0074] In this embodiment, the server connector 60 is configured to obtain the query statement, search for the standard query statement through the global cache 110. If the target data is found in the global cache 110, the target data is transmitted back to the bus client 20 through the data bus.

[0075] It can be understood that the global cache 110 caches the execution results in units of transactions. In the same transaction, if the same query SQL statement appears, it will directly return from the cached results instead of querying the database again. By pre-querying the global cache, the database resource overhead is saved and the overall performance of the database is improved. For example: when querying field A through SQL statement a, if the query result of the data containing field A has been cached in a transaction before, then executing SQL statement a again will directly return the corresponding query result from the global cache.

[0076] Furthermore, in this embodiment, the server connector 60 is further configured to, if the target data is not found in the global cache 110, send the standard query statement to the SQL converter 70; the SQL converter 70 is configured to parse and translate the standard query statement into a domestic database query statement, send the domestic database query statement to the domestic database 40 for data search, and obtain the target data, and transmit the target data back to the bus client 20 through the data bus 30.

[0077] It can be understood that in this embodiment, the SQL converter 70 refers to a database statement translation converter that can parse and translate the standard SQL statements recognizable by the ORACLE database 50 into query statements recognizable by the domestic database 40, and can also parse and translate the query statements recognizable by the domestic database 40 back into standard SQL statements. The SQL converter 70 parses and translates the incompatible SQL of heterogeneous databases into SQL recognizable by mainstream databases, realizing unified access to heterogeneous databases.

[0078] In a specific implementation, after the data bus 30 receives an SQL statement, if the requested data cannot be found in the cache, it sends the SQL statement to the SQL converter 70 for parsing and translation into an SQL statement recognizable by the domestic database. The data bus 30 sends the SQL statement converted by the SQL converter to the domestic database 40 for execution and returns the requested data. After obtaining the execution result, it returns the result to the bus client 20.

[0079] In this embodiment, the business application program 10 is further used to create a connection string; the bus client 20 is used to access the connection distribution center 100 according to the connection string to obtain an available address; the bus client 20 is further used to access the server connector 60 according to the available address and obtain a standard query statement; the server connector 60 is used to obtain the query statement, search for the standard query statement through the global cache 110. If the target data is found in the global cache 110, the target data is transmitted back to the bus client 20 through the data bus. In the above manner, the global cache 110 reduces the intermediate transfer links, saves the database resource overhead, can effectively reduce the negative efficiency problems brought about after accessing the bus, thereby improving the database execution efficiency.

[0080] Refer to Figure 3 , Figure 3 FIG. is the structural block diagram of the third embodiment of the heterogeneous database switching access system of the present invention. Based on the above first embodiment, the third embodiment of the heterogeneous database switching access system of the present invention is proposed.

[0081] In this embodiment, the log extractor 80 is further used to extract operation logs from the domestic database 40 in real time, separate the domestic database query statements in the operation logs and send them to the SQL converter 70.

[0082] It can be understood that during the process of data dual writing, since the database query statements recognizable by the domestic database 40 cannot be used in the ORACLE database 50, it is necessary to obtain the query statements used by the domestic database 40 to update data through the log extractor 80 and then update the data through the ORACLE database 50.

[0083] In a specific implementation, the log file path of the domestic database 40 is obtained; data blocks in the file are read through the obtained log file, and log record information is read from the data blocks and parsed to obtain the change operation data of all databases in the domestic database 40. Based on the operation data, a domestic database query statement can be obtained, and the domestic database query statement is sent to the SQL converter 70 to execute statement conversion.

[0084] In this embodiment, the SQL converter 70 is further configured to parse and translate the domestic database 40 query statement into a standard query statement, and send the standard query statement to the dual-write executor 90.

[0085] In this embodiment, the dual-write executor 90 is further configured to receive the standard query statement and send it to the ORACLE database 50 for execution.

[0086] In this embodiment, the data bus 30 is further configured to compare in real time whether the data in the domestic database 50 and the ORACLE database 40 are synchronized. In the case of data asynchrony, the target standard query statement in the log extractor 80 is searched and sent to the ORACLE database 50 for execution.

[0087] In a specific implementation, the log extractor 80 extracts the operation logs of the primary database in real time. Here, the primary database refers to the domestic database 40. The log extractor 80 separates all domestic database query statements in the operation logs for storage and sends them to the SQL converter 70. The SQL converter 70 parses and translates them into standard SQL statements that can be correctly recognized by the standby database. Here, the standby database refers to the ORACLE database 50. The parsed SQL statements are sent to the dual-write executor 90. The dual-write executor 90 sends them to the standby database for playback and execution. The data bus 30 compares the data consistency between the primary and standby databases in real time. In the data consistency check between the primary and standby databases, methods such as based on synchronous log checking, based on hash value checking, and based on record number checking can be adopted. This embodiment does not limit this. If data inconsistency is found, the bus searches for the corresponding SQL statements stored in the log extractor 80 and sends them to the standby database for playback and execution again.

[0088] In this embodiment, the log extractor 80 is further configured to extract operation logs from the domestic database 40 in real time, separate the domestic database query statements in the operation logs and send them to the SQL converter 70; the SQL converter 70 is further configured to parse and translate the domestic database 40 query statements into standard query statements, and send the standard query statements to the dual-write executor 90; the dual-write executor 90 is further configured to receive the standard query statements and send them to the ORACLE database 50 for execution; the dual-write executor 90 is further configured to receive the standard query statements and send them to the ORACLE database 50 for execution. In the above manner, the dual-write function of the data bus 30 ensures the synchronization of the primary and standby database data, improving the storage efficiency of the database.

[0089] Referring to Figure 4 , Figure 4 FIG. is a structural block diagram of the fourth embodiment of the heterogeneous database switching access system of the present invention. Based on the above first embodiment, the fourth embodiment of the heterogeneous database switching access system of the present invention is proposed.

[0090] In this embodiment, the log extractor 80 is configured to obtain the latest read and write logs.

[0091] In this embodiment, the data bus 30 is configured to determine whether the domestic database 40 and the ORACLE database 50 in the active state are synchronized and whether the data of the ORACLE database 50 is complete according to the read and write logs; when the data of the domestic database 40 and the ORACLE database 50 is complete, stop all business application programs 10 and the read and write processes of the data bus 30, so that the domestic database 40 and the ORACLE database 50 are in a static state.

[0092] It can be understood that setting all programs and databases to a static state in advance can prevent affecting the business process during the switching process, and in this way, avoid long-term interruption of the business during the replacement process. This embodiment is the setup process before switching the primary and standby databases of the database, as Figure 5 shown, Figure 5 FIG. is an architecture diagram before replacing the domestic database of the present invention. After the application program obtains the data read and write request, it accesses the bus client through the JDBC interface or the ODBC interface. After the bus client obtains the IP-assigned address, it connects to the bus server connector, obtains the result from the global cache or accesses the primary database through the JDBC interface, extracts the logs of the primary database, and writes them to the standby database in real time. At this time, the primary database is the ORACLE database 50, and the standby database is the domestic database 40.

[0093] In this embodiment, the data bus 30 is further configured to assign numbers to the primary database and the standby database. At this time, the primary database number is the ORACLE data number, and the standby database number is the domestic database number. In this embodiment, the data bus 30 is further configured to replace the primary database information number with the standby database information number through the data bus. At this time, the primary database number is the domestic database number, and the standby database number is the ORACLE data number.

[0094] Further, in this embodiment, the business application program 10 is configured to obtain the performance information of the domestic database 40. When the performance information does not meet the standard, all business application programs and the data bus read / write processes are stopped. The data bus is further configured to replace the primary database information number with the standby database information number through the data bus. At this time, the primary database number is the ORACLE data number, and the standby database number is the domestic database number.

[0095] In specific implementation, the latest read / write logs in the log extractor 80 are checked. After confirming the consistency of the primary and standby database data in the active state, the latest read / write logs in the log extractor 80 are checked to confirm the integrity of the standby database data. After determining the integrity, all application programs are stopped to make the primary and standby databases in a static state without data read / write. All read / write processes of the data bus 30 are stopped. The verification function of the data bus 30 is started, and the primary and standby database data are verified again in the static state. After confirming the consistency of the primary and standby database data, the configurations of the primary and standby databases are modified with one key on the data bus. For example, in the configuration item, the information of the primary and standby databases is configured, and masterDB = 1 represents the primary database, and masterDB = 2 represents the standby database. When performing database switching, only 1 needs to be changed to 2 to complete the switching process. The business application program 10 is connected to point to the domestic database 40, and the ORACLE database 50 is changed to the standby database. After the switching is completed, all processes of the bus are started again, and the primary and standby databases and all business application programs are started. As Figure 6 shown, Figure 6 is the architecture diagram after replacing the domestic database in the present invention. After the application program obtains the data read / write request, it accesses the bus client through the JDBC interface or the ODBC interface. After the bus client obtains the IP-assigned address, it connects to the bus server connector, obtains the result from the global cache, or parses and converts the query statement through the SQL converter and then accesses the primary database through the JDBC interface, extracts the logs of the primary database, and writes them into the standby database in real time. At this time, the primary database is the domestic database 40, and the standby database is the ORACLE database 50.

[0096] In this embodiment, the log extractor 80 is used to obtain the latest read and write logs; the data bus 30 is used to determine whether the domestic database 40 and the ORACLE database 50 are synchronized and whether the data in the ORACLE database 50 is complete according to the read and write logs; when the data in the domestic database 40 and the ORACLE database 50 is complete, all business application programs 10 and the read and write processes of the data bus 30 are stopped to make the domestic database 40 and the ORACLE database 50 in a static state; the data bus 30 is also used to configure the numbers of the primary database and the standby database, where the primary database number is the ORACLE data number at this time, and the standby database number is the domestic database number at this time; in this embodiment, the data bus 30 is also used to replace the primary database information number with the standby database information number through the data bus, where the primary database number is the domestic database number at this time, and the standby database number is the ORACLE data number at this time. By the above method, the database is switched with one key while ensuring the data integrity of the dual databases, thereby improving the efficiency of heterogeneous database switching access.

[0097] In addition, the present invention also proposes a heterogeneous database switching access method, and the heterogeneous database switching access method is applied to the above-mentioned heterogeneous database switching access system.

[0098] Refer to Figure 7 , Figure 7 which is a schematic flowchart of the first embodiment of the heterogeneous database switching access method of the present invention.

[0099] In step S10, the bus client receives the access from the business application program interface and obtains the connection address and connection port of the server connector allocated by the connection distribution center.

[0100] In step S20, the server connector connects to the bus client and checks whether the target data exists in the global cache. If the target data does not exist in the global cache, the domestic database query statement is parsed and translated through the SQL converter.

[0101] In step S30, the SQL converter connects to the log extractor and the dual-write executor, accesses the domestic database through the domestic database query statement, and obtains the target data.

[0102] In step S40, the log extractor and the dual-write executor connect to the ORACLE database and the domestic database, perform log extraction and verification, and store the data in the domestic database and the ORACLE database.

[0103] In this embodiment, the bus client receives access to the service application interface, and obtains the connection address and connection port of the server connector allocated by the connection allocation center; the server connector connects to the bus client, and checks whether the target data exists in the global cache. If the target data does not exist in the global cache, the SQL converter parses and translates it to obtain a domestic database query statement; the SQL converter connects to the log extractor and the dual-write executor, accesses the domestic database through the domestic database query statement to obtain the target data; the log extractor and the dual-write executor connect to the ORACLE database and the domestic database to perform log extraction and verification, and store the data in the domestic database and the ORACLE database. By verifying data synchronization and ensuring query statement compatibility through the statement converter, the domestic database is smoothly replaced to improve the heterogeneous database switching access efficiency.

[0104] Refer to Figure 8 , Figure 8 which is a schematic flowchart of the second embodiment of the heterogeneous database switching access method of the present invention.

[0105] Step S210, create a connection string.

[0106] Step S220, access the connection allocation center according to the connection string to obtain available addresses.

[0107] Step S230, access the server connector according to the available address and obtain a standard query statement.

[0108] Step S240, obtain the query statement, and search for the target data through the global cache. If the target data is found in the global cache, the target data is transmitted back to the bus client through the data bus.

[0109] Further, after step S240, it further includes: if the target data is not found in the global cache, the standard query statement is sent to the SQL converter; the standard query statement is parsed and translated into a domestic database query statement, the domestic database query statement is sent to the domestic database for data search, and the target data is obtained, and the target data is transmitted back to the bus client through the data bus.

[0110] In this embodiment, the business application program is further used to create a connection string; the bus client is used to access the connection allocation center according to the connection string to obtain an available address; the bus client is further used to access the server connector according to the available address and obtain a standard query statement; the server connector is used to obtain the query statement, search for the standard query statement through the global cache. If the target data is found in the global cache, the target data is transmitted back to the bus client through the data bus. In the above manner, the intermediate transfer links are reduced through the global cache, the database resource overhead is saved, and the negative efficiency problem caused after accessing the bus can be effectively reduced, thereby improving the database execution efficiency.

[0111] It should be noted that the above-described workflow is only illustrative and does not limit the protection scope of the present invention. In actual applications, those skilled in the art can select some or all of them according to actual needs to achieve the purpose of the solution of this embodiment, and no limitation is made here.

[0112] In addition, for the technical details not described in detail in this embodiment, reference can be made to the heterogeneous database switching access system provided in any embodiment of the present invention, which will not be elaborated here.

[0113] In addition, it should be noted that in this article, the terms "including", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or system including the element.

[0114] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0115] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as a read-only memory (ROM) / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal device (which can be a mobile phone, a computer, an integrated platform workstation, or a network device, etc.) to execute the methods described in various embodiments of the present invention.

[0116] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be similarly included in the patent protection scope of the present invention.

Claims

1. A heterogeneous database switching access system, characterized in that, The heterogeneous database switching access system includes a business application program interface, a bus client, a data bus, a domestic database, and an ORACLE database that are connected in sequence. The data bus includes: a server connector, an SQL converter, a log extractor, and a dual-write executor. The bus client also communicates with a connection distribution center, and the server connector is connected to a global cache; The bus client is used to receive access from the business application program interface and obtain the connection address and connection port of the server connector allocated by the connection distribution center; The server connector is used to connect to the bus client, check whether target data exists in the global cache. If the target data does not exist in the global cache, a domestic database query statement is parsed and translated through the SQL converter; The SQL converter is used to connect to the log extractor and the dual-write executor, access the domestic database through the domestic database query statement, and obtain the target data; The log extractor and the dual-write executor are used to connect to the ORACLE database and the domestic database, perform log extraction and verification, and store the data in the domestic database and the ORACLE database; The log extractor is also used to extract operation logs from the domestic database in real time, separate the domestic database query statements in the operation logs, and send them to the SQL converter; The SQL converter is also used to parse and translate the domestic database query statement into a standard query statement, and send the standard query statement to the dual-write executor; The dual-write executor is also used to receive the standard query statement and send it to the ORACLE database for execution; The data bus is also used to compare in real time whether the data in the domestic database and the ORACLE database is synchronized. In the case of data asynchrony, search for the target standard query statement in the log extractor and send it to the ORACLE database for execution.

2. The system according to claim 1, wherein The business application program is also used to create a connection string; The bus client is also used to access the connection distribution center according to the connection string to obtain an available address; The bus client is also used to access the server connector according to the available address and obtain a standard query statement; The server connector is also used to obtain the query statement, search for the target data through the global cache for the standard query statement. If the target data is found in the global cache, the target data is transmitted back to the bus client through the data bus.

3. The system according to claim 2, wherein The server connector is also used to, if the target data is not found in the global cache, send the standard query statement to the SQL converter; The SQL converter is also used to parse and translate the standard query statement into a domestic database query statement, send the domestic database query statement to the domestic database for data search, obtain the target data, and transmit the target data back to the bus client through the data bus.

4. The system according to claim 1, wherein The log extractor is also used to obtain the latest read and write logs; The data bus is also used to determine whether the domestic database and the ORACLE database are synchronized and whether the ORACLE database data is complete according to the read-write log in the active state; when the data of the domestic database and the ORACLE database is complete, stop all business application programs and the data bus read-write process to make the domestic database and the ORACLE database in a static state; The data bus is also used to configure the numbers of the primary database and the standby database. At this time, the primary database number is the ORACLE data number, and the standby database number is the domestic database number; The data bus is also used to replace the primary database information number with the standby database information number through the data bus. At this time, the primary database number is the domestic database number, and the standby database number is the ORACLE data number.

5. The system according to claim 1, wherein The business application program is used to obtain the performance information of the domestic database. When the performance information does not meet the standard, stop all business application programs and the data bus read-write process; The data bus is also used to replace the primary database information number with the standby database information number through the data bus. At this time, the primary database number is the ORACLE data number, and the standby database number is the domestic database number.

6. The system according to any one of claims 1 to 5, characterized in that The business application program is used to obtain the performance information of the domestic database. When the performance information meets the standard, create a preset time; when accessing the domestic database reaches the preset time, stop the data bus; The business application program is also used to remove the data bus dependency package and directly use the domestic database connection string and the domestic database dependency package.

7. A method for switching access to heterogeneous databases, characterized in that The heterogeneous database switching access method is applied to the heterogeneous database switching access system as described in any one of claims 1 to 6. The heterogeneous database switching access system includes a business application program interface, a bus client, a data bus, a domestic database, and an ORACLE database connected in sequence. The data bus includes: a server connector, an SQL converter, a log extractor, and a dual-write executor. The bus client also communicates with a connection distribution center, and the server connector is connected to a global cache; The method includes: The bus client receives the access from the business application program interface and obtains the connection address and connection port of the server connector allocated by the connection distribution center; The server connector connects to the bus client and checks whether the target data exists in the global cache. If the target data does not exist in the global cache, parse and translate it through the SQL converter to obtain a domestic database query statement; The SQL converter connects to the log extractor and the dual-write executor, accesses the domestic database through the domestic database query statement, and obtains the target data; The log extractor and the dual-write executor connect to the ORACLE database and the domestic database, perform log extraction and verification, and store the data in the domestic database and the ORACLE database; The log extractor extracts operation logs from the domestic database in real time, separates the domestic database query statements in the operation logs and sends them to the SQL converter; The SQL converter parses and translates the domestic database query statements into standard query statements, and sends the standard query statements to the dual-write executor; The dual-write executor receives the standard query statements and sends them to the ORACLE database for execution; The data bus compares in real time whether the data in the domestic database and the ORACLE database are synchronized. In the case of data asynchrony, it searches for the target standard query statements in the log extractor and sends them to the ORACLE database for execution.

8. The method according to claim 7, wherein Checking whether there is target data in the global cache includes: Creating a connection string; Accessing the connection distribution center according to the connection string to obtain available addresses; Accessing the server connector according to the available addresses and obtaining standard query statements; Obtaining the query statements, searching for the standard query statements through the global cache. If target data is found in the global cache, the target data is transmitted back to the bus client through the data bus.

9. The method according to claim 8, characterized in that, After searching for the standard query statements through the global cache, it further includes: If target data is not found in the global cache, the standard query statements are sent to the SQL converter; Parsing and translating the standard query statements into domestic database query statements, sending the domestic database query statements to the domestic database for data search, obtaining target data, and transmitting the target data back to the bus client through the data bus.

Citation Information

Patent Citations

  • Database data migration method and system

    CN113157670A

  • Data pattern based ODBC / oledb / JDBC compliant driver

    WO2005067396A2