Movatterモバイル変換


[0]ホーム

URL:


CN113986885A - Oracle database function migration method and device - Google Patents

Oracle database function migration method and device
Download PDF

Info

Publication number
CN113986885A
CN113986885ACN202111321884.7ACN202111321884ACN113986885ACN 113986885 ACN113986885 ACN 113986885ACN 202111321884 ACN202111321884 ACN 202111321884ACN 113986885 ACN113986885 ACN 113986885A
Authority
CN
China
Prior art keywords
function
tree
database
relation tree
syntax
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111321884.7A
Other languages
Chinese (zh)
Other versions
CN113986885B (en
Inventor
游伟
林航
方翔飞
郭秋芬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp LtdfiledCriticalChina Telecom Corp Ltd
Priority to CN202111321884.7ApriorityCriticalpatent/CN113986885B/en
Publication of CN113986885ApublicationCriticalpatent/CN113986885A/en
Application grantedgrantedCritical
Publication of CN113986885BpublicationCriticalpatent/CN113986885B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The application belongs to the technical field of databases, and particularly relates to a function migration method and device for an Oracle database. The method comprises the steps of obtaining a function in an Oracle database, and creating an incidence relation tree associated with the function; reading the original definition of the function and disassembling the original definition of the function to generate a grammatical relation tree; the syntax relation tree is subjected to syntax conversion and function object reduction to generate a function definition of a preset type database; replacing the same structure in the incidence relation tree with the function definition of the preset type database; and reversely traversing the replaced incidence relation tree to transfer the function definition in the incidence relation tree to a preset type database. In this way, the incidence relation tree and the grammar relation tree are established, the function migration sequence and the function grammar difference are respectively appointed, the function grammar difference is automatically adapted in the migration process, the Oracle grammar is automatically adapted to the grammar of the preset type database, and therefore the migration success rate of the function is improved.

Description

Oracle database function migration method and device
Technical Field
The application belongs to the technical field of databases, and particularly relates to a function migration method and device for an Oracle database.
Background
With the development of database management systems, various database products which are mature, stable and applied to different business scenes are produced. Application systems built by early enterprises all adopt a traditional application architecture and use an Oracle database. With the popularization of the internet and the expansion of the business scale or the change of the business scene, the maintenance cost of the traditional architecture and the Oracle database is increased year by year, and the investment is not in direct proportion to the return. Enterprises try to realize the conversion from the traditional architecture to the internet architecture by replacing the Oracle database with the PostgreSQL database so as to reduce the high maintenance cost brought by the Oracle database.
However, in the process of migrating the Oracle database to the PostgreSQL database, most of the existing migration methods are only capable of performing data migration and are not capable of performing function migration, and even if function migration is possible, the success rate of function migration is low.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present application and therefore may include information that does not constitute prior art known to a person of ordinary skill in the art.
Disclosure of Invention
The application aims to provide a method and a device for migrating Oracle database functions, which improve the migration success rate of the functions to a certain extent.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided an Oracle database function migration method, including:
acquiring a function in an Oracle database, and creating an incidence relation tree associated with the function, wherein the incidence relation tree is used for displaying a dependent object having incidence relation with the function;
reading the original definition of the function and disassembling the original definition of the function to generate a syntax relation tree, wherein the syntax relation tree is used for representing the composition structure of the function;
the syntax relation tree is subjected to syntax conversion and function object reduction to generate a function definition of a preset type database;
replacing the same structure in the incidence relation tree with the function definition of the preset type database;
and reversely traversing the replaced incidence relation tree to transfer the function definition in the incidence relation tree to a preset type database.
According to an aspect of an embodiment of the present application, there is provided an Oracle database function migration apparatus, including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a function in an Oracle database and creating an incidence relation tree associated with the function, and the incidence relation tree is used for displaying a dependent object having incidence relation with the function;
the first generation module is used for reading the original definition of the function and disassembling the original definition of the function so as to generate a syntax relation tree, and the syntax relation tree is used for representing the composition structure of the function;
the second generation module is used for carrying out grammar conversion and function object reduction on the grammar relation tree so as to generate a function definition of a preset type database;
the replacing module is used for replacing the same structure in the incidence relation tree with the function definition of the preset type database;
and the migration module is used for reversely traversing the replaced incidence relation tree so as to migrate the function definition in the incidence relation tree to a preset type database.
In some embodiments of the present application, based on the above technical solution, the obtaining module is further configured to take a function of an association relation tree to be created as a first-level node; acquiring a dependent object of the function, and taking the dependent object of the function as a second layer node; traversing the second-layer node, and determining a dependent object of the second-layer node; and traversing the next layer of nodes of the second layer of nodes and determining the dependent objects of the next layer of nodes until the nodes have no dependent objects.
In some embodiments of the present application, based on the above technical solution, the obtaining module is further configured to mark a repeated dependent object in a process of creating the association relation tree; when the current node is traversed to have repeated dependent objects with other nodes, the dependent objects of the current node are not continuously inquired.
In some embodiments of the present application, based on the above technical solution, the obtaining module is further configured to delete a repetition function or a repetition node in the association relation tree to simplify the association relation tree; and storing the simplified association relation tree in a cache region of a database.
In some embodiments of the present application, based on the above technical solution, the first generating module is further configured to scan a structure of the function to read an original definition of the function; merging the structures of the functions into an identification array according to a preset rule, wherein the identification array at least comprises a function name, a parameter statement and a function body; and the identification array is disassembled layer by layer until the minimum granularity is reached so as to generate the syntactic relation tree, wherein the minimum granularity is the minimum refinement level of the data in the database.
In some embodiments of the present application, based on the above technical solution, the first generating module is further configured to use the function name in the identification array as a first-layer child node; taking the parameter declaration in the identification array and the function body as a second layer of child nodes; decomposing the parameter statement into grammar and data types, decomposing the function body into a function expression and returning to a domain object to obtain a third layer of child nodes; and disassembling the third layer of child nodes until the minimum refinement level is reached.
In some embodiments of the present application, based on the above technical solution, the second generating module is further configured to traverse nodes of the syntax relationship tree, and perform syntax conversion processing according to the node types to satisfy a syntax format of a preset type database; and restoring the grammar relation tree after grammar conversion into a function definition form of a preset type database so as to generate a function definition of the preset type database.
According to an aspect of the embodiments of the present application, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the Oracle database function migration method as in the above technical solution.
According to an aspect of an embodiment of the present application, there is provided an electronic apparatus including: 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 as in the above technical solution via executing the executable instructions.
According to an aspect of embodiments herein, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the 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 as in the above technical solution.
According to the technical scheme provided by the embodiment of the application, the association relation tree and the grammar relation tree are established, the function migration sequence and the function grammar difference are respectively appointed, the function grammar difference is automatically adapted in the migration process, the Oracle grammar is automatically adapted to the grammar of the preset type database, and therefore the migration success rate of the function is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 schematically shows a flow of steps of a method for migrating an Oracle database function according to an embodiment of the present application.
Fig. 2 schematically shows a flow of steps for creating an association tree associated with a function in an embodiment of the present application.
Fig. 3 schematically shows a schematic diagram of an association relation tree in an embodiment of the present application.
Fig. 4 schematically shows a flow of steps for creating an association tree associated with a function in another embodiment of the present application.
FIG. 5 schematically shows a flowchart of steps for creating an association tree associated with a function in yet another embodiment of the present application.
Fig. 6 schematically shows a flow of steps of reading an original definition of a function and performing parsing to generate a syntax relation tree in an embodiment of the present application.
Fig. 7 schematically shows a flow of steps of performing layer-by-layer parsing on the identifier array until the minimum granularity is reached in an embodiment of the present application.
Fig. 8 schematically shows a diagram of a syntax relation tree in an embodiment of the present application.
Fig. 9 schematically shows a flow of steps of performing syntax transformation and function object restoration on the syntax relation tree to generate a function definition of the preset type database in an embodiment of the present application.
Fig. 10 schematically shows an exemplary system architecture block diagram to which the technical solution of the present application is applied.
Fig. 11 schematically shows a block diagram of a structure of an Oracle database function migration apparatus according to an embodiment of the present application.
FIG. 12 schematically illustrates a block diagram of a computer system suitable for use in implementing an electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
In migrating an Oracle database to a PostgreSQL database, although PostgreSQL is also designed to be compatible with the Oracle syntax system, there are still many differences in syntax. This results in that the Oracle function still needs to be manually transformed by a database expert to be packaged into the PostgreSQL database, which consumes a lot of time and manpower, and prolongs the upgrade period of the enterprise architecture. Although the tools of the Oracle database migration PostgreSQL database are various, the data migration can be performed, and the function migration cannot be performed in many cases. Or even if function migration can be performed, the problem of function migration failure is caused due to incorrect object migration sequence in the function migration process, so that the success rate of function migration is low.
In order to solve the above problems, the present application provides a method, an apparatus, and a computer readable medium for function migration of an Oracle database, which implement improving the migration success rate of functions by establishing an association relation tree and a syntax relation tree, specifying a function migration sequence and repairing a function syntax difference, automatically adapting the function syntax difference in the migration process, and automatically adapting the Oracle syntax to a PostgreSQL syntax.
The following describes in detail an Oracle database function migration method, apparatus, and computer readable medium provided by the present application with reference to specific embodiments.
Referring to fig. 1, fig. 1 schematically shows a flow of steps of a method for migrating an Oracle database function according to an embodiment of the present application. The execution subject of the method may be a server, and the method may mainly include steps S101 to S105 as follows.
Step S101, acquiring a function in an Oracle database, and creating an incidence relation tree associated with the function, wherein the incidence relation tree is used for displaying a dependent object having an incidence relation with the function.
First, the function in the Oracle database is obtained, and an incidence relation tree of the function is created. The incidence relation between the function objects is reflected through the incidence relation tree. Therefore, the incidence relation tree is created firstly, so that the migration sequence of the functions can be conveniently determined in the function migration process, and the migration failure of a certain function due to the fact that the dependent object of the function is not migrated is avoided.
Step S102, reading the original definition of the function and disassembling the original definition of the function to generate a syntax relation tree, wherein the syntax relation tree is used for representing the composition structure of the function.
Reading the original definition of the Oracle function and decomposing the Oracle function into a syntax relation tree, so that the subsequent syntax conversion is convenient. And performing difference repair between different database functions based on the syntax relation tree.
And step S103, carrying out grammar conversion and function object reduction on the grammar relation tree to generate a function definition of the preset type database.
The syntax relation tree is subjected to syntax conversion and function object restoration to generate a function definition of a preset type database, wherein the preset type database is a PostgreSQL database as an example. I.e. converting functions in the Oracle database into PostgreSQL function definitions, thereby facilitating migration of subsequent functions.
And step S104, replacing the same structure in the association relation tree with the function definition of the preset type database.
And replacing the same structure in the incidence relation tree by the function definition of the preset type database, so that the Oracle syntax is adapted to the PostgreSQL syntax.
And step S105, reversely traversing the replaced incidence relation tree to transfer the function definition in the incidence relation tree to a preset type database.
After the replaced incidence relation tree is obtained, the function definitions in the incidence relation tree are migrated to the PostgreSQL database according to the reverse order, so that migration failure of a certain function due to the fact that a dependent object of the function is not migrated is avoided.
According to the technical scheme provided by the embodiment of the application, the association relation tree and the grammar relation tree are established, the function migration sequence and the function grammar difference are respectively appointed, the function grammar difference is automatically adapted in the migration process, the Oracle grammar is automatically adapted to the grammar of the preset type database, and therefore the migration success rate of the function is improved.
In one embodiment of the present application, referring to fig. 2, fig. 2 schematically shows a flow of steps for creating an association tree associated with a function in an embodiment of the present application. Creating the association relation tree associated with the function mainly includes steps S201 to S204 as follows.
Step S201, using a function of the association relation tree to be created as a first-level node.
For example, if an association relation tree of function a is to be created, function a is taken as a first-level node.
Step S202, obtaining the dependent object of the function, and taking the dependent object of the function as a second layer node.
After determining the function A as a first-layer node, connecting the JDBC to the source library to obtain database objects such as tables, other functions, stored procedures and the like which depend on the function A, and taking the database objects as a second-layer node, wherein if the dependent objects of the function A are an object A1 and an object A2, an object A1 and an object A2 are taken as the second-layer node.
Step S203, traversing the second layer node, and determining the dependent object of the second layer node.
Next, the dependent objects of the second node are determined, and if the dependent objects of the object A1 are the object A11 and the object A12, and the dependent object of the object A2 is the object A22, the object A11, the object A12, and the object A22 are used as the third level nodes.
And step S204, traversing the next layer node of the second layer node and determining the dependent object of the next layer node until the node has no dependent object.
Next, the dependent objects of the third level node are determined, i.e., whether object A11, object A12, and object A22 have dependent objects. And if the dependent objects exist, taking the dependent objects as nodes of a fourth layer, then traversing the nodes of the fourth layer, determining whether the nodes of the fourth layer have the dependent objects, and so on until the nodes do not have the dependent objects.
Therefore, the dependent objects of the nodes of each layer of the function are determined in a layer-by-layer traversal mode, and a relatively comprehensive incidence relation tree is conveniently constructed.
In order to facilitate understanding of the construction process of the association relation tree, in an embodiment of the present application, referring to fig. 3, fig. 3 schematically illustrates a schematic diagram of the association relation tree in an embodiment of the present application. For example, taking the creation of the association relation tree of the function a as an example, the function a is first used as a first-level node. After determining the function A as a first-layer node, connecting the JDBC to the source library to obtain database objects such as tables, other functions, stored procedures and the like which depend on the function A, and taking the database objects as a second-layer node, wherein if the dependent objects of the function A are an object A1 and an object A2, an object A1 and an object A2 are taken as the second-layer node. Next, the dependent objects of the second node are determined, and if the dependent objects of the object A1 are the object A11 and the object A12, and the dependent object of the object A2 is the object A22, the object A11, the object A12, and the object A22 are used as the third level nodes. Next, the dependent objects of the third level node are determined, i.e., whether object A11, object A12, and object A22 have dependent objects. And if the dependent objects exist, taking the dependent objects as nodes of a fourth layer, then traversing the nodes of the fourth layer, determining whether the nodes of the fourth layer have the dependent objects, and so on until the nodes do not have the dependent objects.
In one embodiment of the present application, referring to fig. 4, fig. 4 schematically shows a flow of steps for creating an association tree associated with a function in another embodiment of the present application. Creating the association relation tree associated with the function may mainly include steps S401 to S402 as follows.
Step S401, in the process of creating the association relation tree, marking the repeated dependent objects.
In step S402, when the current node is traversed to have repeated dependent objects with other nodes, the dependent object of the current node is not queried any more.
In order to facilitate understanding of the technical solution of the present application, taking the association relation tree of the function a as an example, in the process of creating the association relation tree, taking the function a as a first-layer node, and the dependent object of the function a includes the object a11 and the object a12, the object a11 and the object a12 as a second-layer node, and so on to determine the dependent object of each layer of nodes. When the current node and other nodes are traversed to have repeated dependent objects, the dependent object of the current node is not continuously queried, which means that if the dependent object of a certain node in other layers is the object A11, the dependent object of the object A11 is not continuously queried. In this way, the association tree is prevented from performing the query phase of the dead loop.
In the process of creating the association relation tree, repeated dependent objects need to be marked, and when the repeated dependent objects are encountered, query is not carried out any more, so that the association relation tree is prevented from forming dead loops. Similarly, all function association relation trees to be migrated are generated for other functions in the same way.
In one embodiment of the present application, referring to fig. 5, fig. 5 schematically shows a flow of steps for creating an association tree associated with a function in yet another embodiment of the present application. Creating the association relation tree associated with the function may mainly include steps S501 to S502 as follows.
Step S501, deleting repeated functions or repeated nodes in the association relation tree to simplify the association relation tree;
step S502, the simplified association relation tree is stored in a cache region of the database.
After obtaining the association relation trees of all the functions to be migrated, all the association relation trees need to be simplified, and part of the association relation trees or repeated nodes need to be deleted. For example, the association relation tree whose vertex is the function a, if the node of the association relation tree has the function B, the association relation tree whose vertex is the function B is deleted; in another case, if the association tree whose vertex is the a function and the association tree whose vertex is the B function both have the node C table, the node C table and the dependent subsequent nodes in the association tree whose vertex is the B function are removed.
In the process of generating the incidence relation tree of the function, the generated incidence relation tree is simplified, so that no cross node exists among the incidence relation trees, and the incidence relation trees are simplified, so that the migration cost is reduced.
In one embodiment of the present application, since there is a collection within the code, there is no duplicate data in the collection. In the process of simplifying the association relation tree, after a node is determined, the node is firstly found in the set to find whether the node exists, if so, the downward traversal is not continued, and if not, the object is followed to traverse downward.
In one embodiment of the present application, referring to fig. 6, fig. 6 schematically shows a flow of steps of reading an original definition of a function and performing parsing to generate a syntax relation tree in an embodiment of the present application. Reading the original definition of the function and performing parsing to generate the syntax relation tree, which mainly includes the following steps S601 to S603.
Step S601, scan the structure of the function to read the original definition of the function.
In the first step, a structure scan is performed to read the original definition of the Oracle function. Taking one of the functions to be migrated as an example, for example, the function a, the original definition is extracted from the Oracle database, and the structure of the function a is scanned first to read the original definition of the function a.
Step S602, merging the structures of the functions into an identification array according to a preset rule, wherein the identification array at least comprises a function name, a parameter statement and a function body.
Then, the structures of the functions A are combined into a function A identification array according to a preset rule. And in the identification array, identification storage is carried out according to the granularity of function names, parameter declarations, function bodies, keywords, system function calls and the like.
Step S603, performing layer-by-layer parsing on the identifier array until a minimum granularity is reached, so as to generate a syntax relation tree, where the minimum granularity is a minimum refinement level of data in the database.
And (4) carrying out layer-by-layer disassembly on the function A mark array until the function A mark array cannot be disassembled at last so as to form a grammatical relation tree.
Therefore, the abstract syntax relation tree is not dependent on concrete syntax, and any heterogeneous migration can be realized as long as the same syntax tree structure is constructed during syntax analysis. And the method is convenient to realize the migration of any isomerism by constructing the syntax relation tree.
In an embodiment of the present application, referring to fig. 7, fig. 7 schematically illustrates a flow of steps of performing layer-by-layer disassembly on an identifier array until a minimum granularity is reached in an embodiment of the present application. The tag array is disassembled layer by layer until the minimum granularity is reached, which mainly includes the following steps S701 to S704.
Step S701, taking the function name in the identification array as a first-layer child node;
step S702, taking the parameter declaration and the function body in the identification array as the second layer of child nodes;
step S703, disassembling the parameter declaration into grammar and data type, and disassembling the function body into function expression and return domain object, to obtain the third layer child node;
and step S704, disassembling the third-layer child node until the minimum refinement level is reached.
Referring to fig. 8, fig. 8 schematically shows a schematic diagram of a syntax relation tree in an embodiment of the present application. First the function name becomes the top level node, i.e. as the first level child node. Then, the parameter declaration and the function body are changed into a next layer node, namely a second layer child node. Then, continuously disassembling the parameter declaration into third-layer nodes such as declaration grammar and data types, wherein the data types are parameter types; the function body can be decomposed into third-layer nodes such as expressions and return domain objects; the function expression can be continuously disassembled, and a fourth layer node of the tree is formed according to keywords, grammar, system functions and calling objects; the system function and the calling object in the expression can continue to be disassembled into the fifth-layer node, for example, when the calling object is a system function, the system function and the calling object can be disassembled into the granularity of the system function name, the function parameter and the like. The disassembly is continued in this order until finally impossible.
Therefore, after the function is disassembled into the relation tree, the nodes of the tree are matched, the granularity is smaller, the conversion is more accurate, a plurality of function structures are linked and migrated by matching with the incidence relation tree, and the migration efficiency and the migration success rate are improved.
In an embodiment of the present application, referring to fig. 9, fig. 9 schematically shows a flow of steps of subjecting a syntax relation tree to syntax transformation and function object reduction to generate a function definition of a preset type database in an embodiment of the present application. The syntax relation tree is subjected to syntax conversion and function object reduction to generate a function definition of the preset type database, and the following steps S901 to S902 may be mainly included.
Step S901, traverse nodes of the syntax relation tree, and perform syntax conversion processing according to node types to satisfy syntax formats of the preset type database.
Traversing from the node at the top layer, and performing different processing on each node according to different node types: for example, the function name or calling object name node needs to be subjected to lower case processing, the parameter data type node needs to be replaced, the Oracle function node needs to replace the function name, and the parameter node can be subjected to left and right node replacement due to the replacement of the function node; the key node is changed to a key in PostgreSQL, etc.
And step S902, restoring the grammar relation tree after grammar conversion into a function definition form of a preset type database so as to generate a function definition of the preset type database.
Therefore, the Oracle grammar can be automatically adapted to the grammar of the preset type database conveniently, and the migration success rate of the function is improved.
In one embodiment of the present application, referring to fig. 10, fig. 10 schematically shows an exemplary system architecture block diagram to which the present solution is applied. The system architecture includes: an incidence relationtree generating module 1001, an Oracleside extracting module 1002, a PostgreSQLside loading module 1003 and a syntax relationtree generating module 1004. The incidence relationtree generating module 1001 is configured to sort call relations between functions and between functions, and call relations between functions and other types of objects; the Oracle-side extraction module 1002 is used for extracting original definitions of Oracle functions; the postgreSQLend loading module 1003 is used for loading the conversion definition of the Oracle function according to the incidence relation tree and acquiring part of postgreSQL database information; the syntax relationtree generating module 1004 is used for disassembling the original definition of the Oracle function, generating a syntax relation tree and replacing nodes in the syntax relation tree; and restoring the syntax relation tree into function definitions, and filling the function definitions into the association relation tree.
It should be noted that although the steps of the methods in this application are depicted in the drawings in a particular order, this does not require or imply that these steps must be performed in this particular order, or that all of the shown steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
The following describes an embodiment of an apparatus of the present application, which may be used to execute the Oracle database function migration method in the above embodiment of the present application. Fig. 11 schematically shows a block diagram of a structure of an Oracle database function migration apparatus according to an embodiment of the present application. As shown in fig. 11, an Oracle databasefunction migration apparatus 1100 includes:
an obtainingmodule 1101, configured to obtain a function in an Oracle database, and create an association relation tree associated with the function, where the association relation tree is used to display a dependent object having an association relation with the function;
afirst generating module 1102, configured to read an original definition of a function and disassemble the original definition to generate a syntax relationship tree, where the syntax relationship tree is used to represent a composition structure of the function;
asecond generating module 1103, configured to perform syntax transformation and function object reduction on the syntax relation tree to generate a function definition of the preset type database;
a replacingmodule 1104, configured to replace the same structure in the association relation tree with a function definition of a preset type database;
amigration module 1105, configured to reversely traverse the replaced incidence relation tree, so as to migrate the function definition in the incidence relation tree to the preset type database.
In some embodiments of the present application, based on the above technical solution, the obtainingmodule 1101 is further configured to take a function of an association relation tree to be created as a first-layer node; acquiring a dependent object of the function, and taking the dependent object of the function as a second layer node; traversing the second-layer nodes and determining the dependent objects of the second-layer nodes; and traversing the next level node of the second level node and determining the dependent object of the next level node until the node has no dependent object.
In some embodiments of the present application, based on the above technical solution, the obtainingmodule 1101 is further configured to mark a repeated dependent object in a process of creating an association relation tree; when the current node is traversed to have repeated dependent objects with other nodes, the dependent objects of the current node are not continuously inquired.
In some embodiments of the present application, based on the above technical solution, the obtainingmodule 1101 is further configured to delete a repeated function or a repeated node in the association relation tree to simplify the association relation tree; and storing the simplified association relation tree in a cache region of the database.
In some embodiments of the present application, based on the above technical solution, thefirst generating module 1102 is further configured to scan a structure of the function to read an original definition of the function; combining the structures of the functions into an identification array according to a preset rule, wherein the identification array at least comprises a function name, a parameter statement and a function body; and (4) the identification array is disassembled layer by layer until the minimum granularity is reached so as to generate a grammatical relation tree, wherein the minimum granularity is the minimum refinement level of the data in the database.
In some embodiments of the present application, based on the above technical solution, thefirst generating module 1102 is further configured to use the function name in the identification array as a first-layer child node; taking the parameter declaration and the function body in the identification array as a second layer of child nodes; resolving the parameter statement into a grammar and a data type, resolving the function body into a function expression and returning to a domain object to obtain a third-layer child node; and disassembling the third layer of child nodes until the minimum refinement level is reached.
In some embodiments of the present application, based on the above technical solution, thesecond generating module 1103 is further configured to traverse nodes of the syntax relationship tree, and perform syntax transformation processing according to node types to meet syntax formats of the preset type database; and restoring the grammar relation tree after grammar conversion into a function definition form of the preset type database so as to generate the function definition of the preset type database.
The specific details of the Oracle database function migration apparatus provided in each embodiment of the present application have been described in detail in the corresponding method embodiment, and are not described herein again.
Fig. 12 schematically shows a block diagram of a computer system of an electronic device for implementing an embodiment of the present application.
It should be noted that thecomputer system 1200 of the electronic device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 12, thecomputer system 1200 includes a Central Processing Unit 1201 (CPU), which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory 1202 (ROM) or a program loaded from astorage section 1208 into a Random Access Memory 1703 (RAM). In therandom access memory 1203, various programs and data necessary for system operation are also stored. Thecpu 1201, therom 1202, and theram 1203 are connected to each other by abus 1204. An Input/Output interface 1205(Input/Output interface, i.e., I/O interface) is also connected to thebus 1204.
The following components are connected to the input/output interface 1205: aninput section 1206 including a keyboard, a mouse, and the like; anoutput section 1207 including a Display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; astorage section 1208 including a hard disk and the like; and acommunication section 1209 including a network interface card such as a local area network card, a modem, or the like. Thecommunication section 1209 performs communication processing via a network such as the internet. Thedriver 1210 is also connected to the input/output interface 1205 as necessary. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on thedrive 1210 as necessary, so that a computer program read out therefrom is mounted into thestorage section 1208 as necessary.
In particular, according to embodiments of the present application, the processes described in the method flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through thecommunication section 1209, and/or installed from theremovable medium 1211. The computer program, when executed by thecentral processing unit 1201, performs various functions defined in the system of the present application.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments 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 disk, a removable 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 embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements 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 application is limited only by the appended claims.

Claims (10)

Translated fromChinese
1.一种Oracle数据库函数迁移方法,其特征在于,所述方法包括:1. an Oracle database function migration method, is characterized in that, described method comprises:获取Oracle数据库中的函数,并创建与所述函数相关联的关联关系树,所述关联关系树用于展示与函数具有关联关系的依赖对象;Obtain the function in the Oracle database, and create an association relationship tree associated with the function, and the association relationship tree is used to display the dependent object that has an associated relationship with the function;读取所述函数的原始定义并进行拆解,以生成语法关系树,所述语法关系树用于表示函数的组成结构;The original definition of the function is read and disassembled to generate a syntax relation tree, which is used to represent the composition structure of the function;将所述语法关系树经过语法转换以及函数对象还原,以生成预设类型数据库的函数定义;The grammatical relation tree is subjected to grammatical conversion and function object restoration to generate a function definition of a preset type database;将所述预设类型数据库的函数定义替换所述关联关系树中的相同结构;Replace the function definition of the preset type database with the same structure in the association tree;逆向遍历经过替换后的所述关联关系树,以将所述关联关系树中的函数定义迁移至预设类型数据库。The replaced relationship tree is traversed in reverse, so as to migrate the function definitions in the relationship tree to a preset type database.2.根据权利要求1所述的Oracle数据库函数迁移方法,其特征在于,所述创建与所述函数相关联的关联关系树,包括:2. Oracle database function migration method according to claim 1, is characterized in that, described creating the association relation tree associated with described function, comprises:将待创建关联关系树的函数作为第一层节点;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 a second-level node;遍历所述第二层节点,并确定所述第二层节点的依赖对象;Traverse the second-level nodes, and determine the dependent objects of the second-level nodes;遍历所述第二层节点的下一层节点并确定下一层节点的依赖对象,直至节点不存在依赖对象。Traverse the next-level node of the second-level node and determine the dependent object of the next-level node until the node has no dependent object.3.根据权利要求2所述的Oracle数据库函数迁移方法,其特征在于,所述创建与所述函数相关联的关联关系树,还包括:3. Oracle database function migration method according to claim 2, is characterized in that, described creating the association relation tree associated with described function, also comprises:在创建所述关联关系树的过程中,对重复的依赖对象进行标志;In the process of creating the association relationship tree, the duplicate dependent objects are marked;当遍历到当前节点与其他节点具有重复的依赖对象时,不再继续查询当前节点的依赖对象。When the traversal reaches that the current node has duplicate dependent objects with other nodes, it will not continue to query the dependent objects of the current node.4.根据权利要求2所述的Oracle数据库函数迁移方法,其特征在于,所述创建与所述函数相关联的关联关系树,还包括:4. Oracle database function migration method according to claim 2, is characterized in that, described creating the association relation tree associated with described function, also comprises:删除所述关联关系树中的重复函数或重复节点,以简化所述关联关系树;Deleting duplicate functions or duplicate nodes in the association tree to simplify the association tree;将经过简化后的所述关联关系树保存在数据库的缓存区中。The simplified association relation tree is stored in the cache area of the database.5.根据权利要求1所述的Oracle数据库函数迁移方法,其特征在于,所述读取所述函数的原始定义并进行拆解,以生成语法关系树,包括:5. Oracle database function migration method according to claim 1, is characterized in that, described reading the original definition of described function and dismantling, to generate syntax relation tree, comprising:扫描所述函数的结构,以读取所述函数的原始定义;scan the structure of the function to read the original definition of the function;将所述函数的结构按照预设规则合并成标识数组,所述标识数组中至少包括函数名、参数声明以及函数体;The structure of the function is merged into an identification array according to a preset rule, and the identification array at least includes a function name, a parameter declaration and a function body;将所述标识数组进行层层拆解直至达到最小粒度,以生成所述语法关系树,其中,所述最小粒度为数据库中数据的最小细化级别。The identification array is decomposed layer by layer until a minimum granularity is reached, so as to generate the syntax relation tree, where the minimum granularity is the minimum refinement level of data in the database.6.根据权利要求5所述的Oracle数据库函数迁移方法,其特征在于,所述将所述标识数组进行层层拆解直至达到最小粒度,包括:6. Oracle database function migration method according to claim 5, is characterized in that, described identification array is carried out layer by layer until reaching minimum granularity, comprising:将所述标识数组中的函数名作为第一层子节点;Use the function name in the identifier array as the first-level child node;将所述标识数组中的参数声明和所述函数体作为第二层子节点;Use 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 a function expression and a return domain object, to obtain a third-level child node;将所述第三层子节点进行拆解,直至达到最小细化级别。The third-layer sub-nodes are disassembled until the minimum refinement level is reached.7.根据权利要求1所述的Oracle数据库函数迁移方法,其特征在于,将所述语法关系树经过语法转换以及函数对象还原,以生成预设类型数据库的函数定义,包括:7. Oracle database function migration method according to claim 1, is characterized in that, described grammatical relation tree is through grammatical conversion and function object restoration, to generate the function definition of preset type database, comprising:遍历所述语法关系树的节点,并根据所述节点类型进行语法转换处理,以满足预设类型数据库的语法格式;Traverse the nodes of the syntax relationship tree, and perform syntax conversion processing according to the node type to meet the syntax format of the preset type database;将经过语法转换后的所述语法关系树还原成预设类型数据库的函数定义形式,以生成预设类型数据库的函数定义。The syntax relation tree after syntax conversion is restored to the function definition form of the preset type database, so as to generate the function definition of the preset type database.8.一种Oracle数据库函数迁移装置,其特征在于,所述装置包括:8. An Oracle database function migration device, wherein the device comprises:获取模块,用于获取Oracle数据库中的函数,并创建与所述函数相关联的关联关系树,所述关联关系树用于展示与函数具有关联关系的依赖对象;an acquisition module, for acquiring the function in the Oracle database, and creating an association tree associated with the function, and the association tree is used to display the dependent object that has an association with the function;第一生成模块,用于读取所述函数的原始定义并进行拆解,以生成语法关系树,所述语法关系树用于表示函数的组成结构;The first generation module is used to read the original definition of the function and disassemble it to generate a syntax relation tree, and the syntax relation tree is used to represent the composition structure of the function;第二生成模块,用于将所述语法关系树经过语法转换以及函数对象还原,以生成预设类型数据库的函数定义;The second generation module is used to convert the syntax relation tree and restore the function object to generate the function definition of the preset type database;替换模块,用于将所述预设类型数据库的函数定义替换所述关联关系树中的相同结构;A replacement module for replacing the same structure in the association tree with the function definition of the preset type database;迁移模块,用于逆向遍历经过替换后的所述关联关系树,以将所述关联关系树中的函数定义迁移至预设类型数据库。The migration module is configured to traverse the replaced relationship tree in reverse, so as to migrate the function definitions in the relationship tree to a preset type database.9.一种计算机可读介质,其上存储有计算机程序,该计算机程序被处理器执行时实现权利要求1至7中任意一项所述的Oracle数据库函数迁移方法。9 . A computer-readable medium on which a computer program is stored, and when the computer program is executed by a processor, implements the Oracle database function migration method according to any one of claims 1 to 7 .10.一种电子设备,其特征在于,包括:10. An electronic device, comprising:处理器;以及processor; and存储器,用于存储所述处理器的可执行指令;a memory for storing executable instructions for the processor;其中,所述处理器配置为经由执行所述可执行指令来执行权利要求1至7中任意一项所述的Oracle数据库函数迁移方法。Wherein, the processor is configured to execute the Oracle database function migration method according to any one of claims 1 to 7 by executing the executable instructions.
CN202111321884.7A2021-11-092021-11-09 Oracle database function migration method and deviceActiveCN113986885B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111321884.7ACN113986885B (en)2021-11-092021-11-09 Oracle database function migration method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111321884.7ACN113986885B (en)2021-11-092021-11-09 Oracle database function migration method and device

Publications (2)

Publication NumberPublication Date
CN113986885Atrue CN113986885A (en)2022-01-28
CN113986885B CN113986885B (en)2024-12-24

Family

ID=79747448

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111321884.7AActiveCN113986885B (en)2021-11-092021-11-09 Oracle database function migration method and device

Country Status (1)

CountryLink
CN (1)CN113986885B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN115061796A (en)*2022-06-172022-09-16特赞(上海)信息科技有限公司Execution method and system for calling between subtasks and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2011041246A1 (en)*2009-09-302011-04-07Smartshift GmbhSystems and methods for analyzing and transforming an application from a source installation to a target installation
CN109376142A (en)*2018-09-032019-02-22中国平安人寿保险股份有限公司Data migration method and terminal device
CN118796157A (en)*2024-04-032024-10-18中国移动通信集团设计院有限公司 Database storage function generation method, device, electronic device and program product

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2011041246A1 (en)*2009-09-302011-04-07Smartshift GmbhSystems and methods for analyzing and transforming an application from a source installation to a target installation
CN109376142A (en)*2018-09-032019-02-22中国平安人寿保险股份有限公司Data migration method and terminal device
CN118796157A (en)*2024-04-032024-10-18中国移动通信集团设计院有限公司 Database storage function generation method, device, electronic device and program product

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
NIKOLAOS TSANTALIS等: "RefactoringMiner 2.0", 《IEEE TRANSACTIONS ON SOFTWARE ENGINEERING》, vol. 48, no. 3, 8 July 2020 (2020-07-08), pages 930 - 950*
姜人和;郑晓梅;朱晓倩;潘敏学;张天;: "一种基于UML关系的Java代码库构造方法", 计算机科学, no. 11, 15 November 2017 (2017-11-15), pages 75 - 85*
邓琼: "Oracle迁移到PostgreSQL改造详情", Retrieved from the Internet <URL:https://www.modb.pro/db/31503>*

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN115061796A (en)*2022-06-172022-09-16特赞(上海)信息科技有限公司Execution method and system for calling between subtasks and electronic equipment

Also Published As

Publication numberPublication date
CN113986885B (en)2024-12-24

Similar Documents

PublicationPublication DateTitle
US11461294B2 (en)System for importing data into a data repository
US20200301895A1 (en)System for analysing data relationships to support data query execution
CN102918494B (en)Data storage based on the storage of database model agnosticism, outline agnosticism and live load agnostic data and Access Model and/or search method and system
CN109491989B (en)Data processing method and device, electronic equipment and storage medium
US20160055233A1 (en)Pre-join tags for entity-relationship modeling of databases
CN117093599A (en)Unified SQL query method for heterogeneous data sources
WO2018051098A1 (en)System for data management in a large scale data repository
CN112434024B (en) Data dictionary generation method, device, equipment and medium for relational database
CN115640406A (en)Multi-source heterogeneous big data analysis processing and knowledge graph construction method
CN114880483A (en) A metadata knowledge graph construction method, storage medium and system
KR20220127443A (en)Data architecture management system
CN112817958A (en)Electric power planning data acquisition method and device and intelligent terminal
CN115203435A (en)Entity relation generation method and data query method based on knowledge graph
CN114661832A (en)Multi-mode heterogeneous data storage method and system based on data quality
CN113157978B (en)Data label establishing method and device
CN117216042A (en)Construction method and device of data standardization platform
CN116795859A (en) Data analysis methods, devices, computer equipment and storage media
Tauscher et al.A modular graph transformation rule set for IFC‐to‐CityGML conversion
CN113221528B (en) Automatic generation and execution method of clinical data quality assessment rules based on openEHR model
CN113986885B (en) Oracle database function migration method and device
CN115238103A (en)Method and device for constructing unstructured data map
CN114519071A (en)Generation method, matching method, system, device and medium of rule matching model
CN116991847A (en) A data management method, system and storage medium based on identity resolution
CN117312268A (en)Multi-source multi-library-based flow batch integrated main data management method, device and readable medium
Srai et al.MDA approach for generating the PSM model for the NoSQL key-value database, application on Redis

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp