Oracle database function migration method and device

By establishing an association relationship tree and a syntax relationship tree, and automatically adapting Oracle syntax to PostgreSQL syntax, the problem of low function migration success rate in Oracle database function migration method is solved, improving migration efficiency and success rate, and reducing enterprise maintenance costs.

CN113986885BActive Publication Date: 2024-12-24CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111321884.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-09
Publication Date
2024-12-24
Estimated Expiration
2041-11-09

AI Technical Summary

Technical Problem

The existing Oracle database migration method cannot effectively perform function migration, and the success rate of function migration is low, resulting in high maintenance costs and long-term delays when upgrading the database architecture.

Method used

By establishing an association tree and a syntax relationship tree, specifying the order of function migration and fixing syntax differences, the Oracle syntax is automatically adapted to PostgreSQL syntax, thereby realizing automatic function migration.

Benefits of technology

It improves the success rate of Oracle database function migration, reduces manual intervention and time costs, and shortens the enterprise architecture upgrade cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986885B_ABST
    Figure CN113986885B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of database technology, and specifically relates to an Oracle database function migration method and device. The method includes obtaining a function in an Oracle database, and creating an association tree associated with the function; reading the original definition of the function and disassembling it to generate a syntax relationship tree; subjecting the syntax relationship tree to syntax conversion and function object restoration to generate a function definition of a preset type database; replacing the function definition of the preset type database with the same structure in the association relationship tree; and reversely traversing the replaced association relationship tree to migrate the function definition in the association relationship tree to the preset type database. In this way, by establishing an association relationship tree and a syntax relationship tree, specifying the function migration order and repairing the function syntax differences respectively, the function syntax differences are automatically adapted during the migration process, and the Oracle syntax is automatically adapted to the syntax of the preset type database, thereby improving the migration success rate of the function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of database technology, and specifically relates to an Oracle database function migration method and device. Background Art

[0002] With the development of database management systems, a variety of mature and stable database products have been developed for different business scenarios. In the early days, the application systems built by enterprises all adopted traditional application architecture and used Oracle database. With the popularization of the Internet and the expansion of business scale or changes in business scenarios, the maintenance costs of traditional architecture and Oracle database have increased year by year, and the investment and return are not proportional. Enterprises try to achieve the transformation from traditional architecture to Internet architecture by replacing Oracle database with PostgreSQL database to reduce the high maintenance costs brought by Oracle database.

[0003] However, in the process of migrating an Oracle database to a PostgreSQL database, most existing migration methods can only perform data migration but not function migration. Even if function migration is possible, the success rate of function migration is low.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The purpose of this application is to provide an Oracle database function migration method and device, which improves the migration success rate of the function to a certain extent.

[0006] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0007] According to one aspect of an embodiment of the present application, a method for migrating an Oracle database function is provided, the method comprising:

[0008] Obtain a function in an Oracle database, and create an association tree associated with the function, wherein the association tree is used to display dependent objects that have an association relationship with the function;

[0009] Reading the original definition of the function and disassembling it to generate a grammatical relationship tree, wherein the grammatical relationship tree is used to represent the component structure of the function;

[0010] The grammatical relationship tree is subjected to grammatical conversion and function object restoration to generate a function definition of a preset type database;

[0011] Replace the same structure in the association tree with the function definition of the preset type database;

[0012] The replaced association tree is traversed in reverse order to migrate the function definitions in the association tree to a preset type database.

[0013] According to one aspect of an embodiment of the present application, an Oracle database function migration device is provided, the device comprising:

[0014] An acquisition module is used to acquire a function in an Oracle database and create an association tree associated with the function, wherein the association tree is used to display dependent objects that have an association relationship with the function;

[0015] A first generating module, used for reading the original definition of the function and disassembling it to generate a grammatical relationship tree, wherein the grammatical relationship tree is used for representing the component structure of the function;

[0016] A second generation module is used to perform syntax conversion and function object restoration on the syntax relationship tree to generate a function definition of a preset type database;

[0017] A replacement module, used to replace the function definition of the preset type database with the same structure in the association relationship tree;

[0018] The migration module is used to reversely traverse the replaced association tree to migrate the function definitions in the association tree to a preset type database.

