[go: up one dir, main page]

CN110968569B - Database management method, database management device, and storage medium - Google Patents

Database management method, database management device, and storage medium Download PDF

Info

Publication number
CN110968569B
CN110968569B CN201911322188.0A CN201911322188A CN110968569B CN 110968569 B CN110968569 B CN 110968569B CN 201911322188 A CN201911322188 A CN 201911322188A CN 110968569 B CN110968569 B CN 110968569B
Authority
CN
China
Prior art keywords
database
version
terminal
meets
latest version
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911322188.0A
Other languages
Chinese (zh)
Other versions
CN110968569A (en
Inventor
岑剑和
廖福康
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Pinwei Software Co Ltd
Original Assignee
Guangzhou Pinwei Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Pinwei Software Co Ltd filed Critical Guangzhou Pinwei Software Co Ltd
Priority to CN201911322188.0A priority Critical patent/CN110968569B/en
Publication of CN110968569A publication Critical patent/CN110968569A/en
Application granted granted Critical
Publication of CN110968569B publication Critical patent/CN110968569B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning

Landscapes

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

Abstract

本发明公开了一种数据库的管理方法,包括以下步骤:在检测到基于数据定义语言发起的数据库操作审核完成后,获取所述数据库操作针对的数据库作为第一数据库;根据所述数据库操作变更所述第一数据库,得到第二数据库;将所述第二数据库更新为最新版本的数据库。本发明还公开了一种数据库的管理装置以及计算机可读存储介质。本发明提高了对数据库管理的效率。

The invention discloses a database management method, which includes the following steps: after detecting that the database operation audit initiated based on the data definition language is completed, obtaining the database targeted by the database operation as the first database; changing the database operation according to the database operation. The first database is used to obtain a second database; and the second database is updated to the latest version of the database. The invention also discloses a database management device and a computer-readable storage medium. The invention improves the efficiency of database management.

Description

数据库的管理方法、数据库的管理装置及存储介质Database management method, database management device and storage medium

技术领域Technical field

本发明涉及数据库技术领域,尤其涉及一种数据库的管理方法、数据库的管理装置以及计算机可读存储介质。The present invention relates to the field of database technology, and in particular, to a database management method, a database management device and a computer-readable storage medium.

背景技术Background technique

在实际生产环境中,由于数据库数量庞大,DDL(Data Definition Language,数据定义语言)变更风险高,所以为了对DDL进行有效管理,一般会在针对生产业务的数据库管理系统中,增加审批及执行场景流程。但在现有的数据库管理中,存在审批成本高、流程慢等问题,导致数据库管理效率低下。In an actual production environment, due to the large number of databases, the risk of DDL (Data Definition Language) changes is high. Therefore, in order to effectively manage DDL, approval and execution scenarios are generally added to the database management system for production business. process. However, in existing database management, there are problems such as high approval costs and slow processes, resulting in low efficiency of database management.

上述内容仅用于辅助理解本发明的技术方案,并不代表承认上述内容是现有技术。The above content is only used to assist in understanding the technical solution of the present invention, and does not represent an admission that the above content is prior art.

发明内容Contents of the invention

本发明的主要目的在于提供一种数据库的管理方法、数据库的管理装置以及计算机可读存储介质,提高了对数据库管理的效率。The main purpose of the present invention is to provide a database management method, a database management device and a computer-readable storage medium, so as to improve the efficiency of database management.

为实现上述目的,本发明提供一种数据库的管理方法,所述数据库的管理方法包括以下步骤:In order to achieve the above object, the present invention provides a database management method. The database management method includes the following steps:

在检测到基于数据定义语言发起的数据库操作审核完成后,获取所述数据库操作针对的数据库作为第一数据库;After detecting that the database operation review initiated based on the data definition language is completed, obtain the database targeted by the database operation as the first database;

根据所述数据库操作变更所述第一数据库,得到第二数据库;Modify the first database according to the database operation to obtain a second database;

将所述第二数据库更新为最新版本的数据库。The second database is updated to the latest version of the database.

可选地,所述根据所述数据库操作变更所述第一数据库,得到第二数据库的步骤之后,还包括:Optionally, after the step of changing the first database according to the database operation to obtain the second database, the method further includes:

检测所述第二数据库是否符合预设需求;Detect whether the second database meets preset requirements;

在所述第二数据库符合预设需求时,执行所述将所述第二数据库更新为最新版本的数据库的步骤。When the second database meets the preset requirements, the step of updating the second database to the latest version of the database is performed.

可选地,所述检测所述第二数据库是否符合预设需求的步骤之后,还包括:Optionally, after the step of detecting whether the second database meets preset requirements, the step further includes:

在所述第二数据库不符合预设需求时,将所述第二数据库还原为所述第一数据库。When the second database does not meet the preset requirements, the second database is restored to the first database.

可选地,所述检测所述第二数据库是否符合预设需求的步骤包括:Optionally, the step of detecting whether the second database meets preset requirements includes:

将所述第二数据库输出至测试人员的关联终端,以供所述测试人员检测所述第二数据库是否符合预设需求;Output the second database to the associated terminal of the tester, so that the tester can detect whether the second database meets the preset requirements;

在接收到所述关联终端发送的确认响应时,判定所述第二数据库符合预设需求;Upon receiving the confirmation response sent by the associated terminal, it is determined that the second database meets the preset requirements;

在接收到所述关联终端发送的取消响应时,判定所述第二数据库不符合预设需求。When receiving the cancellation response sent by the associated terminal, it is determined that the second database does not meet the preset requirements.

可选地,所述检测所述第二数据库是否符合预设需求的步骤之后,还包括:Optionally, after the step of detecting whether the second database meets preset requirements, the step further includes:

在所述第二数据库不符合预设需求时,以及在接收到所述关联终端发送的数据定义语言数据包时,根据所述数据定义语言数据包更新所述第二数据库,得到第三数据库;When the second database does not meet the preset requirements and when the data definition language data packet sent by the associated terminal is received, update the second database according to the data definition language data packet to obtain a third database;

将所述第三数据库更新为最新版本的数据库。The third database is updated to the latest version of the database.

可选地,所述根据所述数据库操作变更所述第一数据库,得到第二数据库的步骤之后,还包括:Optionally, after the step of changing the first database according to the database operation to obtain the second database, the method further includes:

在最新版本的数据库生成时,将上一版本的数据库进行保存,并记录保存时间;When the latest version of the database is generated, save the previous version of the database and record the save time;

在接收到数据库版本更改指令时,从保存的数据库中,获取所述保存时间与所述数据库版本更改指令所针对的时间对应的数据库;When receiving the database version change instruction, obtain from the saved database the database corresponding to the storage time and the time targeted by the database version change instruction;

将获取得到的数据库更新为最新版本的数据库。Update the obtained database to the latest version.

可选地,所述根据所述数据库操作变更所述第一数据库,得到第二数据库的步骤之后,还包括:Optionally, after the step of changing the first database according to the database operation to obtain the second database, the method further includes:

在最新版本的数据库生成时,将上一版本的数据库进行保存;When the latest version of the database is generated, the previous version of the database is saved;

在数据库版本选择界面提供保存的数据库;Provide the saved database in the database version selection interface;

在检测到基于所述数据库版本选择界面生成的数据库选择指令时,将所述数据库选择指令所针对的数据库进行加载。When a database selection instruction generated based on the database version selection interface is detected, the database targeted by the database selection instruction is loaded.

为实现上述目的,本发明还提供一种数据库的管理装置,所述数据库的管理装置包括:In order to achieve the above object, the present invention also provides a database management device. The database management device includes:

所述数据库的管理装置包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的数据库的管理程序,所述数据库的管理程序被所述处理器执行时实现如上述数据库的管理方法的步骤。The database management device includes a memory, a processor, and a database management program stored in the memory and executable on the processor. When the database management program is executed by the processor, the above database is implemented. management steps.

为实现上述目的,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有数据库的管理程序,所述数据库的管理程序被处理器执行时实现如上述数据库的管理方法的步骤。In order to achieve the above object, the present invention also provides a computer-readable storage medium. The computer-readable storage medium stores a database management program. When the database management program is executed by the processor, the above-mentioned database management method is implemented. A step of.

本发明提供的数据库的管理方法、数据库的管理装置以及计算机可读存储介质,在检测到基于数据定义语言发起的数据库操作审核完成后,获取所述数据库操作针对的数据库作为第一数据库;根据所述数据库操作变更所述第一数据库,得到第二数据库;将所述第二数据库更新为最新版本的数据库。这样,提高了对数据库管理的效率。The database management method, database management device and computer-readable storage medium provided by the present invention, after detecting that the database operation review initiated based on the data definition language is completed, obtains the database targeted by the database operation as the first database; according to the The database operation changes the first database to obtain a second database; and updates the second database to the latest version of the database. In this way, the efficiency of database management is improved.

附图说明Description of the drawings

图1为本发明实施例方案涉及的实施例终端的硬件运行环境示意图;Figure 1 is a schematic diagram of the hardware operating environment of the embodiment terminal involved in the embodiment of the present invention;

图2为本发明数据库的管理方法第一实施例的流程示意图;Figure 2 is a schematic flow chart of the first embodiment of the database management method of the present invention;

图3为本发明数据库的管理方法第二实施例的流程示意图;Figure 3 is a schematic flow chart of the second embodiment of the database management method of the present invention;

图4为本发明数据库的管理方法第三实施例的流程示意图。Figure 4 is a schematic flowchart of a third embodiment of the database management method of the present invention.

本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization of the purpose, functional features and advantages of the present invention will be further described with reference to the embodiments and the accompanying drawings.

具体实施方式Detailed ways

应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It should be understood that the specific embodiments described here are only used to explain the present invention and are not intended to limit the present invention.

本发明提供一种数据库的管理方法,提高了对数据库管理的效率。The invention provides a database management method, which improves the efficiency of database management.

如图1所示,图1是本发明实施例方案涉及的实施例终端的硬件运行环境示意图;As shown in Figure 1, Figure 1 is a schematic diagram of the hardware operating environment of the embodiment terminal involved in the embodiment of the present invention;

本发明实施例终端可以是数据库的管理装置,也可以是一种数据库管理系统。The terminal in the embodiment of the present invention may be a database management device or a database management system.

如图1所示,该终端可以包括:处理器1001,例如CPU中央处理器(centralprocessing unit),存储器1002,通信总线1003。其中,通信总线1003用于实现该终端中各组成部件之间的连接通信。存储器1002可以是高速RAM随机存储器(random-accessmemory),也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1002可选的还可以是独立于前述处理器1001的存储装置。As shown in Figure 1, the terminal may include: a processor 1001, such as a CPU central processing unit (central processing unit), a memory 1002, and a communication bus 1003. Among them, the communication bus 1003 is used to realize connection and communication between various components in the terminal. The memory 1002 may be a high-speed RAM random-access memory (random-access memory) or a stable memory (non-volatile memory), such as a disk memory. The memory 1002 may optionally be a storage device independent of the aforementioned processor 1001.

本领域技术人员可以理解,图1中示出的终端的结构并不构成对本发明实施例终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the terminal shown in Figure 1 does not constitute a limitation on the terminal according to the embodiment of the present invention. It may include more or fewer components than shown in the figure, or some components may be combined, or different components may be used. layout.

如图1所示,作为一种计算机存储介质的存储器1002中可以包括数据库的管理程序。As shown in FIG. 1 , a memory 1002 as a computer storage medium may include a database management program.

在图1所示的终端中,处理器1001可以用于调用存储器1002中存储的数据库的管理程序,并执行以下操作:In the terminal shown in Figure 1, the processor 1001 can be used to call the management program of the database stored in the memory 1002, and perform the following operations:

在检测到基于数据定义语言发起的数据库操作审核完成后,获取所述数据库操作针对的数据库作为第一数据库;After detecting that the database operation review initiated based on the data definition language is completed, obtain the database targeted by the database operation as the first database;

根据所述数据库操作变更所述第一数据库,得到第二数据库;Modify the first database according to the database operation to obtain a second database;

将所述第二数据库更新为最新版本的数据库。The second database is updated to the latest version of the database.

进一步地,处理器1001可以调用存储器1002中存储的数据库的管理程序,还执行以下操作:Further, the processor 1001 can call the management program of the database stored in the memory 1002, and also perform the following operations:

检测所述第二数据库是否符合预设需求;Detect whether the second database meets preset requirements;

在所述第二数据库符合预设需求时,执行所述将所述第二数据库更新为最新版本的数据库的步骤。When the second database meets the preset requirements, the step of updating the second database to the latest version of the database is performed.

进一步地,处理器1001可以调用存储器1002中存储的数据库的管理程序,还执行以下操作:Further, the processor 1001 can call the management program of the database stored in the memory 1002, and also perform the following operations:

在所述第二数据库不符合预设需求时,将所述第二数据库还原为所述第一数据库。When the second database does not meet the preset requirements, the second database is restored to the first database.

进一步地,处理器1001可以调用存储器1002中存储的数据库的管理程序,还执行以下操作:Further, the processor 1001 can call the management program of the database stored in the memory 1002, and also perform the following operations:

将所述第二数据库输出至测试人员的关联终端,以供所述测试人员检测所述第二数据库是否符合预设需求;Output the second database to the associated terminal of the tester, so that the tester can detect whether the second database meets the preset requirements;

在接收到所述关联终端发送的确认响应时,判定所述第二数据库符合预设需求;Upon receiving the confirmation response sent by the associated terminal, it is determined that the second database meets the preset requirements;

在接收到所述关联终端发送的取消响应时,判定所述第二数据库不符合预设需求。When receiving the cancellation response sent by the associated terminal, it is determined that the second database does not meet the preset requirements.

进一步地,处理器1001可以调用存储器1002中存储的数据库的管理程序,还执行以下操作:Further, the processor 1001 can call the management program of the database stored in the memory 1002, and also perform the following operations:

在所述第二数据库不符合预设需求时,以及在接收到所述关联终端发送的数据定义语言数据包时,根据所述数据定义语言数据包更新所述第二数据库,得到第三数据库;When the second database does not meet the preset requirements and when the data definition language data packet sent by the associated terminal is received, update the second database according to the data definition language data packet to obtain a third database;

将所述第三数据库更新为最新版本的数据库。The third database is updated to the latest version of the database.

进一步地,处理器1001可以调用存储器1002中存储的数据库的管理程序,还执行以下操作:Further, the processor 1001 can call the management program of the database stored in the memory 1002, and also perform the following operations:

在最新版本的数据库生成时,将上一版本的数据库进行保存,并记录保存时间;When the latest version of the database is generated, save the previous version of the database and record the save time;

在接收到数据库版本更改指令时,从保存的数据库中,获取所述保存时间与所述数据库版本更改指令所针对的时间对应的数据库;When receiving the database version change instruction, obtain from the saved database the database corresponding to the storage time and the time targeted by the database version change instruction;

将获取得到的数据库更新为最新版本的数据库。Update the obtained database to the latest version.

进一步地,处理器1001可以调用存储器1002中存储的数据库的管理程序,还执行以下操作:Further, the processor 1001 can call the management program of the database stored in the memory 1002, and also perform the following operations:

在最新版本的数据库生成时,将上一版本的数据库进行保存;When the latest version of the database is generated, the previous version of the database is saved;

在数据库版本选择界面提供保存的数据库;Provide the saved database in the database version selection interface;

在检测到基于所述数据库版本选择界面生成的数据库选择指令时,将所述数据库选择指令所针对的数据库进行加载。When a database selection instruction generated based on the database version selection interface is detected, the database targeted by the database selection instruction is loaded.

参照图2,在一实施例中,所述数据库的管理方法包括:Referring to Figure 2, in one embodiment, the database management method includes:

步骤S10、在检测到基于数据定义语言发起的数据库操作审核完成后,获取所述数据库操作针对的数据库作为第一数据库。Step S10: After detecting that the database operation audit initiated based on the data definition language is completed, obtain the database targeted by the database operation as the first database.

步骤S20、根据所述数据库操作变更所述第一数据库,得到第二数据库。Step S20: Modify the first database according to the database operation to obtain a second database.

本实施例中,实施例终端可以是数据库的管理装置,也可以是数据库管理系统。以下以实施例终端为数据库的管理装置为例进行说明。In this embodiment, the embodiment terminal may be a database management device or a database management system. The following description takes the embodiment in which the terminal is a database management device as an example.

结构化查询语言(Structured Query Language)简称SQL,是一种特殊目的的编程语言,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统。SQL是在关系数据库上执行数据操作、检索及维护所使用的标准语言,可以用来查询数据,操纵数据,定义数据,控制数据,所有数据库都使用相同或者相似的语言。其中,DDL数据定义语言(又称数据库模式定义语言)是SQL语言的组成部分,定义了数据库的表结构等。Structured Query Language (SQL), referred to as SQL, is a special-purpose programming language. It is a database query and programming language used to access data and query, update and manage relational database systems. SQL is a standard language used to perform data operations, retrieval and maintenance on relational databases. It can be used to query data, manipulate data, define data, and control data. All databases use the same or similar language. Among them, DDL data definition language (also known as database schema definition language) is a component of the SQL language and defines the table structure of the database.

可选地,数据库的开发人员在提交DDL变更需求,可以基于数据定义语言创建对应的数据库操作,并将创建完成的数据库操作提交至公司经理或者DBA数据库管理员(Database Administrator)审批。其中,DDL变更需求包括创建数据库、创建数据库表格、修改数据库表格、删除数据库表格和删除数据表内容等。Optionally, when database developers submit DDL change requirements, they can create corresponding database operations based on data definition language, and submit the created database operations to the company manager or DBA database administrator (Database Administrator) for approval. Among them, DDL change requirements include creating databases, creating database tables, modifying database tables, deleting database tables, and deleting data table contents.

可选地,数据库管理员的审批终端与终端关联,在数据库管理员认为数据库操作没有问题,可以通过审批终端向终端发送数据库操作审核完成的通知。终端在接收到数据库操作审核完成的通知后,判定数据库操作审核完成。这样,可以加快数据库操作的审批流程。Optionally, the database administrator's approval terminal is associated with the terminal. When the database administrator believes that there is no problem with the database operation, a notification of completion of the database operation review can be sent to the terminal through the approval terminal. After receiving the notification that the database operation review is completed, the terminal determines that the database operation review is completed. This speeds up the approval process for database operations.

可选地,终端在检测到基于数据定义语言发起的数据库操作审核完成后,在数据库系统中,获取数据库操作针对的所有数据库作为第一数据库。并从数据库操作的Schema信息中的提取DDL语句,使用DDL语句对第一数据库进行增删改除等操作,从而将第一数据库变更为第二数据库。其中,在数据库操作针对有多个数据库时,终端从数据库系统中查找所有需要自动变更的数据库进行变更。这样,在数据库操作审核后终端自动执行DDL语句,无需人工干预。Optionally, after detecting that the database operation audit initiated based on the data definition language is completed, the terminal acquires all databases targeted by the database operation as the first database in the database system. And extract DDL statements from the Schema information of the database operation, and use the DDL statements to perform operations such as addition, deletion, modification, and deletion of the first database, thereby changing the first database to the second database. Among them, when the database operation targets multiple databases, the terminal searches for all databases that need to be automatically changed from the database system and makes changes. In this way, the terminal automatically executes DDL statements after the database operation is audited, without manual intervention.

这样,经过生产的系统审核的DDL才自动执行,杜绝不合规范DDL被随意执行,避免预生成的数据库(即第二数据库)需要变更回滚。In this way, DDL that has been audited by the production system is automatically executed, preventing non-standard DDL from being executed at will, and avoiding the need for rollback of changes in the pre-generated database (ie, the second database).

步骤S30、将所述第二数据库更新为最新版本的数据库。Step S30: Update the second database to the latest version of the database.

可选地,本公司或单位的测试人员,可以根据公司或单位对数据库的使用需求,预先设计好数据库的预设需求,并将预设需求上传至终端。预设需求定义有数据库的表格格式、表格结构、不可删除的敏感数据的类型、不可删除的敏感数据等。Optionally, the testers of the company or unit can pre-design the preset requirements of the database according to the company or unit's usage requirements for the database, and upload the preset requirements to the terminal. The preset requirements define the table format, table structure, types of sensitive data that cannot be deleted, sensitive data that cannot be deleted, etc.

可选地,终端在第二数据库生成后,将第二数据库与预设需求进行比对,检查第二数据库是否符合预设需求,并在检查到第二数据库的表格格式、表格结构等内容均符合预设需求时,则将第二数据库发布至数据库生产系统,以将第二数据库更新为最新版本的数据库,即将第二数据库作为实际应用的数据库。Optionally, after the second database is generated, the terminal compares the second database with the preset requirements, checks whether the second database meets the preset requirements, and checks that the table format, table structure and other contents of the second database are all correct. When the preset requirements are met, the second database is released to the database production system to update the second database to the latest version of the database, that is, the second database is used as the database for actual application.

可选地,若终端检查到第二数据库不符合预设需求时,可以是将第二数据库还原为第一数据库,并保留当前版本的数据库。这时,开发人员需要重走流程,重新提交新的DDL变更申请。Optionally, if the terminal detects that the second database does not meet the preset requirements, it may restore the second database to the first database and retain the current version of the database. At this time, the developer needs to go through the process again and resubmit a new DDL change application.

这样,通过实现数据库生成的智能化审核,提高了数据库管理的效率。In this way, the efficiency of database management is improved by realizing intelligent auditing generated by the database.

可选地,终端也可以是关联有测试人员的关联终端,在第二数据库生成后,终端将第二数据库发送至关联终端,以供测试人员检测第二数据库是否符合预设需求。可选地,测试人员在检测到第二数据库符合预设需求时,可以通过关联终端向终端发送第二数据库的确认响应,终端在接收到第二数据库的确认响应后,判定第二数据库符合预设需求,并将第二数据库发布至数据库生产系统,以将第二数据库更新为最新版本的数据库。Optionally, the terminal may also be an associated terminal associated with a tester. After the second database is generated, the terminal sends the second database to the associated terminal for the tester to detect whether the second database meets the preset requirements. Optionally, when the tester detects that the second database meets the preset requirements, the tester can send a confirmation response of the second database to the terminal through the associated terminal. After receiving the confirmation response of the second database, the terminal determines that the second database meets the preset requirements. Set up requirements and publish the second database to the database production system to update the second database to the latest version of the database.

可选地,测试人员在检测到第二数据库不符合预设需求时,可以通过关联终端向终端发送第二数据库的取消响应,终端在接收到第二数据库的取消响应时,判定所述第二数据库不符合预设需求,并将第二数据库还原为第一数据库,以及保留当前版本的数据库。Optionally, when the tester detects that the second database does not meet the preset requirements, the tester can send a cancellation response of the second database to the terminal through the associated terminal. When the terminal receives the cancellation response of the second database, it determines that the second database The database does not meet the preset requirements and the second database is restored to the first database and the current version of the database is retained.

可选地,测试人员在检测到第二数据库不符合预设需求时,可以对数据库操作对应的DDL语句进行修改,同时基于修改后的DDL语句创建数据定义语言数据包,然后通过关联终端向终端发送第二数据库的数据定义语言数据包,终端在接收到数据定义语言数据包后,判定第二数据库不符合预设需求的同时,提取数据定义语言数据包中的DDL语句,基于提取的DDL语句对第二数据库进行更改,即覆盖、修改或者删除第二数据库的错误,以将第二数据库修改为第三数据库。然后将第三数据库发布至数据库生产系统,以将第三数据库更新为最新版本的数据库。Optionally, when the tester detects that the second database does not meet the preset requirements, the tester can modify the DDL statement corresponding to the database operation, create a data definition language data package based on the modified DDL statement, and then send the data to the terminal through the associated terminal. Send the data definition language packet of the second database. After receiving the data definition language packet, the terminal determines that the second database does not meet the preset requirements and extracts the DDL statement in the data definition language packet based on the extracted DDL statement. Making changes to the second database, that is, overwriting, modifying, or deleting errors in the second database, to modify the second database into a third database. The third database is then published to the database production system to update the third database to the latest version of the database.

这样,可以降低预生成的数据库与实际应用的数据库之间的变更流程分离带来的流程审批成本。In this way, the process approval costs caused by the separation of the change process between the pre-generated database and the actual application database can be reduced.

其中,关联终端在将数据定义语言数据包(即DDL数据包)发送至终端之前,可以将数据定义语言数据包的审核节点提交至测试DBA端,供测试DBA审批,在测试DBA确认数据定义语言数据包没问题后,向关联终端发出数据定义语言数据包的确认响应,这时,关联终端再将数据定义语言数据包发送至终端。这样,通过提供非标准DDL的审批控制,覆盖测试环节不可避免出现的DDL修改或回滚场景。Among them, before the associated terminal sends the data definition language data packet (i.e., DDL data packet) to the terminal, the audit node of the data definition language data packet can be submitted to the test DBA for approval by the test DBA. After the test DBA confirms the data definition language After there is no problem with the data packet, a confirmation response of the data definition language data packet is sent to the associated terminal. At this time, the associated terminal then sends the data definition language data packet to the terminal. In this way, by providing approval control for non-standard DDL, DDL modification or rollback scenarios that inevitably occur during the testing process are covered.

在一实施例中,在检测到基于数据定义语言发起的数据库操作审核完成后,获取所述数据库操作针对的数据库作为第一数据库;根据所述数据库操作变更所述第一数据库,得到第二数据库;将所述第二数据库更新为最新版本的数据库。这样,提高了对数据库管理的效率。In one embodiment, after it is detected that the audit of the database operation initiated based on the data definition language is completed, the database targeted by the database operation is obtained as the first database; the first database is modified according to the database operation to obtain the second database ;Update the second database to the latest version of the database. In this way, the efficiency of database management is improved.

在第二实施例中,如图3所示,在上述图2所示的实施例基础上,所所述根据所述数据库操作变更所述第一数据库,得到第二数据库的步骤之后,还包括:In the second embodiment, as shown in Figure 3, based on the above embodiment shown in Figure 2, after the step of changing the first database according to the database operation to obtain the second database, it also includes :

步骤S40、在最新版本的数据库生成时,将上一版本的数据库进行保存,并记录保存时间。Step S40: When the latest version of the database is generated, save the previous version of the database and record the saving time.

步骤S41、在接收到数据库版本更改指令时,从保存的数据库中,获取所述保存时间与所述数据库版本更改指令所针对的时间对应的数据库。Step S41: When receiving the database version change instruction, obtain the database corresponding to the storage time and the time targeted by the database version change instruction from the saved database.

步骤S42、将获取得到的数据库更新为最新版本的数据库。Step S42: Update the obtained database to the latest version of the database.

本实施例中,终端每当检测到具有最新版本的数据库生成时,则将最新版本的上个版本的数据库进行常态化DDL保存,同时记录所保存的数据库的保存时间。当测试人员认为当前存在需要将当前应用的数据库还原为旧版本的数据库时,可以通过关联终端向终端发送数据库版本更改指令。其中,数据库版本更改指令中设置有一个设定时间,终端在接收到数据库版本更改指令时,查询在设定时间之前的保存的各版本的数据库中,获取保存时间最新的数据库(即将这些版本的数据库中,保存时间最新的数据库作为数据库版本更改指令所针对的时间对应的数据库),并将获取得到的数据库更新为最新版本的数据库,即将当前获取得到的数据库作为实际应用的数据库。In this embodiment, whenever the terminal detects that a database with the latest version is generated, it saves the database of the latest version and the previous version in a normalized DDL manner, and at the same time records the storage time of the saved database. When the tester believes that there is a need to restore the current application database to an old version of the database, the tester can send a database version change instruction to the terminal through the associated terminal. Among them, a set time is set in the database version change command. When the terminal receives the database version change command, it queries the databases of each version saved before the set time to obtain the database with the latest save time (that is, the database of these versions). In the database, the database with the latest save time is used as the database corresponding to the time targeted by the database version change instruction), and the obtained database is updated to the latest version of the database, that is, the currently obtained database is used as the database for actual application.

