Database management method and device, equipment and medium
By obtaining user attributes and assigning database permissions, and combining user group management, the separation of database permissions is achieved, the problems of centralized database permissions and low security are solved, and database security and management efficiency are improved.
Patent Information
- Application Number
- CN202411253250.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-03
AI Technical Summary
In the existing database permission management system, the permissions are too concentrated, which poses a serious threat to security when the database administrator user is leaked, and role permission assignment is easy to make mistakes and difficult to avoid.
By obtaining user attributes, assigning database permissions, and adding users to user groups, the separation of permissions is achieved, the power concentration is avoided, the user grouping characteristics are realized, and the permission separation switch is set to adjust the security level according to business.
The separation of database permissions is achieved, which avoids the over-concentration of database management functions, improves security, reduces the risk of data being acquired and abused by other groups, and does not require new permission roles.
Smart Images

Figure CN119066050A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to database management methods, devices, equipment and media. Background Art
[0002] Financial enterprise databases store a large amount of key information about the enterprise, including corporate strategy, economic operations, technical secrets, customer information, and transaction information. Permission management is a key link in protecting data resources and systems, and database user permission management is crucial. Reasonable configuration and precise control of user data access rights can effectively prevent unauthorized access, data leakage, and improper operations. At present, in some database permission management systems, there is no opposition between permissions, and the power of database administrators is concentrated. If the database administrators leak information, it will pose a serious threat to database security. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to propose a database management method, device, equipment and medium to implement the database permission separation function.
[0004] To achieve the above object, a first aspect of an embodiment of the present application proposes a database management method, comprising:
[0005] Get the attributes of the first user;
[0006] assigning database permissions to the first user according to the attributes of the first user;
[0007] Adding the first user to a user group, and assigning the database permissions of the first user to the user group;
[0008] In response to receiving a create user command from the first user, creating a second user;
[0009] Add the second user to the user group of the first user, and assign the database permissions of the user group to the second user.
[0010] In some embodiments, before creating the second user in response to receiving a create user command from the first user, the method further includes:
[0011] When the attributes of the first user meet the user creation condition, a user creation command of the first user is received.
[0012] In some embodiments, in response to receiving a create user command from the first user, creating a second user includes:
[0013] In response to receiving a create user command from the first user, when an attribute of the second user in the create user command satisfies a condition for adding the second user to the user group to which the first user belongs, creating a second user and adding the second user to the user group to which the first user belongs.
[0014] In some embodiments, the method further comprises:
[0015] receiving an execution statement command from a third user, wherein the execution statement command includes a target statement;
[0016] Checking the database permissions of the user group to which the third user belongs;
[0017] When the database permission of the user group to which the third user belongs includes the permission to execute the target statement, the target statement is executed.
[0018] In some embodiments, after consulting the database authority of the user group to which the third user belongs, the method further includes:
[0019] When the database permission of the user group to which the third user belongs includes the permission to execute the target statement, the target statement is intercepted.
[0020] In some embodiments, the target statement is a backup target data, and when the database permission of the user group to which the third user belongs includes the permission to execute the target statement, executing the target statement includes:
[0021] When the database authority of the user group to which the third user belongs includes the authority to execute the backup target data, the target data is backed up.
[0022] In some embodiments, the target statement is to restore target data, and when the database permission of the user group to which the third user belongs includes permission to execute the target statement, executing the target statement includes:
[0023] When the database authority of the user group to which the third user belongs includes the authority to execute the restoration of the target data, the target data is restored.
[0024] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a database management device, including:
[0025] An attribute query module, used to obtain the attributes of the first user;
[0026] A permission allocation module, configured to allocate database permissions to the first user according to the attributes of the first user;
[0027] A user group module, used to add the first user to a user group and assign the database permissions of the first user to the user group;
[0028] A new user creation module, configured to create a second user in response to receiving a create user command from the first user;
[0029] The new user permission module is used to add the second user to the user group of the first user and allocate the database permission of the user group to the second user.
[0030] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements the database management method as described in the first aspect of the embodiment of the present application.
[0031] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application is a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the database management method as described in the first aspect of the embodiment of the present application.
[0032] The database management method, device, equipment and medium proposed in this application solve the problems of over-centralization of database permissions, abuse of power and data insecurity; the user grouping feature is realized by using the concept of user collection. There is no need to add new permission roles, and the problem of easy errors and difficult to avoid in assigning role permissions is avoided; a permission separation switch is set, and the security level and switch permission separation function can be adjusted according to actual business needs; the permission separation category and number of groups can be customized according to one's own business situation; in terms of data backup and restoration, the data of each group is backed up and restored by the administrator of each group, and it is impossible to back up across groups, which prevents data from being obtained and abused by other groups. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a step diagram of a database management method provided in an embodiment of the present application;
[0034] Figure 2 It is a sub-step diagram of step S400 provided in an embodiment of the present application;
[0035] Figure 3 It is a sub-step diagram of step S600 provided in an embodiment of the present application;
[0036] Figure 4 is a step diagram of step S710 provided in an embodiment of the present application;
[0037] Figure 5 is a step diagram of step S720 provided in an embodiment of the present application;
[0038] Figure 6 is a structural diagram of a database management device provided in an embodiment of the present application;
[0039] Figure 7 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0043] Financial enterprise databases store a large amount of key information about the enterprise, including corporate strategy, economic operations, technical secrets, customer information, and transaction information. Permission management is a key link in protecting data resources and systems, and database user permission management is crucial. Reasonable configuration and precise control of user data access rights can effectively prevent unauthorized access, data leakage, and improper operations. At present, in some database permission management systems, there is no opposition between permissions, and the power of database administrators is concentrated. If the database administrators leak information, it will pose a serious threat to database security.
[0044] In order to solve the above problems, the embodiments of the present application provide a database management method, apparatus, device and medium, which realize the separation of database permissions and avoid excessive concentration of database power.
[0045] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0046] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0047] The database management method, device, equipment and medium provided in the embodiments of the present application relate to the field of artificial intelligence technology. The database management method provided in the embodiments of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the database management method, etc., but is not limited to the above forms.
[0048] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0049] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant regulations. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or jump to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0050] The database management method, device, equipment and medium provided in the embodiments of the present application are specifically described through the following embodiments, and firstly, the database management method in the embodiments of the present application is described.
[0051] The embodiment of the present application provides a database management method.
[0052] Reference Figure 1 , a database management method, comprising the following steps:
[0053] Step S100, obtaining attributes of the first user;
[0054] Step S200, assigning database permissions to the first user according to the attributes of the first user;
[0055] Step S300, adding the first user to the user group, and assigning the database authority of the first user to the user group;
[0056] Step S400, in response to receiving a create user command from a first user, creating a second user;
[0057] Step S500: Add the second user to the user group of the first user, and assign the database authority of the user group to the second user.
[0058] The database management method realizes the function of separating the authority of the database and avoids the excessive concentration of the management function of the database.
[0059] When initializing the database, initialize the database administrator (DBA) user and set the password of the database administrator user. Assign the permissions of the initialized objects to the database administrator user to ensure that all objects can access the initialized data.
[0060] Set the switch of the database's permission separation function. The switch of the database's permission separation function is true by default. When the switch of the database's permission separation function is true, it means that the permission separation function is turned on. When the switch of the database's permission separation function is false, it means that the permission separation function is turned off. The switch of the database's permission separation function can be configured by modifying the configuration file before starting the database.
[0061] In step S100 of some embodiments, the attributes of a first user are obtained. The first user is a user of a database.
[0062] The properties of the first user include:
[0063] Username: The user's unique identifier in the database;
[0064] Password: a credential used to verify the user's identity;
[0065] Roles: Users can be assigned one or more roles;
[0066] Schema: The database schema that users can access;
[0067] Default tablespace: The tablespace used by default when a user creates a table or index;
[0068] Quotas: In some database systems, users may have quotas on the resources they use;
[0069] Session Attributes: settings during a user session, such as time zone, language, etc.
[0070] Connection Attributes: define the attributes when the user connects to the database, such as port number, client address, etc.
[0071] Encryption Settings: used to define the encryption requirements for user connections;
[0072] Authentication Method: defines how the user is authenticated, such as by a password, certificate, or other external authentication service;
[0073] Account Lock Status: whether the account is locked, and the reason and duration of the lock;
[0074] Expiration Policy: Password and account expiration policy;
[0075] User Configuration: User-specific configuration options, such as notification settings, interface preferences, etc.
[0076] Resource Usage: Statistics of CPU, memory, I / O and other resources used by users.
[0077] It should be noted that the above user attributes are for example only. Different database systems may support slightly different user attributes, depending on the type and version of the database.
[0078] In step S200 of some embodiments, database permissions are assigned to the first user according to the attributes of the first user. Exemplarily, database permissions are assigned to the first user according to the role of the first user.
[0079] For example, the first user is a strategist, and the following database permissions are assigned to the first user: user account management, permission control, database structure management, data operation, backup and recovery, performance monitoring and optimization, database maintenance, configuration management, security management, troubleshooting, data migration, system monitoring, data migration, disaster recovery, etc.
[0080] Specifically, strategists can create, modify, and delete user accounts; grant or revoke user access rights to databases, tables, views, stored procedures, etc.; create, modify, and delete database objects, such as tables, indexes, views, stored procedures, triggers, etc.; perform add, delete, modify, and query operations on data in the database; regularly back up the database and restore data when needed; monitor database performance, analyze query efficiency, and optimize indexes and queries; perform database maintenance tasks, such as updating statistics, rebuilding indexes, shrinking databases, etc.; configure database parameters, such as memory allocation, storage configuration, etc.; implement security policies, including data encryption, auditing, and access control; diagnose and resolve problems in database operation; monitor the operating status and resource usage of the database system; migrate data between different database systems or servers; design and implement high availability solutions and disaster recovery plans for databases.
[0081] The first user is in the role of an auditor, and is assigned the following database permissions: access to audit logs, audit analysis, data access audit, audit policy management, audit record content, start and stop of audit functions, audit information storage and audit reports, etc.
[0082] Specifically, auditors can view and analyze audit logs to detect potential security risks and violations in the database; use audit analysis tools to help detect abnormal behavior, including any potential security threats, and take appropriate actions; have the authority to conduct data access audits, detect anomalies and take action to ensure the integrity and confidentiality of the data; are responsible for formulating and implementing database audit strategies, including determining the audit objects, scope and level of audit events; audit records should include information such as the time, location, type, subject, object and result of the incident; are responsible for turning audit functions on and off, including auditing of user additions, modifications and deletions, and changes in permissions; are responsible for ensuring the storage security of audit records and issuing alarms when the storage space is about to be full; generate audit reports, provide audit results and issues, and help improve data structures and systems.
[0083] The first user is the backup administrator, and the following database permissions are assigned to the first user: backup task management, backup permission control, backup media management, system and data recovery, backup system monitoring and maintenance, etc.
[0084] Specifically, the backup administrator can create and manage backup tasks, including setting backup plans, selecting backup objects and backup types; grant users or roles the permissions required to perform backup operations. For example, in MySQL, backup users may need permissions such as SELECT, SHOW VI EW, TRI GGER, EVENT, LOCK TABLES, RELOAD, REPL I CAT ION CLIENT, and PROCESS; be responsible for the storage and archiving management of backup media to ensure the security of backup media; perform data recovery operations when necessary to ensure that data can be restored from the backup in a timely and effective manner; regularly check the hardware equipment and operating status of the backup system to ensure the normal and stable operation of the backup server.
[0085] In step S300 of some embodiments, the first user is added to a user group, and the database permissions of the first user are allocated to the user group.
[0086] Exemplarily, the first user is a strategist, the first user is added to user group 1, and the strategist's database permissions are assigned to user group 1; the database permissions of user group 1 include user account management, permission control, database structure management, data operations, backup and recovery, performance monitoring and optimization, database maintenance, configuration management, security management, troubleshooting, data migration, system monitoring, data migration, disaster recovery, etc.
[0087] The first user is an auditor. The first user is added to user group 2, and the auditor's database permissions are assigned to user group 2. The database permissions of user group 2 include access to audit logs, audit analysis, data access audit, audit policy management, audit record content, startup and shutdown of audit functions, audit information storage and audit reports, etc.
[0088] The first user is the backup administrator. The first user is added to user group 3, and the database permissions of the backup administrator are assigned to user group 3. The database permissions of user group 3 include backup task management, backup permission control, backup media management, system and data recovery, monitoring and maintenance of the backup system, etc.
[0089] In step S400 of some embodiments, the database system creates a second user in response to receiving a create user command from the first user.
[0090] Reference Figure 2 , exemplarily, step S410; when the attributes of the first user meet the conditions for creating a user, receive the first user's create user command; step S420, in response to receiving the first user's create user command, when the attributes of the second user in the create user command meet the conditions for adding to the user group to which the first user belongs, create a second user and add the second user to the user group to which the first user belongs.
[0091] Specifically, the first user is a strategist, and the first user sends a create user command to the database system. The database system receives the create user command of the first user, and the database system determines whether the attributes of the first user meet the conditions for creating a user. The permissions in the attributes of the first user include the permissions for creating a user, and then the attributes of the first user meet the conditions for creating a user; the database system determines that the attributes of the second user in the create user command meet the conditions for adding to the user group to which the first user belongs. When the attributes of the second user in the create user command meet the conditions for adding to the strategist user group, the second user is created and added to the strategist user group.
[0092] The first user is an auditor. The first user sends a create user command to the database system. The database system receives the create user command from the first user. The database system determines whether the attributes of the first user meet the conditions for creating a user. If the permissions in the attributes of the first user include the permissions for creating a user, then the attributes of the first user meet the conditions for creating a user. The database system determines that the attributes of the second user in the create user command meet the conditions for adding to the user group to which the first user belongs. When the attributes of the second user in the create user command meet the conditions for adding to the auditor user group, the second user is created and added to the auditor user group.
[0093] The first user is a backup administrator. The first user sends a create user command to the database system. The database system receives the create user command from the first user. The database system determines whether the attributes of the first user meet the conditions for creating a user. If the permissions in the attributes of the first user include the permissions for creating a user, then the attributes of the first user meet the conditions for creating a user. The database system determines that the attributes of the second user in the create user command meet the conditions for adding to the user group to which the first user belongs. When the attributes of the second user in the create user command meet the conditions for adding to the backup administrator user group, the second user is created and added to the backup administrator user group.
[0094] In step S500 of some embodiments, the second user is added to the user group to which the first user belongs, and the database permissions of the user group are allocated to the second user.
[0095] Specifically, the first user is a strategist, and the database system adds the second user to the strategist user group, and assigns the database permissions of the strategist user group to the second user. Then the second user has the same database permissions as the first user, and the second user has the database permissions of the strategist. The second user can create, modify, and delete user accounts; grant or revoke user access rights to databases, tables, views, stored procedures, etc.; create, modify, and delete database objects, such as tables, indexes, views, stored procedures, triggers, etc.; perform add, delete, modify, and query operations on data in the database; regularly back up the database and restore data when necessary; monitor database performance, analyze query efficiency, and optimize indexes and queries; perform database maintenance tasks, such as updating statistics, rebuilding indexes, shrinking databases, etc.; configure database parameters, such as memory allocation, storage configuration, etc.; implement security policies, including data encryption, auditing, and access control; diagnose and resolve problems in database operation; monitor the operating status and resource usage of the database system; migrate data between different database systems or servers; design and implement database high availability solutions and disaster recovery plans.
[0096] The first user is an auditor. The database system adds the second user to the auditor user group and assigns the database permissions of the auditor user group to the second user. The second user then has the same database permissions as the first user and the auditor's database permissions. The second user can view and analyze audit logs to detect potential security risks and violations in the database; use audit analysis tools to help detect abnormal behavior, including any potential security threats, and take appropriate actions; have the right to conduct data access audits, detect anomalies and take action to ensure data integrity and confidentiality; be responsible for developing and implementing database audit policies, including determining audit objects, the scope and level of audit events; be responsible for turning on and off audit functions, including auditing of user additions, modifications and deletions, and permission changes; be responsible for ensuring the storage security of audit records and issuing alerts when the storage space is about to be full; generate audit reports, provide audit results and issues, and help improve data structures and systems.
[0097] The first user is the backup administrator. The database system adds the second user to the backup administrator user group and assigns the database permissions of the backup administrator user group to the second user. The second user then has the same database permissions as the first user and the database permissions of the backup administrator. The second user can create and manage backup tasks, including setting backup plans, selecting backup objects and backup types; granting users or roles the permissions required to perform backup operations; being responsible for the storage and archiving management of backup media to ensure the security of backup media; performing data recovery operations when necessary to ensure that data can be restored from backups in a timely and effective manner; and regularly checking the hardware equipment and operating status of the backup system to ensure the normal and stable operation of the backup server.
[0098] It should be noted that the database system limits the permissions of database users. Database users cannot create and manage subordinate users with opposing permissions, and cannot view and modify the data of subordinate users with opposing permissions, so as to implement permission restriction management.
[0099] Reference Figure 3 , the database system also requires statement execution restriction management. The database management method also includes the following steps:
[0100] Step S610, receiving an execution statement command from a third user;
[0101] Step S620, checking the database authority of the user group to which the third user belongs;
[0102] Step S630, when the database permission of the user group to which the third user belongs includes the permission to execute the target statement, execute the target statement;
[0103] Step S640: When the query result shows that the database permission of the user group to which the third user belongs includes the permission to execute the target statement, the database system intercepts the target statement.
[0104] The database user sends an execute statement command to the database system, that is, the database user is a third user. The database system receives the execute statement command from the third user. The database system queries the database permissions of the user group to which the third user belongs. When the query result shows that the database permissions of the user group to which the third user belongs include the permissions to execute the target statement, the database system executes the target statement. When the query result shows that the database permissions of the user group to which the third user belongs include the permissions to execute the target statement, the database system intercepts the target statement.
[0105] Exemplarily, the third user is a strategist. The strategist sends a data operation-related execution statement command to the database system, the database system receives the data operation-related execution statement command, and the database system queries the database permissions of the user group to which the strategist belongs. When the query result shows that the database permissions of the user group to which the strategist belongs include permissions to execute a target statement related to the data operation, the database system executes the target statement related to the data operation.
[0106] The strategist sends a data audit-related execution statement command to the database system. The database system receives the audit-related execution statement command and queries the database permissions of the user group to which the strategist belongs. If the query result shows that the database permissions of the user group to which the strategist belongs do not include the permissions to execute data audit-related execution statement commands, the database system intercepts the target statements related to data audit.
[0107] It is understandable that users in different user groups can only view the data that their user groups have permission to view. The group leaders of different user groups back up the data, policies, etc. of their respective groups.
[0108] Reference Figure 4 , the target statement is to back up the target data. When the database permissions of the user group to which the third user belongs include the permissions to execute the target statement, the target statement is executed, including the following steps: Step S710, when the database permissions of the user group to which the third user belongs include the permissions to execute the back up target data, the target data is backed up.
[0109] Exemplarily, the third user is an auditor, and the auditor sends an execution statement command for backing up audit data to the database system. The database system receives the execution statement command for backing up audit data, and the database system queries the database authority of the user group to which the auditor belongs. When the query result shows that the database authority of the user group to which the auditor belongs includes the authority to execute the execution statement command for backing up audit data, the database system executes the backing up audit data and adds restrictions to the backing up audit data, so that only the user group to which the auditor belongs can operate on the backing up audit data.
[0110] Reference Figure 5 , the target statement is to restore the target data. When the database permissions of the user group to which the third user belongs include the permissions to execute the target statement, the target statement is executed, including the following steps: Step S720, when the database permissions of the user group to which the third user belongs include the permissions to execute and restore the target data, the target data is restored.
[0111] Exemplarily, the third user is an auditor, and the auditor sends an execution statement command for restoring audit data to the database system. The database system receives the execution statement command for restoring audit data, and the database system queries the database permissions of the user group to which the auditor belongs. When the query result shows that the database permissions of the user group to which the auditor belongs include the permissions for executing the execution statement command for restoring audit data, the database system executes the restoration of audit data.
[0112] It is understandable that the database data belongs to the user who backed up the data according to the permission to restore the data.
[0113] In this embodiment, the database management method solves the problem of over-centralization of database permissions, solves the problem that database administrators have super permissions and can manage all objects, which easily leads to abuse of power by database administrators and data insecurity; the user grouping feature is realized by using the concept of user collection. There is no need to add new permission roles, and the problem of easy errors and difficult to avoid in assigning role permissions is avoided; a permission separation switch is set, and the security level and the switch permission separation function can be adjusted according to the actual business needs; the permission separation category and the number of groups can be customized according to their own business conditions; in terms of data backup and restoration, the data of each group is backed up and restored by the administrator of each group, and it is impossible to back up across groups, which avoids the data being obtained and abused by other groups.
[0114] The embodiment of the present application also provides a database management device, which is applied in a database system.
[0115] Reference Figure 6 , a database management device includes: an attribute query module 810, a permission allocation module 820, a user group module 830, a new user creation module 840 and a new user permission module 850.
[0116] Among them, the attribute query module 810 is used to obtain the attributes of the first user; the permission allocation module 820 is used to allocate database permissions to the first user according to the attributes of the first user; the user group module 830 is used to add the first user to the user group and allocate the database permissions of the first user to the user group; the new user creation module 840 is used to create a second user in response to receiving a create user command from the first user; the new user permission module 850 is used to add the second user to the user group to which the first user belongs, and allocate the database permissions of the user group to the second user.
[0117] The database management device realizes the function of separating the authority of the database, and avoids the excessive concentration of the management function of the database.
[0118] When initializing the database, initialize the database administrator user and set the database administrator user's password. Assign the permissions of the initialized objects to the database administrator user to ensure that all objects can access the initialized data.
[0119] Set the switch of the database's permission separation function. The switch of the database's permission separation function is true by default. When the switch of the database's permission separation function is true, it means that the permission separation function is turned on. When the switch of the database's permission separation function is false, it means that the permission separation function is turned off. The switch of the database's permission separation function can be configured by modifying the configuration file before starting the database.
[0120] The attribute query module 810 obtains the attributes of the first user. The first user is a user in the database.
[0121] The attributes of the first user include: user name, password, role, mode, default tablespace, quota, session attributes, connection attributes, encryption settings, authentication method, account lock status, expiration policy, user configuration, resource usage, etc.
[0122] It should be noted that the above user attributes are for example only. Different database systems may support slightly different user attributes, depending on the type and version of the database.
[0123] The authority allocation module 820 allocates database authority to the first user according to the attributes of the first user. For example, the database authority is allocated to the first user according to the role of the first user.
[0124] For example, the first user is a strategist, and the following database permissions are assigned to the first user: user account management, permission control, database structure management, data operation, backup and recovery, performance monitoring and optimization, database maintenance, configuration management, security management, troubleshooting, data migration, system monitoring, data migration, disaster recovery, etc.
[0125] Specifically, strategists can create, modify, and delete user accounts; grant or revoke user access rights to databases, tables, views, stored procedures, etc.; create, modify, and delete database objects, such as tables, indexes, views, stored procedures, triggers, etc.; perform add, delete, modify, and query operations on data in the database; regularly back up the database and restore data when needed; monitor database performance, analyze query efficiency, and optimize indexes and queries; perform database maintenance tasks, such as updating statistics, rebuilding indexes, shrinking databases, etc.; configure database parameters, such as memory allocation, storage configuration, etc.; implement security policies, including data encryption, auditing, and access control; diagnose and resolve problems in database operation; monitor the operating status and resource usage of the database system; migrate data between different database systems or servers; design and implement high availability solutions and disaster recovery plans for databases.
[0126] The first user is in the role of an auditor, and is assigned the following database permissions: access to audit logs, audit analysis, data access audit, audit policy management, audit record content, start and stop of audit functions, audit information storage and audit reports, etc.
[0127] Specifically, auditors can view and analyze audit logs to detect potential security risks and violations in the database; use audit analysis tools to help detect abnormal behavior, including any potential security threats, and take appropriate actions; have the authority to conduct data access audits, detect anomalies and take action to ensure the integrity and confidentiality of the data; are responsible for formulating and implementing database audit strategies, including determining the audit objects, scope and level of audit events; audit records should include information such as the time, location, type, subject, object and result of the incident; are responsible for turning audit functions on and off, including auditing of user additions, modifications and deletions, and changes in permissions; are responsible for ensuring the storage security of audit records and issuing alarms when the storage space is about to be full; generate audit reports, provide audit results and issues, and help improve data structures and systems.
[0128] The first user is the backup administrator, and the following database permissions are assigned to the first user: backup task management, backup permission control, backup media management, system and data recovery, backup system monitoring and maintenance, etc.
[0129] Specifically, backup administrators can create and manage backup tasks, including setting backup plans, selecting backup objects and backup types; granting users or roles the permissions required to perform backup operations; being responsible for the storage and archiving management of backup media to ensure the security of backup media; performing data recovery operations when necessary to ensure that data can be restored from backups in a timely and effective manner; and regularly checking the hardware equipment and operating status of the backup system to ensure the normal and stable operation of the backup server.
[0130] The user group module 830 adds the first user to the user group and allocates the database authority of the first user to the user group.
[0131] Exemplarily, the first user is a strategist, the first user is added to user group 1, and the strategist's database permissions are assigned to user group 1; the database permissions of user group 1 include user account management, permission control, database structure management, data operations, backup and recovery, performance monitoring and optimization, database maintenance, configuration management, security management, troubleshooting, data migration, system monitoring, data migration, disaster recovery, etc.
[0132] The first user is an auditor. The first user is added to user group 2, and the auditor's database permissions are assigned to user group 2. The database permissions of user group 2 include access to audit logs, audit analysis, data access audit, audit policy management, audit record content, startup and shutdown of audit functions, audit information storage and audit reports, etc.
[0133] The first user is the backup administrator. The first user is added to user group 3, and the database permissions of the backup administrator are assigned to user group 3. The database permissions of user group 3 include backup task management, backup permission control, backup media management, system and data recovery, monitoring and maintenance of the backup system, etc.
[0134] The new user creation module 840 creates a second user in response to receiving a create user command from the first user.
[0135] Exemplarily, when the attributes of the first user meet the conditions for creating a user, a command for creating a user from the first user is received. In response to receiving the command for creating a user from the first user, when the attributes of the second user in the command for creating a user meet the conditions for adding to the user group to which the first user belongs, a second user is created and the second user is added to the user group to which the first user belongs.
[0136] Specifically, the first user is a strategist. The first user sends a create user command to the new user creation module 840. The new user creation module 840 receives the first user's create user command. The new user creation module 840 determines whether the first user's attributes meet the user creation conditions. If the permissions in the first user's attributes include the permissions to create a user, then the first user's attributes meet the user creation conditions. The new user creation module 840 determines whether the second user's attributes in the create user command meet the conditions for adding to the user group to which the first user belongs. When the second user's attributes in the create user command meet the conditions for adding to the strategist user group, the second user is created and added to the strategist user group.
[0137] The first user is an auditor. The first user sends a create user command to the new user creation module 840. The new user creation module 840 receives the first user's create user command. The new user creation module 840 determines whether the first user's attributes meet the user creation conditions. If the permissions in the first user's attributes include the permissions to create a user, then the first user's attributes meet the user creation conditions. The new user creation module 840 determines whether the second user's attributes in the create user command meet the conditions for adding to the user group to which the first user belongs. When the second user's attributes in the create user command meet the conditions for adding to the auditor's user group, the second user is created and added to the auditor's user group.
[0138] The first user is a backup administrator. The first user sends a create user command to the new user creation module 840. The new user creation module 840 receives the first user's create user command. The new user creation module 840 determines whether the first user's attributes meet the user creation conditions. If the permissions in the first user's attributes include the permissions to create a user, then the first user's attributes meet the user creation conditions. The new user creation module 840 determines whether the second user's attributes in the create user command meet the conditions for adding to the user group to which the first user belongs. When the second user's attributes in the create user command meet the conditions for adding to the backup administrator user group, the second user is created and added to the backup administrator user group.
[0139] The new user permission module 850 adds the second user to the user group to which the first user belongs, and allocates the database permission of the user group to the second user.
[0140] Specifically, the first user is a strategist, and the new user permission module 850 adds the second user to the strategist user group, and assigns the database permissions of the strategist user group to the second user, so that the second user has the same database permissions as the first user, and the second user has the database permissions of the strategist. The second user can create, modify and delete user accounts; grant or revoke user access rights to databases, tables, views, stored procedures, etc.; create, modify and delete database objects, such as tables, indexes, views, stored procedures, triggers, etc.; perform add, delete, modify and query operations on data in the database; regularly back up the database and restore data when necessary; monitor database performance, analyze query efficiency, optimize indexes and queries; perform database maintenance tasks, such as updating statistics, rebuilding indexes, shrinking databases, etc.; configure database parameters, such as memory allocation, storage configuration, etc.; implement security policies, including data encryption, auditing and access control; diagnose and solve problems in database operation; monitor the operating status and resource usage of the new user permission module 850; migrate data between different new user permission modules 850 or servers; design and implement high availability solutions and disaster recovery plans for databases.
[0141] The first user is an auditor. The new user permission module 850 adds the second user to the auditor user group and assigns the database permissions of the auditor user group to the second user. Then the second user has the same database permissions as the first user, and the second user has the database permissions of the auditor. The second user can view and analyze audit logs to detect potential security risks and violations in the database; use audit analysis tools to help discover abnormal behavior, including any potential security threats, and take appropriate actions; have the right to conduct data access audits, discover anomalies and take actions to ensure the integrity and confidentiality of the data; be responsible for formulating and implementing database audit policies, including determining audit objects, the scope and level of audit events; be responsible for turning on and off audit functions, including auditing the addition, modification and deletion of users and changes in permissions; be responsible for ensuring the storage security of audit records and issuing alarms when the storage space is about to be full; generate audit reports, provide audit results and issues, and help improve data structures and systems.
[0142] The first user is a backup administrator. The new user permission module 850 adds the second user to the backup administrator user group and assigns the database permissions of the backup administrator user group to the second user. The second user then has the same database permissions as the first user and the database permissions of the backup administrator. The second user can create and manage backup tasks, including setting backup plans, selecting backup objects and backup types; granting users or roles the permissions required to perform backup operations; being responsible for the storage and archiving management of backup media to ensure the safety of backup media; performing data recovery operations when necessary to ensure that data can be restored from backups in a timely and effective manner; and regularly checking the hardware equipment and operating status of the backup system to ensure the normal and stable operation of the backup server.
[0143] It should be noted that the database system limits the permissions of database users. Database users cannot create and manage subordinate users with opposing permissions, and cannot view and modify the data of subordinate users with opposing permissions, so as to implement permission restriction management.
[0144] The database management device also performs statement execution restriction management through the authority management module 860. The authority management module 860 receives the execution statement command of the third user; checks the database authority of the user group to which the third user belongs; and executes the target statement when the database authority of the user group to which the third user belongs includes the authority to execute the target statement.
[0145] The database user sends an execute statement command to the authority management module 860, that is, the database user is a third user. The authority management module 860 receives the execute statement command of the third user. The authority management module 860 queries the database authority of the user group to which the third user belongs. When the query result shows that the database authority of the user group to which the third user belongs includes the authority to execute the target statement, the authority management module 860 executes the target statement. When the query result shows that the database authority of the user group to which the third user belongs includes the authority to execute the target statement, the authority management module 860 intercepts the target statement.
[0146] Exemplarily, the third user is a strategist. The strategist sends an execution statement command related to data operation to the authority management module 860, and the authority management module 860 receives the execution statement command related to data operation, and the authority management module 860 queries the database authority of the user group to which the strategist belongs. When the query result shows that the database authority of the user group to which the strategist belongs includes the authority to execute the target statement related to data operation, the authority management module 860 executes the target statement related to data operation.
[0147] The strategist sends a data audit-related execution statement command to the authority management module 860, which receives the audit-related execution statement command and queries the database authority of the user group to which the strategist belongs. When the query result shows that the database authority of the user group to which the strategist belongs does not include the authority to execute the data audit-related execution statement command, the authority management module 860 intercepts the target statement related to the data audit.
[0148] It is understandable that users in different user groups can only view the data that their user groups have permission to view. The group leaders of different user groups back up the data, policies, etc. of their respective groups.
[0149] The target statement is to back up the target data. When the database permission of the user group to which the third user belongs includes the permission to execute the back up target data, the target data is backed up.
[0150] Exemplarily, the third user is an auditor, and the auditor sends an execution statement command for backing up audit data to the authority management module 860, and the authority management module 860 receives the execution statement command for backing up audit data, and queries the database authority of the user group to which the auditor belongs. When the query result shows that the database authority of the user group to which the auditor belongs includes the authority to execute the execution statement command for backing up audit data, the authority management module 860 executes the backing up audit data and adds restrictions to the backing up audit data, so that only the user group to which the auditor belongs can operate on the backing up audit data.
[0151] The target statement is to restore the target data. When the database permission of the user group to which the third user belongs includes the permission to execute the restoration of the target data, the target data is restored.
[0152] Exemplarily, the third user is an auditor, and the auditor sends an execution statement command for restoring audit data to the authority management module 860, and the authority management module 860 receives the execution statement command for restoring audit data, and queries the database authority of the user group to which the auditor belongs. When the query result shows that the database authority of the user group to which the auditor belongs includes the authority to execute the execution statement command for restoring audit data, the authority management module 860 executes the restoration of audit data.
[0153] It is understandable that the database data belongs to the user who backed up the data according to the permission to restore the data.
[0154] In this embodiment, the database management device solves the problem of over-centralization of database permissions, solves the problem that the database administrator has super permissions and can manage all objects, which easily leads to abuse of power by the database administrator and data insecurity; the user grouping feature is realized by using the user set concept. There is no need to add new permission roles, and the problem of easy errors and difficult to avoid in assigning role permissions is avoided; a permission separation switch is set, and the security level and the switch permission separation function can be adjusted according to the actual business needs; the permission separation category and the number of groups can be customized according to the business situation; in terms of data backup and restoration, the data of each group is backed up and restored by the administrator of each group, and it is impossible to back up across groups, which avoids the data being obtained and abused by other groups.
[0155] The present application also provides an electronic device. Figure 7 The electronic device includes a memory 902 and a processor 901. The memory 902 stores a computer program. The processor 901 implements the above database management method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0156] The processor 901 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application; the memory 902 can be implemented in the form of a read-only memory (Read Only Memory, ROM), a static storage device, a dynamic storage device, or a random access memory (Random Access Memory, RAM), etc. The memory 902 can store an operating system and other application programs. When the technical solutions provided in the embodiments of the present specification are implemented by software or firmware, the relevant program codes are stored in the memory 902, and the database management method of the embodiments of the present application is called and executed by the processor 901.
[0157] The input / output interface 903 is used to realize information input and output; the communication interface 904 is used to realize communication interaction between this device and other devices, and communication can be realized through wired methods (such as USB, network cable, etc.) or wireless methods (such as mobile network, WI FI, Bluetooth, etc.); the bus 905 transmits information between the various components of the device (such as the processor 901, the memory 902, the input / output interface 903 and the communication interface 904); the processor 901, the memory 902, the input / output interface 903 and the communication interface 904 realize communication connection with each other within the device through the bus 905.
[0158] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and the computer program implements the above-mentioned database management method when executed by a processor.
[0159] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0160] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0161] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0162] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0163] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0164] The terms "first", "second", "third", "fourth", etc. (if any) in the specification 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 interchangeable 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 of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising 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.
[0165] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0166] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0167] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0168] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0169] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0170] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A database management method, characterized in that: include: Get the attributes of the first user; assigning database permissions to the first user according to the attributes of the first user; Adding the first user to a user group, and assigning the database permissions of the first user to the user group; In response to receiving a create user command from the first user, creating a second user; Add the second user to the user group of the first user, and assign the database permissions of the user group to the second user.
2. The database management method according to claim 1, characterized in that: Before creating the second user in response to receiving a create user command from the first user, the method further includes: When the attributes of the first user meet the user creation condition, a user creation command of the first user is received.
3. The database management method according to claim 1, characterized in that: The step of creating a second user in response to receiving a create user command from the first user comprises: In response to receiving a create user command from the first user, when an attribute of the second user in the create user command satisfies a condition for adding the second user to the user group to which the first user belongs, creating a second user and adding the second user to the user group to which the first user belongs.
4. The database management method according to claim 1, characterized in that: The method further comprises: receiving an execution statement command from a third user, wherein the execution statement command includes a target statement; Checking the database permissions of the user group to which the third user belongs; When the database permission of the user group to which the third user belongs includes the permission to execute the target statement, the target statement is executed.
5. The database management method according to claim 4, characterized in that: After consulting the database authority of the user group to which the third user belongs, the method further includes: When the database permission of the user group to which the third user belongs includes the permission to execute the target statement, the target statement is intercepted.
6. The database management method according to claim 4, characterized in that: The target statement is a backup target data, and when the database permission of the user group to which the third user belongs includes the permission to execute the target statement, executing the target statement includes: When the database authority of the user group to which the third user belongs includes the authority to execute the backup target data, the target data is backed up.
7. The database management method according to claim 4, characterized in that: The target statement is to restore the target data. When the database permission of the user group to which the third user belongs includes the permission to execute the target statement, executing the target statement includes: When the database authority of the user group to which the third user belongs includes the authority to execute the restoration of the target data, the target data is restored.
8. A database management device, characterized in that: include: An attribute query module, used to obtain the attributes of the first user; A permission allocation module, configured to allocate database permissions to the first user according to the attributes of the first user; A user group module, used to add the first user to a user group and assign the database permissions of the first user to the user group; A new user creation module, configured to create a second user in response to receiving a create user command from the first user; The new user permission module is used to add the second user to the user group of the first user and allocate the database permission of the user group to the second user.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the database management method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the database management method according to any one of claims 1 to 7 is implemented.