[0019] In some embodiments of the present application, based on the above technical solution, the acquisition module is also used to use the function of the association tree to be created as the first-layer node; obtain the dependent object of the function, and use the dependent object of the function as the second-layer node; traverse the second-layer nodes and determine the dependent objects of the second-layer nodes; traverse the next layer of nodes of the second layer nodes and determine the dependent objects of the next layer nodes, until there is no dependent object at the node.

[0020] In some embodiments of the present application, based on the above technical solution, the acquisition module is also used to mark repeated dependent objects in the process of creating the association tree; when traversing to the point where the current node and other nodes have repeated dependent objects, the dependent objects of the current node are no longer queried.

[0021] In some embodiments of the present application, based on the above technical solution, the acquisition module is also used to delete repeated functions or repeated nodes in the association tree to simplify the association tree; and save the simplified association tree in a cache area of ​​a database.

[0022] In some embodiments of the present application, based on the above technical solution, the first generation module is also used to scan the structure of the function to read the original definition of the function; merge the structure of the function into an identification array according to preset rules, and the identification array includes at least the function name, parameter declaration and function body; disassemble the identification array layer by layer until the minimum granularity is reached to generate the grammatical relationship tree, wherein the minimum granularity is the minimum refinement level of the data in the database.

[0023] In some embodiments of the present application, based on the above technical solution, the first generation module is also used to use the function name in the identification array as the first-level child node; use the parameter declaration in the identification array and the function body as the second-level child node; decompose the parameter declaration into syntax and data type, and decompose the function body into function expression and return domain object to obtain the third-level child node; decompose the third-level child node until the minimum refinement level is reached.

[0024] In some embodiments of the present application, based on the above technical solution, the second generation module is also used to traverse the nodes of the grammatical relationship tree, and perform grammatical conversion processing according to the node type to meet the grammatical format of the preset type database; restore the grammatical relationship tree after grammatical conversion to the function definition form of the preset type database to generate a function definition of the preset type database.

[0025] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the Oracle database function migration method in the above technical solution is implemented.

[0026] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the Oracle database function migration method in the above technical solution by executing the executable instructions.

[0027] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the Oracle database function migration method in the above technical solution.

[0028] In the technical solution provided in the embodiment of the present application, by establishing an association relationship tree and a syntax relationship tree, the function migration order is specified and the function syntax differences are repaired respectively, the function syntax differences are automatically adapted during the migration process, and the Oracle syntax is automatically adapted to the syntax of the preset type of database, thereby improving the migration success rate of the function.

[0029] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0031] Figure 1 The following schematically illustrates the steps of an Oracle database function migration method provided in one embodiment of the present application.

[0032] Figure 2 The following schematically shows the steps for creating an association tree associated with a function in an embodiment of the present application.

[0033] Figure 3 A schematic diagram of an association relationship tree in an embodiment of the present application is schematically shown.

[0034] Figure 4 The following schematically shows the steps for creating an association tree associated with a function in another embodiment of the present application.

[0035] Figure 5 The following schematically shows the steps for creating an association tree associated with a function in another embodiment of the present application.

[0036] Figure 6 The figure schematically shows the steps of reading the original definition of a function and decomposing it to generate a grammatical relationship tree in one embodiment of the present application.

[0037] Figure 7 The schematic diagram shows the steps of disassembling the identification array layer by layer until the minimum granularity is reached in one embodiment of the present application.

[0038] Figure 8 A schematic diagram of a grammatical relationship tree in an embodiment of the present application is schematically shown.

[0039] Fig. 9The schematic diagram shows the steps of converting the syntax relationship tree into syntax and restoring the function object to generate the function definition of the preset type database in one embodiment of the present application.

[0040] Fig.10 The exemplary system architecture block diagram applying the technical solution of the present application is schematically shown.

[0041] Fig.11 The structural block diagram of the Oracle database function migration device provided in an embodiment of the present application is schematically shown.

[0042] Fig.12 The structure block diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0043] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0044] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0045] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0046] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0047] In the process of migrating an Oracle database to a PostgreSQL database, although PostgreSQL is also committed to being compatible with the Oracle syntax system, there are still many differences in syntax. As a result, Oracle functions still need to rely on database experts to perform manual conversion before they can be encapsulated in the PostgreSQL database, which consumes a lot of time and manpower and prolongs the enterprise architecture upgrade cycle. Although there are various tools for migrating Oracle databases to PostgreSQL databases, most of them can only perform data migration and cannot perform function migration. Or even if function migration can be performed, the function migration fails due to incorrect object migration order during the function migration process, resulting in a low success rate for function migration.

