CN116737767A - Database switching method, system, equipment and medium - Google Patents

Database switching method, system, equipment and medium Download PDF

Info

Publication number
CN116737767A
CN116737767A CN202310508934.5A CN202310508934A CN116737767A CN 116737767 A CN116737767 A CN 116737767A CN 202310508934 A CN202310508934 A CN 202310508934A CN 116737767 A CN116737767 A CN 116737767A
Authority
CN
China
Prior art keywords
database
scene
target
subcommand
command
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.)
Pending
Application number
CN202310508934.5A
Other languages
Chinese (zh)
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.)
Ping An E Wallet Electronic Commerce Co Ltd
Original Assignee
Ping An E Wallet Electronic Commerce Co 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 Ping An E Wallet Electronic Commerce Co Ltd filed Critical Ping An E Wallet Electronic Commerce Co Ltd
Priority to CN202310508934.5A priority Critical patent/CN116737767A/en
Publication of CN116737767A publication Critical patent/CN116737767A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a database switching method, a system, equipment and a medium, which relate to the field of intelligent medical treatment, and the method comprises the following steps: acquiring scene description texts of different application scenes, calling subcommands in a preset command library according to a plurality of characteristic fields in the scene description texts, and forming a subcommand set to establish association relations between the subcommand set and each application scene; determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result; and executing the operation of switching to the target database according to the processing result. The application can ensure the normal operation of the database after switching and ensure the stability of the system.

Description

