This topic describes some basic operations in Web ODC.
Create a user
Example: The administrator edits the username OBD***@oceanbase.com in ODC and grants the system_admin role to the user.
Log in to the OceanBase Cloud console and go to the Web ODC page. In the left-side navigation pane of the project collaboration window, choose Users > Users. On the page that appears, select and edit the user
OBD***@oceanbase.com.On the Create User page that appears, specify the user and role information.
The role is optional. You can assign multiple roles to a user. Click the text box to display a drop-down list of roles created in the organization. Select the roles to assign to the current user. If no roles are created, create a role first.
Click Save to submit the user information.
Create a data source
ODC in the OceanBase Cloud environment supports creating OceanBase MySQL and OceanBase Oracle data sources.
Example: Create an OceanBase MySQL data source named obmysql4.3.x in ODC.
In the left-side navigation pane of the Web ODC project collaboration window, choose Data Sources > Create Data Source > OceanBase MySQL.
In the Create Data Source panel that appears, specify or select the following information.
Parameter Description Endpoint The database instance. You can select a cluster instance or a tenant instance. Database Account - Database User Name: the username of an account created in the tenant. In the MySQL compatible mode, this account must have the privilege to access the default database.
- Database Password: the password of the account created in the tenant. You can click Test Connection next to the password field to test whether you can connect to the target database.
Environment You can select an environment type as needed. Valid values: dev, sit, and prod. Project You can choose to bind the created data source to the specified project. After the data source is bound to the project, the databases created in the data source are automatically moved to the project. Note
The system parameterodc.connect.database.sync.block-internal-databasespecifies whether to automatically synchronize built-in databases to the project. The default value is true, which specifies not to automatically synchronize built-in databases to the bound project. The built-in databases identified by ODC for different data sources are as follows:- OceanBase Oracle:
SYS - OceanBase MySQL:
information_schema,mysql,test, andoceanbase - MySQL:
information_schema,mysql, andtest.
Advanced Settings Startup Script: You can configure a connection session by using an SQL statement, such as set session ob_query_timeout=60000000.After you specify the preceding information, click OK in the lower-right corner of the panel.
In the dialog box that appears, customize the data source name and click OK. The current configuration information is then permanently saved in the ODC data source list.
After the data source is created, you can view it in the data source list.
Create a project
Example: Create a project named odc_4.3.x in ODC.
The ODC system administrator grants the user the permission to create a project.
On the Projects > All Projects page, click Create Project.
On the Create Project tab, specify the following information.
Parameter Description Project Name The name of the project. Administrator The administrator has all permissions in the project. DBA The DBA has all permissions in the project except for member management, message configuration, and project settings. Developer (optional) The developer can log in to all databases, execute SQL statements, and submit tickets. Security Administrator (optional) The security administrator can manage sensitive columns in addition to the permissions of a participant. Participant (optional) The participant can view the basic information of the project, apply for database permissions, and submit tickets. Description (optional) The description of the project. This parameter is optional. Click OK.
Note
If you do not have the permission to create a project, you can join an existing project by clicking Join Project in Projects or Apply for Project Permission in Tickets. For more information, see Collaborative project management.
Add a database to a project
Example: Create a database named odc_test in the odc_4.3.x project.
On the Project > All Projects page, click the name of the odc_4.3.x project.
On the Database tab, click Add Database.
In the Add Database dialog box, select the created data source and database, and then click OK.
In the Database list, view the added database odc_test.
You can click the edit box in the Remarks column to add a remark for the database, which facilitates viewing the database in the future.
Note
Only project administrators and project DBAs can modify the remarks of databases in the project.
In the Database list, click Log in to the database in the Actions column of the odc_test database.
Enter the SQL development window.
Note
If you do not have database permissions, you can apply for database permissions by clicking Apply for Database Permissions in Project > Database/Tickets.
Edit and execute SQL statements
Example: In the SQL window, create a table in the database of the target project.
| Parameter | Example value |
|---|---|
| Project name | odc_4.2.0 |
| Data source | obmysql4.3.0 |
| Database name | odc_test |
| Table name | employee |
In the odc_4.2.0 project, click Log in to the database to go to the SQL window.
In the SQL window, edit the SQL statement to create the
employeetable.CREATE TABLE odc_test.employee ( emp_no int(120) COMMENT 'Employee ID' NOT NULL, birthday date COMMENT 'Birthday' NULL, name varchar(120) COMMENT 'Name' NULL, CONSTRAINT cons_employee_empno PRIMARY KEY (emp_no)) DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;Click
to switch databases.After you edit the SQL statement, click Run F8 in the toolbar of the SQL window to run all SQL statements in the current SQL window.
Feature Description Run F8 Runs all SQL statements in the current SQL window. Run Current Statement F9 Runs all selected SQL statements or the SQL statement on the line where the cursor is located. Abort Click this icon to abort the running statements. Note
If you do not have table permissions, you can apply for table permissions in the Tickets section.
Create a database change
Example: Change the value of the name column in the employee table in the odc_test database from xiaoguo to xiaofeng.
On the Project > All Projects page, click the project name odc_4.3.x.
On the Tickets tab, choose Database Change > Create Database Change.
On the Create Database Change page, enter the following information.
Click Create to create a database change.
After the task is generated, you can view the task approval result and task information in the Tickets > Database Change list.