[0048] In order to solve the above problems, the present application provides an Oracle database function migration method, device and computer-readable medium, which establishes an association relationship tree and a syntax relationship tree, specifies the function migration order and repairs the function syntax differences, automatically adapts the function syntax differences during the migration process, and automatically adapts the Oracle syntax to the PostgreSQL syntax, thereby improving the migration success rate of the function.

[0049] The following is a detailed description of an Oracle database function migration method, device, and computer-readable medium provided by the present application in conjunction with specific implementation methods.

[0050] See also Figure 1 , Figure 1 The method for migrating Oracle database functions provided in an embodiment of the present application is schematically shown. The execution subject of the method may be a server, and the method may mainly include the following steps S101 to S105.

[0051] Step S101, obtain a function in an Oracle database, and create an association tree associated with the function, where the association tree is used to display dependent objects that have an association relationship with the function.

[0052] First, obtain the functions in the Oracle database and create an association tree for the functions. The association tree reflects the associations between function objects. In this way, by creating the association tree first, it is easy to determine the migration order of the functions in the subsequent function migration process, thereby avoiding the migration failure of a function because its dependent objects have not been migrated.

[0053] Step S102, reading the original definition of the function and disassembling it to generate a grammatical relationship tree, where the grammatical relationship tree is used to represent the component structure of the function.

[0054] Read the original definition of the Oracle function and break it down into a syntax tree, which is convenient for subsequent syntax conversion. Based on the syntax tree, repair the differences between different database functions.

[0055] Step S103, subjecting the syntax relationship tree to syntax conversion and function object restoration to generate a function definition of a preset type database.

[0056] The purpose of converting the syntax relationship tree and restoring the function object is to generate a function definition of a preset type database, where the preset type database takes PostgreSQL as an example, that is, to convert the function in the Oracle database into a PostgreSQL function definition, so as to facilitate the subsequent migration of the function.

[0057] Step S104: Replace the same structure in the association tree with the function definition of the preset type database.

[0058] The function definition of the preset type database is replaced with the same structure in the association tree, thereby adapting the Oracle syntax to the PostgreSQL syntax.

[0059] Step S105 , reversely traverse the replaced association tree to migrate the function definitions in the association tree to a preset type database.

[0060] After obtaining the replaced association tree, the function definitions in the association tree are migrated to the PostgreSQL database in reverse order, thereby avoiding the migration failure of a function because its dependent objects are not migrated.

[0061] In the technical solution provided in the embodiment of the present application, by establishing an association relationship tree and a syntax relationship tree, the function migration order is specified and the function syntax differences are repaired respectively, the function syntax differences are automatically adapted during the migration process, and the Oracle syntax is automatically adapted to the syntax of the preset type of database, thereby improving the migration success rate of the function.

[0062] In one embodiment of the present application, see Figure 2 , Figure 2 The step flow of creating an association relationship tree associated with a function in an embodiment of the present application is schematically shown. Creating an association relationship tree associated with a function may mainly include the following steps S201 to S204.

[0063] Step S201: The function of the association tree to be created is used as the first-layer node.

[0064] For example, if you want to create an association tree for function A, use function A as the first-level node.

[0065] Step S202, obtaining the dependent object of the function, and using the dependent object of the function as the second-layer node.

[0066] After determining function A as the first-layer node, obtain the database objects it depends on, such as tables, other functions, stored procedures, etc., through JDBC connection to the source library, and use them as second-layer nodes. If the dependent objects of function A are objects A1 and A2, use objects A1 and A2 as second-layer nodes.

[0067] Step S203, traverse the second-layer nodes and determine the dependent objects of the second-layer nodes.

[0068] Next, the dependent objects of the second node are determined. If the dependent objects of object A1 are object A11 and object A12, and the dependent object of object A2 is object A22, then objects A11, A12 and A22 are used as third-layer nodes.

[0069] Step S204, traverse the nodes in the next layer of the second layer nodes and determine the dependent objects of the nodes in the next layer until there is no dependent object for the node.

