Database access session processing method, device, equipment and medium
By acquiring information from access sessions and model training, the system can distinguish between operation and maintenance access sessions and application access sessions, solving the problem of not being able to differentiate types in existing technologies, improving auditing efficiency and reducing memory usage.
Patent Information
- Application Number
- CN202211549869.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-05
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-12-05
AI Technical Summary
Existing technologies cannot effectively distinguish the types of database access sessions, making it impossible to perform targeted audits on operation and maintenance access sessions and application access sessions, which affects audit efficiency and memory usage.
By obtaining the user identifier, the sender's Internet Protocol address, and the database operation statement in the access session, and combining them with a preset set or access session classification model, the type of access session is determined, and the type is updated as necessary to improve accuracy.
It enables accurate differentiation between operation and maintenance access sessions and application access sessions, improving auditing efficiency and reducing memory usage.
Smart Images

Figure CN115914334B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security, and in particular to a method, device, equipment and medium for processing access sessions of a database. Background Art
[0002] Database auditing is a method of supervising operational behaviors of accessing the database, conducting compliance management of database operations through fine-grained auditing, and providing real-time alerts for abnormal behaviors encountered by the database.
[0003] In the prior art, when a server corresponding to a database receives an access session, it can parse the access session and record and forward the operation behavior of this session on the database. However, access sessions include two types: operation and maintenance access sessions and application access sessions. It is more likely that anomalies will occur when a server operates a database based on an operation and maintenance access session. Therefore, only the operation and maintenance access session can be audited to improve audit efficiency and reduce memory usage.
[0004] However, the existing technology cannot distinguish the types of access sessions, so there is an urgent need for a database access session processing method that can distinguish between operation and maintenance access sessions and application access sessions. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, device and medium for processing access sessions of a database, which are used to solve the problem that the prior art cannot distinguish the types of access sessions, so there is an urgent need for a method for processing access sessions of a database that can distinguish between operation and maintenance access sessions and application access sessions.
[0006] In a first aspect, an embodiment of the present application provides a method for processing a database access session, comprising:
[0007] Acquiring an access session to a database, wherein the access session includes a user identifier, a sender Internet Protocol address, a database operation statement, and a sending time;
[0008] The type of the access session is determined according to the user identifier, the sender Internet Protocol address, and the database operation statement, or the type of the access session is determined according to an access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, wherein the access session classification model is a pre-trained computing model for determining the type of the access session according to the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, and the types of the access sessions include operation and maintenance access sessions and application access sessions.
[0009] In a specific implementation manner, determining the type of the access session according to the user identifier, the sender Internet Protocol address, and the database operation statement includes:
[0010] If the user identifier belongs to a preset application type user identifier set, the sender Internet Protocol address belongs to a preset application type Internet Protocol address set, and the type of the database operation statement belongs to a preset application type database operation statement type set, then the type of the access session is determined to be an application access session.
[0011] In a specific implementation manner, determining the type of the access session according to the user identifier, the sender Internet Protocol address, and the database operation statement includes:
[0012] If the user identifier does not belong to the preset application-type user identifier set, or the sender Internet Protocol address does not belong to the preset application-type Internet Protocol address set, or the type of the database operation statement does not belong to the preset application-type database operation statement type set, then it is determined that the type of the access session is an operation and maintenance access session.
[0013] In a specific implementation manner, determining the type of the access session according to the access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement includes:
[0014] The user identifier, the sender Internet Protocol address, the sending time, and the database operation statement are input into the access session classification model to obtain the type of the access session.
[0015] In a specific embodiment, the method further comprises:
[0016] If the type of the access session is an application access session, the type of the access session is updated according to a preset application-type user identifier set, a preset application-type Internet Protocol address set, a preset application-type database operation statement type set and the user identifier, the sender Internet Protocol address, and the database operation statement.
[0017] In a specific implementation, the updating of the type of the access session according to the preset application-type user identifier set, the preset application-type Internet Protocol address set, the preset application-type database operation statement type set and the user identifier, the sender Internet Protocol address, and the database operation statement includes:
[0018] If the user identifier does not belong to the preset application-type user identifier set, or the sender Internet Protocol address does not belong to the preset application-type Internet Protocol address set, or the type of the database operation statement does not belong to the preset application-type database operation statement type set, then the type of the access session is updated to an operation and maintenance access session.
[0019] In a specific implementation, before obtaining the access session to the database, the method further includes:
[0020] Acquire multiple sets of training data, each set of training data includes a user identifier, a sender Internet Protocol address, a sending time, a database operation statement, and an access session type tag, wherein the access session type tag includes an operation and maintenance access session tag and an application access session tag;
[0021] The plurality of sets of training data are used to perform model training on a preset supervised learning model to obtain the access session classification model.
[0022] In a second aspect, an embodiment of the present application provides a database access session processing device, including:
[0023] An acquisition module, used to acquire an access session to a database, wherein the access session includes a user identifier, an Internet protocol address of a sender, a database operation statement, and a sending time;
[0024] A processing module is used to determine the type of the access session according to the user identifier, the sender Internet Protocol address, and the database operation statement, or to determine the type of the access session according to an access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, wherein the access session classification model is a pre-trained computing model for determining the type of the access session according to the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, and the types of the access sessions include operation and maintenance access sessions and application access sessions.
[0025] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0026] Processor, memory, communication interface;
[0027] The memory is used to store executable instructions of the processor;
[0028] The processor is configured to execute the database access session processing method described in any one of the first aspects by executing the executable instructions.
[0029] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for processing a database access session as described in any one of the first aspects is implemented.
[0030] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the database access session processing method described in any one of the first aspects.
[0031] The database access session processing method, apparatus, device and medium provided in the embodiments of the present application determine the type of the access session according to the user identifier, sender Internet Protocol address and database operation statement in the access session after obtaining the access session, or determine the type of the access session according to the access session classification model and the user identifier, sender Internet Protocol address, sending time and database operation statement in the access session. This solution determines the type of the access session through the information in the access session, thereby distinguishing between the operation and maintenance access session and the application access session. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0033] Figure 1 A flowchart of a first embodiment of a method for processing a database access session provided by the present application;
[0034] Figure 2 A flowchart of a second embodiment of a method for processing a database access session provided by the present application;
[0035] Figure 3 A flowchart of a third embodiment of a method for processing a database access session provided by the present application;
[0036] Figure 4 A flowchart of a fourth embodiment of a method for processing a database access session provided by the present application;
[0037] Figure 5 A schematic diagram of the structure of an embodiment of a database access session processing device provided by the present application;
[0038] Figure 6 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments made by ordinary technicians in this field under the enlightenment of the embodiments belong to the scope of protection of the present application.
[0040] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] With the development of science and technology, more and more data are generated in various fields. Using databases for data management is a simple and effective method. If abnormal operations occur during the operation of the database, the data in the database will be destroyed. In order to reduce such problems, database auditing can be used to supervise the operation of accessing the database.
[0042] In the prior art, when the server corresponding to the database receives an access session, it can parse the access session and record and forward the operation behavior of this session on the database. However, the access session includes two types: operation and maintenance access session and application access session. It is more likely that anomalies will occur when the server operates the database according to the operation and maintenance access session. Therefore, only the operation and maintenance access session can be audited to improve audit efficiency and reduce memory usage. The prior art cannot distinguish the types of access sessions, so there is an urgent need for a database access session processing method that can distinguish between operation and maintenance access sessions and application access sessions.
[0043] In view of the problems existing in the prior art, the inventors found in the process of studying the access session processing method of the database that the type of the access session can be determined according to the information in the access session. After obtaining the access session of the database, the type of the access session can be determined according to the user identifier, the sender Internet Protocol address, the database operation statement, and the preset application user identifier set, the preset application Internet Protocol address set, and the preset application database operation statement type set in the access session. The type of the access session can also be determined according to the access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement in the access session. It is also possible to first determine the type of the access session according to the access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement in the access session. When the type of the access session determined is an application access session, the type of the access session is updated according to the user identifier, the sender Internet Protocol address, the database operation statement, and the preset application user identifier set, the preset application Internet Protocol address set, and the preset application database operation statement type set in the access session. Based on the above-mentioned inventive concept, the database access session processing scheme in this application is designed.
[0044] The execution subject of the database access session processing method in the present application can be a server, or a computer, terminal device, etc. This application does not limit it. The following description will be made using a server as an example.
[0045] The following describes the application scenarios of the database access session processing method provided by the present application.
[0046] Exemplarily, in this application scenario, an operation and maintenance personnel uses a terminal device to access a database, and the terminal device sends an access session to a server corresponding to the database.
[0047] When the server receives the access session, it obtains the user ID, the sender's Internet Protocol address, the sending time, and the database operation statement, and then inputs the user ID, the sender's Internet Protocol address, the sending time, and the database operation statement into the access session classification model to obtain the type of the access session. If the type of the access session is an operation and maintenance access session, the session is audited.
[0048] If the type of access session obtained is an application access session, in order to ensure the correct type, it is necessary to determine the type of access session again based on the user identifier, sender Internet Protocol address, database operation statement, and preset application user identifier set, preset application Internet Protocol address set, and preset application database operation statement type set in the access session.
[0049] If the access session type determined again is an operation and maintenance access session, the session is audited. If the access session type determined again is an application access session, the session is not audited.
[0050] It should be noted that the above scenario is only an example of an application scenario provided by an embodiment of the present application. The embodiment of the present application does not limit the actual form of the various devices included in the scenario, nor does it limit the interaction method between the devices. In the specific application of the solution, it can be set according to actual needs.
[0051] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0052] Figure 1 This is a flow chart of the first embodiment of the method for processing access sessions of a database provided by the present application. The present embodiment of the present application describes the situation where a server obtains an access session and then determines the type of access session based on the information in the access session. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 1 As shown, the database access session processing method specifically includes the following steps:
[0053] S101: Obtaining an access session to a database.
[0054] When an application on the server running the application accesses a database, it sends an access session to the server corresponding to the database. When an operation and maintenance personnel wants to access the database, they send an access session to the server corresponding to the database through a terminal device.
[0055] In this step, after the server or terminal device running the application sends the access session to the server corresponding to the database, the server corresponding to the database can obtain the access session to the database so as to determine the type of the access session later. The access session includes the user ID, the sender's Internet protocol address, the database operation statement and the sending time.
[0056] It should be noted that when the execution subject of this solution is not the server corresponding to the database, but other servers, or devices such as computer terminal devices, after the server corresponding to the database receives the access session to the database, it can send the access session to the execution subject so that the execution subject can determine the type of the access session.
[0057] S102: Determine the type of access session according to the user identifier, the sender's Internet Protocol address, and the database operation statement, or determine the type of access session according to the access session classification model and the user identifier, the sender's Internet Protocol address, the sending time, and the database operation statement.
[0058] In this step, after the server obtains the access session to the database, it can determine the type of the access session based on whether the user identifier, sender Internet protocol address, and database operation statement in the access session belong to the corresponding set. The types of access sessions include operation and maintenance access sessions and application access sessions.
[0059] The type of access session can also be determined based on the access session classification model and the user identifier, sender Internet Protocol address, sending time, and database operation statement in the access session. The access session classification model is a pre-trained computing model used to determine the type of access session based on the user identifier, sender Internet Protocol address, sending time, and database operation statement. Since the access session classification model is a computing model trained based on the user identifier, sender Internet Protocol address, sending time, database operation statement, and access session type label, the access session type label includes an operation and maintenance access session label and an application access session label, the user identifier, sender Internet Protocol address, sending time, and database operation statement in the access session can be input into the access session classification model to obtain the type of the access session.
[0060] After determining the type of the access session based on the access session classification model and the user identifier, sender Internet Protocol address, sending time, and database operation statement in the access session, if the determined type of the access session is an application access session, the type of the access session is updated based on the user identifier, sender Internet Protocol address, and database operation statement in the access session.
[0061] After the server determines the type of access session, it can audit the operation and maintenance access session to improve audit efficiency and reduce memory usage. It can also further process the access session of the operation and maintenance access session type, such as monitoring the access session that meets the monitoring conditions in the operation and maintenance access session type to improve monitoring efficiency. It can also determine the cause of abnormal access based on the abnormal access situation. When there are multiple access sessions for logging into the database, but the login fails, it can be determined based on the type of session whether the cause of the abnormal access is improper application configuration or malicious human login.
[0062] The database access session processing method provided in this embodiment determines the type of access session according to the user identifier, the sender's Internet Protocol address, and the database operation statement in the access session, and / or according to the access session classification model and the user identifier, the sender's Internet Protocol address, the sending time, and the database operation statement in the access session. Compared with the prior art that does not distinguish the types of access sessions, this solution can determine whether the type of access session is an operation and maintenance access session or an application access session through the information in the access session, thereby distinguishing the types of access sessions, and can also effectively improve audit efficiency and reduce memory usage.
[0063] Figure 2 The flowchart of the second embodiment of the method for processing a database access session provided by the present application is based on the above embodiment. The present application embodiment describes the situation in which the server determines the access session type according to the user identifier, the sender Internet protocol address, the database operation statement, and the preset application user identifier set, the preset application Internet protocol address set, and the preset application database operation statement type set in the access session. Figure 2 As shown, the database access session processing method specifically includes the following steps:
[0064] S201: Obtaining an access session to a database.
[0065] It should be noted that this step is similar to step S101 in the first embodiment and will not be described in detail here.
[0066] S202: Determine whether the user identifier belongs to a preset application-type user identifier set; if the user identifier belongs to the preset application-type user identifier set, execute step S203; if the user identifier does not belong to the preset application-type user identifier set, execute step S206.
[0067] S203: Determine whether the sender's Internet Protocol address belongs to the preset application-type Internet Protocol address set; if the sender's Internet Protocol address belongs to the preset application-type Internet Protocol address set, execute step S204; if the sender's Internet Protocol address does not belong to the preset application-type Internet Protocol address set, execute step S206.
[0068] S204: Determine whether the type of the database access operation statement belongs to the preset application-type database operation statement type set; if the type of the database operation statement belongs to the preset application-type database operation statement type set, execute step S205; if the type of the database operation statement does not belong to the preset application-type database operation statement type set, execute step S206.
[0069] S205: Determine that the type of the access session is an application access session.
[0070] S206: Determine that the type of the access session is an operation and maintenance access session.
[0071] In the above steps, after the server obtains the access session to the database, it can determine the type of the access session based on the information therein. Since the user identifier of the access session of the application access session type, the sender's Internet protocol address, and the type of database operation statement are all within a certain range, it is possible to first determine whether the user identifier in the access session belongs to the preset application user identifier set.
[0072] If the user identifier in the access session does not belong to the preset application user identifier set, it means that the type of the access session is not an application access session but an operation and maintenance access session, and then the type of the access session is determined to be an operation and maintenance access session.
[0073] If the user identifier in the access session belongs to the preset application user identifier set, in order to improve the accuracy of access session judgment, it is also necessary to judge whether the sender Internet Protocol address in the access session belongs to the preset application Internet Protocol address set.
[0074] If the sender Internet Protocol address in the access session does not belong to the preset application type Internet Protocol address set, it means that the type of the access session is not an application access session but an operation and maintenance access session, and then the type of the access session is determined to be an operation and maintenance access session.
[0075] If the sender Internet Protocol address in the access session belongs to the preset application type Internet Protocol address set, in order to improve the accuracy of access session judgment, it is also necessary to judge whether the type of database operation statement in the access session belongs to the preset application type database operation statement type set.
[0076] If the type of the database operation statement in the access session belongs to the preset application-type database operation statement type set, it means that the type of the access session is an application access session, and then the type of the access session is determined to be an application access session.
[0077] If the type of database operation statement in the access session does not belong to the preset application-type database operation statement type set, it means that the type of the access session is not an application access session but an operation and maintenance access session, and then the type of the access session is determined to be an operation and maintenance access session.
[0078] It should be noted that the execution order of step S203, step S204 and step S205 may be to execute step S203 first, then execute step S204, and finally execute step S205. It may also be to execute step S205 first, then execute step S204, and finally execute step S203. Execute step S204 first, then execute step S205, and finally execute step S203. The embodiment of the present application does not limit the execution order of step S203, step S204 and step S205, and can be set according to actual conditions.
[0079] It should be noted that the preset application user identification set, the preset application Internet protocol address set, and the preset application database operation statement type set are set by the staff according to the historical access session, and are used to determine the scope and type of the session. The embodiment of the present application does not limit the preset application user identification set, the preset application Internet protocol address set, and the preset application database operation statement type set, and can be set according to actual conditions.
[0080] The database access session processing method provided in this embodiment determines the type of access session according to the user identifier, the sender Internet Protocol address, the database operation statement, and the preset application user identifier set, the preset application Internet Protocol address set, and the preset application database operation statement type set in the access session, thereby distinguishing whether the access session type is an application access session or an operation and maintenance access session. Subsequently, only the operation and maintenance access session is audited, which can improve audit efficiency.
[0081] Figure 3 The flowchart of the third embodiment of the method for processing database access sessions provided by the present application is based on the above embodiments. The present application embodiment describes the situation that the server determines the type of access session according to the access session classification model and the user identifier, sender Internet protocol address, sending time, and database operation statement in the access session, and then updates the type of access session according to the user identifier, sender Internet protocol address, and database operation statement in the access session when the access session type is determined to be an application access session. Figure 3 As shown, the database access session processing method specifically includes the following steps:
[0082] S301: Input the user ID, the sender's Internet Protocol address, the sending time, and the database operation statement into an access session classification model to obtain the type of the access session.
[0083] In this step, after the server obtains the access session to the database, since the access session classification model is a computing model used to classify access sessions, the user identifier, sender Internet Protocol address, sending time, and database operation statement in the access session can be input into the access session classification model to obtain the type of the access session.
[0084] S302: Determine whether the type of the access session is an application access session; if the type of the access session is an operation and maintenance access session, execute step S303; if the type of the access session is an application access session, execute step S304.
[0085] S303: The type of access session is not updated.
[0086] In the above steps, after the server obtains the type of access session according to the access session classification model, in order to ensure that access sessions of the operation and maintenance access session type are not missed in subsequent audits, reduce the missed judgment rate of the operation and maintenance access session type, and improve the judgment accuracy of the access session type, it is also necessary to determine whether the access session type is an application access session.
[0087] If the type of the access session is an operation and maintenance access session, in order to reduce the missed detection rate of the operation and maintenance access session type, no further processing is required for the access session, the type of the access session is not updated, and the access session type is determined to be an operation and maintenance access session.
[0088] S304: Update the type of access session according to the preset application user identification set, the preset application Internet protocol address set, the preset application database operation statement type set and the user identification, the sender Internet protocol address, and the database operation statement.
[0089] In this step, if the type of the access session is an operation and maintenance access session, in order to reduce the missed detection rate of the operation and maintenance access session type and ensure that access sessions of the operation and maintenance access session type are not missed in subsequent audits, it is necessary to determine the type of the access session again.
[0090] The type of the access session is updated according to a preset application user identification set, a preset application Internet protocol address set, a preset application database operation statement type set and the user identification, the sender Internet protocol address and the database operation statement in the access session.
[0091] If the user identifier in the access session does not belong to the preset application-type user identifier set, or the sender Internet Protocol address in the access session does not belong to the preset application-type Internet Protocol address set, or the type of the database operation statement in the access session does not belong to the preset application-type database operation statement type set, then the type of the access session is updated to an operation and maintenance access session.
[0092] If the user identifier in the access session belongs to the preset application-type user identifier set, the sender Internet Protocol address in the access session belongs to the preset application-type Internet Protocol address set, and the type of the database operation statement in the access session belongs to the preset application-type database operation statement type set, then it is determined that the type of the access session is still an application access session.
[0093] It should be noted that, for access sessions that are determined to be application access sessions according to the access session classification model, and then determined to be operation and maintenance access sessions according to the user identifier, sender Internet Protocol address, and database operation statement in the access session, they can be stored. When the number of stored access sessions is equal to the preset number, the access session classification model can be trained further according to the user identifier, sender Internet Protocol address, sending time, database operation statement, and operation and maintenance access session tag in these access sessions. The preset number can be 5000, 6000, or 12000, which is not limited in the embodiment of the present application and can be set according to actual conditions.
[0094] The database access session processing method provided in this embodiment determines the type of the access session according to the access session classification model. If the type of the access session is an application access session, the type of the access session is further updated according to the user identifier, the sender Internet Protocol address, and the database operation statement in the access session, thereby effectively improving the accuracy of determining the access session type.
[0095] Figure 4 This is a flow chart of a fourth embodiment of the method for processing access sessions of a database provided by the present application. Based on the above embodiments, the present embodiment of the present application describes the training process of the access session classification model. Figure 4 As shown, the database access session processing method specifically includes the following steps:
[0096] S401: Acquire multiple sets of training data.
[0097] In this step, in order to obtain an access session classification model, the server first obtains multiple sets of training data, each set of training data includes a user identifier, a sender Internet Protocol address, a sending time, a database operation statement, and an access session type label, and the access session type label includes an operation and maintenance access session label and an application access session label.
[0098] S402: Use multiple sets of training data to perform model training on a preset supervised learning model to obtain an access session classification model.
[0099] In this step, after the server obtains multiple sets of training data, it performs training based on the multiple sets of training data and inputs the training data into a preset supervised learning model. The preset supervised learning model has a preset classification algorithm. According to the user identifier, the sender's Internet Protocol address, the sending time, the database operation statement and the access session type label, the parameters in the preset classification algorithm are updated to obtain the access session classification model.
[0100] It should be noted that the preset classification algorithm can be a K-nearest neighbor algorithm, a naive Bayes algorithm, a decision tree algorithm, etc. The embodiment of the present application does not limit the preset classification algorithm and can be selected according to actual conditions.
[0101] The database access session processing method provided in this embodiment can effectively improve the accuracy of determining the access session type by training a supervised learning model based on the user identifier, the sender's Internet Protocol address, the sending time, the database operation statement, and the access session type label in the access session to obtain an access session classification model.
[0102] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0103] Figure 5 This is a schematic diagram of the structure of an embodiment of a database access session processing device provided by the present application. Figure 5 As shown, the database access session processing device 50 includes:
[0104] An acquisition module 51 is used to acquire an access session to a database, wherein the access session includes a user identifier, an Internet protocol address of a sender, a database operation statement, and a sending time;
[0105] The processing module 52 is used to determine the type of the access session according to the user identifier, the sender Internet Protocol address, and the database operation statement, or to determine the type of the access session according to an access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, wherein the access session classification model is a pre-trained computing model for determining the type of the access session according to the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, and the types of the access sessions include operation and maintenance access sessions and application access sessions.
[0106] Furthermore, the processing module 52 is specifically configured to:
[0107] If the user identifier belongs to a preset application type user identifier set, the sender Internet Protocol address belongs to a preset application type Internet Protocol address set, and the type of the database operation statement belongs to a preset application type database operation statement type set, then the type of the access session is determined to be an application access session.
[0108] Furthermore, the processing module 52 is further configured to:
[0109] If the user identifier does not belong to the preset application-type user identifier set, or the sender Internet Protocol address does not belong to the preset application-type Internet Protocol address set, or the type of the database operation statement does not belong to the preset application-type database operation statement type set, then it is determined that the type of the access session is an operation and maintenance access session.
[0110] Furthermore, the processing module 52 is further configured to:
[0111] The user identifier, the sender Internet Protocol address, the sending time, and the database operation statement are input into the access session classification model to obtain the type of the access session.
[0112] Furthermore, the processing module 52 is further configured to:
[0113] If the type of the access session is an application access session, the type of the access session is updated according to a preset application-type user identifier set, a preset application-type Internet Protocol address set, a preset application-type database operation statement type set and the user identifier, the sender Internet Protocol address, and the database operation statement.
[0114] Furthermore, the processing module 52 is further configured to:
[0115] If the user identifier does not belong to the preset application-type user identifier set, or the sender Internet Protocol address does not belong to the preset application-type Internet Protocol address set, or the type of the database operation statement does not belong to the preset application-type database operation statement type set, then the type of the access session is updated to an operation and maintenance access session.
[0116] Furthermore, the acquisition module 51 is also used for:
[0117] A plurality of sets of training data are obtained, each set of training data includes a user identifier, a sender Internet Protocol address, a sending time, a database operation statement, and an access session type tag, wherein the access session type tag includes an operation and maintenance access session tag and an application access session tag.
[0118] Furthermore, the processing module 52 is also used for:
[0119] The plurality of sets of training data are used to perform model training on a preset supervised learning model to obtain the access session classification model.
[0120] The database access session processing device provided in this embodiment is used to execute the technical solution in any of the aforementioned method embodiments. Its implementation principle and technical effects are similar and will not be described in detail here.
[0121] Figure 6 This is a schematic diagram of the structure of an electronic device provided in this application. Figure 6 As shown, the electronic device 60 includes:
[0122] Processor 61, memory 62, and communication interface 63;
[0123] The memory 62 is used to store executable instructions of the processor 61;
[0124] The processor 61 is configured to execute the technical solution in any of the aforementioned method embodiments by executing the executable instructions.
[0125] Optionally, the memory 62 may be independent or integrated with the processor 61 .
[0126] Optionally, when the memory 62 is a device independent of the processor 61, the electronic device 60 may further include:
[0127] The bus 64 , the memory 62 and the communication interface 63 are connected to the processor 61 via the bus 64 and communicate with each other. The communication interface 63 is used to communicate with other devices.
[0128] Optionally, the communication interface 63 may be implemented by a transceiver. The communication interface is used to implement communication between the database access device and other devices (such as a client, a read-write library, and a read-only library). The memory may include a random access memory (RAM) and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage.
[0129] The bus 64 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0130] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0131] The electronic device is used to execute the technical solution in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.
[0132] An embodiment of the present application also provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the technical solution provided by any of the aforementioned method embodiments is implemented.
[0133] An embodiment of the present application also provides a computer program product, including a computer program, which is used to implement the technical solution provided by any of the aforementioned method embodiments when executed by a processor.
[0134] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for processing access sessions of a database, It is characterized in that include: Acquiring an access session to a database, wherein the access session includes a user identifier, a sender Internet Protocol address, a database operation statement, and a sending time; Determining the type of the access session according to an access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, wherein the access session classification model is a pre-trained computing model for determining the type of the access session according to the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, and the type of the access session includes an operation and maintenance access session and an application access session; The step of determining the type of the access session according to the access session classification model and the user identifier, the sender's Internet Protocol address, the sending time, and the database operation statement includes: Inputting the user identifier, the sender's Internet Protocol address, the sending time, and the database operation statement into the access session classification model to obtain the type of the access session; The method further comprises: if the type of the access session is an application access session, updating the type of the access session according to a preset application-type user identifier set, a preset application-type Internet Protocol address set, a preset application-type database operation statement type set and the user identifier, the sender Internet Protocol address, and the database operation statement; The updating of the type of the access session according to the preset application-type user identifier set, the preset application-type Internet Protocol address set, the preset application-type database operation statement type set and the user identifier, the sender Internet Protocol address, and the database operation statement includes: If the user identifier does not belong to the preset application-type user identifier set, or the sender Internet Protocol address does not belong to the preset application-type Internet Protocol address set, or the type of the database operation statement does not belong to the preset application-type database operation statement type set, then the type of the access session is updated to an operation and maintenance access session.
2. The method according to claim 1, It is characterized in that Before obtaining the access session to the database, the method further includes: Acquire multiple sets of training data, each set of training data includes a user identifier, a sender Internet Protocol address, a sending time, a database operation statement, and an access session type tag, wherein the access session type tag includes an operation and maintenance access session tag and an application access session tag; The plurality of sets of training data are used to perform model training on a preset supervised learning model to obtain the access session classification model.
3. A database access session processing device, It is characterized in that include: An acquisition module, used to acquire an access session to a database, wherein the access session includes a user identifier, an Internet protocol address of a sender, a database operation statement, and a sending time; a processing module, configured to determine the type of the access session according to an access session classification model and the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, wherein the access session classification model is a pre-trained computing model for determining the type of the access session according to the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement, and the type of the access session includes an operation and maintenance access session and an application access session; The processing module is specifically used to input the user identifier, the sender Internet Protocol address, the sending time, and the database operation statement into the access session classification model to obtain the type of the access session; The processing module is further configured to update the type of the access session according to a preset application-type user identifier set, a preset application-type Internet protocol address set, a preset application-type database operation statement type set and the user identifier, the sender Internet protocol address, and the database operation statement if the type of the access session is an application access session; The processing module is further specifically used to update the type of the access session to an operation and maintenance access session if the user identifier does not belong to a preset application-type user identifier set, or the sender Internet Protocol address does not belong to a preset application-type Internet Protocol address set, or the type of the database operation statement does not belong to a preset application-type database operation statement type set.
4. An electronic device, It is characterized in that include: Processor, memory, communication interface; The memory is used to store executable instructions of the processor; The processor is configured to execute the database access session processing method of claim 1 or 2 by executing the executable instructions.
5. A readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the database access session processing method according to claim 1 or 2 is implemented.
6. A computer program product, It is characterized in that The invention comprises a computer program, which is used to implement the database access session processing method according to claim 1 or 2 when the computer program is executed by a processor.