这样,使测试人员可随时回退到指定时间的DDL版本,减少人工编写SQL语句对数据库的变更进行回退的繁杂工作。In this way, testers can roll back to the DDL version at a specified time at any time, reducing the cumbersome work of manually writing SQL statements to roll back changes to the database.

在第三实施例中,如图4所示,在上述图2至图3的实施例基础上,所述根据所述数据库操作变更所述第一数据库,得到第二数据库的步骤之后,还包括:In the third embodiment, as shown in Figure 4, based on the above-mentioned embodiments of Figures 2 to 3, after the step of changing the first database according to the database operation to obtain the second database, it also includes :

步骤S50、在最新版本的数据库生成时,将上一版本的数据库进行保存。Step S50: When the latest version of the database is generated, save the previous version of the database.

步骤S51、在数据库版本选择界面提供保存的数据库。Step S51: Provide the saved database on the database version selection interface.

步骤S52、在检测到基于所述数据库版本选择界面生成的数据库选择指令时,将所述数据库选择指令所针对的数据库进行加载。Step S52: When detecting a database selection instruction generated based on the database version selection interface, load the database targeted by the database selection instruction.

本实施例中,终端每当检测到具有最新版本的数据库生成时,则将最新版本的上个版本的数据库进行常态化DDL保存。In this embodiment, whenever the terminal detects that a database with the latest version is generated, the latest version of the database of the previous version is stored in normalized DDL.