[0070] Next, determine the dependent objects of the third-layer nodes, that is, determine whether objects A11, A12, and A22 have any dependent objects. If there are dependent objects, take their dependent objects as the fourth-layer nodes, and then traverse the fourth-layer nodes to determine whether the fourth-layer nodes have any dependent objects, and so on, until the node has no dependent objects.

[0071] In this way, the dependent objects of the nodes at each layer of the function are determined by traversing layer by layer, so as to facilitate the construction of a more comprehensive association relationship tree.

[0072] In order to facilitate understanding of the construction process of the association tree, in one embodiment of the present application, see Figure 3 , Figure 3The schematic diagram of the association tree in one embodiment of the present application is schematically shown. For example, take the creation of the association tree of function A as an example, first use function A as the first-level node. After determining function A as the first-level node, obtain the database objects it depends on, such as tables, other functions, stored procedures, etc., through the JDBC connection source library, and use them as the second-level nodes. If the dependent objects of function A are objects A1 and A2, then use objects A1 and A2 as the second-level nodes. Next, determine the dependent objects of the second node. If the dependent objects of object A1 are objects A11 and A12, and the dependent objects of object A2 are objects A22, then use objects A11, A12, and A22 as the third-level nodes. Next, determine the dependent objects of the third-level nodes, that is, determine whether objects A11, A12, and A22 have dependent objects. If there are dependent objects, use their dependent objects as the fourth-level nodes, and then traverse the fourth-level nodes to determine whether the fourth-level nodes have dependent objects, and so on, until there are no dependent objects at the node.

[0073] In one embodiment of the present application, see Figure 4 , Figure 4 The step flow of creating an association relationship tree associated with a function in another embodiment of the present application is schematically shown. Creating an association relationship tree associated with a function may mainly include the following steps S401 to S402.

[0074] Step S401: in the process of creating the association tree, duplicate dependent objects are marked.

[0075] Step S402: when it is found that the current node and other nodes have duplicate dependent objects, the dependent objects of the current node are no longer queried.

[0076] In order to facilitate understanding of the technical solution of the present application, the association tree of function A is taken as an example. In the process of creating the association tree, function A is used as the first-layer node, and the dependent objects of function A include object A11 and object A12. Object A11 and object A12 are used as the second-layer nodes, and the dependent objects of each layer of nodes are determined by analogy. When traversing to the point where the current node has duplicate dependent objects with other nodes, the dependent objects of the current node will no longer be queried. This means that if the dependent object of a node in another layer is object A11, the dependent objects of object A11 will no longer be queried. In this way, the association tree is prevented from entering an infinite loop query phase.

[0077] In the process of creating the association tree, it is necessary to mark the repeated dependent objects, and no more query is performed when a repeated dependent object is encountered, so as to avoid the association tree from forming an infinite loop. Similarly, for other functions, the association tree of all functions to be migrated is generated in this way.

[0078] In one embodiment of the present application, see Figure 5 , Figure 5 The step flow of creating an association relationship tree associated with a function in another embodiment of the present application is schematically shown. Creating an association relationship tree associated with a function may mainly include the following steps S501 to S502.

[0079] Step S501, deleting duplicate functions or duplicate nodes in the association tree to simplify the association tree;

[0080] Step S502: save the simplified association tree in a cache area of ​​the database.

[0081] After obtaining the association trees of all functions to be migrated, it is necessary to simplify all association trees and delete some association trees or duplicate nodes. For example, if the association tree with the vertex of function A has function B in its node, then delete the association tree with function B as the vertex; in another case, if the association tree with the vertex of function A and the association tree with the vertex of function B both have node C table, then remove the node C table and the dependent subsequent nodes in the association tree with the vertex of function B.

[0082] In the process of generating the association relationship tree of the function, by simplifying the generated association relationship tree, there is no cross node between the association relationship trees, thus simplifying the association relationship tree and reducing the migration cost.

[0083] In one embodiment of the present application, since there is a set in the code and there is no duplicate data in the set, in the process of simplifying the association tree, each time after a node is determined, it will first check in the set whether the node already exists. If it already exists, it will not continue to traverse downwards. If the node does not exist, it will continue to traverse downwards following this object.

[0084] In one embodiment of the present application, see Figure 6 , Figure 6 The process of reading the original definition of a function and disassembling it to generate a grammar relationship tree in an embodiment of the present application is schematically shown. The process of reading the original definition of a function and disassembling it to generate a grammar relationship tree may mainly include the following steps S601 to S603.