Database switching method, system, equipment and medium
Technical Field
The application relates to the field of intelligent medical treatment, in particular to a database switching method, a database switching system, database switching equipment and database switching media.
Background
The most important components in the database components of the medical system at present are high-availability components, but the existing high-availability components have a plurality of inconveniences in use, the number of supportable commands is tens, the meaning of each command is required to be understood, extremely high learning cost is required, when the database is switched, the appropriate commands are required to be judged and selected according to different environments, the maintenance difficulty of the commands in different environments is high, and how to accurately and efficiently complete the database switching becomes a current problem.
Disclosure of Invention
In view of the problems in the prior art, the application provides a data path switching method, a system, equipment and a medium, which mainly solve the problems of a plurality of commands, high manual learning and maintenance cost of the existing database.
In order to achieve the above and other objects, the present application adopts the following technical scheme.
The application provides a database switching method, which comprises the following steps:
acquiring scene description texts of different application scenes, calling subcommands in a preset command library according to a plurality of characteristic fields in the scene description texts, and forming a subcommand set to establish association relations between the subcommand set and each application scene;
determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result;
and executing the operation of switching to the target database according to the processing result.
In an embodiment of the present application, before invoking the subcommand in the preset command library according to the plurality of feature fields in the scene description text, the method further includes:
generating a command label according to the category of each subcommand in the preset command library;
Word segmentation is carried out on the scene description text to obtain a plurality of scene words;
and comparing the similarity between the scene word and the command tag, and taking the scene word as a characteristic field of the corresponding scene description text if the similarity between the scene word and the command tag is larger than a preset similarity threshold.
In an embodiment of the present application, generating a command tag according to a category of each sub-command in the preset command library includes:
calling a preset command table corresponding to the preset command library, wherein the preset command table is used for recording the function description text of each subcommand;
generating functional feature vectors of all subcommands according to the functional description text, and clustering based on the functional feature vectors to obtain a plurality of clustering clusters and a clustering center of each clustering cluster;
and generating a cluster label of the corresponding cluster according to the function description text of the cluster center as a command label of the whole cluster.
In an embodiment of the present application, invoking the subcommand in the preset command library according to the plurality of feature fields in the scene description text to form a subcommand set includes:
calculating the similarity between the subcommand corresponding to the same command label in the preset command library and the feature field, and sequencing the subcommand according to the similarity to obtain a subcommand sequencing result under the same command label;
Selecting a plurality of subcommands with similarity larger than a preset threshold value as subcommands to be called in the feature field according to the subcommand sequencing result;
and sequencing the subcommands called by the feature fields according to the sequence of the feature fields in the scene description text, and generating the subcommand set.
In an embodiment of the present application, before determining the target application scenario of the target database by analyzing the database switching instruction, the method further includes:
acquiring the database use state by traversing the current database;
comparing the database use state with a preset database switching rule, and determining a target application scene according to the database switching rule matched with the database use state;
determining a target database from a plurality of standby databases according to the target application scene;
and generating a database switching instruction according to the target database and the corresponding target application scene.
In an embodiment of the present application, before determining the target application scenario according to the database switching rule matched with the database usage state, the method further includes:
and constructing database switching rules according to different application scenes to obtain a first mapping relation between the application scenes and the database switching rules, wherein the database switching rules comprise parameter thresholds of the use states of all databases, and determining the database switching rules matched with the use states of the databases based on the parameter thresholds.
In an embodiment of the present application, before determining the target database from the plurality of standby databases according to the target application scenario, the method further includes:
and constructing a second mapping relation between the standby database and the application scene, and determining a database corresponding to the application scene by calling the second mapping relation.
The application also provides a database switching system, which comprises:
the scene association module is used for acquiring scene description texts of different application scenes, calling subcommands in a preset command library according to a plurality of characteristic fields in the scene description texts, and forming a subcommand set to establish association relation between the subcommand set and each application scene;
the database processing module is used for determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result;
and the database switching module is used for executing the operation of switching to the target database according to the processing result.
The present application also provides a computer device comprising: the database switching system comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of the database switching method when executing the computer program.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of the database switching method.
As described above, the database switching method, system, device and medium provided by the application have the following beneficial effects.
According to the method, scene description texts of different application scenes are obtained, subcommands in a preset command library are called according to a plurality of characteristic fields in the scene description texts, and a subcommand set is formed to establish association relations between the subcommand set and each application scene; determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result; and executing the operation of switching to the target database according to the processing result. According to the method, the subcommand set required by database switching is automatically built based on the scene description text, the database switching is automatically completed by calling the corresponding subcommand set, an operator does not need to know the function of each subcommand, scene command configuration is automatically completed, manual participation is reduced, the efficiency of overall database switching is improved, meanwhile, the state of a target database can be checked according to a processing result, normal operation after the database switching is ensured, and the stability of a system is ensured.
Drawings
Fig. 1 is a schematic diagram of an alternative architecture of a database switching system according to an embodiment of the present application.
Fig. 2 is a schematic structural diagram of a terminal according to an embodiment of the present application.
FIG. 3 is a flowchart illustrating a database switching method according to an embodiment of the application.
FIG. 4 is a block diagram of a database switching system according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present application.
Detailed Description
Other advantages and effects of the present application will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present application with reference to specific examples. The application may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present application. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict.
It should be noted that the illustrations provided in the following embodiments merely illustrate the basic concept of the present application by way of illustration, and only the components related to the present application are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complicated.
Referring to fig. 1, fig. 1 is a schematic diagram of an alternative architecture of a database switching system according to an embodiment of the present application, where a terminal 400 (a terminal 400-1 is shown in an exemplary manner) is connected to a server 200 through a network 300, and the network 300 may be a wide area network or a local area network, or a combination of the two.
The terminal 400-1 is a business terminal, and can interact business data with a patient or a user with medical consultation requirements through the terminal 400-1. The terminal 400-1 provides a service database, and related medical data maintenance personnel can also input scene description texts of different application scenes through the terminal 400-1. The user may interact with the service system on the terminal 400-1 and the data during the interaction may be recorded in the service database. The database is switched according to different user demands to acquire service data required by the user, or when the service database usage state meets the set database switching rule, a database switching instruction is generated and uploaded to the server 200 through the network 300. The terminal 400-1 may be selected according to the traffic scenario requirements without limitation.
The server 200 is configured to receive data transmitted by the terminal 400-1, invoke subcommands in a preset command library according to a plurality of feature fields in the scene description text, form a subcommand set to establish an association relationship between the subcommand set and each application scene, determine a target application scene of a target database by analyzing a database switching instruction, and invoke an associated subcommand set to process the target database according to the target application scene and the association relationship to obtain a processing result.
In some embodiments, the server 200 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 400 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart voice interaction device, a smart home appliance, a car terminal, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, which is not limited in the embodiment of the present application.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a terminal 400-1 according to an embodiment of the present application, and the terminal 400-1 shown in fig. 2 includes: at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in terminal 400-1 are coupled together by a bus system 440. It is understood that the bus system 440 is used to enable connected communication between these components. The bus system 440 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration the various buses are labeled in fig. 2 as bus system 440.
The processor 410 may be an integrated circuit chip having signal processing capabilities such as a general purpose processor, such as a microprocessor or any conventional processor, or the like, a digital signal processor (DSP, digital Signal Processor), or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
The user interface 430 includes one or more output devices 431, including one or more speakers and/or one or more visual displays, that enable presentation of the media content. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
Memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid state memory, hard drives, optical drives, and the like. Memory 250 optionally includes one or more storage devices physically remote from processor 410.
Memory 450 includes volatile memory or nonvolatile memory, and may also include both volatile and nonvolatile memory. The nonvolatile Memory may be a Read Only Memory (ROM), and the volatile Memory may be a random access Memory (RAM, random Access Memory). The memory 450 described in embodiments of the present application is intended to comprise any suitable type of memory.
In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules and data structures, or subsets or supersets thereof, as exemplified below.
An operating system 451 including system programs, e.g., framework layer, core library layer, driver layer, etc., for handling various basic system services and performing hardware-related tasks, for implementing various basic services and handling hardware-based tasks;
network communication module 452 for reaching other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: bluetooth, wireless compatibility authentication (WiFi), and universal serial bus (USB, universal Serial Bus), etc.;
a presentation module 453 for enabling presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (e.g., a display screen, speakers, etc.) associated with the user interface 430;
an input processing module 454 for detecting one or more user inputs or interactions from one of the one or more input devices 432 and translating the detected inputs or interactions.
In some embodiments, the apparatus provided by the embodiments of the present application may be implemented in software, and fig. 2 shows a database switching system 455 stored in a memory 450, which may be software in the form of a program, a plug-in, or the like, including the following software modules: scene relating module 4551, database processing module 4552 and database switching module 4553, which are logical and therefore may be arbitrarily combined or further split depending on the functions implemented.
The functions of the respective modules will be described hereinafter.
In other embodiments, the system provided by the embodiments of the present application may be implemented in hardware, and by way of example, the system provided by the embodiments of the present application may be a processor in the form of a hardware decoding processor programmed to perform the database-based switching method provided by the embodiments of the present application, e.g., the processor in the form of a hardware decoding processor may employ one or more application specific integrated circuits (ASIC, application Specific Integrated Circuit), DSPs, programmable Logic devices (PLD, programmable Logic Device), complex programmable Logic devices (CPLD, complexProgrammable Logic devices), field programmable gate arrays (FPGAs, field-Programmable GateArray), or other electronic components.
In some embodiments, the terminal or the server may implement the database switching method provided by the embodiments of the present application by running a computer program. For example, the computer program may be a native program or a software module in an operating system; a local (Native) Application program (APP), i.e. a program that needs to be installed in an operating system to run, such as a social Application APP or a message sharing APP; the method can also be an applet, namely a program which can be run only by being downloaded into a browser environment; but also an applet or web client program that can be embedded in any APP. In general, the computer programs described above may be any form of application, module or plug-in.
Referring to fig. 3, the present application provides a database switching method, which includes the following steps:
step S300, scene description texts of different application scenes are obtained, subcommands in a preset command library are called according to a plurality of characteristic fields in the scene description texts, and subcommand sets are formed to establish association relations between the subcommand sets and all application scenes;
step S310, determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result;
Step S320, performing a switch to the target database according to the processing result.
In step S300, scene description texts of different application scenes are obtained, and subcommands in a preset command library are called according to a plurality of feature fields in the scene description texts to form subcommand sets so as to establish association relations between the subcommand sets and the application scenes.
In an embodiment, because in the use process of the database, the user service requirement is often met by switching between different databases according to different service requirements and calling different database data. And the compatibility, usability and other problems of the database need to be considered during the database switching. The database to be switched to can be verified by calling related database commands, after response data meeting the requirements are obtained, the database switching is completed, and the service requirements of the current application scene can be met after the database switching is ensured. Corresponding scene description text may be built for different application scenes. The scene description text can record data items or function items which need to be verified in the switching process of the target database corresponding to the current application scene. In one embodiment, the content of each data item or function item to be verified is recorded in the scene description text in the order that can be executed as required. Therefore, each scene description text can contain a plurality of characteristic fields, corresponding characteristic fields can be obtained by word segmentation and characteristic extraction of the scene description text, and corresponding database commands are called to process the target database based on the characteristic fields.
In one embodiment, before invoking the subcommand in the preset command library according to the plurality of feature fields in the scene description text, the method further comprises the following steps:
step S301, generating a command tag according to the category of each sub-command in the preset command library.
In one embodiment, a command library may be pre-constructed, and relevant operation subcommands for the database may be stored in the command library, and subcommand calls may be made from the command library when the corresponding subcommands are needed. And sub-commands in the command library may be categorized, for example, sub-commands of different categories, including query, link, create objects, etc., creating a command tag for each category, each category possibly containing multiple sub-commands sharing a command tag for a category.
In one embodiment, when constructing the command library, a command data table may be constructed for all sub-commands in the command library, where information such as the name, symbol, and function description of each command may be recorded. The command data table corresponding to the customized command database can be generated by extracting relevant data items through calling command specifications and the like provided by a database provider by subcommands in the command database. And extracting the common feature words or feature words with highest similarity of the sub-commands of the same category as the command labels of the corresponding categories based on the function description of each sub-command in the command data table.
Step S302, word segmentation is carried out on the scene description text to obtain a plurality of scene words;
in one embodiment, the word may be segmented by conventional word segmentation tools such as based on a maximum matching algorithm, based on a relative probability of occurrence of different words, or based on a dictionary, etc. The specific word segmentation process is not described here in detail. A plurality of scene words related to the application scene can be obtained through word segmentation.
Step S303, comparing the similarity between the scene word and the command label, and if the similarity between the scene word and the command label is greater than a preset similarity threshold, using the scene word as a feature field of the corresponding scene description text.
In an embodiment, since the command tag corresponding to the command category is created for the subcommand in the command library, the similarity between the scene word extracted from the scene description text and the command tag in the command library is compared, and the similarity between the scene word and the command tag is calculated, and if the similarity between the scene word and the command tag reaches the preset similarity threshold, the scene word is considered to be matched with the command tag, and the corresponding scene word can be used as the feature field of the scene description text. The scene words in the scene description text are screened through the command labels in the command library, so that the accuracy of subsequent subcommand calling can be ensured, the interference of redundant data on the processing process is avoided, and the efficiency and accuracy of database switching are ensured.
In one embodiment, generating a command tag according to the category of each sub-command in the preset command library includes the following steps:
step S304, calling a preset command table corresponding to the preset command library, wherein the preset command table is used for recording the function description text of each subcommand.
In an embodiment, the foregoing step constructs a corresponding command data table for the command library, where the command data table may be a preset command table, and the preset command table includes a function description text corresponding to each sub-command, where the function description text may be entered by calling a specification of the corresponding sub-command or by a specific person, and the specific acquisition mode may be adjusted according to an actual application scenario, which is not limited herein.
Step S305, generating functional feature vectors of all sub-commands according to the functional description text, and clustering based on the functional feature vectors to obtain a plurality of cluster clusters and a cluster center of each cluster.
In one embodiment, the function description text of each sub-command in the command library can be obtained by looking up a table, and the function description text is converted into a function feature vector through coding. Specifically, one-hot coding or other coding modes can be adopted, and the method is not limited herein. After the functional feature vectors are obtained, clustering is performed based on the functional feature vectors, wherein the clustering can be performed by adopting K-MEANs clustering or clustering modes based on probability distribution, and the like, and the specific clustering process is not repeated here. Multiple clusters can be obtained by clustering, each cluster corresponding to a subcommand class. And obtaining a cluster center of the cluster, wherein the cluster center is a functional feature vector closest to all individuals in the cluster.
Step S306, generating a cluster label of the corresponding cluster according to the function description text of the cluster center as a command label of the whole cluster.
In an embodiment, after determining a clustering center of each cluster, the functional description text of the clustering center is segmented, similarity of the functional description text corresponding to other subcommands in the same cluster is calculated based on word groups after segmentation, a word with highest similarity to the word groups in the same cluster is selected from the word groups contained in the clustering center to be used as a common word, a cluster label of the corresponding cluster is generated based on the common word, and the cluster label is recorded as a command label of the cluster.
In one embodiment, invoking the subcommand in the preset command library according to the plurality of feature fields in the scene description text to form a subcommand set, comprising the following steps:
step S307, calculating the similarity between the subcommand corresponding to the same command tag in the preset command library and the feature field, and sorting the subcommand according to the similarity to obtain the subcommand sorting result under the same command tag.
In one embodiment, after determining the feature field of the scene description text, a matching command tag in the command library may be invoked based on the feature field. Each command tag may correspond to a plurality of subcommands. Multiple feature fields in the scene description text may be matched to obtain a subcommand set corresponding to multiple command tags. Further, the function description text of each subcommand in the subcommand set can be called through a table lookup, and the similarity between the subcommand and the corresponding feature field in the same command label is calculated based on the function description text. Through similarity ordering, a subcommand sequence that can be invoked by a feature field can be determined as the ordering result.
Step S308, selecting a plurality of subcommands with similarity larger than a preset threshold value as subcommands to be called by the feature field according to the subcommand sequencing result.
In one embodiment, the sub-command ordering result for a single feature field may be used to screen the required sub-commands, and in particular, the ordering result may be from high to low in terms of similarity to obtain an ordering sequence of a plurality of sub-commands. And selecting the subcommands with the similarity reaching a certain threshold value as subcommands needing to be called. The subcommands that need to be invoked may be one or more. The specific threshold may be configured according to the actual application scenario, which is not limited herein.
Step S309, sequencing the subcommands called by the feature fields according to the sequence of the feature fields in the scene description text, and generating the subcommand set.
In an embodiment, a single scene description text may contain a plurality of feature fields, and the subcommands to be invoked obtained in the previous step may be reordered based on the sequence of the feature fields in the scene description text to obtain a subcommand set. So as to be sequentially executed based on the ordered subcommands and complete the corresponding operation of the scene description text requirement.
And constructing the association relation between the subcommand set and the application scene corresponding to the scene description text based on the steps. When the database is required to be switched, corresponding operation can be carried out on the target database according to the corresponding subcommand set called by the application scene.
In step S310, a target application scenario of a target database is determined by analyzing a database switching instruction, and the target database is processed according to the target application scenario and the associated subcommand set called by the association relationship, so as to obtain a processing result.
In an embodiment, before determining the target application scenario of the target database by analyzing the database switching instruction, the method further includes the following steps:
step S311, the database usage status is obtained by traversing the current database.
In one embodiment, the usage status of the database currently being used by the business system may be traversed periodically or over a specified period of time. Wherein the usage status includes data response speed, remaining memory space, etc.
Step S312, the database usage state is compared with a preset database switching rule, and a target application scene is determined according to the database switching rule matched with the database usage state.
In an embodiment, a database switching rule may be constructed according to different application scenarios, and a first mapping relationship between the application scenarios and the database switching rule may be established. The database switching rules comprise parameter thresholds of the using states of all databases, and the database switching rules matched with the using states of the databases are determined based on the parameter thresholds. In particular, the database switching rules may include that the current database request response time is greater than a preset threshold, that the current database remaining memory is less than a preset threshold, or the like. The specific database switching rules can be adjusted according to the actual application scene requirements, and are not limited herein. Comparing the use state of the current database with preset database switching rules to determine whether the use state of the current database meets one of the database switching rules, and if so, calling an application scene corresponding to the corresponding database switching rule.
Step S313, determining a target database from a plurality of standby databases according to the target application scene;
in an embodiment, before determining the target database from the plurality of standby databases according to the target application scenario, the method further includes: and constructing a second mapping relation between the standby database and the application scene, and determining a database corresponding to the application scene by calling the second mapping relation.
In an embodiment, the second mapping relationship between the application scenario and the standby database may be pre-constructed, and after the application scenario is determined according to the database switching rule, the standby database corresponding to the application scenario may be called as the target database.
Step S314, generating a database switching instruction according to the target database and the corresponding target application scene.
In one embodiment, a database switch instruction may be generated based on the target database and the corresponding application scenario after the target database is determined. After receiving the database switching instruction, the system analyzes the instruction to obtain a target database contained in the instruction. The application scene corresponding to the target database can be further called, and the subcommand set for processing the target database is determined based on the association relation between the application scene and the subcommand set. And checking each parameter in the target database based on the subcommand set, and judging whether the target database meets the current application scene requirement. When a certain parameter returns to be abnormal, the rollback operation can be executed, the database switching is stopped, and corresponding alarm information is output. For example, the command of checking the read_only parameter by the original database and the command of checking the database switch are integrated and unified into the switch, so that the database read_only parameter can be checked after the database switch is ensured.
In step S320, a switch to the target database is performed according to the processing result.
In an embodiment, a return value after each sub-command in the sub-command set is executed may be obtained, whether the target database is in a usable state is determined based on the return value, and when the return value is not abnormal after all the sub-commands in the sub-command set are sequentially executed, a database switching operation may be executed, linking the service data to the target database, and performing a subsequent service operation based on the target database.
Referring to fig. 4, fig. 4 is a block diagram of a database switching system according to an embodiment of the application, the system includes: the scene association module 4551 is configured to obtain scene description texts of different application scenes, call subcommands in a preset command library according to a plurality of feature fields in the scene description texts, and form a subcommand set to establish association relations between the subcommand set and each application scene; the database processing module 4552 is configured to determine a target application scenario of a target database by analyzing a database switching instruction, and call an associated subcommand set according to the target application scenario and the association relationship to process the target database, so as to obtain a processing result; and the database switching module 4553 is configured to perform a switching operation to the target database according to the processing result.
In an embodiment, the scenario association module 4551 is further configured to, before invoking the subcommand in the preset command library according to the plurality of feature fields in the scenario description text, further comprise: generating a command label according to the category of each subcommand in the preset command library; word segmentation is carried out on the scene description text to obtain a plurality of scene words; and comparing the similarity between the scene word and the command tag, and taking the scene word as a characteristic field of the corresponding scene description text if the similarity between the scene word and the command tag is larger than a preset similarity threshold.
In an embodiment, the scenario association module 4551 is further configured to generate a command tag according to a category of each sub-command in the preset command library, including: calling a preset command table corresponding to the preset command library, wherein the preset command table is used for recording the function description text of each subcommand; generating functional feature vectors of all subcommands according to the functional description text, and clustering based on the functional feature vectors to obtain a plurality of clustering clusters and a clustering center of each clustering cluster; and generating a cluster label of the corresponding cluster according to the function description text of the cluster center as a command label of the whole cluster.
In an embodiment, the scenario association module 4551 is further configured to invoke sub-commands in a preset command library according to a plurality of feature fields in the scenario description text to form a sub-command set, including: calculating the similarity between the subcommand corresponding to the same command label in the preset command library and the feature field, and sequencing the subcommand according to the similarity to obtain a subcommand sequencing result under the same command label; selecting a plurality of subcommands with similarity larger than a preset threshold value as subcommands to be called in the feature field according to the subcommand sequencing result; and sequencing the subcommands called by the feature fields according to the sequence of the feature fields in the scene description text, and generating the subcommand set.
In an embodiment, the database processing module 4552 is further configured to, before determining the target application scenario of the target database by parsing the database switch instruction, further comprise: acquiring the database use state by traversing the current database; comparing the database use state with a preset database switching rule, and determining a target application scene according to the database switching rule matched with the database use state; determining a target database from a plurality of standby databases according to the target application scene; and generating a database switching instruction according to the target database and the corresponding target application scene.
In an embodiment, the database processing module 4552 is further configured to, before determining the target application scenario according to the database switching rule matched with the database usage state, further comprise: and constructing database switching rules according to different application scenes to obtain a first mapping relation between the application scenes and the database switching rules, wherein the database switching rules comprise parameter thresholds of the use states of all databases, and determining the database switching rules matched with the use states of the databases based on the parameter thresholds.
In an embodiment, the database processing module 4552 is further configured to, before determining the target database from the plurality of standby databases according to the target application scenario, further include: and constructing a second mapping relation between the standby database and the application scene, and determining a database corresponding to the application scene by calling the second mapping relation.
The database switching system described above may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 5. A computer device, comprising: memory, a processor, and a computer program stored on the memory and executable on the processor.
The various modules in the database switching system described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules can be embedded in the memory of the terminal in a hardware form or independent of the terminal, and can also be stored in the memory of the terminal in a software form, so that the processor can call and execute the operations corresponding to the above modules. The processor may be a Central Processing Unit (CPU), microprocessor, single-chip microcomputer, etc.
As shown in fig. 5, a schematic diagram of the internal structure of the computer device in one embodiment is shown. There is provided a computer device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of: acquiring scene description texts of different application scenes, calling subcommands in a preset command library according to a plurality of characteristic fields in the scene description texts, and forming a subcommand set to establish association relations between the subcommand set and each application scene; determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result; and executing the operation of switching to the target database according to the processing result.
In an embodiment, when the processor executes the foregoing, before the invoking of the subcommand in the preset command library according to the multiple feature fields in the scene description text, the method further includes: generating a command label according to the category of each subcommand in the preset command library; word segmentation is carried out on the scene description text to obtain a plurality of scene words; and comparing the similarity between the scene word and the command tag, and taking the scene word as a characteristic field of the corresponding scene description text if the similarity between the scene word and the command tag is larger than a preset similarity threshold.
In an embodiment, when the processor executes the foregoing, the generating a command tag according to the category of each sub-command in the preset command library includes: calling a preset command table corresponding to the preset command library, wherein the preset command table is used for recording the function description text of each subcommand; generating functional feature vectors of all subcommands according to the functional description text, and clustering based on the functional feature vectors to obtain a plurality of clustering clusters and a clustering center of each clustering cluster; and generating a cluster label of the corresponding cluster according to the function description text of the cluster center as a command label of the whole cluster.
In an embodiment, when the processor executes the foregoing, the invoking the subcommand in the preset command library according to the multiple feature fields in the scene description text to form a subcommand set includes: calculating the similarity between the subcommand corresponding to the same command label in the preset command library and the feature field, and sequencing the subcommand according to the similarity to obtain a subcommand sequencing result under the same command label; selecting a plurality of subcommands with similarity larger than a preset threshold value as subcommands to be called in the feature field according to the subcommand sequencing result; and sequencing the subcommands called by the feature fields according to the sequence of the feature fields in the scene description text, and generating the subcommand set.
In an embodiment, before determining the target application scenario of the target database by analyzing the database switching instruction, the processor further includes: acquiring the database use state by traversing the current database; comparing the database use state with a preset database switching rule, and determining a target application scene according to the database switching rule matched with the database use state; determining a target database from a plurality of standby databases according to the target application scene; and generating a database switching instruction according to the target database and the corresponding target application scene.
In an embodiment, before the processor determines the target application scenario according to the database switching rule matched with the database usage state, the method further includes: and constructing database switching rules according to different application scenes to obtain a first mapping relation between the application scenes and the database switching rules, wherein the database switching rules comprise parameter thresholds of the use states of all databases, and determining the database switching rules matched with the use states of the databases based on the parameter thresholds.
In an embodiment, before the processor determines the target database from the plurality of standby databases according to the target application scenario, the method further includes: and constructing a second mapping relation between the standby database and the application scene, and determining a database corresponding to the application scene by calling the second mapping relation.
In one embodiment, the computer device may be used as a server, including but not limited to a stand-alone physical server, or a server cluster formed by a plurality of physical servers, and may also be used as a terminal, including but not limited to a mobile phone, a tablet computer, a personal digital assistant, a smart device, or the like. As shown in FIG. 5, the computer device includes a processor, a non-volatile storage medium, an internal memory, a display screen, and a network interface connected by a system bus.
Wherein the processor of the computer device is configured to provide computing and control capabilities to support the operation of the entire computer device. The non-volatile storage medium of the computer device stores an operating system and a computer program. The computer program is executable by a processor for implementing a database switching method as provided in the above embodiments. Internal memory in a computer device provides a cached operating environment for an operating system and computer programs in a non-volatile storage medium. The display interface can display data through the display screen. The display screen may be a touch screen, such as a capacitive screen or an electronic screen, and the corresponding instruction may be generated by receiving a click operation on a control displayed on the touch screen.
It will be appreciated by those skilled in the art that the architecture of the computer device illustrated in fig. 5 is merely a block diagram of portions of the architecture in connection with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements are applicable, and that a particular computer device may include more or less components than those illustrated, or may be combined with certain components, or have a different arrangement of components.
In one embodiment, a computer readable storage medium is provided having stored thereon a computer program which when executed by a processor performs the steps of: acquiring scene description texts of different application scenes, calling subcommands in a preset command library according to a plurality of characteristic fields in the scene description texts, and forming a subcommand set to establish association relations between the subcommand set and each application scene; determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result; and executing the operation of switching to the target database according to the processing result.
In one embodiment, when the computer program is executed by the processor, before the sub-commands in the preset command library are invoked according to the feature fields in the scene description text, the method further comprises: generating a command label according to the category of each subcommand in the preset command library; word segmentation is carried out on the scene description text to obtain a plurality of scene words; and comparing the similarity between the scene word and the command tag, and taking the scene word as a characteristic field of the corresponding scene description text if the similarity between the scene word and the command tag is larger than a preset similarity threshold.
In one embodiment, when the computer program is executed by the processor, the method for generating a command tag according to the category of each sub-command in the preset command library includes: calling a preset command table corresponding to the preset command library, wherein the preset command table is used for recording the function description text of each subcommand; generating functional feature vectors of all subcommands according to the functional description text, and clustering based on the functional feature vectors to obtain a plurality of clustering clusters and a clustering center of each clustering cluster; and generating a cluster label of the corresponding cluster according to the function description text of the cluster center as a command label of the whole cluster.
In one embodiment, when the computer program is executed by a processor, the method for calling sub-commands in a preset command library according to a plurality of feature fields in the scene description text to form a sub-command set includes: calculating the similarity between the subcommand corresponding to the same command label in the preset command library and the feature field, and sequencing the subcommand according to the similarity to obtain a subcommand sequencing result under the same command label; selecting a plurality of subcommands with similarity larger than a preset threshold value as subcommands to be called in the feature field according to the subcommand sequencing result; and sequencing the subcommands called by the feature fields according to the sequence of the feature fields in the scene description text, and generating the subcommand set.
In an embodiment, before determining the target application scenario of the target database by analyzing the database switching instruction, the method further includes: acquiring the database use state by traversing the current database; comparing the database use state with a preset database switching rule, and determining a target application scene according to the database switching rule matched with the database use state; determining a target database from a plurality of standby databases according to the target application scene; and generating a database switching instruction according to the target database and the corresponding target application scene.
In an embodiment, before the computer program is executed by the processor, the method further includes: and constructing database switching rules according to different application scenes to obtain a first mapping relation between the application scenes and the database switching rules, wherein the database switching rules comprise parameter thresholds of the use states of all databases, and determining the database switching rules matched with the use states of the databases based on the parameter thresholds.
In one embodiment, before determining the target database from the plurality of standby databases according to the target application scenario, the method further includes: and constructing a second mapping relation between the standby database and the application scene, and determining a database corresponding to the application scene by calling the second mapping relation.
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The above embodiments are merely illustrative of the principles of the present invention and its effectiveness, and are not intended to limit the invention. Modifications and variations may be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the invention. Accordingly, it is intended that all equivalent modifications and variations of the invention be covered by the claims, which are within the ordinary skill of the art, be within the spirit and scope of the present disclosure.