可选地,终端提供有数据库版本选择界面,并通过与终端连通的显示设备显示数据库版本选择界面。其中,数据库版本选择界面显示有终端保存的所有版本的数据库。用户可以基于数据库版本选择界面进行数据库的选中操作(例如使用光标点击想要选中的数据库),终端在检测到用户的选中操作时,基于选择操作选中的数据库生成的数据库选择指令。Optionally, the terminal is provided with a database version selection interface, and the database version selection interface is displayed through a display device connected to the terminal. Among them, the database version selection interface displays all versions of the database saved by the terminal. The user can perform a database selection operation based on the database version selection interface (for example, using the cursor to click on the database to be selected). When the terminal detects the user's selection operation, it generates a database selection instruction based on the database selected by the selection operation.

可选地,在检测到数据库选择指令生成时,将所述数据库选择指令所针对的数据库进行加载,并加载为当前应用的数据库。Optionally, when it is detected that the database selection instruction is generated, the database targeted by the database selection instruction is loaded and loaded as the database of the current application.

这样,实现可快速部署指定版本DDL数据库,更好支持同个应用不同版本的数据库的并行开发工作。In this way, the specified version of the DDL database can be quickly deployed, and the parallel development work of different versions of the database for the same application can be better supported.

此外,本发明还提出一种数据库的管理装置,所述数据库的管理装置包括存储器、处理器及存储在存储器上并可在处理器上运行的数据库的管理程序,所述处理器执行所述数据库的管理程序时实现如以上实施例所述的数据库的管理方法的步骤。In addition, the present invention also proposes a database management device. The database management device includes a memory, a processor, and a database management program stored in the memory and executable on the processor. The processor executes the database The management program is the step of implementing the database management method described in the above embodiment.