[0085] Step S601, scanning the structure of the function to read the original definition of the function.

[0086] The first step is to perform a structure scan to read the original definition of the Oracle function. Taking one of the functions to be migrated as an example, for example, function A, the original definition is first extracted from the Oracle database, and the structure of function A is scanned to read the original definition of function A.

[0087] Step S602: merge the function structures into an identification array according to preset rules. The identification array includes at least the function name, parameter declaration and function body.

[0088] Next, the structure of function A is merged into a function A identification array according to a predetermined rule. In the identification array, identification is saved according to the granularity of function name, parameter declaration, function body, keyword, system function call, etc.

[0089] Step S603 , decomposing the identification array layer by layer until the minimum granularity is reached to generate a syntax relationship tree, wherein the minimum granularity is the minimum refinement level of the data in the database.

[0090] The function A flag array is disassembled layer by layer until it cannot be disassembled any more, so as to form a grammar relationship tree.

[0091] In this way, since the characteristic of the abstract syntax relation tree is that it does not depend on the specific syntax, any heterogeneous migration can be achieved as long as the same syntax tree structure is constructed during syntax analysis. By constructing the syntax relation tree, it is easy to achieve any heterogeneous migration.

[0092] In one embodiment of the present application, see Figure 7 , Figure 7 The schematic diagram shows the steps of disassembling the identification array layer by layer until the minimum granularity is reached in one embodiment of the present application. Disassembling the identification array layer by layer until the minimum granularity is reached can mainly include the following steps S701 to S704.

[0093] Step S701, taking the function name in the identification array as the first-level child node;

[0094] Step S702, taking the parameter declaration and function body in the identification array as the second-level child nodes;

[0095] Step S703, decomposing the parameter declaration into syntax and data types, and decomposing the function body into function expressions and return domain objects, to obtain the third-level child nodes;

[0096] Step S704: Decompose the third-layer child nodes until the minimum refinement level is reached.

[0097] See also Figure 8 , Figure 8A schematic diagram of a syntax relationship tree in an embodiment of the present application is schematically shown. First, the function name becomes the top-level node, that is, as a first-level child node. Then, the parameter declaration and the function body become the next-level node, that is, the second-level child node. Then the parameter declaration continues to be disassembled into third-level nodes such as declaration syntax and data types, and data types such as parameter types; the function body will be disassembled into third-level nodes such as expressions and return domain objects; the function expression will continue to be disassembled to form the fourth-level nodes of the tree according to keywords, syntax, system functions, and calling objects; the system functions and calling objects in the expression will continue to be disassembled into fifth-level nodes. For example, when the calling object is a system function, it can be disassembled into system function names, function parameters and other granularities. Continue to disassemble in this order until it cannot be disassembled.

[0098] In this way, after the function is decomposed into a relationship tree, the nodes of the tree are matched, the granularity is smaller, and the conversion is more accurate. At the same time, the association relationship tree is used to realize the linkage migration of multiple function structures, thereby improving the migration efficiency and migration success rate.

[0099] In one embodiment of the present application, see Fig. 9 , Fig. 9 The schematic diagram shows the steps of converting the syntax relationship tree into syntax and restoring the function object to generate the function definition of the preset type database in one embodiment of the present application. Converting the syntax relationship tree into syntax and restoring the function object to generate the function definition of the preset type database can mainly include the following steps S901 to S902.

[0100] Step S901, traverse the nodes of the grammar relationship tree, and perform grammar conversion processing according to the node type to meet the grammar format of the preset type database.

[0101] Traversing from the top-level nodes, each node is processed differently according to the node type: for example, function name or call object name nodes need to be lowercase, parameter data type nodes need to be replaced, Oracle function function nodes need to replace function names, parameter nodes will have left and right nodes swapped due to the replacement of function function nodes; keyword nodes will be replaced with keywords in PostgreSQL, etc.

[0102] Step S902, restoring the syntax relationship tree after syntax conversion into the function definition form of the preset type database to generate the function definition of the preset type database.

[0103] In this way, it is easy to automatically adapt the Oracle syntax to the syntax of the preset type of database, thereby improving the success rate of function migration.