Claims (10)

1. A database switching method, comprising:
acquiring scene description texts of different application scenes, calling subcommands in a preset command library according to a plurality of characteristic fields in the scene description texts, and forming a subcommand set to establish association relations between the subcommand set and each application scene;
determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result;
and executing the operation of switching to the target database according to the processing result.
2. The database switching method according to claim 1, wherein before invoking the subcommand in the preset command library according to the plurality of feature fields in the scene description text, further comprising:
Generating a command label according to the category of each subcommand in the preset command library;
word segmentation is carried out on the scene description text to obtain a plurality of scene words;
and comparing the similarity between the scene word and the command tag, and taking the scene word as a characteristic field of the corresponding scene description text if the similarity between the scene word and the command tag is larger than a preset similarity threshold.
3. The database switching method according to claim 2, wherein generating a command tag according to the category of each sub-command in the preset command library comprises:
calling a preset command table corresponding to the preset command library, wherein the preset command table is used for recording the function description text of each subcommand;
generating functional feature vectors of all subcommands according to the functional description text, and clustering based on the functional feature vectors to obtain a plurality of clustering clusters and a clustering center of each clustering cluster;
and generating a cluster label of the corresponding cluster according to the function description text of the cluster center as a command label of the whole cluster.
4. The database switching method according to claim 1 or 2, wherein invoking sub-commands in a preset command library according to a plurality of feature fields in the scene description text forms a sub-command set, comprising:
Calculating the similarity between the subcommand corresponding to the same command label in the preset command library and the feature field, and sequencing the subcommand according to the similarity to obtain a subcommand sequencing result under the same command label;
selecting a plurality of subcommands with similarity larger than a preset threshold value as subcommands to be called in the feature field according to the subcommand sequencing result;
and sequencing the subcommands called by the feature fields according to the sequence of the feature fields in the scene description text, and generating the subcommand set.
5. The database switching method according to claim 1, further comprising, before determining the target application scenario of the target database by parsing the database switching instruction:
acquiring the database use state by traversing the current database;
comparing the database use state with a preset database switching rule, and determining a target application scene according to the database switching rule matched with the database use state;
determining a target database from a plurality of standby databases according to the target application scene;
and generating a database switching instruction according to the target database and the corresponding target application scene.
6. The database switching method according to claim 5, further comprising, before determining a target application scenario according to a database switching rule matching the database usage state:
and constructing database switching rules according to different application scenes to obtain a first mapping relation between the application scenes and the database switching rules, wherein the database switching rules comprise parameter thresholds of the use states of all databases, and determining the database switching rules matched with the use states of the databases based on the parameter thresholds.
7. The database switching method according to claim 5, further comprising, before determining a target database from a plurality of backup databases according to the target application scenario:
and constructing a second mapping relation between the standby database and the application scene, and determining a database corresponding to the application scene by calling the second mapping relation.
8. A database switching system, comprising:
the scene association module is used for acquiring scene description texts of different application scenes, calling subcommands in a preset command library according to a plurality of characteristic fields in the scene description texts, and forming a subcommand set to establish association relation between the subcommand set and each application scene;
The database processing module is used for determining a target application scene of a target database by analyzing a database switching instruction, and calling an associated subcommand set to process the target database according to the target application scene and the association relation to obtain a processing result;
and the database switching module is used for executing the operation of switching to the target database according to the processing result.
9. A computer device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the database switching method according to any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the database switching method of any of claims 1 to 7.
CN202310508934.5A 2023-05-06 2023-05-06 Database switching method, system, equipment and medium Pending CN116737767A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310508934.5A CN116737767A (en) 2023-05-06 2023-05-06 Database switching method, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310508934.5A CN116737767A (en) 2023-05-06 2023-05-06 Database switching method, system, equipment and medium