此外,本发明还提出一种计算机可读存储介质,所述计算机可读存储介质包括数据库的管理程序,所述数据库的管理程序被处理器执行时实现如以上实施例所述的数据库的管理方法的步骤。In addition, the present invention also proposes a computer-readable storage medium. The computer-readable storage medium includes a database management program. When the database management program is executed by a processor, the database management method as described in the above embodiments is implemented. A step of.

上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above serial numbers of the embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是可选实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是电视机,手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is optional. implementation. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product that is essentially or contributes to the existing technology. The computer software product is stored in a storage medium (such as ROM/RAM) as mentioned above. , magnetic disk, optical disk), including several instructions to cause a terminal device (which can be a television, a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in various embodiments of the present invention.

以上仅为本发明的可选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only optional embodiments of the present invention, and do not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the description and drawings of the present invention, or directly or indirectly applied to other related technologies fields are equally included in the scope of patent protection of the present invention.

Claims (7)

1. A method of managing a database, the method comprising the steps of:
receiving DDL change requirements, and creating corresponding database operations based on a data definition language, wherein the DDL change requirements comprise creating a database, creating a database table, modifying the database table, deleting the database table and deleting the contents of the database table;
after detecting that the database operation audit initiated based on the data definition language is completed, acquiring a database aimed at by the database operation as a first database;
changing the first database according to the database operation to obtain a second database;
outputting the second database to an associated terminal of a tester so that the tester can detect whether the second database meets a preset requirement, wherein the preset requirement is defined by a table format, a table structure, a type of undeletable sensitive data and undeletable sensitive data of the database;
when a confirmation response sent by the association terminal is received, judging that the second database meets preset requirements;
when a cancellation response sent by the associated terminal is received, judging that the second database does not meet preset requirements;
when the second database does not meet the preset requirement and when a data definition language data packet sent by the associated terminal is received, DDL sentences in the data definition language data packet are extracted, and the second database is changed based on the extracted DDL sentences to obtain a third database;
and updating the third database to the latest version database.
2. The method for managing databases according to claim 1, wherein after the step of detecting whether the second database meets a preset requirement, further comprising:
and when the second database meets the preset requirement, executing the step of updating the second database into the latest version database.
3. The method for managing databases according to claim 2, wherein after the step of detecting whether the second database meets a preset requirement, further comprising:
and when the second database does not meet the preset requirement, restoring the second database into the first database.
4. The method for managing databases according to claim 1 or 2, characterized in that after the step of modifying the first database according to the database operation to obtain a second database, further comprising:
when the database of the latest version is generated, the database of the previous version is stored, and the storage time is recorded;
when a database version change instruction is received, acquiring a database corresponding to the time for which the database version change instruction aims from a stored database;
and updating the acquired database into the latest version database.
5. The method for managing databases according to claim 1 or 2, characterized in that after the step of modifying the first database according to the database operation to obtain a second database, further comprising:
when the database of the latest version is generated, the database of the previous version is stored;
providing a stored database in a database version selection interface;
and loading the database aimed at by the database selection instruction when the database selection instruction generated based on the database version selection interface is detected.
6. A database management device, characterized in that the database management device comprises a memory, a processor and a database management program stored on the memory and executable on the processor, the database management program implementing the steps of the database management method according to any one of claims 1 to 5 when being executed by the processor.
7. A computer-readable storage medium, wherein a management program of a database is stored on the computer-readable storage medium, which when executed by a processor, implements the steps of the method for managing a database according to any one of claims 1 to 5.
CN201911322188.0A 2019-12-19 2019-12-19 Database management method, database management device, and storage medium Active CN110968569B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911322188.0A CN110968569B (en) 2019-12-19 2019-12-19 Database management method, database management device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911322188.0A CN110968569B (en) 2019-12-19 2019-12-19 Database management method, database management device, and storage medium

Publications (2)

Publication Number Publication Date
CN110968569A CN110968569A (en) 2020-04-07
CN110968569B true CN110968569B (en) 2023-12-29

Family

ID=70035354

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911322188.0A Active CN110968569B (en) 2019-12-19 2019-12-19 Database management method, database management device, and storage medium

Country Status (1)

Country Link
CN (1) CN110968569B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111651431B (en) * 2020-06-09 2023-06-27 中国雄安集团数字城市科技有限公司 Database service-oriented management flow standardization method
CN115586916A (en) * 2021-07-06 2023-01-10 华为云计算技术有限公司 Database model version management method, device and related equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102160029A (en) * 2008-09-19 2011-08-17 美国索尼电脑娱乐有限责任公司 Software change management, configuration substitution and remote administration of datacenters
CN102193938A (en) * 2010-03-01 2011-09-21 深圳市金蝶中间件有限公司 Method and device for acquiring incremental data
CN102662946A (en) * 2012-02-20 2012-09-12 北京地拓科技发展有限公司 Method and system for automatically monitoring record changes in database
CN103778133A (en) * 2012-10-18 2014-05-07 阿里巴巴集团控股有限公司 Database object changing method and device
CN107797916A (en) * 2016-11-14 2018-03-13 平安科技(深圳)有限公司 DDL sentences checking method and device
WO2019056707A1 (en) * 2017-09-22 2019-03-28 平安科技(深圳)有限公司 Method and device for quickly initializing system database and storage medium
CN110489436A (en) * 2019-08-16 2019-11-22 北京百度网讯科技有限公司 Variation and platform, computer equipment and readable medium on the line of database

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7562357B2 (en) * 2004-03-08 2009-07-14 Microsoft Corporation Relational database schema version management

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102160029A (en) * 2008-09-19 2011-08-17 美国索尼电脑娱乐有限责任公司 Software change management, configuration substitution and remote administration of datacenters
CN102193938A (en) * 2010-03-01 2011-09-21 深圳市金蝶中间件有限公司 Method and device for acquiring incremental data
CN102662946A (en) * 2012-02-20 2012-09-12 北京地拓科技发展有限公司 Method and system for automatically monitoring record changes in database
CN103778133A (en) * 2012-10-18 2014-05-07 阿里巴巴集团控股有限公司 Database object changing method and device
CN107797916A (en) * 2016-11-14 2018-03-13 平安科技(深圳)有限公司 DDL sentences checking method and device
WO2019056707A1 (en) * 2017-09-22 2019-03-28 平安科技(深圳)有限公司 Method and device for quickly initializing system database and storage medium
CN110489436A (en) * 2019-08-16 2019-11-22 北京百度网讯科技有限公司 Variation and platform, computer equipment and readable medium on the line of database

Also Published As

Publication number Publication date
CN110968569A (en) 2020-04-07

Similar Documents

Publication Publication Date Title
US8065323B2 (en) Offline validation of data in a database system for foreign key constraints
US10437795B2 (en) Upgrading systems with changing constraints
EP3428811A1 (en) Database interface agent for a tenant-based upgrade system
US9507810B2 (en) Updating database schemas in a zero-downtime environment
US8255899B2 (en) Techniques for upgrade dependency management
CN103810257B (en) A kind of method, apparatus and equipment of upgrading software database
US20120158795A1 (en) Entity triggers for materialized view maintenance
US20090259993A1 (en) Sandbox Support for Metadata in Running Applications
US20110209042A1 (en) Information Technology Standard Inventory Utility
US20120291014A1 (en) System and method for testing the development and updates in a test system using production/live data
US10990515B2 (en) Automated unit testing in a mainframe environment
CN111026670B (en) Test case generation method, test case generation device and storage medium
CN110968569B (en) Database management method, database management device, and storage medium
CN110413679B (en) Database information processing method, device, equipment and readable storage medium
CN111240891A (en) Data recovery method and device based on data consistency among multiple tables of database
CN114328180A (en) Interface automated testing method, system, electronic device and storage medium
CN112487006A (en) Implementation method for dynamically editing data structure and generating database table
US11567808B2 (en) Dependency handling for configuration transport
CN117668327A (en) Component identification method, device, terminal equipment and storage medium
CN116701215A (en) Interface test case generation method, system, device and storage medium
US20220334829A1 (en) Custom abap cloud enabler
CN112817931B (en) Incremental version file generation method and device
US8150821B2 (en) System and method for using generic utilities to perform database utilities on mainframe operated DB2 databases
US7650358B2 (en) AUTO COMMIT n option in a relational database
WO2019153547A1 (en) Database operation method, apparatus and device, and computer-readable storage medium

Legal Events

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