[0104] In one embodiment of the present application, see Fig.10 , Fig.10 The exemplary system architecture block diagram of the technical solution of the present application is schematically shown. The system architecture includes: an association tree generation module 1001, an Oracle-side extraction module 1002, a PostgreSQL-side loading module 1003, and a syntax relationship tree generation module 1004. Among them, the association tree generation module 1001 is used to organize the calling relationships between functions and the calling relationships between functions and other types of objects; the Oracle-side extraction module 1002 is used to extract the original definition of the Oracle function; the PostgreSQL-side loading module 1003 is used to load the conversion definition of the Oracle function according to the association tree and obtain part of the PostgreSQL database information; the syntax relationship tree generation module 1004 is used to disassemble the original definition of the Oracle function, generate a syntax relationship tree, and replace the nodes in the syntax relationship tree; restore the syntax relationship tree to a function definition, and fill the function definition into the association tree.

[0105] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0106] The following introduces an embodiment of the device of the present application, which can be used to execute the Oracle database function migration method in the above embodiment of the present application. Fig.11 The structure diagram of the Oracle database function migration device provided in the embodiment of the present application is schematically shown. Fig.11 As shown, an Oracle database function migration device, the migration device 1100 includes:

[0107] The acquisition module 1101 is used to acquire the function in the Oracle database and create an association tree associated with the function, where the association tree is used to display dependent objects that have an association relationship with the function;

[0108] The first generating module 1102 is used to read the original definition of the function and disassemble it to generate a syntax relationship tree, and the syntax relationship tree is used to represent the component structure of the function;

[0109] The second generation module 1103 is used to perform syntax conversion and function object restoration on the syntax relationship tree to generate a function definition of a preset type database;

[0110] A replacement module 1104 is used to replace the function definition of the preset type database with the same structure in the association relationship tree;

[0111] The migration module 1105 is used to reversely traverse the replaced association tree to migrate the function definitions in the association tree to a preset type database.

[0112] In some embodiments of the present application, based on the above technical solution, the acquisition module 1101 is also used to use the function of the association tree to be created as the first-level node; obtain the dependent object of the function, and use the dependent object of the function as the second-level node; traverse the second-level nodes and determine the dependent objects of the second-level nodes; traverse the next level of nodes of the second-level nodes and determine the dependent objects of the next level nodes, until there is no dependent object for the node.

[0113] In some embodiments of the present application, based on the above technical solution, the acquisition module 1101 is also used to mark repeated dependent objects in the process of creating an association tree; when traversing to the point where the current node and other nodes have repeated dependent objects, the dependent objects of the current node are no longer queried.

[0114] In some embodiments of the present application, based on the above technical solution, the acquisition module 1101 is also used to delete repeated functions or repeated nodes in the association relationship tree to simplify the association relationship tree; and save the simplified association relationship tree in a cache area of ​​the database.

[0115] In some embodiments of the present application, based on the above technical solution, the first generation module 1102 is also used to scan the structure of the function to read the original definition of the function; merge the structure of the function into an identification array according to preset rules, and the identification array includes at least the function name, parameter declaration and function body; and decompose the identification array layer by layer until the minimum granularity is reached to generate a grammatical relationship tree, wherein the minimum granularity is the minimum level of refinement of the data in the database.

[0116] In some embodiments of the present application, based on the above technical solution, the first generation module 1102 is also used to use the function name in the identification array as the first-level child node; use the parameter declaration and the function body in the identification array as the second-level child node; decompose the parameter declaration into syntax and data type, and decompose the function body into function expression and return domain object to obtain the third-level child node; decompose the third-level child node until the minimum refinement level is reached.

[0117] In some embodiments of the present application, based on the above technical solution, the second generation module 1103 is also used to traverse the nodes of the grammatical relationship tree, and perform grammatical conversion processing according to the node type to meet the grammatical format of the preset type database; restore the grammatical relationship tree after grammatical conversion into the function definition form of the preset type database to generate the function definition of the preset type database.

[0118] The specific details of the Oracle database function migration device provided in each embodiment of the present application have been described in detail in the corresponding method embodiments and will not be repeated here.

[0119] Fig.12 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.

[0120] It should be noted that Fig.12 The computer system 1200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0121] like Fig.12 As shown, the computer system 1200 includes a central processing unit 1201 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1202 (ROM) or the program loaded from the storage part 1208 to the random access memory 1703 (RAM). Various programs and data required for system operation are also stored in the random access memory 1203. The central processing unit 1201, the read-only memory 1202 and the random access memory 1203 are connected to each other through a bus 1204. The input / output interface 1205 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1204.