Publications (1)

Publication Number Publication Date
CN116737767A true CN116737767A (en) 2023-09-12

Family

ID=87903409

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310508934.5A Pending CN116737767A (en) 2023-05-06 2023-05-06 Database switching method, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN116737767A (en)

Similar Documents

Publication Publication Date Title
US10664540B2 (en) Domain specific natural language understanding of customer intent in self-help
CN112711581A (en) Medical data verification method and device, electronic equipment and storage medium
JP6442807B1 (en) Dialog server, dialog method and dialog program
CN114140947A (en) Interface display method and device, electronic equipment, storage medium and program product
CN114239504A (en) Form configuration method, device, equipment, readable storage medium and program product
CN112698895A (en) Display method, device, equipment and medium of electronic equipment
CN116431878A (en) Vector retrieval service method, device, equipment and storage medium thereof
CN109597482B (en) Automatic page turning method and device for electronic book, medium and electronic equipment
CN116450723A (en) Data extraction method, device, computer equipment and storage medium
CN116303937A (en) Reply method, reply device, electronic equipment and readable storage medium
CN116737767A (en) Database switching method, system, equipment and medium
CN115330498A (en) Data processing method and related device in man-machine interaction shopping service system
JP2024505316A (en) Application testing methods, equipment, electronic equipment and storage media
CN109145084B (en) Data processing method, data processing device and server
CN113722446A (en) Power system operation data generation method and device and computer equipment
CN113722590B (en) Medical information recommendation method, device, equipment and medium based on artificial intelligence
CN109873750B (en) Remote sale intelligent reminding information sending method, device, medium and electronic equipment
CN116911304B (en) Text recommendation method and device
CN116431607A (en) Data model reconstruction method, device, equipment and storage medium thereof
CN116431913A (en) Intelligent recommendation method, device and equipment for vehicle owner service push text and storage medium thereof
CN115878898A (en) Channel page recommendation method and device, computer equipment and storage medium
CN116701488A (en) Data processing method, device, computer equipment and storage medium
CN117389549A (en) Service product configuration method, device, computer equipment and storage medium
CN114297417A (en) Multimedia resource recommendation method and related device
CN117370558A (en) Data integration method, device, equipment and storage medium thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination