Disk deletion method, device, electronic device and computer storage medium
By automatically obtaining and judging disk information, generating and executing disk deletion command scripts, it solves the problem of low efficiency and wrong deletion when deleting ASM disks, and ensures the normal operation of the database.
Patent Information
- Application Number
- CN202110969426.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-23
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-08-23
AI Technical Summary
During the operation of deleting ASM disks, manual inspection is inefficient and it is easy to delete the wrong disk, affecting the normal operation of the database.
By obtaining the basic information of the disk to be deleted input by the user, the existing disk information is obtained, and based on this information, it is determined whether the deletion conditions are met. If it is met, a disk deletion command script is generated and executed to automatically delete the disk and avoid manual inspection operations.
It improves the efficiency of deleting ASM disks, avoids deletion errors, and ensures the normal operation of the database.
Smart Images

Figure CN113655967B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a disk deletion method, device, electronic equipment and computer storage medium. Background Art
[0002] Relationship Management Deleting the Automatic Storage Management (ASM) disk from an Oracle database is a common change operation in daily database maintenance.
[0003] When deleting an ASM disk, you need to manually check the ASM disk to be deleted, and then delete the ASM disk. Manual inspection is inefficient and can easily result in the wrong ASM disk being deleted, which affects the normal operation of the database.
[0004] In view of this, how to avoid deleting the wrong ASM disk and improve the inspection efficiency is an urgent problem to be solved. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a disk deletion method, device, electronic device and computer storage medium to solve the problem that the wrong ASM disk is easily deleted and the inspection efficiency is low in the prior art.
[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0007] A first aspect of an embodiment of the present invention shows a method for deleting a disk, the method comprising:
[0008] When it is determined that the user who has successfully logged in meets the requirements for operating the database, basic information of the disk to be deleted input by the user is obtained;
[0009] Based on the basic information of the disk to be deleted, obtaining the existing disk information of the disk to be deleted;
[0010] Based on the existing disk information, determine whether the disk to be deleted meets the deletion condition;
[0011] If it is in compliance, generating a disk deletion command script corresponding to the basic information in a preset format;
[0012] Execute the disk deletion command script to delete the disk to be deleted.
[0013] Optionally, determining that the successfully logged-in user meets the requirements for operating the database includes:
[0014] Determine whether the user rights of the successfully logged in user are management operation rights;
[0015] If so, determine whether there is a process with the same name associated with the user;
[0016] If not, determine whether the number of ASM instances meets the preset number;
[0017] If yes, it is determined that the user who successfully logged in meets the requirements for operating the database.
[0018] Optionally, determining whether the disk to be deleted meets a deletion condition based on the existing disk information includes:
[0019] Determine whether the number of failed groups in the existing disk information meets a preset value range;
[0020] If yes, determine whether the disk size and the number of disks in the existing disk information meet the preset rules;
[0021] If all of them are met, it is determined whether the space data of the disk to be deleted is less than the free space of the corresponding disk group, wherein the free space of the disk group is determined based on the storage area network SAN disk information obtained from the database;
[0022] If it is smaller, it is determined that the disk to be deleted meets the deletion conditions.
[0023] Optionally, after generating a disk deletion command script corresponding to the basic information in a preset format, the method further includes:
[0024] Based on the disk deletion command script, a command log corresponding to the disk deletion command script is generated.
[0025] A second aspect of an embodiment of the present invention shows a disk deletion device, the device comprising:
[0026] A first acquisition unit, configured to acquire basic information of the disk to be deleted input by the user when it is determined that the user who has successfully logged in meets the requirements for operating the database;
[0027] A second obtaining unit, configured to obtain existing disk information of the disk to be deleted based on the basic information of the disk to be deleted;
[0028] A processing unit, configured to determine whether the disk to be deleted meets the deletion condition based on the existing disk information, and if so, execute the generating unit;
[0029] A first generating unit, configured to generate a disk deletion command script corresponding to the basic information in a preset format;
[0030] The deleting unit is used to execute the disk deletion command script to delete the disk to be deleted.
[0031] Optionally, the acquisition unit for determining whether the successfully logged-in user meets the requirements for operating the database is specifically used to: determine whether the user rights of the successfully logged-in user are management operation rights; if so, determine whether there is a process with the same name related to the user; if not, determine whether the number of ASM instances meets the preset number; if so, determine that the successfully logged-in user meets the requirements for operating the database.
[0032] Optionally, the processing unit includes:
[0033] A first judgment module is used to judge whether the number of failure groups in the existing disk information meets a preset value range, and if so, execute a second judgment module;
[0034] The second judgment module is used to judge whether the disk size and the number of disks in the existing disk information meet the preset rules, and if they do, execute the third judgment module;
[0035] The third judgment module is used to judge whether the space data of the disk to be deleted is less than the free space of the corresponding disk group, and if so, execute the determination module, wherein the free space of the disk group is determined based on the storage area network SAN disk information obtained from the database;
[0036] The determination module is used to determine whether the disk to be deleted meets the deletion condition.
[0037] Optionally, also include:
[0038] The second generating unit is configured to generate a command log corresponding to the disk deletion command script based on the disk deletion command script after executing the first generating unit.
[0039] The third aspect of the embodiment of the present invention shows an electronic device used to run a program, wherein when the program is running, the disk deletion method shown in the first aspect of the embodiment of the present invention is executed.
[0040] A fourth aspect of an embodiment of the present invention shows a computer storage medium, which includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute the disk deletion method shown in the first aspect of the embodiment of the present invention.
[0041] Based on the above-mentioned embodiment of the present invention, a disk deletion method, device, electronic device and computer storage medium are provided. The method includes: when it is determined that the user who has successfully logged in meets the requirements of operating the database, the basic information of the disk to be deleted input by the user is obtained; based on the basic information of the disk to be deleted, the existing disk information of the disk to be deleted is obtained; based on the existing disk information, whether the disk to be deleted meets the deletion conditions is determined; if it does, a disk deletion command script corresponding to the basic information is generated in a preset format, and the disk deletion command script is executed to delete the disk to be deleted. In the embodiment of the present invention, there is no need for manual inspection operations, and the existing disk information of the disk to be deleted is used to determine whether the disk to be deleted meets the deletion conditions; when it is determined that the disk to be deleted meets the deletion conditions, a corresponding disk deletion command script is generated in a preset format to delete the disk to be deleted based on the disk deletion command script. The above method can not only avoid the situation of deleting the wrong ASM disk, but also improve the inspection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0043] Figure 1 A schematic flow chart of a method for deleting a disk according to an embodiment of the present invention;
[0044] Figure 2 A schematic flow chart of another method for deleting a disk according to an embodiment of the present invention;
[0045] Figure 3 A schematic diagram of the structure of a disk deletion device according to an embodiment of the present invention;
[0046] Figure 4 The present invention is a schematic structural diagram of another disk deletion device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0049] In the embodiment of the present invention, manual inspection is not required. The existing disk information of the disk to be deleted is used to determine whether the disk to be deleted meets the deletion condition. When it is determined that the disk to be deleted meets the deletion condition, a corresponding disk deletion command script is generated according to a preset format to delete the disk to be deleted based on the disk deletion command script. The above method can not only avoid the situation of deleting the wrong ASM disk, but also improve the inspection efficiency.
[0050] The disk deletion method shown in the embodiment of the present invention can be used for relationship management in an Oracle database. The Oracle database is provided by Oracle Corporation based on an Oracle all-in-one device, that is, a physical device, including a server, a network, and storage. The disk deletion method is run on the device to realize the function of automatically deleting ASM disks.
[0051] The disk deletion method shown in the embodiment of the present invention is designed with a multi-node real-time application cluster Oracle RAC as an operation object, and can be implemented using the computer language perl to adapt it to Oracle 11g or 19c version.
[0052] See also Figure 1 , is a flow chart of a method for deleting a disk according to an embodiment of the present invention, the method comprising:
[0053] S101: Determine whether the successfully logged-in user meets the requirements for operating the database. If it is determined that the successfully logged-in user meets the requirements for operating the database, execute S102. If it is determined that the successfully logged-in user does not meet the requirements for operating the database, it means that the database cannot be operated and the user logs out.
[0054] In the specific implementation of step S101, when the login instruction triggered by the user is detected, the account and password input by the user are obtained, and it is determined whether the account and password are consistent with the account and password pre-stored in the database. If they are inconsistent, a prompt interface indicating login failure is displayed. If they are consistent, it means that the current user has successfully logged in, and information such as user-defined global environment variables and input SQL statements are obtained to determine whether the successfully logged in user meets the requirements for operating the database. When it is determined that the successfully logged in user meets the requirements for operating the database, S102 is executed. If it is determined that the successfully logged in user does not meet the requirements for operating the database, it means that the database cannot be operated, and the user logs out.
[0055] It should be noted that the database shown in the embodiment of the present invention is an Oracle database.
[0056] The requirements for operating the database include managing operation permissions, user-related processes with the same name, and the number of ASM instances.
[0057] S102: Obtaining basic information of the disk to be deleted input by the user.
[0058] In step S102, the basic information of the disk to be deleted includes at least the name of the disk group corresponding to the disk to be deleted, the rebalance value, and the number of disks.
[0059] In the specific process of implementing step S102, the disk group name, rebalance value and number of disks corresponding to the disk to be deleted input by the user are obtained.
[0060] It should be noted that the disk is an Automatic Storage Management (ASM) disk.
[0061] The rebalance value is an Oracle parameter that controls the number of concurrent synchronizations of data on disk.
[0062] S103: Based on the basic information of the disk to be deleted, obtain the existing disk information of the disk to be deleted.
[0063] In the process of implementing step S103, the database is searched through the disk group name, rebalance value and number of disks corresponding to the disk to be deleted to determine the location information, space information (used space information and remaining space information), disk size, number of disks and number of failed groups of the disk to be deleted.
[0064] S104: Based on the existing disk information, determine whether the disk to be deleted meets the deletion conditions. If so, execute S105. If not, it means that the database cannot be operated any more and log out.
[0065] In the specific implementation of step S104, the existing disk information is used to determine whether the disk to be deleted meets the deletion conditions. If it does, S105 is executed. If it does not, it means that the database cannot be operated any more and the user logs out.
[0066] It should be noted that the deletion conditions include judging a preset value range, meeting preset rules, and free space in the disk group.
[0067] S105: Generate a disk deletion command script corresponding to the basic information according to a preset format.
[0068] In the specific implementation of step S105, a disk deletion command script is generated according to a preset format for the disk to be deleted that meets the deletion condition, and the corresponding disk deletion command is displayed to the user.
[0069] Optionally, based on the disk deletion method shown in the above-mentioned embodiment of the present invention, after executing step S105 to generate a disk deletion command script corresponding to the basic information in a preset format, it also includes: based on the disk deletion command script, generating a command log corresponding to the disk deletion command script.
[0070] S106: Execute the disk deletion command script to delete the disk to be deleted.
[0071] In the specific implementation of step S106, the disk deletion command script obtained in the above step S105 is executed to delete the disk to be deleted.
[0072] In the embodiment of the present invention, manual inspection is not required. The existing disk information of the disk to be deleted is used to determine whether the disk to be deleted meets the deletion condition. When it is determined that the disk to be deleted meets the deletion condition, a corresponding disk deletion command script is generated according to a preset format to delete the disk to be deleted based on the disk deletion command script. The above method can not only avoid the situation of deleting the wrong ASM disk, but also improve the inspection efficiency.
[0073] Based on the disk deletion method shown in the above embodiment of the present invention, the embodiment of the present invention further specifically discloses the process of the disk deletion method, such as Figure 2 FIG. 1 is a flow chart of a method for deleting a disk according to an embodiment of the present invention, the method comprising:
[0074] S201: Determine whether the user authority of the successfully logged in user is management operation authority. If so, execute step S202. If not, it means that the database cannot be operated and log out.
[0075] In the process of implementing step S201, when it is determined that the user has logged in successfully, the user's user rights are obtained based on the user account information, and it is determined whether the user rights are management operation rights, that is, whether the user is a management root user. If so, it means that the user can operate the database and execute step S202. If not, it means that the database cannot be operated and the user logs out.
[0076] S202: Determine whether there is a process with the same name related to the user. If not, execute step S203. If yes, it means that the database cannot be operated and log out.
[0077] In the specific implementation of step S202, it is determined whether the user repeatedly executes the tool corresponding to the database, that is, repeatedly executes the process with the same name. If not, step S203 is executed. If so, it means that the database cannot be operated and the user logs out.
[0078] It should be noted that repeatedly executing the application corresponding to the database means that the application corresponding to the database is called up again before the first execution is completed.
[0079] S203: Determine whether the number of ASM instances meets the preset number. If so, execute step S204. If not, it means that the database cannot be operated and log out.
[0080] In step S203, the preset number is a preset setting, for example, it can be set to 1.
[0081] In the specific implementation of step S203, in order to ensure that the object operated by the application is single and not non-single, it is necessary to determine whether there is an ASM instance in the current database. If so, execute step S204. If not, it means that the database cannot be operated and log out.
[0082] It should be noted that the execution order of step S201 to step S203 can be as described above, or can be executed simultaneously, or can be executed in other execution orders, which is not limited in this embodiment of the present invention.
[0083] S204: Determine whether the user who successfully logged in meets the requirements for operating the database.
[0084] S205: Based on the basic information of the disk to be deleted, obtain the existing disk information of the disk to be deleted.
[0085] It should be noted that the specific implementation process of step S205 is the same as the specific implementation process of the above-mentioned step S103, and they can refer to each other.
[0086] S206: Determine whether the number of failure groups in the existing disk information meets the preset value range. If yes, execute step S207. If not, it means that the database cannot be operated and log out.
[0087] In the process of implementing step S206, the number of failure groups in the disk information is compared with the size of the preset numerical range. If the number of failure groups is within the preset numerical range, it means that the number of failure groups meets the specifications. At this time, step S207 is executed. If the number of failure groups is not within the preset numerical range, it means that the number of failure groups meets the specifications. At this time, the database cannot be operated and the login is logged out.
[0088] It should be noted that the preset numerical range is set in advance according to actual specifications, and the embodiment of the present invention does not limit this.
[0089] S207: Determine whether the disk size and the number of disks in the existing disk information meet the preset rules. If so, execute step S208. If not, it means that the database cannot be operated and log out.
[0090] In step S207, the preset rules include a disk size standard rule and a preset threshold storage rule.
[0091] In the process of implementing step S207, determine whether the disk size of the disk to be deleted meets the standard disk size rules, whether the number of disks meets the preset threshold, and whether the disk to be deleted meets the storage rules from different storage cabinets. If all are satisfied, execute step S208. If any one or more are not satisfied, it means that the database cannot be operated and log out.
[0092] S208: Determine whether the space data of the disk to be deleted is less than the free space of the corresponding disk group. If so, execute step S209. If greater than or equal to, it means that the database cannot be operated and log out.
[0093] In step S208, the free space of the disk group is determined based on the storage area network (SAN) disk information obtained from the database.
[0094] Optionally, first obtain all storage area network SAN disk information of the operating system from the database.
[0095] It should be noted that the SAN disk information includes the location information, space information, ID number and disk size information of all disks.
[0096] In the process of implementing step S208, the free space of the disk group corresponding to the disk to be deleted is determined based on the storage area network SAN disk information; the space data of the disk to be deleted is compared with the size of the free space of the corresponding disk group. If the space data of the disk to be deleted is smaller than the free space of the corresponding disk group, step S209 is executed; if the space data of the disk to be deleted is greater than or equal to the free space of the corresponding disk group, it means that the database cannot be operated and the login is logged out.
[0097] It should be noted that the specific implementation order of step S206 to step S208 is not limited to the above order, and can also be executed simultaneously or in other execution orders, which is not limited by the embodiment of the present invention.
[0098] S209: Determine whether the disk to be deleted meets the deletion condition.
[0099] S210: Generate a disk deletion command script corresponding to the basic information according to a preset format.
[0100] S211: Execute the disk deletion command script to delete the disk to be deleted.
[0101] It should be noted that the specific implementation process of step S210 and step S211 is the same as the specific implementation process of the above-mentioned steps S105 and S106, and they can refer to each other.
[0102] In the embodiment of the present invention, manual inspection operation is not required. When it is determined that the user authority of the successfully logged-in user is the management operation authority, there is no process with the same name related to the user, and the number of ASM instances meets the preset number, it is determined whether the number of failure groups in the existing disk information meets the preset value range, whether the disk size and the number of disks in the existing disk information meet the preset rules, and whether the space data of the disk to be deleted is less than the free space of the corresponding disk group, so as to determine whether the disk to be deleted meets the deletion conditions. When it is determined that the number of failure groups meets the preset value range, the disk size and the number of disks meet the preset rules, and the space data of the disk to be deleted is less than the free space of the corresponding disk group, a corresponding disk deletion command script is generated according to a preset format to delete the disk to be deleted based on the disk deletion command script. The above method can not only avoid the situation of deleting the wrong ASM disk, but also improve the inspection efficiency.
[0103] Corresponding to the disk deletion method shown in the above embodiment of the present invention, the embodiment of the present invention also discloses a disk deletion device, such as Figure 3 FIG. 1 is a schematic diagram of a disk deletion device according to an embodiment of the present invention, wherein the device comprises:
[0104] The first acquisition unit 301 is used to acquire basic information of the disk to be deleted input by the user when it is determined that the user who has successfully logged in meets the requirements for operating the database.
[0105] The second obtaining unit 302 is configured to obtain existing disk information of the disk to be deleted based on the basic information of the disk to be deleted.
[0106] The processing unit 303 is used to determine whether the disk to be deleted meets the deletion condition based on the existing disk information, and if so, execute the generation unit.
[0107] The first generating unit 304 is configured to generate a disk deletion command script corresponding to the basic information according to a preset format.
[0108] The deleting unit 305 is used to execute the disk deletion command script to delete the disk to be deleted.
[0109] Optionally, the method further includes: a second generating unit, configured to generate a command log corresponding to the disk deletion command script based on the disk deletion command script after executing the first generating unit 304 .
[0110] It should be noted that the specific principles and execution processes of each unit in the disk deletion device disclosed in the above embodiment of the present invention are the same as the disk deletion method shown in the above embodiment of the present invention. Please refer to the corresponding parts of the disk deletion method disclosed in the above embodiment of the present invention, and will not be repeated here.
[0111] In the embodiment of the present invention, manual inspection is not required. The existing disk information of the disk to be deleted is used to determine whether the disk to be deleted meets the deletion condition. When it is determined that the disk to be deleted meets the deletion condition, a corresponding disk deletion command script is generated according to a preset format to delete the disk to be deleted based on the disk deletion command script. The above method can not only avoid the situation of deleting the wrong ASM disk, but also improve the inspection efficiency.
[0112] Optionally, based on the disk deletion device shown in the above-mentioned embodiment of the present invention, an acquisition unit 301 is used to determine whether the user who has successfully logged in meets the requirements for operating the database, and is specifically used to: determine whether the user rights of the user who has successfully logged in are management operation rights; if so, determine whether there is a process with the same name related to the user; if not, determine whether the number of ASM instances meets the preset number; if yes, determine that the user who has successfully logged in meets the requirements for operating the database.
[0113] In the embodiment of the present invention, it is first necessary to determine whether the user meets the requirements for operating the database based on the user's authority, the number of processes with the same name, and the number of ASM instances. When it is determined that the user meets the requirements for operating the database, it is determined whether the disk to be deleted meets the deletion conditions through the existing disk information of the disk to be deleted; when it is determined that the disk to be deleted meets the deletion conditions, a corresponding disk deletion command script is generated according to a preset format, so as to delete the disk to be deleted based on the disk deletion command script. The above method can not only avoid the situation of deleting the wrong ASM disk, but also improve the inspection efficiency.
[0114] Optionally, based on the disk deletion device shown in the above embodiment of the present invention, the structure Figure 3 , see Figure 4 , the processing unit 303 includes:
[0115] The first judgment module 3031 is used to judge whether the number of failure groups in the existing disk information meets a preset value range. If yes, the second judgment module 3032 is executed.
[0116] The second judgment module 3032 is used to judge whether the disk size and the number of disks in the existing disk information meet the preset rules. If they both meet the rules, the third judgment module 3033 is executed.
[0117] The third judgment module 3033 is used to judge whether the space data of the disk to be deleted is less than the free space of the corresponding disk group. If so, the determination module 3034 is executed, wherein the free space of the disk group is determined based on the storage area network SAN disk information obtained from the database.
[0118] The determination module 3034 is used to determine whether the disk to be deleted meets the deletion condition.
[0119] In the embodiment of the present invention, manual inspection operation is not required. When it is determined that the user authority of the successfully logged-in user is the management operation authority, there is no process with the same name related to the user, and the number of ASM instances meets the preset number, it is determined whether the number of failure groups in the existing disk information meets the preset value range, whether the disk size and the number of disks in the existing disk information meet the preset rules, and whether the space data of the disk to be deleted is less than the free space of the corresponding disk group, so as to determine whether the disk to be deleted meets the deletion conditions. When it is determined that the number of failure groups meets the preset value range, the disk size and the number of disks meet the preset rules, and the space data of the disk to be deleted is less than the free space of the corresponding disk group, a corresponding disk deletion command script is generated according to a preset format to delete the disk to be deleted based on the disk deletion command script. The above method can not only avoid the situation of deleting the wrong ASM disk, but also improve the inspection efficiency.
[0120] The embodiment of the present invention also discloses an electronic device, which is used to run a database storage process, wherein the above-mentioned Figure 1 and Figure 2 Public disk deletion method.
[0121] The embodiment of the present invention also discloses a computer storage medium, wherein the storage medium includes a storage database storage process, wherein when the database storage process is running, the device where the storage medium is located is controlled to execute the above Figure 1 and Figure 2 Public disk deletion method.
[0122] In the context of the present disclosure, a computer storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0123] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0124] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0125] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for deleting a disk, characterized in that: The method comprises: When it is determined that the user who has successfully logged in meets the requirements for operating the database, basic information of the disk to be deleted input by the user is obtained; the basic information of the disk to be deleted input by the user includes the disk group name, rebalance value and number of disks corresponding to the disk to be deleted; Based on the disk group name, rebalance value and disk quantity in the basic information of the disk to be deleted, the database is searched to determine the existing disk information of the disk to be deleted, wherein the existing disk information of the disk to be deleted includes location information, space information, disk size, number of disks and number of failed groups, and the space information includes used space information and remaining space information; Based on the existing disk information, determine whether the disk to be deleted meets the deletion condition; If it is in compliance, generating a disk deletion command script corresponding to the basic information in a preset format; Execute the disk deletion command script to delete the disk to be deleted; Wherein, determining whether the disk to be deleted meets the deletion condition based on the existing disk information includes: Determine whether the number of failed groups in the existing disk information meets a preset value range; If yes, determine whether the disk size and the number of disks in the existing disk information meet preset rules, wherein the preset rules include disk size standard rules, preset threshold storage rules, and storage rules from different storage cabinets; If all of them are met, it is determined whether the space data of the disk to be deleted is less than the free space of the corresponding disk group, wherein the free space of the disk group is determined based on the storage area network SAN disk information obtained from the database; If it is smaller, it is determined that the disk to be deleted meets the deletion conditions.
2. The method according to claim 1, characterized in that: Determining that the successfully logged-in user meets the requirements for operating the database includes: Determine whether the user rights of the successfully logged in user are management operation rights; If so, determine whether there is a process with the same name associated with the user; If not, determine whether the number of ASM instances meets the preset number; If yes, it is determined that the user who successfully logged in meets the requirements for operating the database.
3. The method according to claim 1, characterized in that: After generating a disk deletion command script corresponding to the basic information in a preset format, the method further includes: Based on the disk deletion command script, a command log corresponding to the disk deletion command script is generated.
4. A disk deletion device, characterized in that: The device comprises: The first acquisition unit is used to acquire basic information of the disk to be deleted input by the user when it is determined that the user who has successfully logged in meets the requirements of operating the database; the basic information of the disk to be deleted includes the disk group name, rebalance value and number of disks corresponding to the disk to be deleted; A second acquisition unit is used to search a database based on the disk group name, rebalance value and number of disks in the basic information of the disk to be deleted, and determine the existing disk information of the disk to be deleted, wherein the existing disk information of the disk to be deleted includes location information, space information, disk size, number of disks and number of failed groups, and the space information includes used space information and remaining space information; A processing unit, configured to determine whether the disk to be deleted meets the deletion condition based on the existing disk information, and if so, execute the generating unit; A first generating unit, configured to generate a disk deletion command script corresponding to the basic information in a preset format; A deleting unit, used for executing the disk deletion command script to delete the disk to be deleted; Wherein, the processing unit comprises: A first judgment module is used to judge whether the number of failure groups in the existing disk information meets a preset value range, and if so, execute a second judgment module; The second judgment module is used to judge whether the disk size and the number of disks in the existing disk information meet the preset rules. If they meet, the third judgment module is executed; the preset rules include disk size standard rules, preset threshold storage rules and storage rules from different storage cabinets; The third judgment module is used to judge whether the space data of the disk to be deleted is less than the free space of the corresponding disk group, and if so, execute the determination module, wherein the free space of the disk group is determined based on the storage area network SAN disk information obtained from the database; The determination module is used to determine whether the disk to be deleted meets the deletion condition.
5. The device according to claim 4, characterized in that The acquisition unit for determining whether the successfully logged-in user meets the requirements for operating the database is specifically used to: determine whether the user rights of the successfully logged-in user are management operation rights; if so, determine whether there is a process with the same name related to the user; if not, determine whether the number of ASM instances meets the preset number; if so, determine that the successfully logged-in user meets the requirements for operating the database.
6. The device according to claim 4, characterized in that Also includes: The second generating unit is configured to generate a command log corresponding to the disk deletion command script based on the disk deletion command script after executing the first generating unit.
7. An electronic device, characterized in that: The electronic device is used to run a program, wherein the program, when running, executes the disk erasing method as described in any one of claims 1-3.
8. A computer storage medium, characterized in that: The storage medium includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute the disk deletion method as described in any one of claims 1-3.