[0122] The following components are connected to the input / output interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the input / output interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0123] In particular, according to an embodiment of the present application, the process described in the method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1209, and / or installed from the removable medium 1211. When the computer program is executed by the central processor 1201, various functions defined in the system of the present application are executed.

[0124] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0125] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0126] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0127] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0128] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.

[0129] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. An Oracle database function migration method, characterized in that: The method comprises: Obtain a function in an Oracle database, and create an association tree associated with the function, wherein the association tree is used to display dependent objects that have an association relationship with the function; Reading the original definition of the function and disassembling it to generate a grammatical relationship tree, wherein the grammatical relationship tree is used to represent the component structure of the function; The grammatical relationship tree is subjected to grammatical conversion and function object restoration to generate a function definition of a preset type database; Replace the same structure in the association tree with the function definition of the preset type database; The replaced association tree is traversed in reverse order to migrate the function definitions in the association tree to a preset type database.

2. The Oracle database function migration method according to claim 1, characterized in that: The creating an association relationship tree associated with the function comprises: The function of the association tree to be created is used as the first-level node; Obtaining a dependent object of the function, and using the dependent object of the function as a second-layer node; Traversing the second-layer nodes and determining dependent objects of the second-layer nodes; The nodes in the next layer of the second layer nodes are traversed and dependent objects of the nodes in the next layer are determined until there is no dependent object for the node.

3. The Oracle database function migration method according to claim 2, characterized in that: The creating an association relationship tree associated with the function further includes: In the process of creating the association relationship tree, repeated dependent objects are marked; When the traversal finds that the current node has duplicate dependent objects with other nodes, the query for the dependent objects of the current node will no longer continue.

4. The Oracle database function migration method according to claim 2, characterized in that: The creating an association relationship tree associated with the function further includes: Deleting duplicate functions or duplicate nodes in the association relationship tree to simplify the association relationship tree; The simplified association relationship tree is stored in a cache area of ​​the database.

5. The Oracle database function migration method according to claim 1, characterized in that: The reading and disassembling of the original definition of the function to generate a syntax relationship tree includes: Scanning the structure of the function to read the original definition of the function; Merging the structures of the functions into an identification array according to a preset rule, wherein the identification array includes at least a function name, a parameter declaration, and a function body; The identification array is disassembled layer by layer until the minimum granularity is reached to generate the grammatical relationship tree, wherein the minimum granularity is the minimum refinement level of the data in the database.

6. The Oracle database function migration method according to claim 5, characterized in that: The step of disassembling the identification array layer by layer until the minimum granularity is reached includes: Use the function name in the identification array as the first-level child node; Using the parameter declaration in the identification array and the function body as the second-level child nodes; Decomposing the parameter declaration into syntax and data types, and decomposing the function body into function expressions and return domain objects, to obtain third-layer child nodes; The third-layer child nodes are disassembled until a minimum refinement level is reached.

7. The Oracle database function migration method according to claim 1, characterized in that: The syntax relationship tree is subjected to syntax conversion and function object restoration to generate a function definition of a preset type database, including: Traversing the nodes of the grammatical relationship tree, and performing grammatical conversion processing according to the node type to meet the grammatical format of the preset type database; The grammatical relationship tree after grammatical conversion is restored to the function definition form of the preset type database to generate the function definition of the preset type database.

8. An Oracle database function migration device, characterized in that: The device comprises: An acquisition module is used to acquire a function in an Oracle database and create an association tree associated with the function, wherein the association tree is used to display dependent objects that have an association relationship with the function; A first generating module, used for reading the original definition of the function and disassembling it to generate a grammatical relationship tree, wherein the grammatical relationship tree is used for representing the component structure of the function; A second generation module is used to perform syntax conversion and function object restoration on the syntax relationship tree to generate a function definition of a preset type database; A replacement module, used to replace the function definition of the preset type database with the same structure in the association relationship tree; The migration module is used to reversely traverse the replaced association tree to migrate the function definitions in the association tree to a preset type database.

9. A computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the Oracle database function migration method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the Oracle database function migration method described in any one of claims 1 to 7 by executing the executable instructions.