OceanBase Developer Center (ODC) provides the data mocking feature. This feature can generate data based on field types in a table, to meet your requirement for a large amount of data during database performance tests or feature verification.
Perform the following steps to generate data by using the data mocking feature:
Go to the Mock Data panel.
Log on to ODC, and click the name of the target connection to go to the corresponding database object management page. Click Tool in the navigation bar in the upper part of the page and select Mock Data from the drop-down list. The Mock Data panel appears.
View the connection.
The name of the database connection to which the task belongs is displayed under Connection.
Specify the database.
Select the database to be changed.
Specify the table for generating data.
In the Mock Data panel, select the table from the drop-down list under Table. The drop-down list displays all the tables in the current instance.
Specify the amount of data to be generated.
In the Mock Data panel, set Mock Data Volume to specify the desired number of data rows to be generated. The default value is 1000. The system can generate up to 1,000,000 rows of data. You can set the value to an integer between 1 and 1000000.
Specify the batch size.
In the Mock Data panel, set Batch Size to specify the number of rows generated that trigger a
COMMIT
operation. The default value is 200. That is, a commit operation is performed once every 200 rows are generated. The maximum value supported is 500. You can set the value to an integer between 1 and 500.Specify whether to empty the table before inserting mock data into it.
In the Mock Data panel, select Yes or No under Empty Table Before Inserting Mock Data to specify whether or not to empty the table before inserting mock data.
Specify the data conflict handling mode.
In the Mock Data panel, specify Data Conflict Handling Mode by selecting a mode from the drop-down list. ODC supports the following methods:
Ignore: This option is selected by default. The data conflicting with existing data is not inserted.
Overwrite: If a data conflict occurs, the original data is deleted, and the new data is inserted.
Terminate: If a data conflict occurs, the data mocking task is terminated.
Set data generation rules.
In the Mock Data panel, the Rule Settings table displays the fields in the table you selected before in the Field Name and Field Type columns. You can specify the data generation rules for the target fields in the Rule and Rule Details columns. The Rule column provides built-in rules based on the field type for you to choose from. The Rule Details column displays the detailed information for the rule that you selected. You can click the edit icon to edit the information.
Submit the information to generate a data mocking task.
Click the Submit button in the lower-right corner of the Mock Data panel to generate a data mocking task. You can view the task details in the Task Center panel. For more information, see Data mocking tasks.