WO2019056707A1 - 快速初始化系统数据库的方法、装置及存储介质 - Google Patents

快速初始化系统数据库的方法、装置及存储介质 Download PDF

Info

Publication number
WO2019056707A1
WO2019056707A1 PCT/CN2018/077632 CN2018077632W WO2019056707A1 WO 2019056707 A1 WO2019056707 A1 WO 2019056707A1 CN 2018077632 W CN2018077632 W CN 2018077632W WO 2019056707 A1 WO2019056707 A1 WO 2019056707A1
Authority
WO
WIPO (PCT)
Prior art keywords
ddl
database
script
table name
database table
Prior art date
Application number
PCT/CN2018/077632
Other languages
English (en)
French (fr)
Inventor
张勋
沈毅
王刚
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019056707A1 publication Critical patent/WO2019056707A1/zh

Links

Images

Classifications

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

Definitions

  • the present application relates to the field of database management applications, and in particular, to a method and apparatus for quickly initializing a system database.
  • the same type of system or some systems with the same function have similar business logic. It can also be understood that the above system needs to create the same table structure in different databases. For example, when a certain system A is created for a certain period of time, it will compile more database schema definition language (DDL) statements. At this time, if another database of the same type B or system B with the same function is initialized, The developer needs to manually collect all the DDL statements stored in the system A, and change their schema (owner), authorized users and other information for the system B, the task is large and the operation is very cumbersome, in addition, manual operation The process is also very prone to errors.
  • DDL database schema definition language
  • the present application provides a method for quickly initializing a system database, which is applied to an electronic device, the method comprising:
  • the generating step is to modify the feature information of the merged DDL statement file to generate an initialization database script corresponding to the target system.
  • the present application also provides an electronic device, including: a memory, a processor, and a fast initialization system database system stored on the memory and operable on the processor, the database initialization system being The processor executes, and the following steps can be implemented:
  • the generating step is to modify the feature information of the merged DDL statement file to generate an initialization database script corresponding to the target system.
  • the present application further provides a computer readable storage medium having a fast initialization system database system stored thereon, and the fast initialization system database system is executed by a processor, and the following steps can be implemented:
  • the generating step is to modify the feature information of the merged DDL statement file to generate an initialization database script corresponding to the target system.
  • the method, device and computer readable storage medium for quickly initializing a system database proposed by the present application obtain a DDL script file with the same database table name by scanning the database table name corresponding to all DDL script files in the history system database, according to the submission number
  • the DDL script files with the same database table name are merged into one DDL statement file, and then the user-triggered modification instruction for the owner information and the authorized user information is received according to the target system, and the owner information in the merged DDL statement file is modified and
  • the authorized user obtains the initialized database script, so that the target system has the same function as the historical system corresponding to the initialization database script, thereby improving the initialization efficiency of the database and reducing the data error rate.
  • FIG. 1 is an application environment diagram of a preferred embodiment of an electronic device of the present application.
  • FIG. 2 is a schematic view of a preferred embodiment of the electronic device of FIG. 1.
  • FIG. 3 is a block diagram showing the program of a preferred embodiment of the fast initialization system database system of the electronic device installed in FIG. 1 and FIG.
  • FIG. 4 is a flow chart of a preferred embodiment of a method for quickly initializing a system database of the present application.
  • FIG. 5 is a detailed flowchart of step S120 in FIG. 4.
  • FIG. 6 is a detailed flowchart of step S130 in FIG. 4.
  • FIG. 1 is an application environment diagram of a preferred embodiment of the electronic device 1 of the present application.
  • the fast initialization system database system 10 is applied to the electronic device 1.
  • the electronic device 1 connects a plurality of clients 3 via a network 2.
  • the network 2 can be a network of a local area network, a wide area network, a metropolitan area network, etc., and can be a wired network or a wireless network.
  • the client 3 can be a desktop computer, a notebook, a tablet, a mobile phone, or other terminal device that can communicate with the electronic device 1 via the network 2.
  • the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a fast initialization system database system 10 stored on the memory 11 and operable on the processor 12.
  • the electronic device 1 is communicatively coupled to the historical system database 3 and the target system database 4.
  • the historical system database 3 stores historical DDL statements.
  • the memory 11 stores program code for quickly initializing the system database system 10, which may include at least one type of storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, an SD or DX memory, etc.) ), random access memory (RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, disk , CDs, etc.
  • a flash memory e.g, a flash memory, a hard disk, a multimedia card, a card type memory (eg, an SD or DX memory, etc.) ), random access memory (RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, disk , CDs, etc.
  • the processor 12 reads from the memory 11 and executes the program code for quickly initializing the system database system 10, providing the following functions for quickly initializing the system database system 10.
  • Figure 2 shows only the electronic device 1 with components 10-12, it being understood that the electronic device 1 may include more or fewer components.
  • fast initialization system database system 10 can also send the generated initialization database script to the target system database 4 via the network 2.
  • FIG. 3 it is a program block diagram of a preferred embodiment of the fast initialization system database system 10 installed in the electronic device 1 of FIGS. 1 and 2.
  • the fast initialization system database system 10 includes a scanning module 110, a synthesis module 120, and a generation module 130.
  • the scanning module 110 scans the database table names corresponding to all the DDL script files in the history system database 3, and obtains the DDL script files with the same database table name.
  • the DDL script file naming rule in the historical system is SRXXXX_operate_schema_table.sql, where SRXXXX represents the submission number. The larger the number, the later the submission time, the opera represents the operation type, the schema represents the owner, and the table represents the database table name.
  • the scanning module 110 scans all DDL script files in the historical system database 3, and names all DDL script files according to the naming rules of "submission number + operation type + affiliation + database table name": "001_Oracle_liuyun_Region, 002_Oracle_liuyun_Soext, 003_Oracle_liuyun_Soext, 004_Oracle_liuyun_Salesorder, 005_Oracle_liuyun_Soext, 006_Oracle_liuyun_Salesorder, 007_Oracle_liuyun_Region"; the database table names scanned by the scanning module 110 are Region, Salesorder, Soext.
  • the synthesizing module 120 merges the acquired DDL script files with the same database table name into a DDL statement file according to a preset rule.
  • the synthesizing module 120 includes: a sorting unit 121 and a merging unit 122.
  • the sorting unit 121 sorts the DDL script files of the same database table name in ascending order according to the commit number from small to large. For example, the sorting unit 121 arranges the DDL script files whose database table name is "Region" in ascending order according to the submission number from small to large, respectively, "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region"; the sorting unit 121 names the database table "Salesorder".
  • the DDL script files are arranged in ascending order according to the submission number from small to large, respectively, "004_Oracle_liuyun_Salesorder, 006_Oracle_liuyun_Salesorder"; the sorting unit 121 sorts the DDL script files whose database table name is "Soext" in ascending order according to the submission number from small to large. They are "002_Oracle_liuyun_Soext, 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext.".
  • the merging unit 122 merges the above sorted DDL script files into one DDL statement file. For example, the merging unit 122 merges the files "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region, " in which the database table name is "Region” into one DDL statement file; the merging unit 122 sorts the database table name "Salesorder" into the file "004_Oracle_liuyun_Salesorder".
  • 006_Oracle_liuyun_Salesorder merges into one DDL statement file; the merging unit 122 merges the files "002_Oracle_liuyun_Soext, 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext" of the database table name "Soext" into one DDL statement file.
  • the generating module 130 modifies the feature information of the merged DDL statement file, and generates an initialization database script corresponding to the target system.
  • the generating module 130 includes a receiving unit 131 and a modifying unit 132.
  • the receiving unit 131 receives a modification instruction triggered by the user regarding the owner information and the authorized user information. For example, the receiving unit 131 receives an instruction from the user to change the owner information and the authorized user information from liuyun to wujin.
  • the modifying unit 132 modifies the owner information and the authorized user in the merged DDL statement file according to the above modification instruction, and obtains the initialized database script. For example, the modifying unit 132 modifies the owner information and the authorized user information in the DDL statement file stored in the memory 11 from liuyun to wujin according to the modification instruction, and the owner information and authorization of the DDL script file in the generated DDL statement file. The user was also modified by liuyun as wujin.
  • the modification unit 132 modifies "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region" to "001_Oracle_wujin_Region, 007_Oracle_wujin_Region"
  • the modification unit 132 modifies "004_Oracle_liuyun_Salesorder, 006_Oracle_liuyun_Salesorder" to "004_Oracle_wujin_Salesorder, 006_Oracle_wujin_Salesorder"
  • the modification unit 132 "002_Oracle_liuyun_Soext" , 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext" is modified to "002_Oracle_wujin_Soext, 003_Oracle_wujin_Soext, 00
  • FIG. 4 it is a flowchart of a preferred embodiment of the database initialization method of the present application.
  • step S110 the scanning module 110 scans the database table names corresponding to all the DDL script files in the history system database 3 through the network 2, and obtains the DDL script files with the same database table name.
  • the naming rules for all DDL script files in the history system are SRXXXX_operate_schema_table.sql, where SRXXXX represents the submission number. The larger the number, the later the submission time; the opera represents the operation type; the schema represents the owner; the table represents the database table name.
  • the scanning module 110 scans all the DDL script files in the historical system database 3, and names all the DDL script files according to the naming rules of "commit number + operation type + affiliation + database table name", respectively, "001_Oracle_liuyun_Region , 002_Oracle_liuyun_Soext, 003_Oracle_liuyun_Soext, 004_Oracle_liuyun_Salesorder, 005_Oracle_liuyun_Soext, 006_Oracle_liuyun_Salesorder, 007_Oracle_liuyun_Region".
  • the database table names scanned by the data scanning module 110 are Region, Salesorder, and Soext.
  • step S120 the synthesizing module 120 merges the acquired DDL script files with the same database table name into a DDL statement file according to a preset rule.
  • the synthesizing module 120 merges the files "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region" of the database table name "Region” into a DDL statement file according to a preset rule.
  • the synthesizing module 120 merges the file "004_Oracle_liuyun_Salesorder, 006_Oracle_liuyun_Salesorder" of the database table name "Salesorder" into a DDL statement file according to a preset rule.
  • the synthesizing module 120 merges the files "002_Oracle_liuyun_Soext, 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext, " whose database table name is "Soext" into a DDL statement file according to a preset rule.
  • the generating module 130 will modify the feature information of the merged DDL statement file to generate an initialization database script corresponding to the target system. For example, the generation module 130 modifies "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region" to "001_Oracle_wujin_Region, 007_Oracle_wujin_Region", the generation module 130 modifies "004_Oracle_liuyun_Salesorder, 006_Oracle_liuyun_Salesorder" to "004_Oracle_wujin_Salesorder, 006_Oracle_wujin_Salesorder", and the generation module 130 "002_Oracle_liuyun_Soext" , 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext" is modified to
  • step S120 in FIG. 5 As shown in FIG. 5, it is a detailed flowchart of step S120 in FIG.
  • step S121 the sorting unit 121 sorts the DDL script files of the same database table name in ascending order according to the submission number from small to large. For example, the sorting unit 121 arranges the DDL script files whose database table name is "Region" according to the submission number from ascending to ascending order, which are respectively "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region". The sorting unit 121 arranges the DDL script files whose database table name is "Salesorder" according to the submission number from ascending to ascending order, respectively, "004_Oracle_liuyun_Salesorder, 006_Oracle_liuyun_Salesorder".
  • the sorting unit 121 arranges the DDL script files whose database table name is "Soext" according to the submission number from ascending to ascending order, which are respectively "002_Oracle_liuyun_Soext, 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext.".
  • step S122 the merging unit 122 merges the above sorted DDL script files into one DDL statement file.
  • the merging unit 122 merges the files "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region" of the database table name "Region” into one DDL statement file.
  • the merging unit 122 merges the files "004_Oracle_liuyun_Salesorder, 006_Oracle_liuyun_Salesorder" of the database table name "Salesorder" into one DDL statement file.
  • the merging unit 122 merges the files "002_Oracle_liuyun_Soext, 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext, " in which the database table name is "Soext" into one DDL statement file.
  • step S130 in FIG. 6 is a detailed flowchart of step S130 in FIG.
  • step S131 the receiving unit 131 receives a modification instruction about the owner information and the authorized user information triggered by the user. For example, the receiving unit 131 receives an instruction that the user modifies the owner information and the authorized user information from liuyun to wujin, and sends the instruction to the modifying unit 132 for processing.
  • step S132 the modifying unit 132 modifies the owner information and the authorized user in the merged DDL statement file according to the modification instruction, and obtains the initialized database script.
  • the modifying unit 132 modifies the owner information and the authorized user information in the DDL statement file stored in the memory 11 from liuyun to wujin, and the owner information and the authorized user of the DDL script file in the generated DDL statement file are also Liuyun was changed to wujin.
  • the modification unit 132 modifies "001_Oracle_liuyun_Region, 007_Oracle_liuyun_Region" to "001_Oracle_wujin_Region, 007_Oracle_wujin_Region"
  • the modification unit 132 modifies "004_Oracle_liuyun_Salesorder, 006_Oracle_liuyun_Salesorder" to "004_Oracle_wujin_Salesorder, 006_Oracle_wujin_Salesorder"
  • the modification unit 132 "002_Oracle_liuyun_Soext" , 003_Oracle_liuyun_Soext, 005_Oracle_liuyun_Soext" is modified to "002_Oracle_wujin_Soext, 003_Oracle_wujin_Soext, 00
  • the embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium includes a fast initialization system database system 10, and when the fast initialization system database system 10 is executed by the processor, the following operations are implemented:
  • the generating step is to modify the feature information of the merged DDL statement file to generate an initialization database script corresponding to the target system.
  • the DDL script file is named by a DDL statement in the historical system database according to a preset naming rule.
  • the preset naming rule is “commit number + operation type + attribution person + database table name”.
  • the synthesizing step comprises:
  • the merging step merges the above sorted DDL script files into one DDL statement file.
  • the generating step further includes:
  • Receiving receiving a modification instruction triggered by the user regarding the owner information and the authorized user information
  • the modification step is to modify the owner information and the authorized user in the merged DDL statement file according to the modification instruction, and obtain the initialized database script, so that the initialization database script corresponding to the target system has the same function as the history system.
  • a disk including a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the various embodiments of the present application.
  • a terminal device which may be a mobile phone, a computer, a server, or a network device, etc.

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

一种快速初始化系统数据库的方法,该方法应用于电子装置(1)。该方法包括:扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件(S110);将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件(S120);及修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本(S130)。该方法提高了数据库的初始化效率,降低了数据出错率。还提供一种电子装置及一种计算机可读存储介质。

Description

快速初始化系统数据库的方法、装置及存储介质
本申请要求于2017年9月22日提交中国专利局、申请号为201710868666.2、发明名称为“快速初始化系统数据库的方法、装置及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及数据库管理应用领域,尤其涉及一种快速初始化系统数据库的方法及装置。
背景技术
目前,相同类型的系统或者有部分功能相同的系统具有类似的业务逻辑,也可以理解为:上述系统需要在不同的数据库创建相同的表结构。例如,当某个系统A创建一定时长后,会编译得到较多的数据库模式定义语言(Data Definition Language,DDL)语句,此时如果初始化另一个类型相同或有部分功能相同的系统B的数据库,则需要开发人员手动搜集系统A中存储的所有DDL语句,并分别更改它们的schema(归属人)、授权用户等信息为系统B所用,工作任务量大且操作起来十分繁琐,另外,手动操作的过程中也非常容易出现错误。
发明内容
鉴于以上内容,有必要提供一种快速初始化系统数据库的方法、装置及计算机可读存储介质,可以搜集历史系统数据库的DDL语句,按照表名分类归档,由系统自动更改其中的schema和授权用户信息,生成所述目标系统对应的初始化数据库脚本,从而更加简洁,减少出错。
为实现上述目的,本申请提供一种快速初始化系统数据库的方法,应用于一种电子装置,该方法包括:
扫描步骤,扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件;
合成步骤,将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件;及
生成步骤,将修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
另外,本申请还提供一种电子装置,该电子装置包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的快速初始化系统数据库系统,所述数据库初始化系统被所述处理器执行,可实现如下步骤:
扫描步骤,扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件;
合成步骤,将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件;及
生成步骤,修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
此外,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有快速初始化系统数据库系统,所述快速初始化系统数据库系统被处理器执行,可实现以下步骤:
扫描步骤,扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件;
合成步骤,将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件;及
生成步骤,修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
本申请提出的快速初始化系统数据库的方法、装置及计算机可读存储介质,通过扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件,根据提交号由小到大将数据库表名相同的DDL脚本文件合并成一个DDL语句文件,再根据目标系统接收用户触发的针对归属人信息和授权用户信息的修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本,使得目标系统具备所述初始化数据库脚本对应的与所述历史系统相同的功能,提高了数据库的初始化效率,降低了数据出错率。
附图说明
图1为本申请电子装置较佳实施例的应用环境图。
图2为图1中电子装置较佳实施例的示意图。
图3为图1、图2中电子装置安装的快速初始化系统数据库系统较佳实施例的程序模块图。
图4为本申请快速初始化系统数据库方法较佳实施例的流程图。
图5为图4中步骤S120的细化流程图。
图6为图4中步骤S130的细化流程图。
具体实施方式
如图1所示,是本申请电子装置1较佳实施例的应用环境图。该快速初始化系统数据库系统10应用于电子装置1。所述电子装置1通过网络2连接多个客户端3。网络2可以为局域网,广域网,城域网等等类型的网络,可以为有线网络,也可以为无线网络。客户端3可以为桌上型计算机、笔记本、平板电脑、手机,或其它可以通过网络2与电子装置1进行通信的终端装置。
如图2所示,是图1中电子装置1较佳实施例的示意图。电子装置1包括,但不仅限于,存储器11、处理器12及存储在所述存储器11上并可在所述处理器12上运行的快速初始化系统数据库系统10。所述电子装置1与历史系统数据库3、目标系统数据库4通信连接。在本实施例中,历史系统数据库3中存有历史DDL语句。
存储器11存储快速初始化系统数据库系统10的程序代码,该存储器11可以包括至少一种类型的存储介质,所述存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等等。
处理器12从存储器11读取并执行快速初始化系统数据库系统10的程序代码,提供快速初始化系统数据库系统10的下述功能。图2仅示出了具有组件10-12的电子装置1,应当理解的是,电子装置1可以包括更多或者更少的组件。
进一步地,快速初始化系统数据库系统10还可以将生成的初始化数据库脚本通过网络2发送至目标系统数据库4。
如图3所示,是图1、图2中电子装置1安装的快速初始化系统数据库系统 10较佳实施例的程序模块图。
在一个实施例中,该快速初始化系统数据库系统10包括扫描模块110、合成模块120及生成模块130。
扫描模块110扫描历史系统数据库3中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件。历史系统中DDL脚本文件命名规则为SRXXXX_operate_schema_table.sql,其中SRXXXX代表提交号,号码越大代表提交时间越晚,operate代表操作类型,schema代表归属人,table代表数据库表名。例如,扫描模块110扫描历史系统数据库3中所有的DDL脚本文件,并对所有的DDL脚本文件按照“提交号+操作类型+归属人+数据库表名”的命名规则进行命名:“001_Oracle_liuyun_Region、002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、004_Oracle_liuyun_Salesorder、005_Oracle_liuyun_Soext、006_Oracle_liuyun_Salesorder、007_Oracle_liuyun_Region……”;扫描模块110扫描到的数据库表名分别为Region、Salesorder、Soext。
合成模块120将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件。
在本实施例中,所述合成模块120包括:排序单元121和合并单元122。
排序单元121将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列。例如:排序单元121将数据库表名为“Region”的DDL脚本文件按照提交号由小到大进行升序排列,分别为“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”;排序单元121将数据库表名为“Salesorder”的DDL脚本文件按照提交号由小到大进行升序排列,分别为“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”;排序单元121将数据库表名为“Soext”的DDL脚本文件按照提交号由小到大进行升序排列,分别为“002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”。
合并单元122将上述排序好的DDL脚本文件合并成一个DDL语句文件。例如,合并单元122将数据库表名为“Region”排好序的文件“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”合并成一个DDL语句文件;合并单元122将数据库表名为“Salesorder”排好序的文件“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”合并成一个DDL语句文件;合并单元122将数据库表名为“Soext”排好序的文件 “002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”合并成一个DDL语句文件。
生成模块130修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
在本实施例中,所述生成模块130包括接收单元131和修改单元132。
接收单元131接收用户触发的关于归属人信息和授权用户信息的修改指令。例如,接收单元131接收到用户将归属人信息和授权用户信息由liuyun改成wujin的指令。
修改单元132根据上述修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本。例如,修改单元132根据修改指令将存在存储器11中的DDL语句文件中的归属人信息和授权用户信息由liuyun修改为wujin,则上述生成的DDL语句文件中的DDL脚本文件的归属人信息和授权用户也由liuyun修改为wujin。例如,修改单元132将“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”修改为“001_Oracle_wujin_Region、007_Oracle_wujin_Region……”,修改单元132将“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”修改为“004_Oracle_wujin_Salesorder、006_Oracle_wujin_Salesorder……”,修改单元132将“002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”修改为“002_Oracle_wujin_Soext、003_Oracle_wujin_Soext、005_Oracle_wujin_Soext……”,从而生成初始化数据库脚本。
如图4所示,是本申请数据库初始化方法较佳实施例的流程图。
步骤S110,扫描模块110通过网络2扫描历史系统数据库3中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件。历史系统中所有的DDL脚本文件命名规则为SRXXXX_operate_schema_table.sql,其中SRXXXX代表提交号,号码越大代表提交时间越晚;operate代表操作类型;schema代表归属人;table代表数据库表名。例如,扫描模块110扫描到历史系统数据库3中所有的DDL脚本文件,并对所有的DDL脚本文件按照“提交号+操作类型+归属人+数据库表名”的命名规则进行命名,分别为“001_Oracle_liuyun_Region、002_Oracle_liuyun_Soext、 003_Oracle_liuyun_Soext、004_Oracle_liuyun_Salesorder、005_Oracle_liuyun_Soext、006_Oracle_liuyun_Salesorder、007_Oracle_liuyun_Region……”。数据扫描模块110扫描到的数据库表名分别为Region、Salesorder、Soext。
步骤S120,合成模块120将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件。例如:合成模块120将数据库表名为“Region”的文件“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”按照预设规则合并成一个DDL语句文件。合成模块120将数据库表名为“Salesorder”的文件“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”按照预设规则合并成一个DDL语句文件。合成模块120将数据库表名为“Soext”的文件“002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”按照预设规则合并成一个DDL语句文件。
步骤S130,生成模块130将修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。例如:生成模块130将“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”修改为“001_Oracle_wujin_Region、007_Oracle_wujin_Region……”、生成模块130将“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”修改为“004_Oracle_wujin_Salesorder、006_Oracle_wujin_Salesorder……”、生成模块130将“002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”修改为“002_Oracle_wujin_Soext、003_Oracle_wujin_Soext、005_Oracle_wujin_Soext……”,从而生成初始化数据库脚本。
如图5所示,是图4中步骤S120的细化流程图。
步骤S121,排序单元121将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列。例如:排序单元121将数据库表名为“Region”的DDL脚本文件按照提交号由小到大升序排列,分别为“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”。排序单元121将数据库表名为“Salesorder”的DDL脚本文件按照提交号由小到大升序排列,分别为“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”。排序单元 121将数据库表名为“Soext”的DDL脚本文件按照提交号由小到大升序排列,分别为“002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”。
步骤S122,合并单元122将上述排序好的DDL脚本文件合并成一个DDL语句文件。例如:合并单元122将数据库表名为“Region”排好序的文件“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”合并成一个DDL语句文件。合并单元122将数据库表名为“Salesorder”排好序的文件“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”合并成一个DDL语句文件。合并单元122将数据库表名为“Soext”排好序的文件“002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”合并成一个DDL语句文件。
如图6所示,是图4中步骤S130的细化流程图。
步骤S131,接收单元131接收用户触发的关于归属人信息和授权用户信息的修改指令。例如:接收单元131接收到用户将归属人信息和授权用户信息由liuyun修改为wujin的指令,并将指令发送到修改单元132进行处理。
步骤S132,修改单元132根据上述的修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本。例如:修改单元132将存在存储器11中的DDL语句文件中的归属人信息和授权用户信息由liuyun修改为wujin,则上述生成的DDL语句文件中的DDL脚本文件的归属人信息和授权用户也由liuyun修改为wujin。例如:修改单元132将“001_Oracle_liuyun_Region、007_Oracle_liuyun_Region……”修改为“001_Oracle_wujin_Region、007_Oracle_wujin_Region……”、修改单元132将“004_Oracle_liuyun_Salesorder、006_Oracle_liuyun_Salesorder……”修改为“004_Oracle_wujin_Salesorder、006_Oracle_wujin_Salesorder……”、修改单元132将“002_Oracle_liuyun_Soext、003_Oracle_liuyun_Soext、005_Oracle_liuyun_Soext……”修改为“002_Oracle_wujin_Soext、003_Oracle_wujin_Soext、005_Oracle_wujin_Soext……”,从而生成初始化数据库脚本。
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存 储介质中包括快速初始化系统数据库系统10,所述快速初始化系统数据库系统10被处理器执行时实现如下操作:
扫描步骤,扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件;
合成步骤,将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件;及
生成步骤,将修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
优选地,所述DDL脚本文件是由历史系统数据库中的DDL语句按照预设命名规则命名得到的。
优选地,所述预设命名规则为“提交号+操作类型+归属人+数据库表名”。
优选地,所述合成步骤包括:
排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
优选地,所述生成步骤还包括:
接收步骤,接收用户触发的关于归属人信息和授权用户信息的修改指令;及
修改步骤,根据上述的修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本,使得目标系统对应的初始化数据库脚本具备与所述历史系统相同的功能。
本申请之计算机可读存储介质的具体实施方式与上述快速初始化系统数据库方法的具体实施方式大致相同,在此不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。通过以上的 实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种快速初始化系统数据库的方法,其特征在于,该方法包括:
    扫描步骤,扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件;
    合成步骤,将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件;及
    生成步骤,修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
  2. 如权利要求1所述的快速初始化系统数据库的方法,其特征在于,所述DDL脚本文件是由历史系统数据库中的DDL语句按照预设命名规则命名得到的。
  3. 如权利要求2所述的快速初始化系统数据库的方法,其特征在于,所述预设命名规则为“提交号+操作类型+归属人+数据库表名”。
  4. 如权利要求1所述的快速初始化系统数据库的方法,其特征在于,所述合成步骤包括:
    排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
    合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
  5. 如权利要求2所述的快速初始化系统数据库的方法,其特征在于,所述合成步骤包括:
    排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
    合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
  6. 如权利要求3所述的快速初始化系统数据库的方法,其特征在于,所述合成步骤包括:
    排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
    合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
  7. 如权利要求1-6任一项所述的快速初始化系统数据库的方法,其特征在于,所述生成步骤还包括:
    接收步骤,接收用户触发的关于归属人信息和授权用户信息的修改指令;及
    修改步骤,根据上述的修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本,使得目标系统对应的初始化数据库脚本具备与所述历史系统相同的功能。
  8. 一种电子装置,其特征在于,该装置包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的快速初始化系统数据库系统,所述快速初始化系统数据库系统被所述处理器执行,可实现如下步骤:
    扫描步骤,扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件;
    合成步骤,将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件;及
    生成步骤,修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
  9. 如权利要求8所述的电子装置,其特征在于,所述DDL脚本文件是由历史系统数据库中的DDL语句按照预设命名规则命名得到的。
  10. 如权利要求9所述的电子装置,其特征在于,所述预设命名规则为“提交号+操作类型+归属人+数据库表名”。
  11. 如权利要求8所述的电子装置,其特征在于,所述合成步骤包括:
    排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
    合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
  12. 如权利要求9所述的电子装置,其特征在于,所述合成步骤包括:
    排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
    合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
  13. 如权利要求10所述的电子装置,其特征在于,所述合成步骤包括:
    排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
    合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
  14. 如权利要求8-13任一项所述的电子装置,其特征在于,所述生成步骤 还包括:
    接收步骤,接收用户触发的关于归属人信息和授权用户信息的修改指令;及
    修改步骤,根据上述的修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本,使得目标系统对应的初始化数据库脚本具备与所述历史系统相同的功能。
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有快速初始化系统数据库系统,所述快速初始化系统数据库系统被处理器执行,可实现如下步骤:、
    扫描步骤,扫描历史系统数据库中所有DDL脚本文件对应的数据库表名,获取数据库表名相同的DDL脚本文件;
    合成步骤,将获取的数据库表名相同的DDL脚本文件,按照预设规则合并成一个DDL语句文件;及
    生成步骤,修改合并后的DDL语句文件的特征信息,生成所述目标系统对应的初始化数据库脚本。
  16. 如权利要求15所述的计算机可读存储介质,其特征在于,所述DDL脚本文件是由历史系统数据库中的DDL语句按照预设命名规则命名得到的。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述预设命名规则为“提交号+操作类型+归属人+数据库表名”。
  18. 如权利要求15或16或17所述的计算机可读存储介质,其特征在于,所述合成步骤包括:
    排序步骤,将相同数据库表名的DDL脚本文件按照提交号由小到大进行升序排列;及
    合并步骤,将上述排序好的DDL脚本文件合并成一个DDL语句文件。
  19. 如权利要求15-17任一项所述的计算机可读存储介质,其特征在于,所述生成步骤还包括:
    接收步骤,接收用户触发的关于归属人信息和授权用户信息的修改指令;及
    修改步骤,根据上述的修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本,使得目标系统对应的初始化数据库脚本具备与所述历史系统相同的功能。
  20. 如权利要求18所述的计算机可读存储介质,其特征在于,所述生成步骤还包括:
    接收步骤,接收用户触发的关于归属人信息和授权用户信息的修改指令;及
    修改步骤,根据上述的修改指令,修改合并后的DDL语句文件中的归属人信息以及授权用户,得到初始化后的数据库脚本,使得目标系统对应的初始化数据库脚本具备与所述历史系统相同的功能。
PCT/CN2018/077632 2017-09-22 2018-02-28 快速初始化系统数据库的方法、装置及存储介质 WO2019056707A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710868666.2A CN108427699B (zh) 2017-09-22 2017-09-22 快速初始化系统数据库的方法、装置及存储介质
CN201710868666.2 2017-09-22

Publications (1)

Publication Number Publication Date
WO2019056707A1 true WO2019056707A1 (zh) 2019-03-28

Family

ID=63155626

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/077632 WO2019056707A1 (zh) 2017-09-22 2018-02-28 快速初始化系统数据库的方法、装置及存储介质

Country Status (2)

Country Link
CN (1) CN108427699B (zh)
WO (1) WO2019056707A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110968569A (zh) * 2019-12-19 2020-04-07 广州品唯软件有限公司 数据库的管理方法、数据库的管理装置及存储介质

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861969B (zh) * 2017-09-14 2020-10-02 平安普惠企业管理有限公司 语句修改方法、扫描平台和计算机可读存储介质
CN109325046A (zh) * 2018-10-25 2019-02-12 深圳壹账通智能科技有限公司 数据库脚本生成方法、装置、介质及电子设备
CN109753490A (zh) * 2018-12-13 2019-05-14 深圳壹账通智能科技有限公司 基于漏洞修复的数据库优化方法、系统、设备及介质
CN110633284B (zh) * 2019-09-19 2022-04-29 中国工商银行股份有限公司 数据库中表的变更方法及装置
CN111737227B (zh) * 2020-06-22 2024-04-02 平安健康保险股份有限公司 数据修改方法及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300075A1 (en) * 2008-06-02 2009-12-03 Guan Ruifeng Method and System for Data Definition Language (DDL) Replication
CN102279886A (zh) * 2011-08-16 2011-12-14 中国民生银行股份有限公司 元数据处理方法及设备
CN102929878A (zh) * 2011-08-09 2013-02-13 阿里巴巴集团控股有限公司 一种数据库变更管理方法及装置
CN105205053A (zh) * 2014-05-30 2015-12-30 阿里巴巴集团控股有限公司 一种数据库增量日志解析方法及系统
CN105630783A (zh) * 2014-10-27 2016-06-01 青岛金讯网络工程有限公司 一种数据库数据迁移系统

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102737020B (zh) * 2011-03-31 2014-08-27 国际商业机器公司 一种初始化多租户数据库的方法和装置
WO2014101207A1 (en) * 2012-12-31 2014-07-03 Sybase, Inc. Continuous change data capture without disruption of ddl
JP2016057722A (ja) * 2014-09-08 2016-04-21 株式会社日立製作所 Dml検索装置
CN104965735B (zh) * 2015-06-18 2018-10-19 北京京东尚科信息技术有限公司 用于生成升级sql脚本的装置
CN105260403B (zh) * 2015-09-22 2019-05-31 同望科技股份有限公司 通用跨数据库访问方法
CN106991104B (zh) * 2016-01-21 2020-03-17 泰康保险集团股份有限公司 数据库脚本部署装置和数据库脚本部署方法
CN107025249A (zh) * 2016-02-02 2017-08-08 上海格尔软件股份有限公司 一种快速支持多数据库同步开发的方法
CN106776997A (zh) * 2016-12-02 2017-05-31 国家电网公司 一种数据库的迁移方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300075A1 (en) * 2008-06-02 2009-12-03 Guan Ruifeng Method and System for Data Definition Language (DDL) Replication
CN102929878A (zh) * 2011-08-09 2013-02-13 阿里巴巴集团控股有限公司 一种数据库变更管理方法及装置
CN102279886A (zh) * 2011-08-16 2011-12-14 中国民生银行股份有限公司 元数据处理方法及设备
CN105205053A (zh) * 2014-05-30 2015-12-30 阿里巴巴集团控股有限公司 一种数据库增量日志解析方法及系统
CN105630783A (zh) * 2014-10-27 2016-06-01 青岛金讯网络工程有限公司 一种数据库数据迁移系统

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110968569A (zh) * 2019-12-19 2020-04-07 广州品唯软件有限公司 数据库的管理方法、数据库的管理装置及存储介质
CN110968569B (zh) * 2019-12-19 2023-12-29 广州品唯软件有限公司 数据库的管理方法、数据库的管理装置及存储介质

Also Published As

Publication number Publication date
CN108427699B (zh) 2021-08-24
CN108427699A (zh) 2018-08-21

Similar Documents

Publication Publication Date Title
WO2019056707A1 (zh) 快速初始化系统数据库的方法、装置及存储介质
US9619545B2 (en) Naïve, client-side sharding with online addition of shards
US11163906B2 (en) Adaptive redaction and data releasability systems using dynamic parameters and user defined rule sets
US20160269423A1 (en) Methods and systems for malware analysis
US10410304B2 (en) Provisioning in digital asset management
US10938907B2 (en) Techniques and architectures for managing disparate heterogeneous cloud-based resources
US10909103B2 (en) Techniques and architectures for data field lifecycle management
US9830385B2 (en) Methods and apparatus for partitioning data
JP2018503154A (ja) データベースセキュリティ
US20220035847A1 (en) Information retrieval
CN110209766B (zh) 数据展示方法、电子装置及存储介质
CN110023901A (zh) 用于更新基于云的多层应用栈的系统和方法
US10599681B2 (en) Configurable search categories including related information and related action functionality over a relational database
CN111625809A (zh) 数据授权方法及装置、电子设备、存储介质
WO2017111644A1 (en) Flexible event ingestion framework in an event processing system
WO2019000698A1 (zh) 生成sql语句的方法、系统、电子装置及可读存储介质
WO2019071898A1 (zh) 电子装置、数据库查询脚本生成方法及存储介质
US10382528B2 (en) Disposition actions in digital asset management based on trigger events
CN111723077A (zh) 数据字典维护方法、装置及计算机设备
US20230145461A1 (en) Receiving and integrating external data into a graphical user interface of an issue tracking system
US20210034574A1 (en) Systems and methods for verifying performance of a modification request in a database system
US11449628B2 (en) System and method for data security grading
US11055431B2 (en) Securing data storage of personally identifiable information in a database
US20160261707A1 (en) Sign-up and provisioning in online reputation management with reputation shaping
US20180227647A1 (en) Method and system for issuing media information

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13/10/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18858548

Country of ref document: EP

Kind code of ref document: A1