diff --git a/.aci.yml b/.aci.yml new file mode 100644 index 00000000..a0ad1525 --- /dev/null +++ b/.aci.yml @@ -0,0 +1,36 @@ + +stages: + - build + +beforeScript: + - | + export PATH=$PWD/node_modules/.bin:/root/.cli:$PATH + echo $PATH + tnpm -v + +build: + stage: build + aciTags: DOCKER + agent: + docker: + image: reg.docker.alibaba-inc.com/odc-front/odc-e2e:node14 + resourceRequirements: + cpu: 4 + memory: 12 + ephemeral-storage: 30 + script: + - | + export PATH=$PWD/node_modules/.bin:/root/.cli:$PATH + node -e "console.log('%j, %j', process.versions, process.execPath)" + tnpm i @alipay/ob-yuque2book-front@2 -g + ob-md2book -p ./ -n "${ACI_VAR_docName}" -o ./ -r + tar -zcvf output.tar.gz output + echo 'open doc' > ./index.html + publisher: + archiveArtifacts: + artifacts: 'output.tar.gz, index.html' + allowEmptyArchive: true + html: + index: index.html + displayName: '在线预览' + \ No newline at end of file diff --git a/en-US/1.oceanbase-developer-center-documentation-odc-v3-3-0.md b/en-US/1.oceanbase-developer-center-documentation-odc-v3-3-0.md new file mode 100644 index 00000000..f29a097c --- /dev/null +++ b/en-US/1.oceanbase-developer-center-documentation-odc-v3-3-0.md @@ -0,0 +1,9 @@ +Document Overview +====================================== + +OceanBase Developer Center (ODC) is an enterprise-class database development platform tailored for OceanBase. ODC is connected to MySQL and Oracle databases in OceanBase. ODC also provides database developers with various features, such as daily development operations, WebSQL, SQL diagnostics, session management, and data import and export. + + +| Quick Start | Common Operations | FAQ | +|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Overview](4.quickstart/1.quickstart-overview.md)
[Install ODC](7.client-odc-user-guide/1.client-odc-install-odc.md)
[Log on to ODC with an account](6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md)
[Create a private connection](6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md)
[Export data](5.tutorials/3.tutorials-export.md)
[Import data](5.tutorials/4.tutorials-import.md)
[Use the SQL Window](6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md) | [Private connection management](6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md)
[Public resource management](6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md)
[Use the workspace](6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md)
[Use tools](6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md)
[Task management](6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md)
[Session management](6.web-odc-user-guide/10.web-odc-session-management.md)
[Database objects management](6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-database-objects-overview.md)
[Use recycle bin](6.web-odc-user-guide/7.web-odc-recycle-bin.md)
[View operating record](6.web-odc-user-guide/8.web-odc-view-operation-records.md) | [FAQ](10.faq.md) | \ No newline at end of file diff --git a/en-US/10.faq.md b/en-US/10.faq.md new file mode 100644 index 00000000..2a2b79b5 --- /dev/null +++ b/en-US/10.faq.md @@ -0,0 +1,259 @@ +FAQ +======================== + + + +ODC client installation +-------------------------------------------- + +1. Q: What items are pre-checked when I install the ODC client? + + A: The following items are pre-checked: +
+ +2. Q: How do I view the logs when the installation or startup of the ODC client fails? + + A: You can view the error information in the main.log file. The storage path of the file varies with the OS. +
+ +3. Q: What do I do when the installation or startup of the ODC client fails and an error message is returned indicating that a port conflict issue has occurred? + + A: You need to check the process that occupies port 8989, kill the process, and then reinstall or restart the ODC client. Dynamic ports are used in ODC V2.3.0 and later to avoid this problem. + + - On macOS, run the following command to check the use status of port 8989: + + ```JavaScript + lsof -i tcp:8989 + ``` + - On Windows, run the following statement to check the use status of port 8989: + ```JavaScript + netstat -ano|findstr 8989 + ``` + + + ODC V3.2.0 allows you to set custom ports. + + - On Mac OS, set environment variables and run the corresponding command to enable the port: + + ![faq 3.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%983-1.png) + + ![faq 3.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%983-2.png) + + - On Windows, set the ODC_PORT parameter to enable the specified port: + + ![faq 3.3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%983-3.png) +
+ +4. Q: What do I do when the installation or startup of the ODC client fails and an error message is returned indicating that the Java version is not supported? + + A: You can run the following command to check the Java runtime environment. We recommend that you install JDK1.8.0_242 or a later version. If you have installed JDK of an earlier version, upgrade JDK, restart the computer, and then reinstall or restart the ODC client. + + ```javascript + java -version + ``` +
+ +5. Q: What do I do when the installation or startup of the ODC client fails and an error message is returned indicating that the software package is damaged? + + A: You can run the `sudo spctl --master-disable` command and select any source. + + ![FAQ - Software package damage](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3568659361/p327743.png) +
+ +6. Q: What do I do when the following message appears while I am installing the ODC client on macOS? ![0630BE10-49E1-4E06-BB2B-F55CDEEDC31F](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3568659361/p313145.png)A: The ODC client cannot be directly installed on Mac OS because it is not downloaded from the App Store. For more information about how to safely open an app that is not downloaded from the Apple Store, see [Safely open apps on your Mac](https://support.apple.com/zh-cn/guide/mac-help/mchleab3a043/mac). + + + + + + +Launch of Web ODC +-------------------------------------- + +1. Q: What do I do when the username (such as admin) conflict occurs during the upgrade of ODC from an earlier version to V3.2.0 or later, and the startup fails? + + A: + + **Example error:** + + ![Failed to start due to username conflict.](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5444379361/p345547.png) + + **Solution** : + + This example shows how to solve the admin conflict. + 1. Open the rename.properties file in the ../odc/static/tmp/ directory, and edit the rename.properties in the following format: + + ```unknow + admin=a new username + ``` + + + + 2. Save the change and start ODC again. + + + + + + + + + +Connection information +------------------------------------------- + +1. Q: What do I do when ODC is disconnected during the execution of an SQL query? + + A: + + The disconnection is caused by a proxy server timeout. You can send an `sql-execute` request in the browser debugging mode and check the response. + + To ensure sufficient proxy server timeout, modify the load balancing configurations. The following example shows how to modify the NGINX configuration: + + a. Add the following proxy configuration. + + ```shell + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + ``` + + + > **Note**
+ > We recommend that you set the `proxy_connect_timeout` parameter to a value of no longer than 75 seconds. For more information, see [proxy_connect_timeout](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout). + > If you do not set the `proxy_next_upstream` parameter to off, the NGINX proxy will forward your requests to the next ODC node. In this case, you need to log on to ODC again, and cannot use features related to file upload and download, such as downloading the result set of an asynchronous task. + + + b. After the modification, restart the NGINX proxy. +
+ +2. Q: How do I back up the connection information in ODC? + + A: + + * A: If you are using Web ODC, you can directly migrate or back up the MetaDB that you created during ODC deployment. + * If you are using the ODC client, you can back up the `odc2.0.mv.db` file in the user directory. When you need to restore the connection, you can copy this file to the original directory. +
+ +3. Q: What do I do when the execution of an SQL query times out? + + A: When the execution of an SQL query times out, you can manually set the timeout value. In Advanced Configuration on the connection information editing page, you can set **SQL Query Timeout Value** to a larger value. This configuration item is supported in ODC since V2.2.0. If you are using an earlier version, upgrade to ODC V2.2.0 or a later version. +
+ +4. Q: What do I do when an error is returned indicating that the proxyro user does not exist? + + A: You need to set **Query sys Tenant View** to a user with the permission to query sys tenant views in Advanced Configuration on the connection information editing page. This configuration item is supported in ODC since V2.2.0. If you are using an earlier version, upgrade to ODC V2.2.0 or later. + + + + + +Command-line window +---------------------------------------- + +1. Q: After I connect to a database by using the ODC client on Windows, the connection is stuck and then disconnected, as shown in the following figure. How do I solve this problem? ![Image 360](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3568659361/p255231.png)A: This problem is caused by the lack of the system library files of msvcp120.dll and msvcr120.dll. Please install the official [Visual Studio patch](https://www.microsoft.com/en-us/download/details.aspx?id=40784). + + > **Note**
+ > You do not need to restart ODC after installing the Visual Studio patch. It is recommended to update ODC to the latest version. The current ODC version has a corresponding DDL file, so you do not need to install the patch separately. + + + + + +Encoding +----------------------------- + +1. Q: What do I do when the result set of a query is full of garbled characters? + + A: This problem is caused by the inconsistency between the encoding format used by the ODC client and that expected by the database. The ODC client allows you to encode data in SQL windows or command-line windows + + + | Location | Linux | macOS | Windows | + |---------------------|-------|-------|---------| + | SQL window | UTF8 | UTF8 | UTF8 | + | Command-line window | UTF8 | UTF8 | GBK | + + + + You can run the following command to query the encoding format expected by the database: + + ```sql + show variables like '%character_set_c%'; + show variables like '%character_set_r%'; + ``` + + + + The following table shows the encoding formats. + + ![FAQ - Garbled characters](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3568659361/p326073.png) + + You can run the following command to modify the encoding format expected by the database: + + ```sql + set names gbk; + ``` + + + + + | Scenario | Solution | + |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | The result set of an SQL statement executed in an SQL window contains garbled Chinese characters.
- OS on the server where the ODC client is installed: Mac OS
- Character set used by OBServer: GBK | - Symptom Run the following command in the database:
```sql show variables like '%character%'; ```
The following variables are displayed:
```sql character_set_client gbk character_set_connection gbk character_set_filesystem binary character_set_results gbk character_set_system gbk ```
It can be learned that the data is encoded in GBK format and the database expects that the ODC client uses the GBK character set.
- Cause The character set the database expects the client to use is GBK. However, the ODC client uses UTF8, which is different from GBK.
- Solution Modify the character set expected by the database so that it is compatible with the character set actually used by the ODC client.
```sql set names utf8mb4; ```
After the character set is modified, execute the SQL statement in the current session again and view the result set. The result set contains no garbled Chinese characters. | + | The result set of an SQL statement executed in a command-line window contains garbled Chinese characters.
- OS on the server where the ODC client is installed: Windows
- Character set used by OBServer: UTF8MB4 | - Symptom Run the following command in the database:
```sql show variables like '%character%'; ``` The following variables are displayed:
```sql character_set_client utf8mb4 character_set_connection utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_system utf8mb4 ```
It can be learned that the data is encoded in UTF8MB4 and the database expects that the ODC client uses the UTF8MB4 character set.
- Cause The character set the database expects the client to use is UTF8MB4. However, the ODC client uses GBK, which is different from UTF8MB4.
- Solution Modify the character set expected by the database so that it is compatible with the character set actually used by the ODC client.
```sql set names gbk; ```
After the character set is modified, execute the SQL statement in the current session again and view the result set. The result set contains no garbled Chinese characters. | + | The result set of an SQL statement executed in a command-line window contains garbled Chinese characters.
- OS on the server where the ODC client is installed: Windows
- Character set used by OBServer: UTF8MB4 | - Symptom Run the following command in the database:
```sql show variables like '%character%'; ```
The following variables are displayed:
```sql character_set_client utf8mb4 character_set_connection utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_system utf8mb4 ```
It can be learned that the data is encoded in UTF8MB4 and the database expects that the ODC client uses the UTF8MB4 character set.
- Cause The character set the database expects the client to use is UTF8MB4. However, the ODC client uses GBK, which is different from UTF8MB4.
- Solution Modify the character set expected by the database so that it is compatible with the character set actually used by the ODC client.
```sql set names gbk; ```
After the character set is modified, execute the SQL statement in the current session again and view the result set. The result set contains no garbled Chinese characters. | + | The result set of an SQL statement executed in a command-line window contains garbled Chinese characters.
- OS on the server where the ODC client is installed: Windows
- Character set used by OBServer: UTF8MB4 | - Symptom Run the following command in the database:
```sql show variables like '%character%'; ```
The following variables are displayed:
```sql character_set_client utf8mb4 character_set_connection utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_system utf8mb4 ```
It can be learned that the data is encoded in UTF8MB4 and the database expects that the ODC client uses the UTF8MB4 character set.
- Cause The character set the database expects the client to use is UTF8MB4. However, the ODC client uses GBK, which is different from UTF8MB4.
- Solution Modify the character set expected by the database so that it is compatible with the character set actually used by the ODC client.
```sql set names gbk; ```
After the character set is modified, execute the SQL statement in the current session again and view the result set. The result set contains no garbled Chinese characters. | + | A file imported to the database contains garbled Chinese characters.
- Encoding standard: GBK
- OS on the server where the ODC client is installed: Mac OS
- Character set used by OBServer: UTF8MB4 | - Symptom Run the following command in the database:
```sql show variables like '%character%'; ```
The following variables are displayed:
```sql character_set_client utf8mb4 character_set_connection utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_system utf8mb4 ```
It can be learned that the data is encoded in UTF8MB4 and the database expects that the ODC client uses the UTF8MB4 character set.
- Cause In this case, the data is written into the database by importing a file, which is independent of the encoding of the ODC client. Instead, the encoding standard of the imported file must be consistent with the character set expected by the database.
- Solution Transcode the file from the GBK format to the UTF8 format, and import it again. | + + + + + + +Data export and import +------------------------------------------- + +1. Q: When the data import or export fails and the task summary information includes the following error information: `javax.crypto.BadPaddingException: Given final block not properly padded`. What do I do? + + A: This exception is caused because the OBProxy password failed to be decrypted. You can solve this problem in the following three ways: + + + + + + + +DDL statement display +------------------------------------------ + +1. Q: What do I do when the DDL statements are incomplete in the table structure? + + A: The existing DDL statements include those for querying indexes and constraints. You can use the `DBMS_METADATA.get_ddl` function or run the `SHOW CREATE TABLE` command to query the DDL statements. + + Example: + + ```sql + -- Sample DDL statement for querying table indexes. + SELECT dbms_metadata.get_ddl('INDEX', 'indexname', 'username') from dual; + -- Sample DDL statement for querying table comments. + SELECT 'comment on table ' || table_name || ' is ' || '''' || comments || ''';' + FROM all_tab_comments where owner='USER1' AND table_name='T_1' ; + -- Sample DDL statement for querying table comments. + comment on table T_1 is 'desc 2'; + + -- Sample DDL statement for querying column comments. + SELECT 'comment on column ' || table_name || '.' || column_name || ' is ' || '''' || comments || ''';' + FROM all_col_comments where owner='USER1' AND table_name='T_1' ; + -- Sample DDL statement for querying column comments. + comment on column T_1.ID is 'ID 3'; + ``` +
+ +2. Q: Why are the displayed statements truncated when I check the DDL statements of a view or table on the view or table management page? + + A: This is because that the DDL tab of the database object management page calls the content of the `text` field in the `all_views` table. In versions earlier than OBServer V2.2.70, if the content of the `text` field in the `all_views` table is too long, it will be truncated. This problem has been solved in OBServer V2.2.70 and later versions. You can run the `SHOW CREATE VIEW/TABLE` statement to directly query the complete structure statements of the target view or table. + + + + diff --git a/en-US/2.what-s-new/1.product-updates.md b/en-US/2.what-s-new/1.product-updates.md new file mode 100644 index 00000000..6d32f527 --- /dev/null +++ b/en-US/2.what-s-new/1.product-updates.md @@ -0,0 +1,13 @@ +# What's New + +OceanBase Developer Center (ODC) V4.0.0 released in October 2022 is adapted to support OceanBase Database V4.0.0, allows you to manage partitions and approve the synchronization of shadow tables, and optimizes features such as connection creation and parameter settings of PL objects. + +## Updated modules and features + + +| Feature | Module | Description | +|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------| +| Partition plan | [Create a partition plan](../6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md) | The partition plan feature supports automatic creation of new partitions and deletion of expired partitions. | +| Shadow table synchronization | [Create a shadow table synchronization project](../6.web-odc-user-guide/6.web-odc-use-tools/5.web-odc-shadow-table-synchronization.md) | The shadow table synchronization feature supports automatic creation of shadow tables in the same database based on the schema of the source table. | +| Interactions during connection creation | [Create a private connection (Web ODC)](../6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md)
[Create a connection (ODC client)](../7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md) | You can save a connection without specifying the database account or password. The interactions during the configuration of the sys tenant are optimized. | +| Parameter settings of PL objects | [Manage functions](../6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md)
[Manage stored procedures](../6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md)
[Manage program packages](../6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md) | When you debug a PL object, you can set its parameters to DEFAULT, NULL, or a null string. | \ No newline at end of file diff --git a/en-US/3.odc-overview/1.what-is-oceanbase-developer-center.md b/en-US/3.odc-overview/1.what-is-oceanbase-developer-center.md new file mode 100644 index 00000000..47a63fd6 --- /dev/null +++ b/en-US/3.odc-overview/1.what-is-oceanbase-developer-center.md @@ -0,0 +1,7 @@ +What is ODC? +================================= + +OceanBase Developer Center (ODC) is an enterprise-class database development platform tailored for OceanBase. ODC is connected to MySQL and Oracle databases in OceanBase. ODC also provides database developers with various features, such as daily development operations, WebSQL, SQL diagnostics, session management, and data import and export. + +ODC adopts the mature browser/server architecture, which supports cross-platform capabilities and is lightweight and easy to deploy. ODC also provides a client version to help individual developers get started with OceanBase. It also improves the collaboration efficiency between developers and database administrators (DBAs). + diff --git a/en-US/3.odc-overview/2.benefits.md b/en-US/3.odc-overview/2.benefits.md new file mode 100644 index 00000000..66b60b11 --- /dev/null +++ b/en-US/3.odc-overview/2.benefits.md @@ -0,0 +1,100 @@ +Benefits +============================= + +OceanBase Developer Center (ODC) is an enterprise-class development platform for OceanBase Database. In ODC, you can edit and manage database objects and resources. + +Database object management +----------------------------------- + +* ODC provides instructions to help you create various database objects. In ODC, you can modify database objects in a visualized manner. + + + +* In addition, ODC provides the recycle bin feature for you to restore or clear deleted objects. + + + + + + +Enterprise-class partitioning feature +---------------------------------------------- + +* ODC supports all types of partitioning in OceanBase in the MySQL and Oracle modes. + + + +* ODC also provides user-friendly instructions on the entire partitioning process. This makes the partitioning feature easy to use. + + + + + + +Web console +-------------------- + +* The ODC console supports Data Definition Language (DDL), Data Manipulation Language (DML), and secure data update. + + + +* The ODC console supports Web SQL to help you use the various OceanBase features for development. + + + +* The ODC console provides user-friendly features, such as syntax highlighting, formatting, and smart tips, that suit the MySQL and Oracle modes of OceanBase. + + + +* The ODC console allows you to edit data in a visualized manner, which is similar to data editing in Excel. + + + + + + +Data import and export +------------------------------- + +* ODC provides data import and export features, which are designed for OceanBase. + + + +* ODC allows you to import and export files of various formats. + + + + + + +Database variable editing +---------------------------------- + +* ODC allows you to modify session variables and global variables in a visualized manner. + + + +* ODC makes variables easier to remember. + + + +* ODC increases the efficiency of customizing variables based on business scenarios. + + + + + + +Resource performance +----------------------------- + +* ODC allows you to manage and control database sessions in real time. You can also view and terminate sessions. + + + +* ODC provides the features of SQL execution plan analysis and SQL tuning. + + + + + diff --git a/en-US/3.odc-overview/3.product-architecture.md b/en-US/3.odc-overview/3.product-architecture.md new file mode 100644 index 00000000..de8a88f7 --- /dev/null +++ b/en-US/3.odc-overview/3.product-architecture.md @@ -0,0 +1,65 @@ +Architecture +================================= + +The architecture of OceanBase Developer Center (ODC) consists of three parts: + +* **Basic features** + + + +* **Core features** + + + +* **Advanced features** + + + + + + +The following figure shows the architecture of ODC. + +![Image 600](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0859620261/p269897.png) + +Basic features +----------------------- + +* User Management: This feature provides services such as account creation, system logon, and password modification. + + + +* Connection Management: This feature allows you to manage connections to OceanBase Database in MySQL and Oracle modes. You can create, save, copy, and delete database connections. + + + + + + +Core features +---------------------- + +* Object Management: This feature allows you to follow the instructions to create database objects, such as tables, views, functions, stored procedures, and sequences. This makes OceanBase Database easier to use. In addition, you can edit the online table data that you are currently viewing. + + + +* Console: In the console, you can save and edit the content in a SQL window and reuse the scripts that you have saved. You can also format SQL scripts and display structured SQL statements. The SQL editor supports auto-complete when you write SQL statements to save your effort. You can edit and export the result set returned from SQL execution. ODC V2.2.0 and later versions support PL and allow you to format, compile, run, and debug PL objects. + + + + + + +Advanced features +-------------------------- + +* Toolkit: This feature includes session management, recycle bin management, and import and export tools. Session Management: The session management tool enables you to edit database sessions and global properties and terminate specified database sessions. Recycle Bin Management: The recycle bin management tool allows you to empty and restore database objects in the recycle bin. Import and Export: The import and export tools enable you to import or export data of various formats in one or more tables. + + + +* SQL Diagnostics: This feature allows you to diagnose SQL execution plans and view resource consumption during SQL execution. It can help you locate problems in SQL scripts. + + + + + diff --git a/en-US/3.odc-overview/4.product-features.md b/en-US/3.odc-overview/4.product-features.md new file mode 100644 index 00000000..f0349d87 --- /dev/null +++ b/en-US/3.odc-overview/4.product-features.md @@ -0,0 +1,96 @@ +Features +============================= + +OceanBase Developer Center (ODC) is an enterprise-grade database development platform tailored for OceanBase Database. It supports both MySQL and Oracle modes of OceanBase Database and provides database developers with features such as database development, WebSQL-based workspace, SQL diagnostics, session management, and data import and export. + +Manage database connections +------------------------------------------------ + +ODC allows you to connect to database instances in MySQL or Oracle mode of OceanBase Database. After you enter the required information on the connection creation page of ODC, you can test the connection and save the connection configuration. ODC allows you to save the connections to multiple databases. + +On the homepage of ODC, the Connections section displays the connections that you created and saved. You can open, edit, copy, and delete a saved connection. + +![Image 173](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9846960461/p241285.png) + +Workspace +------------------------------ + +ODC provides a WebSQL-based workspace where you can edit and diagnose SQL and PL/SQL statements. + +* In the SQL window of the workspace, you can run and save your SQL scripts. + + + +* In the anonymous block window, you can edit, run, debug, and save anonymous blocks. + + + +* The workspace also provides diagnostics information, such as execution details and execution results, in the corresponding tabs. + + + +* You can also use the Snippets feature to search for and save the frequently used command code.![Image 174](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9846960461/p241286.png) + + + + + + +Create and manage database objects +------------------------------------------------------- + +Object creation and management is a common task in database development. In ODC, you can create and manage database objects such as tables, views, functions, stored procedures, sequences, triggers, types, and synonyms. + +In addition to object creation and management by using SQL statements, ODC provides a concise and clear visualized interface where you can create objects and manage their properties. + +![Image 175](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9846960461/p241287.png) + +Session management and properties +------------------------------------------------------ + +A session is a connection between an application and a database. On the Session Management tab, you can view the details about all sessions of a database. + +The Session Properties tab of ODC provides a visualized interface where you can view and modify the session variables and global variables that the current database supports. + +![Image 176](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9846960461/p241289.png) + +Data import and export +------------------------------------------- + +To make database maintenance easier, ODC supports importing and exporting a single table or multiple tables. You can export files in SQL and CSV formats and import SQL files and ZIP packages of files in SQL or CSV format. + +* ODC allows you to select multiple tables to import or export their data at a time. + + + +* You can also import or export the data of a single table. + +![Image 622.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E4%BA%A7%E5%93%81%E7%AE%80%E4%BB%8B-%E4%BA%A7%E5%93%81%E5%8A%9F%E8%83%BD-%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA-EN.png) + + + + + + + + +Command-line window +---------------------------------------- + +The OceanBase client (OBClient) is the recommended command-line client for OceanBase Database. + +As a graphical user interface (GUI) development tool for OceanBase Database, ODC integrates OBClient in the form of a command-line window. The command-line window allows you to use command lines to develop and manage database features without downloading and installing OBClient. + +You can execute SQL or PL/SQL statements and view the execution results in real time. You can also use the `SOURCE` command to run files uploaded to your servers. + +![Image 177](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9846960461/p241291.png) + +Data mocking +--------------------------------- + +ODC provides the data mocking feature that can generate data based on field types in a table. This can meet your requirement for a large amount of data during database performance tests or feature verification. + +ODC generates data based on the field types and rules that you specified in the Mock Data panel. + +![Image 178](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9846960461/p241293.png) + diff --git a/en-US/3.odc-overview/5.product-limits.md b/en-US/3.odc-overview/5.product-limits.md new file mode 100644 index 00000000..4b1e5330 --- /dev/null +++ b/en-US/3.odc-overview/5.product-limits.md @@ -0,0 +1,148 @@ +Limits +=========================== + +This topic describes the limits that you may encounter when you use features of OceanBase Developer Center (ODC) V2.2.0. + +Supported database versions +------------------------------------------------ + + + +| Database | Supported versions | +|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| OceanBase Database versions supported by ODC V3.2.0 |
  • OceanBase Database V1.4.x
  • OceanBase Database V2.0.x
  • OceanBase Database V2.1.x
  • OceanBase Database V2.2.x
  • OceanBase Database V3.1.x
  • OceanBase Database V3.2.x
  • OceanBase Database CE (PL-related feactures are not supported)
  • | + + + +The following table shows the OceanBase Database versions that support PL. + + +| Feature | Supported versions | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------| +| Compilation of PL objects (functions, stored procedures, and packages) Debugging of PL objects (functions and stored procedures) Debugging of anonymous blocks | V2.2.7, V3.0.0, and later | +| Execution of PL objects (functions, stored procedures, and packages) Execution of anonymous blocks | V2.0.x and later | + + + +Supported browser versions +----------------------------------------------- + +The following table lists browser versions supported by Web ODC. + + +| Browser | Supported versions | +|--------------------|----------------------------------------------------------------------------------------------| +| Supported browsers | Chrome 76 and later Firefox 60 and later Edge 79 and later | + + + +Recommended installation environment +--------------------------------------------------------- + +The following table describes the recommended environment for installing the ODC client. + + +| Environment | Requirements | +|-----------------------|-----------------------------------------------------------------------------------------------------------------| +| Operating system (OS) | Windows: Win 7/Win10 Mac: 10.13.6 (17G65) | +| Java environment | JDK 1.8.0_242 or later | +| Port number | Thanks to the dynamic port detection technology, you do not need to reserve port 8989 for ODC V2.3.0 and later. | +| CPU | 64-bit x86 processor, dual core or above | +| Memory | 4 GB or more | + + + +Account management +--------------------------------------- + +To change your account password in ODC, log on to ODC, find your username in the upper-right corner of the top navigation bar. + +Click the username and select **Change Password** . + +Database connection +---------------------------------------- + +* Oracle connections are designed to share one session. Whether you commit or roll back a transaction, or trigger a transaction either by creating, modifying, or deleting a database object, or by executing a DDL statement, the transaction takes effect on all windows. + + + +* In manual-commit mode, make sure to set `ob_trx_idle_timeout` to a value greater than the timeout value of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of `ob_trx_idle_timeout`, the connection will be terminated. However, if `ob_trx_idle_timeout` is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you need to set this parameter to a proper value. + + + + + + +Workspace +------------------------------ + +* The anonymous block window is available only in Oracle mode. + + + +* The debugging feature is unavailable when you use OBProxy to connect to an instance. Connect to the target instance directly in ODC. + + + +* You have installed the debugging packages such as DBMS_DEBUG and DBMS_OUTPUT in the connected database. + + + +* PL object debugging is supported only when OBServer V2.2.70, V3.0.00, or later is connected. Kernel debugging is supported only in an x86 architecture. + + + +* In ODC, multiple identical connections share one single session. In ODC V2.3.2 and above, automatic committing is disabled by default for the Oracle mode. You must manually commit transactions. You can modify the value of the autocommit parameter on the **Session Properties** page to change this setting. For more information, see [Session management](../7.client-odc-user-guide/9.client-odc-session-management.md). + + + + + + +Data import and export +------------------------------------------- + +* OceanBase V2.2.30 and later versions support the following character sets: UTF8, GBK, GB18030, and UTF16. Instances earlier than OceanBase V2.2.30 only support UTF8. + + + +* In ODC V2.2.0 and later, you can use the import and export feature when the target instance is directly connected to ODC or by using OBProxy. + + + +* The maximum size of data exported in one batch in Web ODC cannot exceed 2 GB before compression. To export data of a larger size, use the data export tool OBDUMPER. + + + +* The maximum size of files imported in one batch in Web ODC cannot exceed 2 GB after compression. To import data of a larger size, use the data import tool OBLOADER. + + + +* ODC allows you to run up to three import or export tasks in parallel. Subsequent tasks will wait in the queue. + + + +* In ODC V2.4.1 and later, you can use the sys tenant account to accelerate the import and export tasks. To export objects other than tables and views, you must configure the sys tenant account. + + + + + + +Database objects +------------------------------------- + +* Currently, you cannot modify indexes that are already created in a table. + + + +* You can only create sequence and package objects in Oracle mode. + + + +* The sys user has the read permission to view partition information. You need to set the sys user in Advanced Configuration during connection creation. + + + + + diff --git a/en-US/4.quickstart/1.quickstart-overview.md b/en-US/4.quickstart/1.quickstart-overview.md new file mode 100644 index 00000000..3260efb0 --- /dev/null +++ b/en-US/4.quickstart/1.quickstart-overview.md @@ -0,0 +1,23 @@ +Overview +============================= + +OceanBase Developer Center (ODC) is an enterprise-class database development platform tailored for OceanBase Database. This topic describes some basic operations for new users to quickly get started with ODC. + +To know how to use ODC, perform the following steps: + +1. [Install ODC](../7.client-odc-user-guide/1.client-odc-install-odc.md): You can manage your database from either the web-based ODC console or an ODC client. If you do not use an ODC client, skip the Install ODC topic. + + + +2. [Log on to ODC](../6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md): After you register an ODC account, enter the username and password to log on to ODC. + + + +3. [Create a connection](../6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md): After you log on to ODC, you need to create a connection for the target instance to access the management page of the target database instance. + + + + + + +After you finish the preceding steps, you can proceed to the development and management of your OceanBase Database instance in ODC. For more information about how to use ODC, see the User Guide of the corresponding version. diff --git a/en-US/4.quickstart/2.quickstart-install-odc.md b/en-US/4.quickstart/2.quickstart-install-odc.md new file mode 100644 index 00000000..b868f3c9 --- /dev/null +++ b/en-US/4.quickstart/2.quickstart-install-odc.md @@ -0,0 +1,49 @@ +Install ODC +================================ + +To manage your database, you can either access the web-based OceanBase Developer Center (ODC) console from OceanBase, or download the ODC client. Unlike the web-based ODC console that provides a logon portal, the ODC client uses a default user account for user identification. You just need to install the client and [create a connection](/zh-CN/6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md) to connect to your database. + +Recommended installation environment +--------------------------------------------- + + + +| Item | Requirement | +|-----------------------|-----------------------------------------------------------------------------------------------------------------| +| Operating system (OS) | Windows: Windows 7 or Windows 10 Mac: 10.13.6 (17G65) | +| Java environment | JDK 1.8.0_242 and later. | +| Port number | Thanks to the dynamic port detection technology, you do not need to reserve port 8989 for ODC V2.3.0 and later. | +| CPU | X86-64 processor with 2 or more cores. | +| Memory | 4GB or above. | + + + +Procedure +------------------ + +1. Download [ODC Client](https://help.aliyun.com/document_detail/212816.html). + + + +2. Double-click the installation file you downloaded to start the installation. + + + +3. The setup wizard prompts you to select an installation directory. + + + +4. When you run the client after installation, it checks the environment. If the environment does not meet the requirements, the client displays an error message, indicating that you can either continue using the application, or end the process to fix the problem of the environment. If ODC passes the environment check and operates normally, you can create a connection. + + + + + + > **Notice**
    + >
  • JRE installation packages for Mac and 64-bit Windows are included in the installation package of ODC V3.2.0. You can install it as needed.
  • + >
  • For more information about installation or startup failures, see [Installation of the ODC client](https://icms.alibaba-inc.com/content/oceanbase-developer-center/odc?l=1&m=71006&n=3113505) in FAQ.
  • + + + + + diff --git a/en-US/4.quickstart/3.quickstart-log-on-to-odc.md b/en-US/4.quickstart/3.quickstart-log-on-to-odc.md new file mode 100644 index 00000000..f3f243c6 --- /dev/null +++ b/en-US/4.quickstart/3.quickstart-log-on-to-odc.md @@ -0,0 +1,16 @@ +Log on to ODC with an account +================================================== + +During logon to OceanBase Developer Center (ODC), a user is identified by a logon account. The account is needed for subsequent operations such as configuring database connections and saving SQL scripts in the workspace. + +Go to the logon page of ODC, as shown in the following figure. Enter the registered account and password on the logon page and click **Log On** to go to the ODC homepage. + +![登录页面](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/ODC%20%E7%99%BB%E5%BD%95%E9%A1%B5-EN.png) + +The Connections page automatically appears. The current account is displayed in the upper-right corner of the top navigation bar. You can click the account name and select **Log Off** from the drop-down list to return to the logon page. Then, you can log on to ODC with another account. + +> **Note** +> * After ODC is deployed, you can use the IP address and port number, for example, http://IP:PORT or http://DOMAIN:PORT, of the host (where the NGINX proxy resides) to access Web ODC in a browser. +> * The default username and password can be obtained from the administrator. +> * For the administrator, the default username is admin, and the default password is aaAA 11__. +> * When you upgrade ODC to V3.2.0 or later and encounter user conflicts, you need to manually modify the original username. For more information, see FAQs ![phone](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5620319361/p367649.jpg) Web ODC startup. \ No newline at end of file diff --git a/en-US/4.quickstart/4.quickstart-create-a-personal-connection.md b/en-US/4.quickstart/4.quickstart-create-a-personal-connection.md new file mode 100644 index 00000000..ba770d17 --- /dev/null +++ b/en-US/4.quickstart/4.quickstart-create-a-personal-connection.md @@ -0,0 +1,71 @@ +Create a private connection +================================================ + + + + + +Overview +----------------------------- + +After you log on to the homepage of OceanBase Developer Center (ODC), you can click **Create Connection** in the upper-right corner of the **Private Connection** tab to create a private connection. + +After you create the connection, you can view the saved database connection in the connection list on the ODC homepage. + +> **Notice** +>
  • In ODC V2.3.0 and later, the root@sys user permissions are required to query views when you use the import and export features. Therefore, to use the import and export features, you need to set the root@sys user in the Advanced Configuration section during connection creation.
  • +>
  • In ODC since V2.4.1, the dependency of the import and export feature on the root@sys user is removed when you query views.
  • +>
  • However, the root@sys user permissions are still required to view the partition information. Therefore, you must set the root@sys user in the Advanced Configuration section during connection creation.
  • +>
  • The Oracle connection mode is designed to share sessions. In this mode, when you actively commit or roll back a transaction, or trigger a transaction commit or rollback by creating, modifying, or deleting a database object or by executing a DDL statement, the transaction commit or rollback takes effect in all windows. When you enter a connection in Oracle mode for the first time, a reminder is displayed.
  • +>
  • In manual-commit mode, make sure to set the `ob_trx_idle_timeout` parameter to a value greater than or equal to the timeout value of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of the `ob_trx_idle_timeout` parameter, the connection is terminated. However, if the `ob_trx_idle_timeout` parameter is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you must set this parameter to a proper value.
  • + + + + + + +Procedure +------------------------------ + +Perform the following steps to create a connection: + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/402/pravite%20connection-1-EN.png) + +1. Log on to ODC and click **Create Connection** in the upper-right corner of the **Private Connection** tab. + + + +2. In the Create Connection panel, specify the fields described in the following table. If you have an OceanBase connection string, which follows the mysql -h **host name** -P **port number** -u **database username@tenant name** # **cluster name** -D **default database** -p ' **database password** ' format, you can obtain the information from the string. You can also paste the string in the field of Intelligent Parsing on the panel to automatically populate the corresponding fields. + + + + + | Field | Description | + |-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Database Type | Select **Physical Database** or **Logical Database** . * Physical Database: regular databases. * Logical Database: ODP (Sharding). | + | Region | Select **Independent Deployment/Apsara Stack** if your database instance is deployed in your own environment, or select **Public Cloud** if your database instance is deployed on Alibaba Cloud. | + | Intelligent Parsing | You can paste a connection string to the field. ODC automatically identifies the string and fills in the corresponding fields on the page. | + | Connection Mode | Select **MySQL** or **Oracle** . Logical databases support only the MySQL mode. | + | Endpoint | * **Host IP** : the IP address of the server where the target database is located. * **Port** : the port number of the server where the target database is located. * **Cluster name** : the name of the cluster where the target database is located. This parameter is not required for logical databases. * **Rent name** : the name of the tenant in which the target database is located. This parameter is not required for logical databases. **Note** You can obtain the host name and port number from the details page of the tenant in which the target database is located, such as a tenant created on Alibaba Cloud or in OceanBase Cloud Platform (OCP). | + | Database Account | * Database Username: an account under the tenant. In MySQL mode, this account must have access to the default database. * Database Password: the password of the account under the tenant. You can click **Test Connection** next to the password field to check the connection to the target database. * Save Database Password * If you disable this option, the database password for the connection is not saved. Each time you use or test the connection, you must enter the database password in the password dialog box. * If you enable this option, the database password for the connection is saved. You do not need to enter the database password each time you use the connection. **Note** * An error will be returned if the configurations such as the username, password, and network settings are invalid. * You can only connect to a database in the current tenant. Otherwise, a test failure error will be returned. | + | Default Database/schema | When you connect to a database in a MySQL tenant, you must specify the default database for the connection. You do not need to specify this field when you connect to a database in an Oracle tenant. **Note** If you leave this parameter unspecified, the information_schema database is connected by default. However, if the connection to the information_schema database fails, you need to specify a database that the current user has access permissions. | + | SQL Query Timeout Value | You can specify a timeout value for SQL queries. A query whose execution time exceeds the timeout value is automatically terminated. The default timeout value is 60 seconds. | + | Query sys Tenant View | When Database Type is set to Physical Database, you can specify an account that has the privilege to query the SYS tenant view, and the password. This field is automatically populated when SYS is specified as the tenant in **Endpoint** . * **Account** : an account having the privilege to check the views under the SYS tenant. * **Password** : the password of the account. After you specify the account and password, click **Test Connection** next to the password field to verify whether the account information is valid. **Note** * In ODC V2.3.0 and later versions, to use the import and export features, you need to configure the root@sys account in the Advanced Configuration section during connection creation. * In ODC V2.4.1 and later versions, the dependency of the import and export features on the root@sys user is removed when you query views. If the root@sys account is not configured, some ODC objects such as stored procedures and functions do not support the export feature. If the root@sys account is configured, you can access the views under the SYS tenant to obtain the optimal data routing strategy, which can increase the export speed. | + + + +3. Click **Save** to save the current configuration in the ODC connection list. Next time you log on to ODC, you can directly select the connection from the list. The connection configuration does not necessarily need to pass the connection test when you save the configuration. + + + +4. Click **Copy Connection String** in the lower part of the panel to copy the connection information being edited on the current panel as a connection string if necessary. This allows you to obtain the connection information with ease. + + + +5. Click **Cancel** if you do not need to save the current connection configuration. Then, a confirmation dialog box appears. + + + + + + diff --git a/en-US/5.tutorials/1.tips-on-the-sql-console.md b/en-US/5.tutorials/1.tips-on-the-sql-console.md new file mode 100644 index 00000000..d8f522b1 --- /dev/null +++ b/en-US/5.tutorials/1.tips-on-the-sql-console.md @@ -0,0 +1,109 @@ +Tips on the SQL Console +============================================ + +This topic describes some tips on the SQL console in OceanBase Developer Center (ODC) for you to carry out development work more efficiently on ODC. + +Background information +------------------------------- + +ODC provides a web SQL-based SQL console as a work area where you can edit and diagnose SQL statements. In the SQL window, you can run and save perform operations such as running and saving SQL and PL scripts. The SQL window also provides diagnostic information such as execution details and execution results in the corresponding tabs. The editing area of the SQL window provides rich features, for example, highlighting of keywords in different colors, auto-complete, and formatting, to improve the SQL statement editing efficiency. Under the editing area, you can find the Execution Record tab and the Results tab. The Execution Record tab displays the execution details of each statement in the current connection. The Results tab displays the result of the current execution. + +This topic describes some additional tips that can facilitate your development and management work in the SQL console. + +Switch the transaction commit mode +------------------------------------------- + +In ODC V2.3.2 and later versions, auto-commit is turned off by default in Oracle mode, so you need to manually commit transactions. In MySQL mode, auto-commit is turned on by default. In manual-commit mode, make sure to set `ob_trx_idle_timeout` to a value greater than the timeout duration of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of `ob_trx_idle_timeout`, the connection will be terminated. + +You can switch the transaction commit mode in ODC. + +1. Click the name of the target connection to go to the connection management page, click the **Session** button in the navigation bar, and select **Session Properties** from the drop-down list. + + + +2. On the **Session Properties** page, select the `autocommit` variable in the variable list, and click the Edit button in the toolbar to go to the variable editing page. + + + +3. On the editing page, set **Value** to **ON** to turn on auto-commit or **OFF** to turn off auto-commit. + + + + + + +View the execution plan +-------------------------------- + +1. After you finish editing the required statements in the SQL window and before you execute the script, you can select a statement and click the **Plan** button in the toolbar. A panel appears, displaying an execution plan for the selected statement or the statement on which the pointer is located. This execution plan is estimated by the system before execution and is the result of the `EXPLAIN PLAN` operation. Therefore, the execution data displayed may differ from the actual execution data. You can use this feature to evaluate SQL statements. + + + +2. After a statement that you wrote in the editing area is executed, you can click the **Plan** button in the toolbar of the result set to view the actual resource consumption and execution plan of the statement. This allows you to evaluate the performance of the statement. + + + + + + +Save an SQL script +--------------------------- + +1. Edit your SQL script in the editing area of the SQL window. + + + +2. Click the **Save SQL** button in the toolbar of the SQL window, specify a name for the script in the dialog box that appears, and then click **OK** to save the script. + + + +3. Click the **Workspace** button in the navigation bar in the upper part of the page, and place the pointer on **Stored Scripts** on the drop-down list that appears, to view all the scripts that you saved on the cascading menu. + + + +4. On the cascading menu, the **Edit** and **Delete** buttons are provided after each script name. Click **Edit** . A dialog box appears and displays the script name and content. You can modify the script and click **OK** to save the modification. + + + +5. After you click a script name on the cascading menu, an SQL window appears and displays the script content. You can continue to edit the script and run the script in the SQL window. + + + + + + +Set the delimiter +-------------------------- + +ODC supports PL and allows you to edit PL statements in an SQL window starting from V2.2.0. You must set a delimiter before you edit PL statements. + +1. Click the **Settings** button in the toolbar of the SQL window. + + + +2. Select the sign that you want to use as the delimiter in the **Delimiter** box in the drop-down list. Five types of delimiters are supported: semi-colons ( **;** ), slashes ( **/** ), double slashes ( **//** ), dollar signs ( **$** ), and double dollar signs ( **$$** ). + + + +3. You can start to write PL statements after you set the delimiter. After you write a PL statement, end it with the selected delimiter. + + + + + + +In ODC V2.4.1 and later, you can use the `DELIMITER` statement to define the delimiter. In **Settings** , the **Delimiter** field displays the delimiter that you specified. + +Limit the number of lines in the query result +------------------------------------------------------ + +1. Click the **Settings** button in the toolbar of the SQL window. + + + +2. Specify **Query Result Limit** to set the maximum number of lines returned in the query result set. The default value is 1000 rows. + + + + + diff --git a/en-US/5.tutorials/2.create-a-conection.md b/en-US/5.tutorials/2.create-a-conection.md new file mode 100644 index 00000000..73db4e6f --- /dev/null +++ b/en-US/5.tutorials/2.create-a-conection.md @@ -0,0 +1,127 @@ +Create a connection +======================================== + +This topic describes how to create a database connection in OceanBase Developer Center (ODC). + +Background +------------------- + +As an enterprise-level database development platform tailored for OceanBase Database, ODC can connect to your OceanBase Database, and allow you to edit and manage the database objects and resources. After you install client ODC or deploy web ODC, you must create database connections. ODC can connect to OceanBase Database in MySQL and Oracle modes on Apsara Stack and Alibaba Cloud. + +Prerequisites +---------------------- + +* Client ODC has been installed or web ODC has been deployed. For the deployment of web ODC, contact your technical support personnel. For the installation of client ODC, see [Install ODC](https://www.oceanbase.com/docs/oceanbase-developer-center/odc/V3.1.1/install-odc-1). + + + +* If you are using web ODC, you have logged to ODC and entered the connection management page. For more information, see [Log on to the database](t1909443.md#task397). + + + +* The connection information or connection string of the target instance has been obtained. The connection string of the example connection in this topic is as follows: + + ```unknow + -h100.0.0.0 -P8080 -uodc@oracle_tenant#odc_cluster -Dodc -p'Password01' + ``` + + + + + + +Procedure +------------------ + +1. On the **Connections** tab of the ODC homepage, click **Create Connection** go to the Create Connection panel. + + + +2. Specify **Region** for the connection. The region is where the connected instance is located. The following options are available: + + * **Public Cloud** : the database instance deployed on Alibaba Cloud. + + * **Independent Deployment/Apsara Stack** : the database instance in your own environment. In this example, select Apsara Stack. + + + + +3. Specify **Connection Mode** . + + OceanBase Database supports instances in MySQL and Oracle modes. In this example, Oracle is selected because the sample instance in this topic is in Oracle mode. + + +4. Specify **Connection Name** . + + The connection name uniquely identifies the connection. You need to specify a unique connection name. The sample connection is named Connection_Tutorial. + + +5. Use intelligent DNS resolution. + + If you have the connection string of the connected instance, you can paste the connection string to the Intelligent DNS Resolution field. After you click **Intelligent DNS Resolution** , ODC automatically resolves the string and specifies the parameters such as **Endpoint** , **Default Database** , **Database Username** , and **Database Password** . If you do not have the connection string, you can skip this step and start from Step 6 to manually enter the preceding information. + + +6. Specify **Endpoint** . + + The endpoint contains the following information: + * **Host Name** : the IP address of the server where the target instance is located. If your instance is located on Alibaba Cloud, you can get the host name from the tenant information page of the Alibaba Cloud Management Console. The IP address of the sample instance is 100.0.0.0. + + + + * **Port** : the port number of the server where the target instance is located. If your instance is on Alibaba Cloud, you can get the port number from the tenant information page of the Alibaba Cloud Management Console. The port number of the sample instance is 8080. + + + + * **Cluster** : the name of the cluster where the target instance is located. In this example, the cluster name is odc_cluster. + + + + * **Tenant** : the name of the tenant to which the target instance belongs. The tenant name of the sample instance is oracle_tenant. + + + + + + +7. Specify **Default Database** . + + When you connect ODC to a database in a MySQL tenant, you can choose to specify a default database for the connection. This parameter does not need to be specified when you connect ODC to a database in an Oracle tenant. This parameter is optional. If you do not set this parameter, the default database instance information_schema is used. + + +8. Specify **Database Username** . + + The database username is the name of a user created in a tenant. In Oracle mode, the username is the same as the schema name. In MySQL mode, the corresponding user of the username must access to the default database. The database username of the sample instance is odc. + + +9. Specify **Database Password** . + + Specify the password corresponding to the database username specified in Step 8. The database password of the sample instance is Password01. + + +10. Click **Test Connection** . + + After you specify **Database Password** , you can click **Test Connection** to check whether ODC is connected to the target instance based on the preceding connection information. The connection status does not affect the saving of the connection information. + + +11. Specify whether to disable **Save Database Password** . + + If you disable this option, the database password for the connection is not saved. Each time you use or test a connection, you must enter the database password in the password dialog box to use the connection. If you enable this option, the database password for the connection is saved. You do not need to enter the database password each time you use the connection. + + +12. Specify **SQL Query Timeout Value** in **Advanced Configuration** . + + ODC allows you to specify a custom SQL query timeout value, which is 60s by default. When the execution time of a query reaches the specified value, the query automatically terminates. In ODC V2.3.2 and later, transactions need to be manually committed. In earlier versions, transactions are automatically committed. In manual commit mode, the value of the `ob_trx_idle_timeout` variable cannot be less than the SQL query timeout value. If two SQL queries in one transaction are executed at an interval exceeding the value of `ob_trx_idle_timeout`, the connection will be terminated. However, if `ob_trx_idle_timeout` is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you need to set this parameter to a proper value. + + +13. Specify **Query SYS Tenant View** in **Advanced Configuration** . + + You can specify the account that have the permission to query views of the sys tenant and the corresponding password. In ODC V2.3.0 and later versions, to use the import and export features and check the partition information, you need to configure the root@sys account, that is, the root account under the sys tenant, by using this option. By default, the password for the root@sys account of the sample instance is null, so you only need to set **Account** to root. After you specify Account, you can click **Test Connection** to test whether you can use the root@sys account to access the current database. + + +14. Click **Save** to save the connection information. + + After you configure all the preceding connection information, click **Save** in the lower-right corner to save the settings in the current **Create Connection** page. Then, the information appears on the **Connections** tab of the ODC homepage. You can directly find the target connection on the **Connections** tab and click the name of the connection to enter the connected instance in the future. + + + + diff --git a/en-US/5.tutorials/3.tutorials-export.md b/en-US/5.tutorials/3.tutorials-export.md new file mode 100644 index 00000000..011f62da --- /dev/null +++ b/en-US/5.tutorials/3.tutorials-export.md @@ -0,0 +1,137 @@ +Export data +================================ + +This topic describes how to export data in batches in OceanBase Developer Center (ODC). + +Background information +------------------------------------------- + +ODC provides the batch import and export features and the table import and export features, to facilitate database data maintenance for database developers. The import and export features allow you to import data or schema to or export them from database objects. ODC supports the CSV format and SQL format for data export, and supports ZIP files, SQL files, and CSV files for data import. SQL files can be imported in batches, and CSV files are supported in single table import. + +After you create an import or export task, you can go to the Tasks page to download the exported file and view the task details and logs. + +This topic takes batch export as an example to describe how to export data in ODC. + +Prerequisites +---------------------------------- + +* The character set is supported. OceanBase Database V2.2.30 and later versions support the following character sets: UTF-8, GBK, GB18030, and UTF-16. OceanBase Database of a version earlier than V2.2.30 supports only UTF-8. Exported files of ODC are encoded by using UTF-8, which cannot be changed. + + + +* The connection method is supported. In ODC V2.2.1 and earlier versions, to use the import and export features, you must connect ODC to the target instance through OBProxy. If you directly connect ODC to the target instance, the import and export features are unavailable. + + + +* The root@sys account has been configured. In ODC V2.4.1 and later versions, you can optionally configure a sys tenant account to accelerate the execution of export and import tasks. If you are exporting objects other than tables and views, the sys tenant account must be configured. + + + + + + +Procedure +------------------------------ + +1. Go to the **Export Settings** panel. + + After you enter the connection, click **Tool** in the navigation bar on the top of the page, and click **Export** in the drop-down list. Then, the **Export Settings** panel appears on the right. + + +2. Specify **Task Name** . + + The Export Settings panel displays the default task name automatically generated by ODC in the format of connection name_mode name_date. You can change it to a custom task name. + + +3. Specify **Export Content** . + + ODC supports three export modes: **Export Schema and Data** , **Export Data Only** , and **Export Schema Only** . + + Export Schema Only exports the definition statements of the target object and generates an SQL file suffixed with .sql. Export Data Only exports the actual data stored in the object. The file format of exported data varies depending on the value of **Export Format** . In this example, the Export Content is **Export Schema and Data** . + + +4. Specify **Data Format** . + + ODC supports exporting data to the **CSV Format** or **SQL Format** . If the **Export Content** is **Export Schema Only** , you do not need to specify the data format. For more information about formats, see [Export and import formats](../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). In this example, the Data Format is **CSV Format** . + + +5. Specify **Encoding Standard** . + + ODC supports the following encoding standards: **ASCII** , **ISO-8859-1** , **GB2312** , **GBK** , **GB1803** **0** , **Unicode (UTF-8)** , **Unicode (UTF-16)** , **Unicode (UTF-32)** , and **BIG5** . You need to select an encoding standard from the **Encoding Standard** drop-down list. + + +6. Specify **Export Objects** . + + In the **Export Objects** table, select the objects you want to export. The table displays information on the **Object Name** and **Object Type** . You can filter objects by **Object Type** or search for target objects in the search box. You can select a batch of or all objects in the table. You can also filter objects by object type. The maximum size of data exported in one batch in ODC cannot exceed 250 MB before compression. Therefore, if the size of the data in the selected objects exceeds 250 MB, the data in the generated data file will be incomplete. + + +7. Specify **Export Data Settings** . + + If the **Export Content** is Export Schema Only, you do not need to configure data export settings. The following options are included: + * **Use Global Snapshot** : If you select this option, ODC exports the data in the latest global snapshot of the specified table to ensure global data consistency. + + + + * **Batch Commit Quantity** : You can click **Advanced Settings** next to **Export Data Settings** to specify this option. If the **Data Format** is SQL format, you can specify this option to add a `COMMIT` command to the exported file after a certain number of rows is exported. + + + + * **Skipped Data Types** : You can click **Advanced Settings** next to **Export Data Settings** to specify this option. This option decides the data types to be skipped when exporting data. The data types that can be skipped are different in MySQL and Oracle modes. You can select multiple data types. + + + + + + +8. Specify information for the CSV format. + + If you select the CSV format for **Data Format** in Step 4, you need to specify the information for the CSV format. Click **Advanced Settings** next to **Export Data Settings** to specify the following information: + * **Include Column Header** : This option is selected by default. It determines whether to include column headers when the export format is CSV format. + + + + * **Convert Empty String to Null Value** : This option is selected by default. It specifies whether to convert empty strings in the table to `NULL` values when the export format is CSV format. + + + + * **Field Delimiter** : This option specifies the delimiter between fields. The following delimiter characters are supported: commas ( **,** ), Semicolons ( **;** ), and colons ( **:** ). You can also specify another deliminter that is one character long. + + + + * **Text Identifier** : This option specifies the identifier for text content. Single quotation marks ( **'** ) and double quotation marks ( **"** ) are supported. + + + + * **Line Break Character** : The option specifies the line break character. The following characters are supported: **\\n** , **\\r** , and **\\r\\n** . + + + + + + +9. Specify **Export Schema Settings** . + + This option specifies whether to **Add DROP Statement** . If you select this option, a `DROP` statement is added before the corresponding `CREATE` statement for the object. + + +10. Configure **Sys Tenant Account** . + + You can specify whether to **use the sys tenant account to accelerate data export** . If you select this option, you need to enter the sys account and password in **Account** and **Password** fields that appear. After you specify this option, data export will be performed with the permissions of the sys tenant, which accelerates the execution of the export task. If you are exporting objects other than tables and views, the sys tenant account must be configured. + **Notice** + + + + OceanBase Database of a version earlier than V2.2.30 supports only UTF-8. + + In ODC V2.2.1 and earlier versions, to use the import and export features, you must connect ODC to the target instance through OBProxy. If you directly connect ODC to the target instance, the import and export features are unavailable. + + In ODC V2.4.1 and later versions, you can optionally configure a sys tenant account to accelerate the execution of export and import tasks. If you are exporting objects other than tables and views, the sys tenant account must be configured. + + +11. Generate an export task. + + After you select all the objects that you want to export, you can click **Export** in the lower-right corner of the panel to generate an export task. After the task is generated, the Tasks page automatically appears, where you can view the running status of the export task. After the task is completed, you can download the exported data file and view the task details and logs. + + + + diff --git a/en-US/5.tutorials/4.tutorials-import.md b/en-US/5.tutorials/4.tutorials-import.md new file mode 100644 index 00000000..3719d829 --- /dev/null +++ b/en-US/5.tutorials/4.tutorials-import.md @@ -0,0 +1,112 @@ +Import data +================================ + +This topic describes how to import data in batches in OceanBase Developer Center (ODC). + +Background information +------------------------------------------- + +ODC provides the database import and export features and the single table import and export features to facilitate database data maintenance for database developers. The database import and export features allow you to import data to or export data or schemas from selected objects in the database in batches. The single table import and export features allow you to import data to or export data from the target table. ODC supports exporting data in CSV and SQL formats and importing ZIP, SQL (batch import), and CSV (single table import) files. + +After you create an import or export task, you can go to the Task Center to download the exported files and view the task details and logs. + +This topic takes batch import as an example to describe how to import data in ODC. + +Prerequisites +---------------------------------- + +* The character set is supported. OceanBase Database V2.2.30 and later versions support the following character sets: UTF8, GBK, GB18030, and UTF16. OceanBase Database of a version earlier than V2.2.30 supports only UTF8. Exported files of ODC are encoded by using UTF-8, which cannot be changed. + + + +* The connection method is supported. In ODC V2.2.1 and earlier versions, to use the import and export features, you must connect ODC to the target instance through OBProxy. If you directly connect ODC to the target instance, the import and export features are unavailable. + + + +* The root@sys account has been configured. In ODC V2.4.1 and later, you can use the sys tenant account to accelerate the import and export tasks. To export objects other than tables and views, you must configure the sys tenant account. + + + + + + +Procedure +------------------------------ + +1. Go to the **Batch Import** panel. + + After you enter the connection, click **Tool** in the navigation bar in the upper part of the page, and then click **Import** in the drop-down list. The **Batch Import** panel appears on the right. + + +2. Specify **Task Name** . + + The Batch Import panel displays the default task name automatically generated by ODC in the format of connection name_mode name_date. You can change it to a custom task name. + + +3. Specify **Import** **Format** . + + ODC supports importing ZIP, SQL (batch import), and CSV (single table import) files. The SQL and CSV format are specific to the import and export tools of OceanBase Database. For more information about formats, see [Export and import formats](../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). In this topic, **ZIP Files** are used as an example. + + +4. Upload the file to be imported. + + Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. The format of the uploaded file must be the same as that of the value you specified for Import Format. To upload a file in the ZIP file format, you must first package it into a .zip file. SQL files to be uploaded can be suffixed with .sql. The format of the uploaded file must be the same as that of the value you specified for **Import Format** in Step 3. + + +5. Specify **Encoding Standard** . + + ODC supports the following encoding formats: **ASCII** , **ISO-8859-1** , **GB2312** , **GBK** , **GB1803** **0** , **Unicode (UTF-8)** , **Unicode (UTF-16)** , **Unicode (UTF-32)** and **BIG5** . You need to select the encoding standard from the drop-down list of **Encoding Standard** . + + +6. Specify **Import Content** . + + ODC supports three import modes: **Import Schema and Data** , **Import Data Only** , and **Import Schema Only** **.** + + You must specify this item when you select ZIP for **Import Format** . Import Schema Only runs the object definition statement in the imported file. After the file is imported, a new object will be created in the database. Import Data Only imports the data in the data file into the specified object. In this topic, the **Import Schema and Data** mode is used as an example. + + +7. Specify **Data Format** . + + You must specify this item when you select ZIP for **Import Format** . ODC only support importing data in **CSV format** and **SQL format** . For more information about formats, see [Export and import formats](../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). This topic uses the **CSV format** as an example. + + +8. Specify **Import Data Settings** . + + If you specify ZIP files for **Import Format** and Import Schema Only for **Import Content** , this step is not required. You need to specify the following fields: + * **Clear Data Before Import** : If you select this option, the original data in the destination object is cleared during data import. + + + + * **Batch Commit Quantity** : You can click **Advanced Settings** next to **Import Data Settings** to specify this field. When you specify this field, you specify the number of rows to be committed during the data import from the source files to the database. When this number is reached, a `COMMIT` command is executed. + + + + * **Skipped Data Types** : You can click **Advanced Settings** next to **Import Data Settings** to specify this field. Here, you can specify the data types that you want to skip when you import the data. The data types that can be skipped are different in MySQL and Oracle modes. You can select multiple data types. + + + + + + +9. Specify **Import Schema Settings** . + + You cannot specify this field if you select Import Data Only for **Import Content** . This field involves operations on schemas that already exist. If you select **Skip** , the system skips the schema definition statement in the file to be imported and directly imports the data. The original data in the object is retained. If you select **Replace** , the system executes the schema definition statement in the file to be imported to recreate an object and replace the original one. Data in the original object is cleared. + + +10. Specify **Task Error Handling Method** . + + ODC supports two error handling methods: **Abort Task** and **Ignore Error and Continue** . You need to specify the handling method in **Task Error Handling Method** . + + +11. Specify **Sys Tenant Account** . + + Select whether to **use the sys tenant account to accelerate data import** . If you select this option, you need to enter the sys account and the password in the **Account** and **Password** fields. Then, you can use privileges of this account to import data, which accelerates the import task. + + +12. Create the import task. + + Click **Import** in the lower-right corner of the panel to generate the import task. After the task is generated, the Task Center page appears, where you can view the task status. After the task is completed, you can view the task details and logs. + + + + diff --git a/en-US/5.tutorials/5.tutorials-debug.md b/en-US/5.tutorials/5.tutorials-debug.md new file mode 100644 index 00000000..1669f973 --- /dev/null +++ b/en-US/5.tutorials/5.tutorials-debug.md @@ -0,0 +1,151 @@ +Debug a stored procedure +============================================= + +This topic describes how to debug a stored procedure in OceanBase Developer Center (ODC). + +Background +------------------- + +PL program development is important daily work for database service developers. Like the support module for SQL statements, the PL debugging module is also of great significance. Therefore, developers require a PL development area and a debugging feature during programming. + +ODC V2.2.0 and later support the creation, compilation, running, and debugging of PL objects and anonymous blocks. In the editing area of the anonymous block window, you can compile PL/SQL statements, and edit and debug the created PL objects. ODC provides features such as Batch Execute, Step Over, Step Into, Step Out, Abort Debugging, Debug Again, and Exit Debugging for debugging PL objects. ODC also displays debugging information in tabs such as **Parameters** , **Stacks and Variables** , **DBMS Output** , **Breakpoints** , and **Debugging Logs** . + +Prerequisites +---------------------- + +* The database is OceanBase Database V2.2.73 or later in Oracle mode. + + + +* ODC V3.2.2 or earlier does not support the debugging feature when you connect ODC to the target instance by using OBProxy. To use the debugging feature, directly connect ODC to the target instance. + + + +* ODC V3.2.2 and later support PL/SQL debugging when you connect to OBServer by using OBProxy. + + + +* You have installed the debugging packages such as DBMS_DEBUG and DBMS_OUTPUT in the connected database. + + + +* You have created a sample stored procedure named procedure_test by using the following sample script: + + ```javascript + CREATE OR REPLACE PROCEDURE procedure_test + ( + A IN NUMBER, + B IN NUMBER, + C OUT NUMBER + ) IS + BEGIN + C:= A + B; + dbms_output.put_line ( C / 2 ) ; + END procedure_test; + ``` + + + + + + +Procedure +------------------ + +The result of procedure_test is the value obtained by dividing the value of output parameter C by 2. The value of parameter C is equal to the sum of values of parameter A and parameter B. Therefore, you cannot directly learn the value of parameter C from the output result of the program. You can view and verify the actual value of parameter C during program running by debugging procedure_test. + +1. Enter the debugging mode. + + After you enter the connection, find the target stored procedure procedure_test in the stored procedure list in the left-side navigation pane. Then, right-click procedure_test and click **Debug** in the shortcut menu to start debugging. You can also click **Edit** in the shortcut menu to go to the object editing page, and then click the debug icon ![debug](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2867570461/p377711.jpg) in the toolbar to start debugging. + + +2. Set parameters. + + procedure_test has three parameters: input parameters A and B, and output parameter C. + 1. If the input parameters already exist, you need to set the values of the input parameters first before debugging. When you start the debugging, ODC will first display the **Set Parameters** page for you to set values of the input parameters. In this example, the value of parameter A is set to 2 and the value of parameter B is set to 4. + + + + 2. After you set the values, click **OK** . + + ![Image 223](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2867570461/p242630.png) + + + + + +3. Go to the debugging page. + + The debugging page appears after you set the parameters. + + The **Parameters** tab below the editing area of the debugging page displays the definition information of all the parameters configured for the program. The definition information includes the parameter name, mode, and type. The values of the parameters may change accordingly in the debugging process. + + ODC provides the following buttons in the toolbar of the debugging page: + * **Batch Execute** : Click this button to execute the statements till the next breakpoint or the end if no breakpoint exists. + + + + * **Step Over** : Click this button to step over a given line without stepping into any subprogram. + + + + * **Step Into** : Click this button to step into the called subprogram if the current line calls a defined stored procedure or function. + + + + * **Step Out** : For a subprogram, you can click this button to return to the next line of the upper-layer call position. For the main program, this button achieves the same effect as **Auto Debugging** . + + + + * **Abort Debugging** : Click this button to execute the stored procedure till the end and skip breakpoints. + + + + + + +4. Set breakpoints. + + A breakpoint allows the program to stop at the specified position during execution, to facilitate program analysis. You can set a breakpoint in ODC by clicking a line number in the editing area: + 1. In the sample program, click the line number of the `dbms_output.put_line ( C / 2 );` statement in the ninth line to set a breakpoint. + + + + 2. The **Breakpoints** tab below the editing area displays information such as the PL/SQL **Object Name** and **Line Number** of all breakpoints set in the program. You are also allowed to **Cancel** and **View** breakpoints. + + > **Note** + > The kernel does not support setting breakpoints in comment lines or keywords such as BEGIN and END. + + + + + +5. Start the debugging. + + After you set the breakpoints, click the batch execute icon![调试-批量执行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2867570461/p377714.jpg)in the toolbar to start the debugging. The debugging will stop at the breakpoints. You can also click the step over icon![调试-单步执行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2867570461/p377715.jpg)to execute the program statements step by step. One step is executed when you click this icon once. + + +6. View the debugging information. + + The program now stops at the ninth line. You can view the variables on the current stack and their values on the **Stacks and Variables** tab below the editing area. The program stops at the ninth line because of the breakpoint. So, on the **Stacks and Variables** tab, you can find that the value of variable C is 6. You can also view the records and error logs of actions such as starting debugging, aborting debugging, adding breakpoints, and canceling breakpoints on the **Debugging Logs** tab. + + +7. Abort the debugging. + + Click the abort debugging icon![调试-终止调试](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2867570461/p377717.jpg)in the toolbar. The program will continue to run till the end and skip subsequent breakpoints. + + The program contains the PL/SQL output statement `dbms_output.put_line`. Therefore, when the program ends, the **DBMS Output** tab below the editing area displays the value obtained by dividing the value of parameter C by 2. The value now displayed on the tab is 3, indicating that no error has occurred during the running of the program. + + +8. Debug again. + + After the program running ends, you can click **Debug Again** in the toolbar to debug the current object again. The information and breakpoints of the previous debugging will be cleared. You can reset parameters and start a new round of debugging. + + +9. Exit the debugging. + + After you finish the program analysis based on the debugging, you can click **Exit Debugging** in the toolbar to exit the debugging page. + + + + diff --git a/en-US/5.tutorials/6.tutorials-view-sql-performance.md b/en-US/5.tutorials/6.tutorials-view-sql-performance.md new file mode 100644 index 00000000..c6c314d2 --- /dev/null +++ b/en-US/5.tutorials/6.tutorials-view-sql-performance.md @@ -0,0 +1,118 @@ +View the performance of an SQL statement +============================================================= + +This topic describes how to view the performance of an SQL statement in OceanBase Developer Center (ODC). + +Background information +------------------------------- + +SQL is a database language that provides multiple features such as data manipulation and data definition. Most database developers manage and develop database content by using SQL statements. Therefore, the performance of SQL statements affects the performance of the database. SQL provides the `EXPLAIN` command, which allows you to view the specific steps for executing an SQL statement in the database. You can judge and improve the performance of the SQL statement based on the execution steps. + +As a powerful enterprise-level database development platform, ODC provides a graphical user interface (GUI) for you to view the execution plans of SQL statements. ODC allows you to directly and conveniently view the execution status and analyze the performance of SQL statements. + +Prerequisites +---------------------- + +A sample table named "employees" has been created by running the following statement: + +```javascript +CREATE TABLE employees( + emp_id INTEGER, + emp_name VARCHAR(20), + manager_id INTEGER +); + +INSERT INTO employees VALUES ( 1, 'Anna', 6 ) ; +INSERT INTO employees VALUES ( 2, 'Brain', 4 ) ; +INSERT INTO employees VALUES ( 3, 'Candy', 4 ) ; +INSERT INTO employees VALUES ( 4, 'David', 5 ) ; +INSERT INTO employees VALUES ( 5, 'Eva', NULL) ; +INSERT INTO employees VALUES ( 6, 'Frank', 5 ) ; +INSERT INTO employees VALUES ( 7, 'Gary', 6 ) ; +``` + + + +Procedure +------------------ + +1. After you enter the connection, enter the following `SELECT` statement in the editing area of the SQL window to view the data in the table named "employees": + + ```javascript + SELECT * FROM employees; + ``` + + + + + + + + +2. Click **Plan** in the toolbar in the editing area. + + Before you run the statements, you can click **Plan** to view the estimated execution plan of the SQL statement selected or where the cursor is located in the current editing area. The estimated execution plan is actually the result of the `EXPLAIN PLAN` operation. The estimated plan may be slightly different from the actual plan, but you can assess the SQL statement in advance. + + +3. In the **Plan Details** panel, view the estimated execution plan before you execute the SQL statement. + + The **Planned Statistics Collection** tab in the **Plan Details** panel displays following information: + + + + + + + +4. Run the statement. + + Click **Run** in the toolbar to execute the `SELECT` statement. + + +5. Click **Plan** in the toolbar of the result set, to view the execution plan after the statement is executed. + + The **Execution Details** page displays the actual execution plan. + + +6. View the basic information of the statement in the **Basic Info** section of the **Execution Details** panel. + + The **Basic Info** section displays the following information: + + + + + + + +7. View the time statistics of the statement in the **Time Spent** section of the **Execution Details** panel. + + The **Time Spent** section displays the following information and corresponding proportions in a bar graph. + + + + + + + +8. View the I/O statistics of the statement in the **I/O Statistics** section of the **Execution Details** panel. + + The **I/O Statistics** section displays the following information: + + + + + + + +9. View the plan statistics of the statement on the **Planned Statistics Collection** tab of the **Execution Details** panel. + + The **Planned Statistics Collection** tab displays the actual execution plan in a structured manner. This tab is the same as the **Plan Details** tab in structure. For more information about this tab, see the information about the **Planned Statistics Collection** tab in Step 3. + + +10. View the outline of the statement in the **Outline** section of the **Execution Details** panel. + + The **Outline** section displays the corresponding content of `OUTLINE DATA` in results returned by the execution plan. The content in this section is a set of hints generated by the optimizer for the purpose of fully reproduce a plan. + + + + diff --git a/en-US/6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md b/en-US/6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md new file mode 100644 index 00000000..4f6f178e --- /dev/null +++ b/en-US/6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md @@ -0,0 +1,15 @@ +Log on to ODC with an account +================================================== + +During logon to OceanBase Developer Center (ODC), a user is identified by a logon account. The account is needed for subsequent operations such as configuring database connections and saving SQL scripts in the workspace. + +Go to the logon page of ODC, as shown in the following figure. Enter the registered account, password and verification code on the logon page and click **Log On** to go to the ODC homepage. + +![logon](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/ODC%20%E7%99%BB%E5%BD%95%E9%A1%B5-EN.png) + +The Connections page automatically appears. The current account is displayed in the upper-right corner of the top navigation bar. You can click the account name and select **Log Off** from the drop-down list to return to the logon page. Then, you can log on to ODC with another account. + +> **Note** +> * After ODC is deployed, you can use the IP address and port number, for example, http://IP:PORT or http://DOMAIN:PORT, of the host (where the NGINX proxy resides) to access Web ODC in a browser. +> * The default username and password can be obtained from the administrator. +> * When you upgrade ODC to V3.2.0 or later and encounter user conflicts, you need to manually modify the original username. For more information, see FAQs > Web ODC startup. \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/1.log-on-to-odc/2.change-password.md b/en-US/6.web-odc-user-guide/1.log-on-to-odc/2.change-password.md new file mode 100644 index 00000000..9404c4bc --- /dev/null +++ b/en-US/6.web-odc-user-guide/1.log-on-to-odc/2.change-password.md @@ -0,0 +1,38 @@ +Change the password +======================================== + + + +1. After you log on to Web OceanBase Developer Center (ODC), you can click the username in the upper-right corner of the top navigation bar, and select **Change Password** from the drop-down list. + + ![Change the password](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0674823561/p360961.png) + + +2. In the **Change Password** dialog box, specify the following fields to change the password: + + ![Change Password dialog box](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9574823561/p360965.png) + + * **Original Password** : enter the original password of the account. + + + + * **New Password** : set a new password. + + + + * **Confirm Password** : enter the new password again for verification. + + + + + + +3. After you specify the preceding fields, click **OK** . + + + + + + + + diff --git a/en-US/6.web-odc-user-guide/10.web-odc-session-management.md b/en-US/6.web-odc-user-guide/10.web-odc-session-management.md new file mode 100644 index 00000000..f0fc9858 --- /dev/null +++ b/en-US/6.web-odc-user-guide/10.web-odc-session-management.md @@ -0,0 +1,80 @@ +Session management +======================================= + +A session is a connection between an application and a database. On the Session Management page of OceanBase Developer Center (ODC), you can view the details of all the sessions connected to the current database. The Session Properties page of ODC provides a graphical interface where you can view and modify the session variables and global variables that the current database supports. + +After you enter a database connection in ODC, click **Session** in the top navigation bar and then choose **Session properties** or **Session management** to go to the corresponding page. + +![Image 186](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86-1-EN.png) + +Session properties +--------------------------------------- + +![Session management 2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7729169361/p203464.png) + +The session properties are database variables. OceanBase Database provides two types of variables: session variables and global variables. + +* **Session variables** : When a client connects to a database, the database copies the global variables to automatically generate session variables. The modification of session variables takes effect on the current session only. + +* **Global variables** : Global variables are shared by all the instances of a database. These variables are shared among different users. When you modify a global variable, the database saves the modification, which remains valid after you disconnect from and reconnects to the database. + + + +> **Note**
    +>
  • The current ODC version does not allow you to edit global variables. You can modify session variables.
  • +>
  • In ODC, multiple identical connections share one single session. In ODC V2.3.2 and later versions, auto-commit is turned off by default in Oracle mode, so you need to manually commit transactions. You can modify the value of the autocommit parameter to change this setting.
  • +>
  • In manual-commit mode, make sure to set ob_trx_idle_timeout to a value greater than the timeout duration of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of ob_trx_idle_timeout, the connection will be terminated. However, if ob_trx_idle_timeout is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you need to set this parameter to a proper value.
  • + + + + + + +ODC provides a graphical interface where you can view and modify the variables that the current database supports. Take note of the following items related to the modification of variables: + +* In the current ODC version, session variables have two modes: display mode and edit mode. To modify a variable, select the variable and click Edit in the toolbar to go to the editing page. After you edit a variable, click **OK** . On the SQL Confirmation page, click **Execute** to apply the modification. + + + +* To modify a variable of a character or numeric type, you can directly enter the new value on the Edit page. + + + +* To modify a variable of an enumeration type, ODC lists the values that the variable supports in the edit box. This allows you to modify the variable in a graphical interface without having to memorize its name or value, which saves your memorization efforts and increases the efficiency of variable modification. + + + + + + +Session management +--------------------------------------- + +A session is a connection between an application and a database. On the Session Management page, you can view all the sessions connected to the current database and the following session information: + + +| Information | Description | +|--------------------|---------------------------------------------------------------------| +| Session ID | The ID that uniquely identifies the current session. | +| User | The username used to log on to the database in the current session. | +| Source | The address from which the session is initiated. | +| Database name | The name of the database accessed in the session. | +| Status | The state of the session. Valid values: **SLEEP** and **ACTIVE** . | +| Command | The type of the command being executed in the session. | +| Execution Time (s) | The time in seconds spent on executing the current SQL query. | +| SQL | The actual SQL query being executed in the session. | +| OBProxy | The address of the proxy used for the session. | + + +![Manage sessions](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7729169361/p203463.png) + +The Session Management page provides the following buttons in the navigation bar for you to manage sessions. + +* **Refresh** : Click this button to refresh the session list. + +* **Close Session** : Click this button to terminate the current session. + +* **Close current query processes of the session** : Click this button to terminate the ongoing SQL execution processes in the session. + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-table-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-table-objects-overview.md new file mode 100644 index 00000000..c1a26429 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-table-objects-overview.md @@ -0,0 +1,262 @@ +# Create a table + + + +## Overview + +A table is a data structure in a database and stores data in rows and columns. + +![Create a table](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%A6%82%E8%BF%B0-EN.png) + +As shown in the preceding figure, you can create a table in the following seven steps: + +1. Specify the basic information. + + + +2. Set columns. + + + +3. Set partitioning rules. + + + +4. Set the index. + + + +5. Set constraints. + + + +6. Verify the SQL statement. + + + +7. Complete the table creation. + + + + + + +## Procedure + +In the following example, a table named employee is created in the OceanBase Developer Center (ODC) console. The table contains the emp_no, birthdate, name, and gender columns. Procedure: + +### Step 1: Specify the basic information. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. To create a table, click **+** in the upper-right corner of the table list or click **Create** in the top navigation bar. + +In the **Basic Info** section, specify **Table Name** and **Description**. + +> **Note** +> In MySQL mode, you also need to specify **Default Character Set** and **Default Sorting Rule**. + +![Step 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E4%B8%80-EN.png) + +### Step 2: Set columns. + +The following figure and table show the information that you need to specify when you add a column. + +![Step 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E4%BA%8C-EN.png) + + +| Field | Description | +|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Field Name | The name of the column. | +| Data Type | The data type of the column.
    For more information about data types, see [OceanBase Database Developer Guide](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview). | +| Non-empty | Specifies whether the value of the column must be specified. | +| Auto-increment | Specifies whether to set the column to an auto-increment column. This parameter is valid in MySQL mode. | +| Default Value | The default value of the column. | +| Comment | The additional information about the column. | + + + +The column setting section also provides three buttons. + + +| Button | Description | +|-----|-------------------------| +| Create | Click this button to add a field. | +| Edit | Click this button to edit the selected field. You can also directly double-click a cell to edit it. | +| Delete | Click this button to delete the selected field. | + + + +### Step 3: Set partitioning rules. + +![Step 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E4%B8%89-EN.png) + +You can partition a table that contains a large amount of data. After a table is partitioned, data in the table is stored in multiple tablespaces. The database does not scan the entire table for a query. + +* In MySQL mode, OceanBase Database supports the following six partitioning methods: **Key**, **Hash**, **Range**, **Range Columns**, **List**, and **List Columns**. + +* In Oracle mode, OceanBase Database supports the following three partitioning methods: **List**, **Range**, and **Hash**. + + The definition of a partition in MySQL mode is different from that in Oracle mode. So, the values of the following fields vary in different modes. You need to specify the following fields based on the selected partitioning method. + + +| Field | Description | +|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Partitioning Method | Specifies the partitioning method. The partitioning methods supported in MySQL mode are different from those in Oracle mode.
    - Range partitioning: Multiple rows with column values in an ordered, continuous and non-overlapping range are assigned to a partition.
    - List partitioning: A table is partitioned based on the enumeration values.
    - Hash partitioning: A table is partitioned based on a given number of partitions. For a table that stores data without a clear pattern or range, you can use hash partitioning to randomly distribute values of the partition column to different partitions based on the HASH algorithm.
    - Key partitioning: This partitioning method is similar to HASH partitioning. The difference is that key partitioning only supports computation of one or more columns, and the MySQL server provides its own hash function. At least one INT type column is required for Key partitioning.
    For more information about partitioning, see [Overview](https://www.oceanbase.com/docs/enterprise/oceanbase-database-cn/V3.2.3/10000000000357153). | +| Field | The column that is used as the partition key. | +| Expression | Partitions are divided based on the return value of the expression. The partition expression is not supported in Oracle mode. | +| Partition | Based on the value specified for **Partitioning Method**, you may need to specify information such as **Partition Name**, **Partition Quantity**, **Upper limit of the range**, and **Enumeration Value**.
    **Note**
    - When selecting the **Range** partitioning method, if the table contains a large amount of data, you can fill in MAXVALUE in **Upper limit of the range**, which means that the upper limit of the range is not set.
    - You can add multiple partitions and drag the partitions to adjust their order. | + + + + + +### Step 4: Set the index. + +If a table contains a large amount of data, you can use indexes to accelerate data queries. An index is a data structure that pre-sorts the values of one or more columns in a table. By using indexes, you can directly locate records that meet the conditions. + +The following figure and table show the information that you need to specify when you set the index. + +![Step 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E5%9B%9B-EN.png) + + +| Field | Description | +|------|-------------------------------------------------------------| +| Index Name | The name of the index. | +| Index Range | The default value is **GLOBAL**, which indicates a global index. You can set this parameter to **LOCAL** only for tables with partitions. The value LOCAL indicates a local index. | +| Index Type | Only BTree is supported. | +| Optional Field | The columns to be indexed. Pay attention to the order of the indexed columns. | +| Unique | Specifies whether the index is unique. In other words, the index is used to ensure that the constraint is unique. | + + + +The index setting section also provides three buttons. + + +| Button | Description | +|-----|-------------------------| +| Create | Click this button to add an index. | +| Edit | Click this button to edit the selected index. You can also directly double-click a cell to edit it. | +| Delete | Click this button to delete the selected index. | + + + +### Step 5: Set constraints. + +Constraints are used to specify data rules for a table. A data operation that violates the constraints will be terminated. + +![Step 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E4%BA%94-EN.png) + +ODC supports the following four table constraints: + +* **Primary Key Constraint**: defines a primary key to uniquely identify each row of data in the table. A primary key constraint can be a field or a group of fields. You can set only one primary key constraint for a table, and you cannot edit the constraint after it is configured. + +* **Unique Constraint**: ensures that the data in a field or a group of fields is unique in the table. You can set multiple unique constraints in one table. + +* **Foreign Key Constraint**: associates one or more columns in two tables. A foreign key constraint is used to maintain the data consistency and integrity between associated tables. After you complete the setting of foreign key constraints, you cannot create new constraints or edit existing constraints. + +* **Check Constraint**: checks the data in the database based on the configured check rules when you edit the data. Data modification is allowed only after the check is passed. OceanBase Database supports **Check Constraint** only in Oracle mode. + + +OceanBase Database supports different constraints in MySQL and Oracle modes, and different constraints require different information. Therefore, you need to specify the required information based on the constraint you selected and the requirements on the page. + +| Field | Description | +|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Constraint Name | The name of the constraint. | +| Column Information | The field or a group of fields specified as the constraint. | +| Trigger State |Specifies whether to enable the created constraint. In some cases, you may need to temporarily disable the constraints. For example, when you import a large amount of data, you can disable constraints to improve the import efficiency. This field is valid only in Oracle mode.| +| Deferrable|Supports three types of delay status. Valid values: Verify Now , Non-deferrable , and Delayed Verification. This field is valid only in Oracle mode.| +| Associated Schema | The schema where the associated table is located when **Foreign Key Constraint** is used. The associated table is the parent table. This field is valid only in Oracle mode. | +| Associated Database | The database where the associated table is located when **Foreign Key Constraint** is used. The associated table is the parent table. This field is valid only in MySQL mode. | +| Associated Table | The associated table when **Foreign Key Constraint** is used. The associated table is the parent table. | +| Associated Field | The associated field when **Foreign Key Constraint** is used. The associated field is in the parent table. | +| Delete | Specifies the action to be performed on the current table when the data in the associated table is deleted. The current table is the child table, and the associated table is the parent table. The following four types of action are supported: **CASCADE**, **NO ACTION**, **RESTRICT**, and **SET NULL**. OceanBase Database supports different foreign key actions in MySQL and Oracle modes.
    - In MySQL mode, OceanBase Database allows you to specify CASCADE, NO ACTION, RESTRICT, and SET NULL.
    - In Oracle mode, OceanBase Database allows you to specify CASCADE, NO ACTION, and SET NULL.
    **Notice**
    At present, OceanBase Database does not support **SET NULL**.
    For more information about the syntax, see [CREATE TABLE](https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database/V3.2.1/create-table), or the official documentation of MySQL or Oracle. | +| Update | Specifies the action to be performed on the current table when the data in the associated table is updated. The current table is the child table, and the associated table is the parent table. The following four types of action are supported: **CASCADE**, **NO ACTION**, **RESTRICT**, and **SET NULL**. OceanBase Database supports different foreign key actions in MySQL and Oracle modes.
    - In MySQL mode, OceanBase Database allows you to specify CASCADE, NO ACTION, RESTRICT, and SET NULL.
    - In Oracle mode, OceanBase Database allows you to specify NO ACTION.
    **Notice**
    At present, OceanBase Database does not support **SET NULL**.
    For more information about the syntax, see [CREATE TABLE](https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database/V3.2.1/create-table), or the official documentation of MySQL or Oracle. | +| Check Condition | Specifies the check rules for data verification when **Check Constraint** is enabled. This field is valid only in Oracle mode. | + + + +The constraint setting section also provides three buttons. + + +| Button | Description | +|-----|-------------------------| +| Create | Click this button to add a constraint. | +| Edit | Click this button to edit the selected constraint. You can also directly double-click a cell to edit it. | +| Delete | Click this button to delete the selected constraint. | + + + +### Step 6: Verify the SQL statement. + +![Step 6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E5%85%AD-EN.png) + +Click **Submit** to go to the SQL Confirmation page. + +You can edit the SQL statement on the SQL Confirmation page. Syntax: + +```sql +CREATE TABLE table_name (column_name column_type, column_name column_type,.......); +``` + +| Parameter | Description | +|--------------|----------------------------------------| +| CREATE TABLE | The key word that indicates the creation ofa table with a specified name. You must have the privileges to create tables. | +| table_name | The name of the table. The table name must conform to the identifier naming rules. | +| column_name column_type | The name and data type of the column or field in the table. To create multiple columns, separate the tuple with commas (,). | + + + +### Step 7: Complete the table creation. + +Click **Run**. After the table is created, the employee table appears in the table list in the left-side navigation pane. + +![Step 7.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E4%B8%83-1-EN.png) + +> **Note** +> To manage a table, right-click the table name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Single Table Import **, **Single Table Export**, **Download**, **Mock Data**, **Open SQL Window**, **Copy**, **Rename**, **Delete**, and **Refresh**. + +For more information, see [Manage table data](../1.web-odc-table-objects/5.web-odc-manage-table-data.md). + +You can use the `SELECT` statement to query data in the new table. + +Syntax: + +```sql +SELECT + column_name, + column_name +FROM + table_name [WHERE Clause] [LIMIT N] [ OFFSET M] +``` + + +| Parameter | Description | +|-------------|------------------------------------------------------| +| SELECT | The key word that indicates the name of the statement. You can use the SELECT statement to read one or more records. | +| column_name | The name of the column to be queried. You can use an asterisk (*) to query all columns | +| WHERE | The key word of the condition clause. | +| LIMIT | The number of records to be returned. | +| OFFSET | The data offset from which the SELECT statement starts to query. The default offset is 0. | + + + +Example: + +```sql +SELECT `emp_no`, `birthdate`, `name`, `gender` FROM `employee`; +``` + + + +![Step 7.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A4%E4%B8%83-EN.png) + + + +## Related topics +* [Create a view](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [Create a function](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [Create a stored procedure](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [Create a program package](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [Create a trigger](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [Create a type](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +* [Create a synonym](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md new file mode 100644 index 00000000..24c1bab3 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md @@ -0,0 +1,263 @@ +Create a table +======================== + + + +Overview +----------------------- + +OceanBase Developer Center (ODC) allows you to create a table on a GUI. This topic describes how to create a table in the ODC console. + +![Create a table](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%A6%82%E8%BF%B0-EN.png) + +As shown in the preceding figure, you can create a table in the following seven steps: + +1. Specify the basic information. + +2. Set columns. + +3. Set the index. + +4. Set constraints. + +5. Set partitioning rules. + +6. Confirm the SQL statement. + +7. Complete the table creation. + + + + + + +Procedure +------------------------- + +In the following example, a table named `employee` is created in the ODC console. The table contains the **emp_no**, **birthdate**, **name**, and **gender** columns. Perform the following operations: + +### Step 1: Specify the basic information + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. To create a table, click **+** in the upper-right corner of the table list or click **Create** in the top navigation bar. + +In the **Basic Info** section, specify **Table Name** and **Description**. + +![Step 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A41-EN.png) + +> **Note** +>
  • In MySQL mode, you also need to specify Default Character Set and Default Sorting Rule.
  • +>
  • After you specify the basic information and switch to the Column step, the basic information is submitted.
  • + +### Step 2: Set columns + +The following figure and table show the information that you need to specify when you add a column. + + + +![Step 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A42-EN.png) + +| Field | Description | +|---------------|--------------------------------------------------------------------| +| Name | The name of the column. | +| Type | The data type of the column.
    For more information about data types, see [OceanBase Database Developer Guide](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview). | +| Length | The length of the data type. | +| Scale | The number of decimal places of the data type. | +| Non-empty | Specifies whether the value of the column must be specified. | +| Auto-increment | Specifies whether to set the column to an auto-increment column. This parameter is valid in MySQL mode.
    **Notice**
    Only one auto-increment column is allowed for each table.
    After a column is set to an auto-increment column, the auto-increment checkbox of other columns cannot be selected. | +| Virtual Column | Specifies whether to set the column to a virtual column.
    **Notice**
    When you set a virtual column, you must specify its expression.
    When you create a virtual column, you must define an expression that the virtual column depends on. A virtual column is a generated column. A generated column can be a virtual generated column or a stored generated column. The value of a virtual column is calculated based on the expression only when the column is used. Therefore, when you insert data into the table, you cannot specify values for the virtual column. | +| Default Value/Expression | The default value or expression of the column. | +| Comment | The additional information about the column. | + + + +The following table describes operations that you can perform on the column setting page. + +| Operation | Description | +|--------|-------------------------------------------------------------------------------------------------------------------------------------------| +| Toolbar operations | You can add or delete columns by using the top toolbar of the page. | +| Click a row ID | - You can click a row ID to select the row and display the quick access toolbar that allows you to add or delete a row.
    - You can click a row ID to select the row, and then drag the row to adjust its order. | +| Right-click a row | You can right-click a row to select it, and then select **Copy** or **Move Down** from the context menu that appears. | + + +> **Note** +>
  • After you copy a row, you can paste the row by using the Command + V or Ctrl + V shortcut keys.
  • +>
  • The auxiliary editing section at the bottom of the page displays additional information about the selected column.
  • +>
  • Settings in the Basic Information and Column steps are required. Settings in other configuration steps are optional. After you specify settings in the Basic Information and Column steps, you can click Commit and Confirm SQL Statement to create a table.
  • + + +### Step 3: Set indexes + +If a table contains a large amount of data, you can use indexes to accelerate data queries. An index is a data structure that pre-sorts the values of one or more columns in a table. By using indexes, you can directly locate records that meet the conditions. + +The following figure and table show the information that you need to specify when you set the index. + +![Step 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A43-EN.png) + +| Field | Description | +|------|--------------------------------------------------------------------------------| +| Index Name | The name of the index. | +| Scope | The default value is **GLOBAL**. Valid values: **GLOBAL** and **LOCAL**. | +| Method | The default value is **BTREE**, which is applicable to a global index. Valid values: **Empty, BTREE, and HASH**.
    - A BTREE index stores data in a B+ tree structure, and is suitable for searching for SQL statements in the specified index scope.
    - A HASH index is implemented based on a HASH table, and is used only when the query conditions exactly match all columns in the HASH index. A HASH index can be used only for query conditions that use the equal operator (=), IN operator, or NULL-safe equal operator (<=>). A HASH index cannot be used for sorting and is not suitable for columns with less distinctive values, such as the gender column. | +| Index Type | The default value is **NORMAL**. Valid values: **NORMAL, UNIQUE**, and **FULLTEXT**.
    - **NORMAL** indicates a normal index.
    - **UNIQUE** indicates a unique index that does not allow duplicate values, such as the **emp_no** column.
    - **FULLTEXT** indicates a full-text index, which is used to search a table that contains a large amount of data. | +| Columns | The columns to be indexed. Pay attention to the order of the indexed columns. | +| Invisible | Specify whether the index is invisible. | + + + +The index setting page provides the following icons. + +| Icon | Description | +|-----|------------| +| Create | Click this icon to add an index. | +| Delete | Click this icon to delete the selected index. | + + + +### Step 4: Set constraints + +Constraints are used to specify data rules for a table. A data operation that violates the constraints will be terminated. + +![Step 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A44-EN.png) + +ODC supports the following four table constraints: + +* **Primary Key Constraint**: defines a primary key to uniquely identify each row of data in the table. A primary key constraint can be a field or a group of fields. You can set only one primary key constraint for a table, and you cannot edit the constraint after it is configured. + +* **Unique Constraint**: ensures that the data in a field or a group of fields is unique in the table. You can set multiple unique constraints in one table. + +* **Foreign Key Constraint**: associates one or more columns in two tables. A foreign key constraint is used to maintain the data consistency and integrity between associated tables. After you complete the setting of foreign key constraints, you cannot create new constraints or edit existing constraints. + +* **Check Constraints**: checks the data in the database based on the configured check rules when you edit the data. Data modification is allowed only after the check is passed. + + +OceanBase Database supports different constraints in MySQL and Oracle modes, and different constraints require different information. Therefore, you need to specify the required information based on the constraint you selected and the requirements on the page. + + +| Field | Description | +|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Constraint Name | The name of the constraint. | +| Column Information | The field or a group of fields specified as the constraint. | +| Associated Schema | The schema where the associated table is located when **Foreign Key Constraint** is used. The associated table is the parent table. This field is valid only in Oracle mode. | +| Associated Database | The database where the associated table is located when **Foreign Key Constraint** is used. The associated table is the parent table. This field is valid only in MySQL mode. | +| Associated Table | The associated table when **Foreign Key Constraint** is used. The associated table is the parent table. | +| Associated Field | The associated field when **Foreign Key Constraint** is used. The associated field is in the parent table. | +| Delete | Specifies the action to be performed on the current table when the data in the associated table is deleted. The current table is the child table, and the associated table is the parent table.
    The following four types of action are supported: **CASCADE**, **NO ACTION**, **RESTRICT**, and **SET NULL**. OceanBase Database supports different foreign key actions in MySQL and Oracle modes.
    - In MySQL mode, OceanBase Database allows you to specify **CASCADE**, **NO ACTION, RESTRICT**, and **SET NULL**.
    - In Oracle mode, OceanBase Database allows you to specify **CASCADE**, **NO ACTION**, and **SET NULL**.

    **Notice**
    At present, OceanBase Database does not support **SET NULL**.
    For more information about the syntax, see [Create a table](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000357139), or the official documentation of MySQL or Oracle. | +| Update | Specifies the action to be performed on the current table when the data in the associated table is updated. The current table is the child table, and the associated table is the parent table.
    The following four types of action are supported: **CASCADE**, **NO ACTION**, **RESTRICT**, and **SET NULL**.
    OceanBase Database supports different foreign key actions in MySQL and Oracle modes.
    - In MySQL mode, OceanBase Database allows you to specify **CASCADE**, **NO ACTION, RESTRICT**, and **SET NULL**.
    - In Oracle mode, OceanBase Database allows you to specify **NO ACTION**.
    **Notice**
    At present, OceanBase Database does not support **SET NULL**.
    For more information about the syntax, see [Create a table](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000357139), or the official documentation of MySQL or Oracle. | +| Check Condition | Specifies the check rules for data verification when **Check Constraint** is enabled. | + +The constraint setting page provides the following icons. + + +| Icon | Description | +|-----|------------| +| Create | Click this icon to add a constraint. | +| Delete | Click this icon to delete the selected constraint. | + +### Step 5: Set partitioning rules + +![Step 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A45-EN.png) + +You can partition a table that contains a large amount of data. After a table is partitioned, data in the table is stored in multiple tablespaces. The database does not scan the entire table for a query. + +* In MySQL mode, OceanBase Database supports the following six partitioning methods: **Key**, **Hash**, **Range**, **Range Columns**, **List**, and **List Columns**. + + + +* In Oracle mode, OceanBase Database supports the following three partitioning methods: **List**, **Range**, and **Hash**. + + The definition of a partition in MySQL mode is different from that in Oracle mode. So, the values of the following fields vary in different modes. You need to specify the following fields based on the selected partitioning method. + + | Field | Description | + |------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Partitioning Method | Specifies the partitioning method. The partitioning methods supported in MySQL mode are different from those in Oracle mode.
    - Range partitioning: Multiple rows with column values in an ordered, continuous, and non-overlapping range are assigned to a partition.
    - List partitioning: A table is partitioned based on the enumeration values.
    - Hash partitioning: A table is partitioned based on a given number of partitions. For a table that stores data without a clear pattern or range, you can use hash partitioning to randomly distribute values of the partition column to different partitions based on the HASH algorithm.
    - Key partitioning: This partitioning method is similar to HASH partitioning. The difference is that key partitioning only supports computation of one or more columns, and the MySQL server provides its own hash function. At least one INT type column is required for Key partitioning.
    For more information about partitioning, see [Overview](https://www.oceanbase.com/docs/enterprise/oceanbase-database-cn/V3.2.3/10000000000357153). | + | Field | The column that is used as the partition key. | + | Expression | Partitions are divided based on the return value of the expression. The partition expression is not supported in Oracle mode. | + | Partition | Based on the value specified for **Partitioning Method**, you may need to specify information such as **Partition Name**, **Partition Quantity**, **Upper Limit**, and **Value Enumeration**. You can add multiple partitions and drag selected fields to adjust their order. | + + + + + + +### Step 6: Confirm the SQL statement + +![Step 6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/create%20table-EN.png) + +After you click **Submit**, you can view the statement on the SQL Confirmation page. To view lengthy clauses, click **SQL Check** and **Format** in the lower-right corner of the page. + +Syntax: + +```sql +CREATE TABLE table_name (column_name column_type, column_name column_type,.......); +``` + + + +Parameters + +| Parameter | Description | +|-------------------------|----------------------------------------| +| CREATE TABLE | The key word that indicates the creation ofa table with a specified name. You must have the privileges to create tables. | +| table_name | The name of the table. The table name must conform to the identifier naming rules. | +| column_name column_type | The name and data type of the column in the table. To create multiple columns, separate the tuple with commas (,). | + + + +### Step 7: Complete the table creation + +Click **Execute**. After the table is created, the **employee** table appears in the table list in the left-side navigation pane. + +![Step 7.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A47.1-EN.png) + +> **Note** +> To manage a table, right-click the table name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View Table Structure**, **View DDL**, **View Table Data**, **CreateTable**, **Import**, **Export**, **Download**, **Mock Data**, **Open SQL Window**, **Copy**, **Rename**, **Delete**, and **Refresh**. + +For more information, see [Manage table data](../1.web-odc-table-objects/5.web-odc-manage-table-data.md). + +You can use the `SELECT` statement to query data in the new table. + +Syntax: + +```sql +SELECT + column_name, + column_name +FROM + table_name [WHERE Clause] [LIMIT N] [ OFFSET M] +``` + + + +Parameters + +| Parameter | Description | +|-------------|------------------------------------------------------| +| SELECT | The key word that indicates the name of the statement. You can use the SELECT statement to read one or more records. | +| column_name | The name of the column to be queried. You can use an asterisk (\*) to query all columns | +| WHERE | The key word of the condition clause. | +| LIMIT | The number of records to be returned. | +| OFFSET | The data offset from which the SELECT statement starts to query. The default offset is 0. | + + + +Example: + +```sql +SELECT `emp_no`, `birthdate`, `name`, `gender` FROM `employee`; +``` + +![Step 7.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A47.2-EN.png) + + + +Related topics +------------------------- + +* [Create a view](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [Create a function](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [Create a stored procedure](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [Create a program package](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [Create a trigger](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [Create a type](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +* [Create a synonym](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/3.web-odc-table-list.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/3.web-odc-table-list.md new file mode 100644 index 00000000..72344787 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/3.web-odc-table-list.md @@ -0,0 +1,39 @@ +Table list +=============================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. The table list displays the table objects in the connected database. In the table list, you can view the structure tree of an object. You can also right-click the target object to perform some management actions on the object. + +Structure tree +----------------------------------- + +You can click the expand icon before the name of the target table in the table list, and the structure tree of the table is displayed in a drop-down list, as shown in the following figure. The structure tree of a table can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section. In this section, you can find the table describing the management options. + +![Image 188](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%88%97%E8%A1%A8-1-EN.png) + +Management actions +--------------------------------------- + +The names of table objects support ascending example by head character by default in the table list. +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + + +| Option | Description | +|----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Table Structure | Click this option to go to the Attribute tab. On this tab, you can view comprehensive information of the table such as the basic information, columns, indexes, constraints, and DDL statements. | +| View DDL | Click this option to go to the Attribute tab to view the SQL statements that define the table. | +| View Table Data | Click this option to go to the Data tab to view the data in the table. | +| Create Table | Click this option to go to the table creation page, where you can create a table as prompted. | +| Single Table Import | Click this option to import data to the table. For more information, see [Single table export and import](../../6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md). | +| Single Table Export | Click this option to export data from the table. For more information, see [Single table export and import](../../6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md). | +| Download | Download the SQL file for the table object. | +| Mock Data | Click this option to go to the **Mock Data** panel. | +| Open SQL Window | Click this option to open a new SQL window. | +| Copy | Click this option to copy the table name, SELECT statement, INSERT statement, UPDATE statement, or DELETE statement. | +| Rename | Click this option to rename the table. | +| Delete | Click this option to delete the table. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the table, so that the structure tree displays the latest information. | +| View Column/View Index/View Constraint | Click these options to go to the Attribute tab to view specific information about the columns, indexes, or constraints in the table. | +| Create Column/Create Index/Create Constraint | Click these options to create a column, an index, or a constraint. | + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/4.web-odc-manage-table-attributes.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/4.web-odc-manage-table-attributes.md new file mode 100644 index 00000000..22b07e20 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/4.web-odc-manage-table-attributes.md @@ -0,0 +1,184 @@ +Manage table attributes +============================================ + + + +Overview +----------------------------- + +![Overview](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-1-EN.png) + +1. After you log on to OceanBase Developer Center (ODC), click the name of the target connection on the ODC homepage to go to the corresponding connection management page. + + + +2. In the left-side navigation pane, click **Table** to get a list of tables. + + + +3. Double-click the name of a table in the table list to go to the table management page. + + + +4. Click **Attribute** in the top navigation bar to go to the Attribute tab. + + The Attribute tab displays the following table attributes: + + * **Basic information** + + + + * **Column** + + + + * **Index** + + + + * **Constraints** + + + + * **Partition** + + + + * **DDL** + + + + + + + + + +Basic information +-------------------------------------- + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/table%20attribute-basic%20information-EN.png) + +In the left-side navigation pane of the **Attribute** tab, click **Basic Info** to view the basic information about the table. + + +| Field | Description | +|-----------------------|-------------------------------------------------------------------------------------------------------------------------| +| Table Name | Displays the name of the table. You can modify the table name here. | +| Default Character Set | Displays the character set that the table uses. | +| Default Sorting Rule | Displays the sorting rule that the table uses. | +| Description | Displays the description that you specified when you created the table. You can also modify the table description here. | +|Row data volume|Displays the number of rows.| +|Size|Displays the data size.| + + + +The basic information page provides the following buttons. + + +| Button | Description | +|---------|-----------------------------------------------------------------------------------------------------------------------------------------| +| Edit | Click ![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412792.jpg) to modify the basic information. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the basic information. | + + + +Column information +--------------------------------------- + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-3-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Column** to view the columns in the table. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to add a field (or column) to the table. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected field. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the field information. | +| Filter | Click ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412788.jpg) (to the right of **Field Name** ) to filter or search for fields. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.| + + + +Index information +-------------------------------------- + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-4-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Index** to view the indexes on the table. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to add an index to the table. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected index. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the index information. | +| Filter | Click ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412788.jpg) (to the right of **Index Name** ) to filter or search for indexes. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.An index cannot be modified after it is created. | + +> **Note** +> An index cannot be modified after it is created. + +Constraint information +------------------------------------------- + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-5-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Constraint** to view the constraints on the table. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|-----------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to add a constraint to the table. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected constraint. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the constraint list. | +|Filter| ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412788.jpg) (to the right of **Name** ) to filter or search for constraints. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.| + + +> **Note** +>
  • The buttons provided vary with the constraint method. If a button is dimmed out or not present in the navigation bar, it means that the constraint method does not support the corresponding action.
  • +>
  • To view foreign key constraints on a table, you can query the `all_constraints` view in Oracle mode, or the information_schema.key_column_usage table in MySQL mode since OBServer V2.2.6.
  • +>
  • OceanBase Database supports constraint checking only in Oracle mode.
  • + + + + + + +Partition information +------------------------------------------ + +![6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-6-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Partition** to view the information about the partitions in the table. The information includes **Partition Name** , **Order** , **Partitioning Method** , **Expression** , **Upper limit of the range** , and **Enumeration Value** . In Oracle mode, **Expression** indicates the partitioning key. **Partitioning Method** indicates the partitioning method specified when the table was created. The information displayed varies with the partitioning method. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to create a partition from an undefined range. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected partition and destroy the data in the partition. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the partition list. | +| Filter | Click ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p423624.jpg) to filter partitions by partition name, order, partitioning method, expression, or upper limit of the range. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.| + + +> **Note** +> In ODC V3.3.0 and later versions, you can view the partitions of table objects not necessarily under the SYS tenant. + + + +DDL information +------------------------------------ + +![7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-7-en.png) + +In the left-side navigation pane of the **Attribute** tab, click **DDL** to view the DDL statements that define the table. You cannot edit these statements. Click ![Format](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412851.jpg) in the toolbar to view the statements. + +| Button | Description | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Format | Click [Format](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412851.jpg) to format the statements. | +| Download | Click Download to download the statements. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the statement. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.| \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/5.web-odc-manage-table-data.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/5.web-odc-manage-table-data.md new file mode 100644 index 00000000..5434e441 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/5.web-odc-manage-table-data.md @@ -0,0 +1,135 @@ +Manage table data +====================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. Double-click the name of a table in the table list to go to the table management page. Click the **Data** button in the navigation bar on the top of the page to go to the Data tab, where you can view, add, modify, and delete table data. +**Notice** + + + +In ODC, connections to the same database share the same session. In ODC V2.3.2 and later versions, auto-commit is turned off by default in Oracle mode, so you need to manually commit transactions. You can modify the value of the autocommit parameter on the **Session Properties** page to change this setting. For more information, see [Session management](6.web-odc-user-guide/10.web-odc-session-management.md). + +![Image 535](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2889620261/p268002.png) + +View data +------------------------------ + +On the Data tab, ODC displays data in the form of a table. The navigation bar provides the following buttons for you to view and manage the data: + +* **Enable Editing** : Click this button to enable the editing mode so that you can edit the data in the table. + + + +* **Commit** : Auto-commit is turned off by default in Oracle mode, so you need to click this button to commit the current transaction. After you click this button, a dialog box appears, indicating that the current connection uses a shared session and the commit will apply to all windows. Click **Yes** to apply the commit. In MySQL mode, auto-commit is turned on by default, so this button is not displayed. + + + +* **Rollback** : Auto-commit is turned off by default in Oracle mode. You can click this button to roll back the current transaction. After you click this button, a dialog box appears, indicating that the current connection uses a shared session and the rollback will apply to all windows. Click **Yes** to apply the rollback. In MySQL mode, auto-commit is turned on by default, so this button is not displayed. + + + +* **Refresh** : Click this button to refresh the data in the table. + + + +* **Column Mode** : Click this button to display the data in the selected rows in the form of a table. On the **Column Mode** page, you can switch to the previous or next row. The column mode makes it easier to view data in a row that has many columns. + + + +* **Columns** : Click this button to select the columns to be displayed on the page. + + + +* **Back to Start** : Click this button to jump to the first page. + + + +* **Previous** : Click this button to go to the previous page. + + + +* **Next** : Click this button to go to the next page. + + + +* **Jump to Bottom** : Click this button to jump to the last page. + + + +* **Display Data Volume** : Click this button to set the maximum number of rows to be displayed on a page. + + + +* **Export** : Click this button to export the data in the table. You can specify the type of the exported file, the character set, and the number of rows to be exported. The file type can be CSV or SQL, and the character set can be GBK or UTF8. You can export up to 10,000 rows from a result set. + + + +* **Mock Data** : Click this button to mock data in the table. For more information, see [Data mocking](6.web-odc-user-guide/6.web-odc-use-tools/2.web-odc-data-mocking.md). + + + + + + +Edit data +------------------------------ + +Click **Enable Editing** in the navigation bar on the Data tab to enter the editing mode, as shown in the following figure. ODC use different colors to mark data in different states. New data is marked in green, deleted data in red, and modified data in orange. + +![Image 534](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2889620261/p268003.png) + +In editing mode, the navigation bar provides the following buttons for you to edit data in the table: + +* **Add Row** : Click this button to insert an empty row to the table. Double-click a cell to insert data to it. ODC provides the verification feature and related tools to help you insert data in a more convenient way. For example, if the current cell is of the date type, ODC displays a calendar for you to select the to-be-inserted date from. + + + +* **Delete Row** : Click this button to delete the selected rows from the table. + + + +* **Copy Current Row** : Click this button to copy the selected rows in the table. + + + +* **Column Mode** : Click this button to display the data in the selected rows in the form of a table. On the **Column Mode** page, you can switch to the previous or next row. The column mode makes it easier to view data in a row that has many columns. + + + +* **Columns** : Click this button to select the columns to be displayed on the page. + + + +* **Back to Start** : Click this button to jump to the first page. + + + +* **Previous** : Click this button to go to the previous page. + + + +* **Next** : Click this button to go to the next page. + + + +* **Jump to Bottom** : Click this button to jump to the last page. + + + +* **Display Data Volume** : Click this button to set the maximum number of rows to be displayed on a page. + + + +* **Cancel** : Click this button to exit the editing mode. + + + +* **Confirm Modification** : Click this button to generate the SQL statement for the action. After you verify the statement, click **Execute** to apply the data modification. If auto-commit is turned on, the transaction is automatically committed after you click this button. + + + +* **Modify and Submit** : Auto-commit is turned off by default in Oracle mode, so you need to click this button to commit the current transaction. After you click this button, a dialog box appears, indicating that the current connection uses a shared session and the commit will apply to all windows. Click **Yes** to apply the commit. In MySQL mode, auto-commit is turned on by default, so this button is not displayed. + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/1.web-odc-view-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/1.web-odc-view-objects-overview.md new file mode 100644 index 00000000..2c047daf --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/1.web-odc-view-objects-overview.md @@ -0,0 +1,29 @@ +Overview +============================= + +A view is a virtual table created based on one or more tables or views. The tables on which the view is based are called base tables. Views do not store data. You can use views to query and modify data in base tables. Therefore, the definition of a view is stored in the data dictionary, and no data copy related to the view definition is stored in the database. Views are similar to physical tables in the database, so you can perform operations on views like on tables. When you modify data in a view, you are actually modifying data in base tables. Conversely, the modification of data in base tables is also reflected in views generated based on these base tables. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click View in the left-side navigation pane to get a list of views. In the view list, you can double-click a view name to go to the view management page. On this page, you can check the data of the view on the Data tab or the attributes such as the basic information, columns, and DDL statements of the view on the Attribute tab. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.0.0 or a later version | +| OceanBase Database in MySQL mode | V1.4.1 or a later version | + + + +This chapter describes in different topics the operations you can perform on view objects in ODC. + +* [Create a view](6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md) + + + +* [Manage views](6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md new file mode 100644 index 00000000..a8dcf0c7 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md @@ -0,0 +1,200 @@ +# Create a view + +ODC supports visualized view creation. This topic describes how to create a view with ODC. + +## Overview + +A view is a virtual table that consists of data in one or more tables. You can use the `SELECT` statement to query a view. A view itself does not contain data. + +### Purposes of views + +* Simplifies data queries: You can use views to combine data from different tables in a database into a single virtual table, and thereby convert multi-table queries into a single-table query. + + + +* Controls data access: You can use views to present certain data to specific users. These users can view only the data in a specific view. + + + +![Overview](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%A6%82%E8%BF%B0-EN.png) + +As shown in the preceding figure, you can create a view in the following five steps: + +1. Specify the basic information. + + + +2. Select base tables. + + + +3. Select fields. + + + +4. Verify the SQL statement. + + + +5. Complete the view creation. + + + + + + +## Procedure + +In the following example, an employee salary view is created in the OceanBase Developer Center (ODC) console. The salary view consists of the name field in the employee table and the budget and dept_name fields in the consumer table. Procedure: + +### Step 1: Specify the basic information. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **View** in the left-side navigation pane to get a list of views. To create a view, click **+** in the upper-right corner of the view list or click **Create** in the top navigation bar. + +In the **Basic Info** section, specify **View Name** and **Check Item**. + +* **View Name**: specifies the name of the view. + + + +* **Check Item**: specifies the constraints on the input data. OceanBase Database in Oracle mode supports only the read-only mode. Default value: **None**. + + + + + + +![Step 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%80-EN.png) + +After you specify all the basic information, click **OK**. + +After the basic information is specified, you can either click **Next: Verify SQL Statement** to go to Step 4 and verify the SQL statement, or proceed to Step 2 and select base tables. + +### Step 2: Select base tables. + +After you specify the basic information, you can proceed to Step 2 and select base tables, or skip this step. + +In the **Select Base Tables** section, the list on the left displays available base tables in the hierarchy of schema > database > table/view. You can search for base tables in this list. Select tables or views in this base table list, and click the add icon (>) next to the list to add the selected tables or views to the table operation area on the right. + +![Step 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%BA%8C-EN.png) + +In the table operation area, you can perform the following operations on a selected base table. + + +| Operation | Description | +|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Set an alias | You can set an alias for a selected base table. Click **\** next to the table name in the table operation area and enter the alias. This operation is optional. | +| Set association relationships | When two or more tables exist in the table operation area, you can define an association relationship between the tables. The default association is **JOIN**. You do not need to set an association relationship for the last table. Click the ![drop-down list](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E4%B8%8B%E6%8B%89%E5%88%97%E8%A1%A8.jpg) icon next to Alias and select an association relationship. Supported options: **JOIN**, **INNER JOIN**, **LEFT JOIN**, **RIGHT JOIN**, **CROSS JOIN**, **FULL JOIN**, **UNION**, **UNION ALL**, **INTERSECT**, **MINUS**, **LEFT OUTER JOIN**, **RIGHT OUTER JOIN**, and **FULL OUTER JOIN**. | +| Adjust the association order | You can drag the base tables in the table operation area to reorder them. If you drag a table to the bottom of the list, the association relationships of this table are removed. | +| Delete a base table | You can click the delete icon next to a table in the table operation area to delete it from the table operation area. After you delete a table, its associations with the next table are removed. | + + + +After you select and configure the base tables, click **OK**. + +### Step 3: Select fields. + +After you select the base tables, you can proceed to Step 3 and select fields. If you skip Step 2, this step is unavailable. + +In the **Select Fields** section, the list on the left displays the fields of the base tables that you selected in Step 2 in the hierarchy of schema > database > table/view. You can search for fields in this list. Select fields in the field list, and click the add icon (>) next to the list to add the selected fields to the field operation area on the right. + +![Step 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%89-EN.png) + +In the field operation area, you can perform the following operations on a selected field. + + +| Operation | Description | +|--------|-----------------------------------------------------------| +| Set an alias | You can set an alias for a selected field. Click **\** next to the field name in the field operation area and enter the alias. This operation is optional. | +| Adjust the association order | You can drag the fields in the field operation area to reorder them. | +| Delete a field | You can click the delete icon next to a field in the field operation area to delete it from the operation area. | +| Customize fields | Click **+Custom** in the upper-right corner of the field operation area to add a field to the operation area. You must specify a name and an alias for the field. | + + + +After you select and configure the fields, click **OK**. + +### Step 4: Verify the SQL statement. + +After you complete all the previous steps, click **Next: Verify SQL Statement** to go to the statement editing page. + +![Step 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E5%9B%9B-EN.png) + +On the statement editing page, the view definition statements are generated based on the information specified in the **Basic Info**, **Select Base Tables**, and **Select Fields** sections. When two or more tables are included, you must complete the statement according to the relationship between the tables and logical conditions. After you complete the statements, click **Create** in the upper-right corner of the page to create the view. + +You can edit the SQL statements of the created view on the Create View page. Syntax: + +```sql +CREATE VIEW view_name AS +SELECT + column1, + column2..... +FROM + table_name +WHERE + [condition]; +``` + + + +In addition, the toolbar on the editing page provides the following buttons. + + +| Button | Description | +|-------|--------------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | Click this button and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | +|IN Value Conversion|A format such as A B can be converted to ('A','B') format.| +| Previous | Click this button to go back to the **Create View** page, where you can continue to edit or modify the parameters in the **Basic Info**, **Select Base Tables**, and **Select Fields** sections. | + + + +### Step 5: Complete the view creation. + +Click **Create** in the upper-right corner to create the view. After a view is created, you can use the `SELECT` statement to query it, just like how you query a table. + +![Step 4.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E5%9B%9B-2-EN.png) + +> **Note** +> To manage a view, right-click the view name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Delete**, **Download**, and **Copy**. + +For more information, see [Manage views](../2.web-odc-view-objects/3.web-odc-manage-views.md). + +Syntax: + +```sql +SELECT +column1, +column2..... +FROM +table_name; +``` + + + +Example: + +```sql +SELECT `name`, `budget`, `department_name` FROM `salary`; +``` + + + +![Step 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%BA%94-EN.png) + +## Related topics + +* [Create a table](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [Create a function](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [Create a stored procedure](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [Create a program package](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [Create a trigger](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [Create a type](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +* [Create a synonym](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md new file mode 100644 index 00000000..f6040bf7 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md @@ -0,0 +1,57 @@ +Manage views +================================= + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **View** in the left-side navigation pane to get a list of views in the current database. + +In the view list, you can view the **structure tree** of an object. You can also right-click the target object to perform some **management actions** on the object. You can also double-click the name of the target view to go to the view management page, which includes the **Attribute and Data tabs** . + +Structure tree +----------------------- + +You can click the expand icon before the name of the target view in the view list, and the structure tree of the view is displayed in a drop-down list, as shown in the following figure. The structure tree of a view can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section, where you can find the table describing the management options. + +![Image 193](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-1-EN.png) + +Management actions +--------------------------- + +The names of view objects support ascending example by head character by default in the view list. +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Option | Description | +|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Check View Properties | Click this option to go to the **Attribute** tab, where you can view comprehensive information such as the basic information, columns, and code of the view. | +| Check View Data | Click this option to go to the **Data** tab, to check data in the view. | +| Create View | Click this option to go to the Create View page, where you can create a view as prompted. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the view object. | +| Copy | Click this option to copy the object name, SELECT statement, INSERT statement, UPDATE statement, or DELETE statement. | +| Delete | Click this option to delete the current view object. | + + + +Attribute and Data tabs +-------------------------------- + +![en](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-2-EN.png) + +* Attribute tab: + * **Basic Info** : displays information such as **View Name** , **Check Item** , and **Created By** . + + + + * **Column** : displays information of the base table corresponding to the view, such as **Field Name** , **Data Type** , and **Comment** . + + + + * **Code** : displays the definition script of the view. + + +* Data tab: displays the columns that the view contains. + + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/1.web-odc-function-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/1.web-odc-function-objects-overview.md new file mode 100644 index 00000000..bc3a73f9 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/1.web-odc-function-objects-overview.md @@ -0,0 +1,29 @@ +Overview +============================= + +A function defines a collection of SQL statements. You can call a function in an SQL statement to get a return value from the execution. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click Function in the left-side navigation pane to get a list of functions. In the function list, double-click the name of a function to go to the function management page, where you can view the basic information, parameters, and data definition language (DDL) statements of the function. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.0.0 or a later version | +| OceanBase Database in MySQL mode | V2.0.0 or a later version | + + + +This chapter describes in different topics the operations you can perform on function objects in ODC. + +* [Create a function](6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/2.web-odc-create-a-function.md) + + + +* [Manage functions](6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/2.web-odc-create-a-function.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/2.web-odc-create-a-function.md new file mode 100644 index 00000000..075648f7 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/2.web-odc-create-a-function.md @@ -0,0 +1,197 @@ +# Create a function + +ODC supports visualized function creation. This topic describes how to create a function with ODC. + +## Overview + +A function is a subprogram defined in a database. You can call functions by using built-in SQL statements. If the built-in functions cannot meet your business requirements, OceanBase Developer Center (ODC) allows you to create functions. User-defined functions not only help you perform some calculations and special operations, but also reduce coding redundancy to improve the program readability. + +A function is a procedural object that is similar to a stored procedure in a database. Like a stored procedure, a function is a code snippet of SQL statements and procedural statements, and can be called by applications and other SQL statements. + +Differences between a user-defined function and a stored procedure: + +* A function returns only one result and is suitable for data processing that generates one result. A stored procedure may return zero or multiple results and is suitable for batch insertion and batch update. + +* You can call a function by using a `SELECT` statement. You can call a stored procedure by using a `CALL` statement. + +![Create a function 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%A6%82%E8%BF%B0-EN.png) + +As shown in the preceding figure, you can create a function in the following six steps: + +1. Specify the function name. + +2. Specify the data type of the return value. + +3. Specify parameters. + +4. Verify the parameters of the new function. + +5. Edit the function. + +6. Complete the function creation. + +## Procedure + +In the following example, a function named function_emp is created in the ODC console to obtain the employee name from an employee table based on the employee ID. The function_emp function contains an INT type id parameter. Procedure: + +### Step 1: Specify the function name. + +Log on to the ODC console and click the name of a connection to go to the corresponding connection management page. You can click **Function** in the left-side navigation pane to get a list of functions. To create a function, click + in the upper-right corner of the function list or click **Create** in the top navigation bar. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A41-EN.png) + +### Step 2: Specify the data type of the return value. + +For more information about data types, see [OceanBase Database Developer Guide](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview). + +### Step 3: Specify parameters. + +1. Parameters specify the information passed to a function when the function is called. + + * In Oracle mode, specify the following fields: **Name**, **Mode**, **Type**, and **Default Value**. + + + + * In MySQL mode, specify the following fields: **Name**, **Type**, and **Length**. + + + + + + +2. You can specify parameters by using one of the following three methods. + + | Method | Description | + |----------|-------------------------------------------------------------------------------------------------------------------------------------------------| + | Use the quick access toolbar | In the quick access toolbar, you can add, delete, and move up and down parameters. | + | Click the row number | - You can click a row number to select a row and display the quick access toolbar that allows you to delete the row or move the row up or down.
    - You can click a row number to select the row, and then drag the row to adjust its order. | + | Right-click | Right-click the mouse to select the entire row, copy row or move down the row. | + +3. You need to specify the mode for the parameters. + + The parameter mode setting is unavailable in MySQL mode. The Oracle mode supports the following parameter modes: **IN**, **OUT**, and **INOUT**. + + + | **Parameter** | **Type** | + |--------|-------------------------------------------------------------------| + | IN | Indicates an input parameter. When a function is called, the input parameter is passed to the function and used in the execution of the function. | + | OUT | Indicates an output parameter. When a function is called, the value of the output parameter is ignored and an empty value is passed to the function. The output parameter in the function body can be modified. The modified result is returned and passed to the argument that the output parameter represents. | + | INOUT | Indicates an inout parameter. An inout parameter is both an input parameter and an output parameter. | + + + > **Note**
    + > In Oracle mode, both functions and stored procedures support IN, OUT, and INOUT modes. In MySQL mode, functions support only IN mode, and stored procedures support IN, OUT, and INOUT modes. + + + + + +### Step 4: Verify the parameters of the new function. +Click **OK** to go to the Create Function page. + +### Step 5: Edit the function. + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A45-EN.png) + +Edit the function statement on the Create Function page. +You can edit the SQL statements of the created function on the Create Function page. Syntax: + +```sql +CREATE FUNCTION < function name > ([ [ , ] ] …) +RETURNS < type > +< function body > +``` + + + +Parameters: + + +| Parameter | Description | +|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| \< function name \> | The name of the user-defined function.
    **Notice**
    The name of a user-defined function cannot be the same as that of a stored procedure.
    | +| \< parameter \>\< type \> | Parameters of the function. This field contains only the name and type. You cannot specify the IN, OUT, or INOUT keyword. | +| RETURNS\< type \> | The data type of the return value. `` specifies the data type of the return value.
    **Notice**
    The SELECT statement in a RETURN VALUE statement returns only a single-row and single-column value.
    | +| \< function body \> | The body of the user-defined function. The function body must contain a `RETURN ` statement, where `` specifies the return value of the user-defined function. | + + + +Example: + +```sql +CREATE FUNCTION `function_emp` ( `id` int(45)) RETURNS VARCHAR(300) + +-- The start of the function body. +BEGIN + +-- Declare a variable. +DECLARE + a VARCHAR(300); + +-- Assign a value to the variable. +SELECT + name INTO a +FROM + employee +WHERE + emp_no = id; + +-- The return value. +RETURN a; + +-- The end of the function body. +END +``` + + + +### Step 6: Complete the function creation. + +Click **Create** in the upper-right corner to create the function. After a user-defined function is created, you can use the `SELECT` statement to call it, just like how you call a built-in function. + +> **Note**
    +> To manage a function, right-click the function name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Edit**, **Compile**, **Debug**, **Run**, **Download**, **Delete**, and **Refresh**. **Edit** , **Compile** , and **Debug** are not supported in MySQL mode. +> For more information, see [Manage functions](../3.web-odc-function-objects/3.web-odc-manage-functions.md). + +Syntax: + +```sql +SELECT ([ [,...]]) +``` + + + +Example: + +```sql +SELECT function_emp(2); +``` + + + +* MySQL mode + + ![6.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A46-1-EN.png) + + +* Oracle mode + + ![6.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A46-2-EN.png) + + + > **Notice**
    + > - In Oracle mode, if a user-defined function contains an OUT parameter, you must call the function by using the `CALL` statement.
    + > - A yellow icon in the function list indicates an error or alert. + + + +## Related topics + +[Create a table](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +[Create a view](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +[Create a stored procedure](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +[Create a sequence](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +[Create a program package](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +[Create a trigger](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +[Create a type](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +[Create a synonym](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md new file mode 100644 index 00000000..aed70f26 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md @@ -0,0 +1,91 @@ +Manage functions +===================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Function** in the left-side navigation pane to get a list of functions. + +In the function list, you can view the **structure tree** of an object, or right-click the target object to perform some **management actions** on the object. You can also double-click the name of the target function to go to the **function management page**. + +Structure tree +----------------------- + +You can click the expand icon before the name of the target function in the function list, and the structure tree of the function is displayed in a drop-down list, as shown in the following figure. The structure tree of a function can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section. In this section, you can find the table describing the management options. + +![Image 194](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-1-EN.png) + +Management actions +--------------------------- + +The names of function objects support ascending order by the head character by default in the function list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create function. | +| Filter | Click this option to display valid/invalid functions. | +| Batch Compile | Click this option to batch compile the function object. Including: compile all objects and compile invalid objects.
    ![batch compile](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91-EN.png) | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the function, so that the structure tree displays the latest information. | + + + +### Right-click function + +After you right-click an item in the structure tree, a shortcut menu appears and displays some actions that you can take to manage the item. The following table describes the management actions in details: + + +| Action |Description| +|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View | Click this option to go to the function management page. On this page, you can view comprehensive information such as the basic information, parameters, and code of the function. | +| Create | Click this option to go to the Create Function page, where you can create a function as prompted.| +| Edit | Click this option to go to the function management page, which displays the statements that define the function and where you can edit the function. | +| Compile | Click this option to compile the function. | +| Debug | Click this option to go to the debugging page. On this page, you can debug the function.
    **Note**
    • We recommend that you upgrade to OBServer V2.2.77 or later. This is because some versions of OBServer have been found with PL/SQL debugging issues, which may compromise the OBServer stability.
    • ODC V3.2.2 or earlier does not support the debugging feature when you connect ODC to the target instance by using OBProxy. To use the debugging feature, directly connect ODC to the target instance.
    • ODC V3.2.2 and later support PL/SQL debugging when you connect to OBServer by using OBProxy.
    • ODC V4.0.0 and later support setting the parameter value as DEFAULT, NULL or empty string.
    | +| Run | Click this option to execute the function. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the function object.| +| Delete | Click this option to delete the function. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the function, so that the structure tree displays the latest information. | + + +Function management page +--------------------------------------------- + +![Image 817](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-2-EN.png) + +You can double-click the name of the target function in the function list to go to the function management page. The function management page displays the following information: + + +|Section| Description | +|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This section displays the basic information about the function in fields such as **Function Name** , **Return Type** , and **Created By**. | +| Parameter | This section displays the information about the parameters in fields such as **Name** , **Order** , **Mode** , **Data Type** , and **Default Value** . Click the ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2672849361/p326053.jpg) icon to refresh the parameters. | +| DDL | This section displays the script that defines the function and provides the **Edit**, **Download**, **Find**, and **Refresh** icons.
    **Note**
    Click the **Edit** icon to go to the PL object editing page.
    | + + + +Function editing page +------------------------------ + +Right-click the target item in the function list. In the menu that appears, click **Edit** to go to the function editing page. In the code area of the editing page, the statements that define the function are displayed. You can edit the statements. In addition, the toolbar provides the following buttons: + + +|Button|Description| +|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Confirm Modification | Click this button to apply the current modification. | +| Compile | Click this button to compile the statements on the current page. | +| Run | Click this button to execute the statements in the code area. | +|Abort|Click this button to terminate the running statement.| +| Debug | Click this button to go to the debugging page, where you can debug the PL object in the code area. | +| Format | Click this button to apply the formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found.| +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All C** **aps** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | +| IN Value Conversion | Click this button to convert the copied rows or columns into the specified format during queries. After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format.
    • Column values are separated with line breaks.
    • Row values are separated with spaces or tabs.
    | +|Snippets| Built-in syntax snippets and custom syntax snippets are provided to view and reference. See Snippet for details.| +|Download|Download the SQL file for the function object.| diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/1.web-odc-stored-procedure-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/1.web-odc-stored-procedure-objects-overview.md new file mode 100644 index 00000000..fa698575 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/1.web-odc-stored-procedure-objects-overview.md @@ -0,0 +1,46 @@ +Overview +============================= + +In a database system, a stored procedure is a collection of SQL statements for implementing a specific action. A stored procedure is stored in the database, and can be reused after it is compiled. + +Functions and stored procedures are similar in definition. Both are a collection of SQL statements. They have the following differences: + +* A function normally returns a value, whereas a stored procedure does not return values. + + + +* You can embed a function in an SQL statement. For example, you can call a function in a `SELECT` statement. However, usually a stored procedure is independently executed. + + + +* Functions have more limits than stored procedures. In general, stored procedures implement more complex features, whereas a function implements a more specific feature. + + + + + + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Stored Procedure** in the left-side navigation pane to get a list of stored procedures. In the stored procedure list, you can double-click the name of a stored procedure to go to the stored procedure management page, where you can view the basic information, parameters, and data definition language (DDL) statements of the stored procedure. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.0.0 or a later version | +| OceanBase Database in MySQL mode | V2.0.0 or a later version | + + + +This chapter describes in different topics the operations you can perform on stored procedure objects in ODC. + +* [Create a stored procedure](../../../6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) + + + +* [Manage stored procedures](../../../6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md new file mode 100644 index 00000000..f18bc7a3 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md @@ -0,0 +1,222 @@ +# Create a stored procedure + +ODC supports visualized stored procedure creation. This topic describes how to create a stored procedure with ODC. + +## Overview + +A stored procedure is a collection of one or more statements. To perform a series of complex operations on a database, you can use a stored procedure to encapsulate these complex operations into a reusable code block in the database. It helps developers reduce their workload. + +In OceanBase Database, a stored procedure is a collection of SQL statements for implementing a specific feature. After you compile and store a stored procedure in the database, you can specify the stored procedure name and the required parameters to call this stored procedure for accelerated execution of the SQL statements. + +A stored procedure can contain parameters and return values. + +### Differences between a stored procedure and a function + +* The return value of a function is a specific result value, while the return value of a stored procedure only indicates whether the execution is successful. + + + +* You can call a function by using a `SELECT` statement. You can call a stored procedure by using a `CALL` statement. + + + + + + +### Benefits of stored procedures + +* Improve the versatility and portability of the application: After you create a stored procedure, it can be repeatedly called by a program without rewriting the SQL statements of the procedure. In addition, stored procedures can be modified with no impact on the program source code, thereby improving the portability of the program. + + + +* Accelerate SQL execution: If an operation involves a large amount of SQL statements or repeated execution of the same SQL statements, you can compile the code into a stored procedure and execute the stored procedure, which is faster than separately executing the statements. + + + +* Alleviate the workload of the server: If one SQL statement is called at a time to perform operations on the database objects, a large number of SQL statements are transmitted. If an equivalent stored procedure, only the command for calling the procedure is sent, thereby reducing the network load. + + + + +![Overview](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%A6%82%E8%BF%B0-EN.png) + + +As shown in the preceding figure, you can create a stored procedure in the following five steps: + +1. Specify the name of the stored procedure. + +2. Specify parameters. + +3. Verify the parameters of the stored procedure. + +4. Edit the parameters of the stored procedure. + +5. Complete the stored procedure creation. + +## Procedure + +In the following example, a stored procedure named proc_total is created in the ODC console for the calculation of department budgets. The stored procedure contains two INT type input parameters budget_r and budget_s and calculates the sum of the two parameters. Procedure: + +### Step 1: Specify the name of the stored procedure. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Stored Procedure** in the left-side navigation pane to get a list of stored procedures. To create a stored procedure, click **+** in the upper-right corner of the Stored Procedure list or choose **Create** > **Stored Procedure** in the top navigation bar. + +In the **Create Stored Procedure** dialog box, enter a name for the stored procedure. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A41-EN.png) + +### Step 2: Specify parameters. + +1. Parameters specify the information passed to a function when the function is called. + + * In Oracle mode, specify the following fields: **Name**, **Mode**, **Type**, and **Default Value**. + + + + * In MySQL mode, specify **Name**, **Mode**, **Type**, and **Length**. + + + + + + +2. You can specify parameters by using one of the following three methods. + + + +| Method | Description | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------| +| Use the quick access toolbar | In the quick access toolbar, you can add, delete, and move up and down parameters. | +| Click the row number | - You can click a row number to select a row and display the quick access toolbar that allows you to delete the row or move the row up or down.
    - You can click a row number to select the row, and then drag the row to adjust its order. | +| Right-click | - Copy a row or move one row down: Drag the pointer to select a row, right-click it, and then select Copy or Move Down from the context menu that appears.
    - Copy a cell: Select a cell, right-click it, and then select Copy from the context menu that appears. | + + > **Note** + > + > After copying a row, you can select a row and paste the copied row data with the shortcut keys Command + V / Ctrl + V. + +3. You need to specify the mode for the parameters. + + OceanBase Database in both MySQL mode and Oracle mode supports the following parameter modes: **IN**, **OUT**, and **INOUT**. + + ```sql + CREATE PROCEDURE proc_name ([[IN |OUT |INOUT ] parameter_name parameter_type...]) + ``` + + + * Parameters + + + +| **Parameter** | Type | +| ------------- | ------------------------------------------------------------ | +| IN | Indicates an input parameter.
    When a stored procedure is called, the input parameter is passed to the stored procedure and used in the execution of the stored procedure. Usually, input parameters are only used to pass values in, and are not modified or returned in the call of a stored procedure. | +| OUT | Indicates an output parameter.
    When a stored procedure is called, the value of an output parameter is ignored and an empty value is passed to the stored procedure. The value of the output parameter is modified during the execution of the stored procedure. After the execution is complete, the modified value is assigned to the output parameter. Usually, output parameters are used to obtain the execution results of a stored procedure. Output parameters can be used to modify and return values in the call of a stored procedure. | +| INOUT | Indicates an inout parameter.
    An inout parameter is both an input parameter and an output parameter. | + + * Parameter settings + + + +| Property | Required | Default | Mode | +| ------------- | -------- | ------- | ------------ | +| Name | Yes | Empty | Oracle/MySQL | +| Mode | Yes | IN | Oracle/MySQL | +| Type | Yes | VARCHAR | Oracle/MySQL | +| Length | Yes | 45 | MySQL | +| Default value | No | Empty | Oracle | + + + + + + + +### Step 3: Verify the parameters of the stored procedure. + +Click **OK** to go to the Create Stored Procedure page. + +### Step 4: Edit the stored procedure. + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A44-EN.png) + +Edit the statements on the Create Stored Procedure page. + +In addition, the toolbar on the editing page provides the following buttons. + + +| Button | Description | +|-------|----------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | Click this button and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | + + + +You can edit the SQL statements of the created stored procedure on the Create Stored Procedure page. Syntax: + +```sql +CREATE PROCEDURE proc_name ( + [proc_parameter[,...]]) +IS +BEGIN +proc_body: +  Valid SQL routine statement +END [end_label] +``` + + + +Parameters + + +| Parameter | Description | +|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| proc_name | The name of the stored procedure. By default, a stored procedure is created in the current database. To create a stored procedure in a specific database, add the database name as the prefix to the name of the stored procedure in the format of db_name.sp_name.
    **Notice**
    The name of a stored procedure must differ from that of any built-in MySQL function. Otherwise, an error may occur. | +| [proc_parameter[,…] ] | The list of stored procedure parameters. A parameter is specified in the format of `[IN|OUT|INOUT] parameter_name parameter_type`.
    `parameter_name` specifies the parameter name and `parameter_type` specifies the parameter type, which can be any valid MySQL data type. If you need to specify multiple parameters, separate them with commas (,). A stored procedure can be created without a parameter. In this case, add a pair of parentheses after the name of the stored procedure.
    **Notice**
    The parameter names must differ from the column names in the data table. Otherwise, the SQL statements of the stored procedure may take a parameter name as a column name, which results in errors. | +| proc_body | The body of the stored procedure, which contains the SQL statements to be executed when the stored procedure is called.
    The body begins with **BEGIN** and ends with **END**. If the body contains only one SQL statement, you can omit the BEGIN and END flags. | + + + +### Step 5: Complete the stored procedure creation. + +Click **Create** in the upper-right corner to create the stored procedure. After a stored procedure is created, you can use the `CALL` statement to call it, just like how you call a built-in function. + +![5.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A45-EN.png) + +> **Note** +> To manage a stored procedure, right-click the stored procedure name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Edit**, **Run**, **Download**, **Delete**, and **Refresh**. + +For more information, see [Manage stored procedures](../4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md). + +Syntax: + +```sql +CALL proc_name ([proc_parameter [,...]]); +``` + + + +Example: + +```sql +CALL proc_total (30000, 20000); +``` + + + +![5.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A45-2-EN.png) + +## Related topics + +* [Create a table](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [Create a view](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [Create a function](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [Create a sequence](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [Create a program package](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [Create a trigger](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [Create a type](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +* [Create a synonym](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md new file mode 100644 index 00000000..f326a723 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md @@ -0,0 +1,113 @@ +Manage stored procedures +============================================= + + + +Overview +----------------------------- + +After you log on to OceanBase Developer Center (ODC), you can click the name of a connection on the homepage to go to the corresponding connection management page. In the left-side navigation pane, you can click **Stored Procedure** to get a list of stored procedures in the current database. + +In the stored procedure list, you can view the **Structure tree** of an object, or right-click the object to perform some **Management actions** on the object. You can also double-click the name of the stored procedure in the list to go to the **Stored procedure management page** . + +Structure tree +----------------------------------- + +You can click the expand icon ![2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p377780.jpg) before the name of the target stored procedure in the stored procedure list, and the structure tree of the stored procedure is displayed in a drop-down list, as shown in the following figure. + +The structure tree of a stored procedure can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section. In this section, you can find the table describing the management options. + +![Image 195](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-1-EN.png) + +Management actions +--------------------------------------- + +The names of stored procedure objects support ascending order by the head character by default in the stored procedure list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create stored procedure. | +| Filter | Click this option to display valid/invalid stored procedures. | +| Batch Compile | Click this option to batch compile the stored procedure object. Including: compile all objects and compile invalid objects.
    ![batch compile](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91-EN.png) | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the stored procedure, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Action | Description | +|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View | Click this option to go to the Stored procedure management page, where you can view comprehensive information such as the basic information, parameters, and code of the stored procedure. | +| Create | Click this option to go to the Create Stored Procedure page, where you can create a stored procedure as prompted. | +| Edit | Click this option to go to the Stored procedure editing page, which displays the statements that define the stored procedure and where you can edit the stored procedure. | +| Compile | Click this option to compile the stored procedure. | +| Debug | Click this option to go to the **debugging page** , where you can debug the stored procedure.
    **Note**
    ODC V4.0.0 and later support setting the parameter value as DEFAULT, NULL or empty string.
    | +| Run | Click this option to execute the stored procedure. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the stored procedure object. | +| Delete | Click this option to delete the stored procedure. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the stored procedure so that the structure tree displays the latest information.
    **Note**
  • We recommend that you upgrade to OBServer V2.2.77 or later. This is because some versions of OBServer have been found with PL/SQL debugging issues, which may compromise the OBServer stability.
  • ODC V3.2.2 or earlier does not support the debugging feature when you connect ODC to the target instance by using OBProxy. To use the debugging feature, directly connect ODC to the target instance.
  • ODC V3.2.2 and later support PL/SQL debugging when you connect to OBServer by using OBProxy.
  • | + + + +Stored procedure management page +----------------------------------------------------- + +![Parameters](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-2-EN.png) + +You can double-click the name of a stored procedure in the function list to go to the stored procedure management page. The stored procedure management page displays the following information: + + +| Section | Description | +|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This section displays the basic information about the stored procedure in fields such as **Stored Procedure Name** , **Created By** , **Creation At** , and **Last Modified At** . | +| Parameter | This section displays the information about the parameters in fields such as **Name** , **Mode** , **Data Type** , **Length** , and **Default Value** .Click the ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2672849361/p326053.jpg) icon to refresh the parameters. | +| DDL | This section displays the script that defines the stored procedure and provides the **Edit** , **Find** **,** **Format** , and **Refresh** buttons. **Note** Click the **Edit** icon to go to the PL object editing page. | + + + +Stored procedure editing page +-------------------------------------------------- + +Right-click the target item in the stored procedure list. In the menu that appears, click **Edit** to go to the stored procedure editing page. In the code area of the editing page, the statements that define the stored procedure are displayed. You can edit the statements. In addition, the toolbar provides the following buttons: + + +| Button | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Confirm modification | Click this button to apply the current modification. | +| Compile | Click this button to compile the statements on the current page. **Note** * During the compilation, a code line is highlighted if it contains the name of an external object that cannot be referenced. * After the compilation, the **Compilation Result** tab displays the compilation status. If alerts exist, the alert details are displayed. | +| Run | Click this button ![run](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p377781.jpg) to execute the statements in the code area. | +| Debug | Click this button ![debug](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p377782.jpg) to enter the debug mode, which allows you to edit the PL or SQL object in the code area. After the debugging, you can close the debugging window. | +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can add indents to or delete indents from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | +| IN Value Conversion | Click this button to convert the copied rows or columns into the specified format during queries. After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format. * Column values are separated with line breaks. * Row values are separated with spaces or tabs. | + + + +Stored procedure output page +------------------------------------------------- + +![Output](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p350898.png) + +After the stored procedure is executed, you can view the information of execution results in the **Output** and **DBMS Output** tabs. + + +| Tab | Description | +|-------------|----------------------------------------------------------------------------------------------------------------------------| +| Output | Displays the status, parameters, parameter types, parameter values, return type, and return value of the stored procedure. | +| DBMS Output | Displays DBMS outputs of the stored procedure. | + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/1.web-odc-sequence-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/1.web-odc-sequence-objects-overview.md new file mode 100644 index 00000000..2f1e12eb --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/1.web-odc-sequence-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +A sequence is a serial arrangement of numbers that automatically increase based on specific rules in the database. A sequence is generally used as the primary key or unique key of a table because it does not contain duplicate values. +**Notice** + + + +After you connect OceanBase Developer Center (ODC) to OceanBase Database V2.1.0 or a later version in Oracle mode, you can create sequence objects in ODC. The MySQL mode does not support this feature. + +Log on to ODC and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click Sequence in the left-side navigation pane to get a list of sequences. You can double-click a sequence name in the sequence list to go to the sequence management page. On this page, you can view the basic information, parameters, and DDL statements of the sequence. + +This chapter describes in different topics the operations you can perform on sequence objects in ODC. + +* [Create a sequence](../../../6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) + + + +* [Manage sequences](../../../6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md new file mode 100644 index 00000000..58a9eb7d --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md @@ -0,0 +1,43 @@ +Create a sequence +====================================== + +
    +

    Note

    +

    ODC V3.2.2 and later versions support connection to OceanBase Community Edition. Due to the function differences of different OceanBase Database versions, the sequence function of ODC does not support the OceanBase Community Edition (The menu entry will be disabled).

    +
    + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click **Sequence** in the left-side navigation pane to get a list of sequences. To create a sequence, click **+** in the upper-right corner of the sequence list or choose **Create \> Sequence** in the top navigation bar. Perform the following two steps to create a sequence: + +![](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7530269361/p138331.png) + +1. Set **Basic Info** : You need to specify **Sequence Name** and **User** . The User parameter is automatically specified based on the current account. + + + +2. Set columns. This step is optional. You need to specify the following parameters to set columns: + + + + | Parameter | Description | + |-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | From | Specifies the initial value of the sequence, which must not be less than the value of **Minimum Value** . | + | Increment | Specifies the step size for the auto-increment of sequence values. The value can be a negative number. | + | Minimum Value | Specifies the minimum value that can be obtained by the sequence. The minimum value supported by the database is -1026. | + | Maximum Value | Specifies the maximum value that can be obtained by the sequence. The maximum value supported by the database is 1027. | + | Cache Settings | Specifies the cache size for the sequence. A proper cache size can improve the performance in obtaining sequence values. You can also set the value to **No Cache** . | + | Whether to Sort | Specifies whether the sequence obtains values in an ordered manner. The performance of the sequence in obtaining values in an ordered manner is inferior to that in an unordered manner. | + | Cyclic or Not | Specifies whether to start from the minimum value again when the sequence value reaches the maximum value. | + + + +3. Click **Next: Verify SQL Statement** to go to the Create Sequence page. + + ![Confirm](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0582659361/p326072.png) + + +4. An SQL script is pre-generated based on the information you specified. After the SQL script is verified, click **Create** in the upper-right corner to run the script and generate a sequence. + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md new file mode 100644 index 00000000..48e630c3 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md @@ -0,0 +1,42 @@ +Manage sequences +===================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click **Sequence** in the left-side navigation pane to get a list of sequences. + +You can right-click the target object in the sequence list to perform some **Management actions** on the object. You can also double-click the target sequence in the sequence list to go to the **sequence Management** page. + +![Image 196](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-1-EN.png) + +Management actions +--------------------------- + +The names of sequence objects support ascending example by head character by default in the sequence list. +Right-click the target object in the sequence list. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Action | Description | +|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create Sequence | Click this option to go to the Create Sequence page, where you can create a sequence as prompted. | +| View Sequence | Click this option to go to the **sequence management page** , where you can view comprehensive information such as the basic information, attributes, and DDL statements of the sequence. | +| Modify | Click this option to go to the Attribute tab of the **sequence management page** to modify the information of the sequence. | +| Delete | Click this option to delete the sequence. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the sequence object. | +| Refresh | Click this option to refresh the list after you perform management actions on the sequence, so that the list displays the latest information. | + + + +Sequence management page +--------------------------------- + +[sequence2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-2-EN.png) +You can view the following information on the Sequence Management page. + + +| Section | Description | +|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This tab displays the basic information of a sequence in fields such as the **Sequence Name** and **Owner** . It also provides the **Edit** and **Refresh** icons.You can click **Edit** to modify the value of the following fields: **Increment** , **Minimum Value** , **Maximum Value** , **Cache Settings** , **Whether to Sort** , and **Cyclic or Not** . **Next Buffer Value** is the value of `last_number` in the sequence view. This value cannot be modified. | +| DDL | This section displays the script that defines the sequence. Click the ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2672849361/p326053.jpg) icon to refresh the parameters. **Note** Click the **Edit** icon to go to the PL object editing page. | + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/1.web-odc-package-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/1.web-odc-package-objects-overview.md new file mode 100644 index 00000000..739b37c5 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/1.web-odc-package-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +A package is a combination of related PL programming elements, such as functions, procedures, variables, and cursors. Packages are similar to classes in Java. Variables in a package are similar to member variables in a class, and functions and procedures are similar to methods in a Java class. A package is used to group identical or similar objects, to facilitate maintenance and management and improve development efficiency and performance. +**Notice** + + + +After you connect OceanBase Developer Center (ODC) to OceanBase Database V2.2.20 or a later version in Oracle mode, you can create package objects in ODC. The MySQL mode does not support this feature. + +Log on to ODC and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click package in the left-side navigation pane to get a list of packages. Double-click a package name in the package list to go to the package management page. On this page, you can view information such as the basic information and codes of the package header and package body. + +This chapter describes in different topics the operations you can perform on package objects in ODC. + +* [Create a package](../../../6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md) + + + +* [Manage packages](../../../6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md new file mode 100644 index 00000000..f6853d5f --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md @@ -0,0 +1,27 @@ +Create a program package +============================================= + +
    +

    Note

    +

    ODC V3.2.2 and later versions support connection to OceanBase Community Edition. Due to the function differences of different OceanBase Database versions, the program package function of ODC does not support the OceanBase Community Edition (The menu entry will be disabled).

    +
    + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Program Package** in the left-side navigation pane to get a list of program packages. To create a program package, click **+** in the upper-right corner of the program package list or click **Create** in the navigation bar on the top of the page. To create a program package, you need to create the package header and the package body. + +Create the package header +---------------------------------- + +Click the **+** icon in the upper-right corner of the package list, or click **Create** in the navigation bar to go to the Create Program Package page, where you can create the package header. + +![Create package](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3140269361/p326070.png) + +On the package creation page, specify the package name and click **Next: Verify SQL Statement** to go to the header definition page. + +ODC automatically generates the template statement, as shown in the following figure. In the navigation bar of the header definition page, ODC provides the **Format** button for you to standardize the statement format. After you complete the header definition statements, click **Create** in the upper-right corner to generate the header. + +![Image 197](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2178659361/p241381.png) + +Create the package body +-------------------------------- + +After you create the package header, the new program package appears in the program package list. Right-click the created program package and click **Create Package Body** to go to the package body definition page. This page is similar to the header definition page, as shown in the following figure. ODC automatically generates the template statement and provides the **Format** button for you to standardize the statement format. After you complete the package body definition statements, click **Create** in the upper-right corner to generate the package body.![Image 198](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2178659361/p241382.png) diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md new file mode 100644 index 00000000..8d61c4c1 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md @@ -0,0 +1,106 @@ +Manage program packages +============================================ + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Program Package** in the left-side navigation pane to get a list of program package objects in the current database. + +In the program package list, you can view the **structure tree** of an object. You can also right-click the target object to perform some **management actions** on the object. You can also double-click the name of a program package to go to the program package page, which provides a **Package Header** tab and a **Package Body** tab. + +Structure tree +----------------------------------- + +You can click the Expand icon before the name of the target program package in the program package list. Then, the structure tree of the program package displayed in a drop-down list, as shown in the following figure. The structure tree of a program package can have up to six levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section, where you can find the table describing the management options. + +![Image 227](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-1-EN.png) + +Management actions +--------------------------------------- + +The names of program package objects support ascending order by the head character by default in the program package list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create program package. | +| Filter | Click this option to display valid/invalid program packages. | +| Batch Compile | Click this option to batch compile the program package object. Including: compile all objects and compile invalid objects.
    ![batch compile](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91-EN.png) | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the program package, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Action | Description | +|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create Program Package | Click this option to go to the Create Program Package page, where you can create a program package header as prompted. | +| Create Package Body | Click this option to go to the package body definition page and create a program package body. | +| Edit the package header and package body | Click this option to open both the package header editing and package body editing pages, where you can edit the package header and the package body. | +| Delete | Click this option to delete the program package. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the program package, so that the structure tree displays the latest information. | +| View | Click this option to go to the Package Header tab or the Package Body tab, where you can view comprehensive information such as the basic information and code of the program package. | +| Edit | Click this option to go to the package header editing and package body editing pages, which display the package header and package body definition statements and where you can continue to edit the package header and the package body. | +| Compile | Click this option to compile the program package. | +| Debug | Click this option to go to the debugging page, where you can debug the program package. PL object debugging is supported only when OBServer V2.2.73 or a later version, or V3.0.00 or a later version is connected.
    **Note**
    ODC V4.0.0 and later support setting the parameter value as DEFAULT, NULL or empty string.
    | +| Run | Click this option to run the stored procedure or function in a subprogram in the program package body. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the program package object. | +| Delete | Click this option to delete the body of the program package. | + + + +Package Header tab +--------------------------------------- + +On the program package management page, click the **Package Header** tab. The following information is displayed: + + +| Section | Description | +|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This section displays the basic information about the program package in fields such as **Package Name** , **Created By** , **Created At** , and **Last Modified At** . | +| DDL | This section displays the code that defines the package header and provides the **Edit**, **Download**, **Find** , and **Refresh** buttons. You can click Edit to go to the package header editing page.
    **Note**
    Click the **Edit** icon to go to the PL object editing page. | + + + +Package Body tab +------------------------------------- + +On the program package management page, click the **Package Body** tab. The following information is displayed: + + +| Section | Description | +|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This section displays the basic information about the package header in fields such as **Package Name** , **Created By** , **Created At** , and **Last Modified At** . | +| DDL | This section displays the script that defines the function and provides the **Edit** , **Find** , and **Refresh** icons. **Note** Click the **Edit** icon to go to the PL object editing page. | + + + +Package header/body editing page +----------------------------------------------------- + +![programpackage2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-2-EN.png) + +Right-click the target object in the program package list. In the shortcut menu that appears, click **Edit** to go to the program package editing page. The code area of the editing page displays statements that define the program package. You can edit the statements. In addition, the toolbar provides the following buttons: + + +| Button | Description | +|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Confirm Modification | Click this button to apply the current modification. | +| Compile | Click this button to compile the statements on the current page. This button is available only on the package body editing page. | +| Abort | Click this button to abort the statement that is being executed. | +| Debug | Click this option to go to the debugging page, where you can debug the program package. PL object debugging is supported only when OBServer V2.2.70, V3.0.00, or a later version is connected. | +| Format | Click this button to apply the formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three configurations: **All Uppercase** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding button to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | You can add indents to or delete indents from the statements that you selected. | +| Comment | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | +| IN Value Conversion | Click this button to convert the copied rows or columns into the specified format during queries. After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format. * Column values are separated with line breaks. * Row values are separated with spaces or tabs. | + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/1.web-odc-trigger-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/1.web-odc-trigger-objects-overview.md new file mode 100644 index 00000000..bd26d28e --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/1.web-odc-trigger-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +Triggers are special stored procedures that are triggered by events but cannot be explicitly called. Therefore, triggers are used to monitor specific situations and trigger corresponding actions. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click Trigger in the left-side navigation pane to get a list of triggers. Click **+** in the upper-right corner of the list to go to the Create Trigger page. You can also double-click the name of a trigger in the list to go to the trigger management page. On this page, you can view the basic information and codes of the trigger. +**Notice** + + + +After you connect ODC to OceanBase Database V2.2.20 or a later version in Oracle mode, you can create trigger objects in ODC. The MySQL mode does not support this feature. + +This chapter describes in different topics the operations you can perform on trigger objects in ODC. + +* [Create a trigger](../../../6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) + + + +* [Manage triggers](../../../6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md new file mode 100644 index 00000000..f75a4d3d --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md @@ -0,0 +1,119 @@ +Create a trigger +===================================== + +
    +

    Note

    +

    ODC V3.2.2 and later versions support connection to OceanBase Community Edition. Due to the function differences of different OceanBase Database versions, the trigger function of ODC does not support the OceanBase Community Edition (The menu entry will be disabled).

    +
    + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Trigger** in the left-side navigation pane to get a list of triggers. To create a trigger, click **+** in the upper-right corner of the trigger list or click **Create** in the navigation bar on the top of the page + +To create a trigger, perform the following three steps: + +1. Specify the basic information. + + + +2. Configure the advanced settings. + + + +3. Verify the SQL statement. + + + + + + +![Image 548](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9989620261/p268312.png) + +Specify the basic information +-------------------------------------------------- + +This is Step 1. The **Basic Inf** **ormation** section contains the following parameters: + +* **Trigger Name** : specifies the name of the trigger. + + + +* **Base Object Mode** : specifies the schema where the object that the trigger works on is located. + + + +* **Base Object Type** : specifies the type of the object that the trigger works on. The current version supports only **TABLE** objects. + + + +* **Base Object Name** : specifies the name of the object that the trigger works on. + + + +* **Trigger Status** : specifies the state of the trigger. Valid value: **On** or **Disable** . + + + + + + +Configure the advanced settings +---------------------------------------------------- + +This is Step 2. The **Advanced Settings** section contains the following parameters: + +* **Trigger Type** : specifies the type of the trigger. The current version supports only **SIMPLE** triggers. + + + +* **Trigger** : specifies whether the trigger is activated before or after the triggering event. Valid value: **BEFORE** or **AFTER** . + + + +* **Level** : specifies the level of the trigger. The current version supports only row-level triggers. + + + +* **Event** : specifies the type of operation that activates the trigger. Valid value: **INSERT** , **UPDATE** , or **DELETE** . + + + +* **Column (Optional)** : specifies the range that the event specified in **Event** applies to. This parameter is displayed when you set **Event** to **UPDATE** . The current version allows you to create only row-level triggers in a table. Therefore, the range here is the columns that the event applies to. + + + +* **Referencing Old** **(Optional)** : specifies an alias for the referenced object that corresponds to the value specified for `REFERENCEING OLD` in the trigger creation statement. + + + +* **Referencing New** **(Optional)** : specifies an alias for the referenced object that corresponds to the value specified for `REFERENCEING NEW` in the trigger creation statement. + + + +* **Clause Condition** **(Optional)** : specifies a logical expression for the trigger. After you specify a clause condition, the action specified by the trigger is executed only if the value of the expression is True. + + + + + + +Verify the SQL statement +--------------------------------------------- + +After you specify all the information in the **Basic Info** and **Advanced Settings** sections, click **Next: Verify SQL Statement** to go to the statement editing page. + +The trigger definition statement is generated on the statement editing page based on the information that you specified in the **Basic Info** and **Advanced Settings** sections. You only need to complete the trigger body, which specifies the action to be executed. After you complete the trigger body, click the **Create** button in the upper-right corner of the page to complete the creation of the trigger. + +In addition, the toolbar on the editing page provides the following buttons: + + +| Button | Description | +|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can specify search criteria in the search box to find specific content in the script and enter other content in the replacement box to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three configurations: **All Caps** , **All Lowercase** , and **Capitalize the first letter** . Click this button to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | The **Add Indents** and **Delete Indent** options are provided, to allow you to add indents to or delete indents from the selected statements in the script. | +| Comment | The **Add Comments** and **Delete Comment** options are provided, which respectively allow you to convert the selected statements in the script to comments and convert comments to SQL statements. | +| Previous | Click this button to go back to the **Create Trigger** page, where you can continue to edit or modify the parameters in the **Basic Information** and **Advanced Settings** sections. | + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md new file mode 100644 index 00000000..02629706 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md @@ -0,0 +1,81 @@ +Manage triggers +==================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Trigger** in the left-side navigation pane to get a list of triggers. The trigger list displays the trigger objects in the current database. You can right-click the target object to perform some management actions on the object. You can also double-click the name of the target trigger in the trigger list to go to the trigger management page. + +![Image 647](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-1-EN.png) + +Management actions +--------------------------------------- + +The names of trigger objects support ascending order by the head character by default in the trigger list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create trigger. | +| Filter | Click this option to display valid/invalid triggers. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the trigger, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the list. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Option | Description | +|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Trigger | Click this option to go to the trigger management page, where you can view the basic information, parameters, and code of the trigger. | +| Create Trigger | Click this option to go to the Create Trigger page, where you can create a trigger as prompted. | +| Edit | Click this option to go to the trigger editing page, which displays the statements that define the trigger and where you can continue to edit the trigger. | +| Compile | Click this option to compile the trigger. | +| Enable | Click this option to enable the trigger. | +| Disable | Click this option to disable the trigger. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the trigger object. | +| Delete | Click this option to delete the trigger. | +| Refresh | Click this option to refresh the list after you perform management actions on the trigger, so that the list displays the latest information. | + + + +Trigger management page +-------------------------------------------- + +[trigger2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-2-EN.png) + +You can double-click the name of the target trigger in the trigger list to go to the trigger management page, which provides the following three tabs: + +* **Basic Info** : displays information such as **Name** , **Owner** , and the **Trigger State** of the trigger. + +* **Base Object** : displays information such as **Name** , **Owner** , and **Type** of the base object of the trigger. + +* **DDL** : displays the script that defines the trigger and provides the **Edit** , **Find** , and **Refresh** buttons. You can click Edit to go to the trigger editing page. + + + + + + +Trigger editing page +----------------------------------------- + +To go to the trigger editing page, right-click the target trigger in the trigger list and choose **Edit** from the shortcut menu that appears. You can also click the **Edit** button on the DDL tab of the trigger management page to go to this page. The code area on the editing page displays the statements that define the trigger. You can edit the statements. In addition, the toolbar provides the following buttons: + + +| Button | Description | +|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can specify search criteria in the search box to find specific content in the script and enter other content in the replacement box to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three configurations: **All Caps** , **All Lowercase** , and **Capitalize the first letter** . Click this button to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | The **Add Indents** and **Delete Indent** options are provided, to allow you to add indents to or delete indents from the selected statements in the script. | +| Comment | The **Add Comments** and **Delete Comment** options are provided, which respectively allow you to convert the selected statements in the script to comments and convert comments to SQL statements. | +| Confirm Modification | Click this button to apply the current modification. | + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/1.web-odc-type-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/1.web-odc-type-objects-overview.md new file mode 100644 index 00000000..a8c5d77c --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/1.web-odc-type-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +You can create custom object types in OceanBase Database. A type in OceanBase Database is similar to a class in Java. A class has attributes and methods, and methods in Java are equivalent to functions and stored procedures in OceanBase Database. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. Click Type in the left-side navigation pane to get a list of types. Click the **+** button in the upper-right corner of the list to go to the type creation page. You can double-click the name of a type in the list to go to the type management page, where you can view the basic information and code of the type. +**Notice** + + + +After you connect ODC to OceanBase Database V2.2.20 or a later version in Oracle mode, you can create type objects in ODC. The MySQL mode does not support this feature. + +This chapter describes in different topics the operations you can perform on type objects in ODC. + +* [Create a type](../8.web-odc-type-objects/2.web-odc-create-a-type.md) + + + +* [Manage types](../8.web-odc-type-objects/3.web-odc-manage-types.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/2.web-odc-create-a-type.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/2.web-odc-create-a-type.md new file mode 100644 index 00000000..6b6a75a2 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/2.web-odc-create-a-type.md @@ -0,0 +1,164 @@ +# Create a type + +
    +

    Note

    +

    ODC V3.2.2 and later versions support connection to OceanBase Community Edition. Due to the function differences of different OceanBase Database versions, the type function of ODC does not support the OceanBase Community Edition (The menu entry will be disabled).

    +
    + +ODC supports visualized type creation. This topic describes how to create a type with ODC. + +## Overview + +A database type object specifies the name, method, and other attributes of a type. + +OceanBase Developer Center (ODC) supports three types: object type, array type, and table type. + +* Object type: an abstract data type (ADT), which is an expression that encapsulates database objects, relationships between database objects, and basic operations on database objects. + + + +* Array type: a variable array, which is a collection similar to a nested table. A variable array is a collection of objects, where each object is of the same data type. The size of a variable array is determined when the array is created. The data type of a column in a table can be a variable-length multidimensional array. The type of the array can be any of the primitive types, the enumerated type, the composite type, or a user-defined type. + + + +* Table type: an independent nested table type. The created arrays are directly defined in the columns of the table. + + +![Create a type](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-EN.png) + + +As shown in the preceding figure, you can create a type in the following four steps:. + +1. Specify the type name. +2. Select a type object. +3. Edit SQL statements. +4. Complete the type creation. + +## Procedure + +In the following example, the ob_var object type is created in the ODC console. The type contains two VARCHAR type parameters: var and var1. Procedure: + +### Step 1: Specify the name of the type. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Type** in the left-side navigation pane to get a list of types. To create a type, click **+** in the upper-right corner of the type list or click **Create** in the top navigation bar. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A41-EN.png) + +### Step 2: Select a type object. + + + +| Type | Description | Example | +|------|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| Object Type | The ADT.
    **Note**
    Only the object type can contain a subprogram. | ``` CREATE OR REPLACE TYPE ob_var AS OBJECT( var varchar2(10), var1 varchar(10) ); ``` | +| Array Type | The independent variable array (VARRAY) type. | ``` CREATE OR REPLACE TYPE test AS VARRAY(20) of varchar2(20); ``` | +| Table Type | The independent nested table type. | ```CREATE OR REPLACE TYPE test AS TABLE OF varchar2(100 BYTE);``` The `AS TABLE OF` clause allows you to create an array list\. | + + + +### Step 3: Edit SQL statements. + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A43-EN.png) + +After you specify the information in Step 2, click **Next: Verify SQL Statement** to go to the statement editing page. This page displays the corresponding type definition statements generated based on the information you specified in the **Create Type** dialog box. You must complete the statements based on your needs. After you complete the statements, click **Create** in the upper-right corner to complete the type creation. + +In addition, the toolbar on the editing page provides the following buttons. + + +| Button | Description | +|-------|----------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | Click this button and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | +|IN Value Conversion|A format such as A B can be converted to ('A','B') format.| + + + +### Step 4: Complete the type creation. + +Click **Create** in the upper-right corner to create the type. After a user-defined type is created, you can use the `INSERT` key word to call it in a PL statement. + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A44-EN.png) + +> **Note** +> To manage a type, right-click the type name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Delete**, **Download**, and **Refresh**. +> For more information, see [Manage types](../8.web-odc-type-objects/3.web-odc-manage-type.md). + +Example: + +```sql +-- Create a table. +create table data_type (id number(10),name varchar2(50),age int,address varchar2(50),salary float); + +-- Insert table data. +insert into data_type values(1,'baba',20,'hangzhou',3000.00); + +-- Create a type. +create or replace type ob_var as object( + var varchar2(10), + var1 varchar(10) +); + +delimiter / +-- Create a stored procedure. +create or replace procedure p_datatype is +begin + declare + rec data_type%rowtype; + v_age rec.age%type; + var varchar2(50); + v_name var%type; + v_salary data_type.salary%type; + +-- Define a type. + type salary is table of number index by varchar2(20); + arr salary; + v_arr arr%type; + + CURSOR c2 IS SELECT name, age FROM data_type; + c_row c2%rowtype; + v_rec c_row%type; + + ob ob_var; + v_obj ob%type; + + begin + v_name := 'ali '; + v_age := 30; + v_salary := 2000; + dbms_output.put_line('Referenced item: variable, record, and table column name: ' || v_name || ' * ' || v_age || ' * ' || v_salary); + + v_arr('James') := 78000; + dbms_output.put_line('Referenced item: name of collection variable ' || v_arr.FIRST); + + open c2; + fetch c2 into v_rec; + dbms_output.put_line('Referenced item: name of cursor variable: ' || v_rec.name || ' * ' || v_rec.age); + close c2; + + v_obj:=ob_var('test','object'); + dbms_output.put_line('Referenced item: name of object instance: ' || v_obj.var || ' * ' || v_obj.var1); + end; +end; +/ + +begin + p_datatype; +end; +/ +``` + +## Related topics + +* [Create a table](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [Create a view](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [Create a function](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [Create a stored procedure](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [Create a program package](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [Create a trigger](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [Create a synonym](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/3.web-odc-manage-type.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/3.web-odc-manage-type.md new file mode 100644 index 00000000..cf98e8ac --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/3.web-odc-manage-type.md @@ -0,0 +1,55 @@ +Manage types +================================= + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Type** in the left-side navigation pane to get a list of types The type list displays the type objects in the current database. You can right-click the target object in the type list to perform some management actions on the object. You can also double-click the target type in the type list to go to the type management page. + +Structure tree +----------------------------------- + +You can click the expand icon before the name of the target type in the type list, and the structure tree of the type is displayed in a drop-down list, as shown in the following figure. The structure tree of a type can have up to five levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section, where you can find the table describing the management options. + +![Image 648](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%B1%BB%E5%9E%8B-1-EN.png) + +Management actions +--------------------------------------- + +The names of type objects support ascending order by the head character by default in the type list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create type. | +| Filter | Click this option to display valid/invalid types. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the type, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. + +The following table describes the management options. + + +| Option | Description | +|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Type | Click this option to go to the type management page, where you can view the basic information and codes of the type. | +| Create Type | Click this option to go to the **Create Type** page, where you can create a type as prompted. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the type object. | +| Delete | Click this option to delete the type. | +| Refresh | Click this option to refresh the list after you perform management actions on the type, so that the list displays the latest information. | + + +Type management page +----------------------------------------- + +You can double-click the name of the target type in the type list to go to the type management page. This page provides two tabs: + +* **Basic Info** : displays information such as **Name** , **Owner** , **Type** , **Creation Time** , and **Modified At** of the type object. + +* **DDL** : displays the script that defines the type and provides the **Download** , **Find**, **Refresh** and **Format** buttons. You can click Edit to go to the type editing page. \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/1.web-odc-synonym-objects-overview.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/1.web-odc-synonym-objects-overview.md new file mode 100644 index 00000000..998f2073 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/1.web-odc-synonym-objects-overview.md @@ -0,0 +1,29 @@ +Overview +============================= + +A synonym is an alias of a database object. It is often used to simplify object access and improve the security of object access. Similar to views, synonyms do not consume storage space, and only the synonym definitions are stored in the data dictionary. Synonyms are divided into public synonyms and common synonyms. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click Synonym in the left-side navigation pane to get a list of synonyms. You can click **+** in the upper-right corner of the list to go to the synonym creation page. You can also double-click a synonym name in the list to go to the synonym management page. On this page, you can view the basic information and codes of the synonym. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.2.0 or a later version | +| OceanBase Database in MySQL mode | V2.2.0 or a later version | + + + +This chapter describes in different topics the operations you can perform on synonym objects in ODC. + +* [Create a synonym](../../../6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) + + + +* [Manage synonyms](../../../6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md new file mode 100644 index 00000000..f809de21 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md @@ -0,0 +1,144 @@ +# Create a synonym + +
    +

    Note

    +

    ODC V3.2.2 and later versions support connection to OceanBase Community Edition. Due to the function differences of different OceanBase Database versions, the synonym function of ODC does not support the OceanBase Community Edition (The menu entry will be disabled).

    +
    + +ODC supports visualized synonym creation. This topic describes how to create a synonym with ODC. + +## Overview + +A synonym is an alias that you create for a database object of another user. You can perform operations on the object by querying and operating the synonym. + +Synonyms are similar to views. You can use synonyms to add, delete, modify, and query table data. You can define synonyms for most database objects in OceanBase Database, such as tables, views, materialized views, sequences, functions, stored procedures, packages, and synonyms. + +Synonyms extend the availability of database objects and allow them to be accessed by different database users with the required privileges. This design simplifies and secures access to database objects. + +### Synonym types + +OceanBase Database supports synonyms and public synonyms. + +* Synonyms: In general, a synonym created by a regular user is a private synonym. A private synonym can be accessed by the user who created it or other users who are granted the required privileges. To create a private synonym under the current user, you must have the CREATE SYNONYM privilege. + + + +* Public synonyms: A public synonym is created by a user who is granted the administrator role, such as the system user account, and can be accessed by all users. + + + +For more information, see [Synonyms](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.2/synonyms). + +![Create a synonym](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-EN.png) + +As shown in the preceding figure, you can create a synonym in the following eight steps: + +1. Specify the synonym name. +2. Specify the object owner. +3. Specify the object type. +4. Specify the object name. +5. Specify the synonym type. +6. Verify the information about the synonym. +7. Edit the synonym. +8. Complete the synonym creation. + +## Procedure + +In this example, a synonym named syn_employee is created in the OceanBase Developer Center (ODC) console for an employee table in the SYS database. Procedure: + +### Step 1: Specify the name of the synonym. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Synonym** in the left-side navigation pane to get a list of synonyms and a list of public synonyms. To create a synonym, click **+** in the upper-right corner of the synonym list or choose **Create** > **Synonym** in the top navigation bar. + +In the **Create Synonym** dialog box, specify the name of the synonym. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-1-EN.png) + +### Step 2: Specify the object owner. + +Specify the schema where the object is located. + +### Step 3: Specify the object type. + +Specify the object type. Valid values: Table and View. + +### Step 4: Specify the object name. + +Specify the name of the object for which the synonym is created. + +### Step 5: Specify the synonym type. + +Specify the synonym type. Valid values: Synonym and Public Synonym. + +### Step 6: Verify the information about the synonym. + +Click **Next: Verify SQL Statement** to go to the Create Synonym page. + +### Step 7: Edit the synonym. + +![7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-7-EN.png) + +Edit the statement on the Create Synonym page. + +On the statement editing page, a synonym definition statement is generated based on the information specified in the **Create Synonym** dialog box. You can modify this statement. After you confirm the statement, click the **Create** button in the upper-right corner of the page to complete the synonym creation. A synonym cannot be modified after it is created. + +Before a synonym is created, you can edit the SQL statements of the synonym on the Create Synonym page. Syntax: + +```sql +CREATE OR REPLACE SYNONYM syn_name FOR schema_name.object_name; +``` + + + +Parameters + + +| Parameter | Description | +|-------------|----------------------------------------------------| +| OR REPLACE | Updates a synonym if the synonym already exists. | +| syn_name | The name of the synonym. The name of a synonym must be unique in the specified schema. | +| schema_name | The database schema to which the object belongs. | +| object_name | The name of the object. | + + + +### Step 8: Complete the synonym creation. + +Click **Create**. After you create a synonym, you can use it in the same way as a built-in synonym. + +![8.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-8-1-EN.png) + + +> **Note** +> To manage a synonym, right-click the synonym name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Delete**, **Download**, and **Refresh**. + +For more information, see [Manage synonyms](../9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md). + +Syntax: + +```sql +SELECT * FROM syn_name ([syn_parameter[,...]) +``` + + + +Example: + +```sql +SELECT * FROM syn_employee; +``` + + + +![8.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-8-2-EN.png) + +## Related topics + +* [Create a table](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [Create a view](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [Create a function](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [Create a stored procedure](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [Create a program package](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [Create a trigger](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [Create a type](../8.web-odc-type-objects/2.web-odc-create-a-type.md) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md new file mode 100644 index 00000000..e0172eb7 --- /dev/null +++ b/en-US/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md @@ -0,0 +1,57 @@ +Manage synonyms +==================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Synonym** in the left-side navigation pane to get a list of synonyms or a list of public synonyms. The synonym list displays the synonym objects in the current database. You can right-click the target object in the synonym list to perform some management actions on the object. You can also double-click the target synonym to go to the synonym management page. +![Image 690](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%90%8C%E4%B9%89%E8%AF%8D-1-EN.png) + + +Management actions +--------------------------------------- + +The names of type objects support ascending order by the head character by default in the type list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create type. | +| Filter | Click this option to display valid/invalid types. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the type, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. + +The following table describes the management options. + + +| Option | Description | +|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Type | Click this option to go to the type management page, where you can view the basic information and codes of the type. | +| Create Type | Click this option to go to the **Create Type** page, where you can create a type as prompted. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the type object. | +| Delete | Click this option to delete the type. | +| Refresh | Click this option to refresh the list after you perform management actions on the type, so that the list displays the latest information. | + + + + +Synonym management page +-------------------------------------------- + +Double-click the target synonym in the synonym list to go to the synonym management page, which provides the following two tabs: + +* **Basic Info** : displays synonym information such as **Name** , **Object** **Owner** , **Object Name** , **Creation Time** , and **Modified At** . + +* **DDL** : displays the script that defines the synonym. A synonym cannot be modified after it is created. You can **Download** and **Format** the synonym. + + + + + diff --git a/en-US/6.web-odc-user-guide/12.web-odc-help-center.md b/en-US/6.web-odc-user-guide/12.web-odc-help-center.md new file mode 100644 index 00000000..fa108834 --- /dev/null +++ b/en-US/6.web-odc-user-guide/12.web-odc-help-center.md @@ -0,0 +1,65 @@ +Help center +================================ + + + +Overview +----------------------------- + +In the upper-right corner of the OceanBase Developer Center (ODC) homepage, you can click **Help** in the top navigation bar to view **New Features** and **View Help Documentation** . You can also obtain product information and email address on **About Developer Center** and **Feedback** tabs. + +![Image 909](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1413960461/p313332.png) + +Features +----------------------------- + +When you access ODC for the first time, the **Features** dialog box automatically appears. It displays the features and core functions of the current version to help you quickly learn about ODC. + +After you close the dialog box, you can select **Features** in the **Help** menu to open it again. +**Note** + + + +The Features dialog box may display different information based on user permissions. + +View help documentation +-------------------------------------------- + +To view the help documentation, click **Help** in the top navigation bar, and select **View Help Documentation** in the drop-down list. + +* If you are using Web ODC, the help documentation is displayed in HTML format on a new tab of the browser. + + + +* If you are using Client ODC, the help documentation is displayed in a browse window. + + + + + + +To view the product documentation of the latest or history versions, you can go to **[OceanBase documentation center](https://www.oceanbase.com/en/docs/enterprise/oceanbase-developer-center/odc/V3.3.1/product-updates)**. + +About developer center +------------------------------------------- + +Select **About Developer Center** in the drop-down list of **Help** to display a window. This window displays information such as the product name, version number, release date, official website URL, and copyright. + +![Image 910](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0897962561/p313341.png) + +Feedback +----------------------------- + +To send your feedback, select **Feedback** in the drop-down list of **Help** . + +* If you are using Web ODC, you can see the email address of ODC Technical Support odcsupport@service.alipay.com in the dialog box that appears. You can send your suggestions to that email address. + + + +* If you are using Client ODC, the dialog box of Feedback also provides you the feature of downloading the feedback package. You can click **Generate information package** in the dialog box to pack frontend and backend logs, system environment, and other information into a feedback package. + + ![Image 911](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1413960461/p313345.png) + + + + diff --git a/en-US/6.web-odc-user-guide/2.web-odc-homepage.md b/en-US/6.web-odc-user-guide/2.web-odc-homepage.md new file mode 100644 index 00000000..9f1d6912 --- /dev/null +++ b/en-US/6.web-odc-user-guide/2.web-odc-homepage.md @@ -0,0 +1,114 @@ +# ODC homepage + +## Overview + +After you log on to OceanBase Developer Center (ODC), the ODC homepage automatically appears. + +On the ODC homepage, you can view the session history, [tasks](../6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md), [operating records](../6.web-odc-user-guide/8.web-odc-view-operation-records.md), and [help documentation](../6.web-odc-user-guide/12.web-odc-help-center.md). You can also perform the following operations on the page: managing database connections, switching the language, setting personal information, changing the password, and logging off ODC. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/1-EN.png) + +## Manage database connections + +The ODC homepage provides the **Private Connections** tab that shows the connections you have created, the **Public Connections** tab that shows the public connections that you have the permission to access, and the **All Connections** tab that shows all connections. + +* **All Connections**: On the **All Connections** tab, you can [create a private connection](../6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md), [apply for the permission on a public connection](9.web-odc-task-management/7.web-odc-apply-for-permissions-task.md), and search for, filter, sort, and refresh connections. + +* **Private Connections**: On the **Private Connections** tab, you can [create a private connection](3.web-odc-connect-database/1.web-odc-create-private-connection.md), [apply for the permission on a public connection](9.web-odc-task-management/7.web-odc-apply-for-permissions-task.md), and search for, filter, sort, and refresh connections. For more information, see [Manage private connections](3.web-odc-connect-database/2.web-odc-manage-connections.md). + + + +* **Public Connections**: On the **Public Connections** tab, you can [create a private connection](3.web-odc-connect-database/1.web-odc-create-private-connection.md), [apply for the permission on a public connection](9.web-odc-task-management/7.web-odc-apply-for-permissions-task.md), and search for, filter, sort, and refresh connections. For more information, see [Manage public connections](4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md). + + +## View session history + +On the ODC homepage, you can click **History** in the left-side navigation pane to go to the session history page. + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/history-3-EN.png) + +The page shows a list that has the following columns. + + +| Column | Description | +|-----------|----------------------------------------------------| +| Connection Name | The name of the connection you accessed. | +| Database/Schema Name | The name of the database or schema that you accessed by using the connection. | +| Recently Opened At | The time when you last accessed the connection. | +| SQL/PL Window | The workspace window that you created when you accessed the connection. Move the pointer to a window name, and the script that you edited in the window is displayed. | +| Actions | You can click **Open** to resume the connection in a new window. The corresponding workspace window and its content are also resumed. | + + +> **Note** +> By default, the historical records in the panel are stored for 48 hours. You can restore the content in an unsaved SQL window based on records in the panel. + +## Manage tasks + +On the ODC homepage, you can click **Task** in the left-side navigation pane to create and view tasks. For more information, see [Manage tasks](9.web-odc-task-management/1.web-odc-task-management-overview.md). + +Public resource console +---------------------------- + +As a database development platform for enterprises, ODC provides the public resource console for the ODC administrator to manage users, grant permissions, and allocate resources. +> **Notice** +> The **Public Resource Console** tab is displayed on the ODC homepage only when you log on as an administrator. + +On the ODC homepage, click **Console** in the left-side navigation pane to go to the public resource management page. + +The console allows you to manage users, roles, public connections, resource groups, automatic authorization rules, task processes, desensitization rules, and system settings. + +You can grant users the permissions to use public and private resources by roles. You can also use a resource group to batch grant or revoke the permissions for multiple public connections. For more information, see [Manage public resources](4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md). + +Switch the theme +------------------------- + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/theme-4-EN.png) + +In the lower-left corner of the ODC homepage, choose **Me** > **Theme** to switch the theme to **Default Theme** or **Dark Theme**. + +Switch the language +------------------------- + +In the lower-left corner of the ODC logon page or ODC homepage, choose **Me** > **Language** to view the display language of ODC. The default language is **Simplified Chinese**. You can click the language option to switch the display language. ODC supports **English**, **Simplified Chinese**, and **Traditional Chinese**. + +Personal settings +------------------------- + + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/setting-5-EN.png) + +In the lower-left corner of the ODC homepage, choose **Me** > **Preferences**. The **Edit Personal Settings** panel appears. + +In the panel, you can globally modify the settings of the customizable features. You can also select a connection and configure these features in the connection. The configurations take effect on the current connection. The priority of personal settings is lower than that of settings you configured for each connection. In addition, the personal settings are persisted. + +Your modifications to fields in the **Edit Personal Settings** panel take global effect. + + +| Parameter | Description | +|-------------------|----------------------------------------------------------------------------------------------------| +| Session Mode for SQL Window | The session mode of the SQL window. | +| Delimiter Settings | The default delimiter for executing PL/SQL statements in the SQL window. Five types of delimiters are supported: semi-colons (**;**), slashes (**/**), double slashes (**//**), dollar signs (**$**), and double dollar signs (**$$**). | +| Transaction Commit Mode in Oracle Mode | The default transaction commit mode in Oracle mode. Valid values: **Manual** and **Automatic** | +| Transaction Commit Mode in MySQL Mode | The default transaction commit mode in MySQL mode. Valid values: **Manual** and **Automatic** | +| Maximum Number of Rows in Result Set | The default number of rows returned for an SQL statement executed in the SQL window. | +| Type of Statements Generated by Dragging and Dropping Object | The default type of statements generated when you drag and drop table or view objects. | + + + +Change the password +------------------------- + +In the lower-left corner of the ODC homepage, choose **Me** > **Change Password**. The **Change Password** dialog box appears. For more information, see [Change the password](1.log-on-to-odc/2.change-password.md). + +Log off +------------------------- + +In the lower-left corner of the ODC homepage, choose **Me** > **Log Off** to return to the ODC logon page. + +Help +------------------------- + +In the lower-left corner of the ODC homepage, you can click **Help** to view tutorial documents of some common operations in ODC, new features in the current version, and FAQ. + +Click the document you want to view on this tab. The introduction and link to the document are displayed in a dialog box. You can click the link to view the document. + diff --git a/en-US/6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md b/en-US/6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md new file mode 100644 index 00000000..da8f95d4 --- /dev/null +++ b/en-US/6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md @@ -0,0 +1,71 @@ +Create a private connection +================================================ + + + +Overview +----------------------------- + +After you log on to the homepage of OceanBase Developer Center (ODC), you can click **Create Connection** in the upper-right corner of the **Private Connection** tab to create a private connection. + +After you create the connection, you can view the saved database connection in the connection list on the ODC homepage. + + + +> **Notice**
    +>
  • In ODC V2.3.0 and later versions, the root@sys user permissions are required to query views when you use the import and export features. Therefore, to use the import and export features, you need to set the root@sys user in the Advanced Configuration section during connection creation.
  • +>
  • The root@sys user permissions are also required to view the partition information. Therefore, to display the table partition information, you must also set the root@sys user in the Advanced Configuration section during connection creation.
  • +>
  • ODC V3.3.0 and later versions support independent sessions and shared sessions. In independent session mode, each SQL window corresponds to one database session, and all modifications affect only the current window. In shared session mode, all SQL windows share one database session, and modifications in any SQL window affect other SQL windows.
  • +>
  • In manual-commit mode, make sure to set the `ob_trx_idle_timeout` parameter to a value greater than or equal to the timeout value of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of the `ob_trx_idle_timeout` parameter, the connection is terminated. However, if the `ob_trx_idle_timeout` parameter is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you must set this parameter to a proper value.
  • + + + + + + +Procedure +------------------------------ + +Perform the following steps to create a connection: + + +1. Log on to ODC and click **Create Connection** in the upper-right corner of the **Private Connection** tab. + + + +2. In the Create Connection panel, specify the fields described in the following table. If you have an OceanBase connection string, which follows the mysql -h **host name** -P **port number** -u **database username@tenant name** # **cluster name** -D **default database** -p ' **database password** ' format, you can obtain the information from the string. You can also paste the string in the field of Intelligent Parsing on the panel to automatically populate the corresponding fields. + + + + | Field | Description | + |-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Intelligent Parsing | You can paste a connection string to the field. ODC automatically identifies the string and fills in the corresponding fields on the page. | + | Connection Type | Select **MySQL** or **Oracle** . Logical databases support only the MySQL mode. | + | Endpoint | * **Host IP** : the IP address of the server where the target database is located. * **Port** : the port number of the server where the target database is located. * **Cluster name** : the name of the cluster where the target database is located. This parameter is not required for logical databases. * **Rent name** : the name of the tenant in which the target database is located. This parameter is not required for logical databases. **Note** You can obtain the host name and port number from the details page of the tenant in which the target database is located, such as a tenant created on Alibaba Cloud or in OceanBase Cloud Platform (OCP). | + | Database Account | * Database Username: an account under the tenant. In MySQL mode, this account must have access to the default database. * Database Password: the password of the account under the tenant. You can click **Test Connection** next to the password field to check the connection to the target database. * Save Database Password * If you disable this option, the database password for the connection is not saved. Each time you use or test the connection, you must enter the database password in the password dialog box. * If you enable this option, the database password for the connection is saved. You do not need to enter the database password each time you use the connection. **Note** * An error will be returned if the configurations such as the username, password, and network settings are invalid. * You can only connect to a database in the current tenant. Otherwise, a test failure error will be returned. | + | Default Database/schema | When you connect to a database in a MySQL tenant, you must specify the default database for the connection. You do not need to specify this field when you connect to a database in an Oracle tenant. **Note** If you leave this parameter unspecified, the information_schema database is connected by default. However, if the connection to the information_schema database fails, you need to specify a database that the current user has access permissions. | + | Query Tenant Views with sys Tenant Account | When Database Type is set to Physical Database, you can specify an account that has the privilege to query the SYS tenant view, and the password. This field is automatically populated when SYS is specified as the tenant in **Endpoint** . * **Account** : an account having the privilege to check the views under the SYS tenant. * **Password** : the password of the account. After you specify the account and password, click **Test Connection** next to the password field to verify whether the account information is valid. **Note** * In ODC V2.3.0 and later versions, to use the import and export features, you need to configure the root@sys account in the Advanced Configuration section during connection creation. * In ODC V2.4.1 and later versions, the dependency of the import and export features on the root@sys user is removed when you query views. If the root@sys account is not configured, some ODC objects such as stored procedures and functions do not support the export feature. If the root@sys account is configured, you can access the views under the SYS tenant to obtain the optimal data routing strategy, which can increase the export speed. | + |Enable SSL|Select whether to enable the SSL encrypted SSL link to ensure the safe transmission of data between the client and the server.
    **Note**
    • Users created in non-encrypted mode (require none) (require none by default) can choose whether to enable SSL according to their needs. If **Enable SSL** is checked, an SSL connection will be created; if not checked, a normal connection will be created.
    • For users created through the SSL connection method (require ssl), you can create an SSL connection after checking **Enable SSL**; if you don’t check it, the connection will fail.
      Users created through require ssl do not need to upload a certificate but must check **Enable SSL**, otherwise the connection will fail. It is recommended to upload a certificate to verify the identity of both communication parties (not required):
      • Upload the CA certificate, and the client will verify the identity of the server;
      • Upload the client key and client certificate, and the server will verify the identity of the client.
    • Users created by x509 encryption (require x509) must **enable SSL** and upload the CA certificate, client key and client certificate, and the client and server will verify each other's identity; uncheck **Enable SSL ** Neither uploading the certificate nor uploading the certificate will successfully create the connection.
    Before enabling SSL through ODC, you must confirm that SSL is enabled on the OBServer side; if you connect through OBProxy, you also need to ensure that OBProxy has enabled SSL. How to enable SSL on the server side, please refer to [OBServer Transmission Encryption](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000944716) and [ApsaraDB for OceanBase SSL Link Encryption](https://help.aliyun.com/document_detail/254643.html).
    | + + + + +3. Click **Save** to save the current configuration in the ODC connection list, and enter the connection name. Next time you log on to ODC, you can directly select the connection from the list. The connection configuration does not necessarily need to pass the connection test when you save the configuration. + + + > **Notice** + > + > Before saving, you can click **Test Connection** to test the database connection. If the database user name and password are correct, it will prompt **Connected**. + + +4. Click **Copy Connection String** in the lower part of the panel to copy the connection information being edited on the current panel as a connection string if necessary. This allows you to obtain the connection information with ease. + + + +5. Click **Cancel** if you do not need to save the current connection configuration. Then, a confirmation dialog box appears. + + + + + + diff --git a/en-US/6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md b/en-US/6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md new file mode 100644 index 00000000..f66250f6 --- /dev/null +++ b/en-US/6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md @@ -0,0 +1,155 @@ +Manage private connections +=============================================== + + + +Overview +----------------------------- + +On the homepage of OceanBase Developer Center (ODC), you can view the connections you have created on the **Private Connection** tab and the public connections that you have the permission to access on the **Public Connection** tab. Connections are listed for easy viewing and management. + + +View private connections +--------------------------------------------- + +The information of private connections is displayed in a list: + +* Use the search icon ![search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) above the list to find the target connection. + + + +* Use ![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter connections by type, authority, and label. Button The refresh button can refresh the list information. + + +* Refresh the list information through ![update](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%B7%E6%96%B0.jpg). + + + +* Adjust the column width of the connection list. + + + + + + +The following table describes columns of the list of private connections. + + +| Column | Description | +|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection Name | The name of the connection and the host and port information. You can click the name of a connection to go to the corresponding connection management page. The icon before the connection name indicates the status of the connection. Green indicates valid, red indicates invalid, and gray indicates that the database password is not saved. | +| Cluster | The cluster information. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the cluster information. If you select **Empty** , you can filter connections that do not belong to any clusters. | +| Tenant | The tenant information. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tenant information. If you select **Empty** , you can filter connections that do not belong to any tenants. | +| Tag | The tag of the connection. You can create a tag and assign it to a connection. You can assign only one tag to each connection. | +| Operation Time | The time when the connection was edited, or the time when the connection was created if the connection has not been edited. | +| Actions | You can click the More icon to display actions you can take, namely **Open** , **Edit** , **Copy** , and **Delete** . | + + + +Set a tag +------------------------------ + +ODC allows you to create a tag and assign it to a connection. You can assign only one tag to each connection. Alternatively, you can move the pointer in the tag column of the row where the target connection is located in the connection list and click **Set Tag** . The drop-down list provides options for you to create, set, and manage tags. + +* Tag creation: You can create a tag by using the following two methods: + + * Click **Set Tag** next to the **Connection Name** field in the **Create Connection** panel. + + + + * Move the pointer in the tag column of the row where the target connection is located in the connection list, click **Set Tag** and click **Create Tag** in the drop-down list. On the **Tags** page, specify the name and color of the tag, and click the tick icon to complete the creation. + + + + + + +* Tag setting: Select the target tag from the drop-down list that displays all the tags that you created, and modify related parameters to finish the setting. + + + +* Tag management: Click the settings icon in the upper-right corner of the drop-down list to go to the **Tags** page, In the Tags window, you can edit or delete created tags. + + + + + + +Pin a private connection to the top +-------------------------------------------------------- + +By default, the connections in the connection list are sorted by their creation time, with the most recently created connection on top. The list does not support custom sorting, but you can pin frequently used connections to the top. + +You can click the flag ![Homepage - Pin Connection Name to Top](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6818379361/p342106.png) next to the name of a connection to pin the connection to the top. This turns the flag to yellow. You can click the flag again to unpin the connection from the top. + +Edit a private connection +---------------------------------------------- + +Click **Edit** in the **Actions** column of the target connection. The **Edit Connection** panel appears, which has the same structure as the **Create Connection** panel and displays the configuration information of the current connection. You can edit the information displayed in the **Edit Connection** panel. + +Before you change **Database Password** , you must first click **Change Password** next to the password box. To abort the current change, click **Cancel** next to the password box, and the input in the password box is restored to its original value. + +Copy a private connection +---------------------------------------------- + +Click **Copy** in the **Actions** column of the target connection. The **Create Connection** panel appears. The copied information is automatically filled in the panel. This allows you to quickly create a connection by modifying existing information. + +The copy feature allows you to easily create database connections having similar information. + +Delete a private connection +------------------------------------------------ + +To delete a connection, click **Delete** in the **Actions** column of the target connection. + +For example, when the connected database no longer exists or you do not need to access the connected database, you can directly delete the corresponding connection. + +Other operations +------------------------------------- + +* In addition to the management actions that the **Private Connection** tab provides, after you go to the management page of a database connection, the homepage menu icon ![Homepage menu](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7767860461/p352089.jpg) in the top navigation bar further provides the following buttons: + + * **Open Connection in New Window**: After you click a connection in the connection list that appears, ODC opens the connection in a new window. + + + + * **Connections** : Click this button to open the ODC homepage in a new window. On the ODC homepage, you can view and manage the configuration information of all connections. + + + + * **Reload** : Click this button to reload the current page. + + + + * **Exit Connection** : Click this button to exit the current connection and go to the ODC homepage. + + + + + + + ![Image 031](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9906118461/p232235.png) + +* On the database connection page, the `@{database name}` information is included in the browser tab of Web ODC. + ![Image 032](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/web%20%E4%B8%AA%E4%BA%BA%E8%BF%9E%E6%8E%A5%E7%AE%A1%E7%90%86-%40%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%8D-EN.png) + +* Information such as the connection name, schema (in Oracle mode), and database name (in MySQL mode) appears in the top navigation bar of the workspace. + + * Move your pointer over the connection name in the top navigation bar. In the tooltip that appears, you can see information in the following fields: **Connection Mode** , **Host/Port** , **Cluster/Tenant** , and **Database Username**. + ![Manage private connections - Other operations](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9102553561/p358120.png) + + + + * Click the drop-down arrow next to the displayed schema name or database name. All the schemas and databases accessible to the current database user are included in the drop-down list that appears. You can switch to a target schema or database by clicking its name in the list. + ![Manage private connections - switch between connections within a connection](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2800571561/p413596.png) + + + + + + +Related information +---------------------------------------- + +On the ODC homepage, you can click the Public Connection tab to view accessible public connections. + +For more information about how to create and manage a public connection, see [Manage public connections](../4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md). diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md new file mode 100644 index 00000000..3a513de4 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md @@ -0,0 +1,51 @@ +Overview +============================= + +As a database development platform for enterprises, OceanBase Developer Center (ODC) provides a public resource console to enable the ODC administrator to manage users, grant permissions, and allocate resources. + +The ODC administrator can see the **Public Resource Console** tab on the right side of the ODC homepage. The console enables the ODC administrator to manage users, roles, public connections, resource groups, and system settings. + +In addition to the built-in **system_admin** role, the ODC administrator must create other roles as needed and grant appropriate permissions to the roles on the Role Management page. After the roles are created, the administrator can batch create new ODC accounts on the User Management page for users in the organization and assign roles to the users for permission authorization and control. + +After ODC users obtain the database access information, they can create private connections in ODC. A private connection is accessible only to the user who creates it. For the security of the enterprise, database access information is not shared with all users. The administrator can create public connections in ODC, combine multiple public connections to create resource groups, and grant the access permission on public connections or resource groups to specific roles. As the public connections of a role are shared to all users with the role, the administrator does not need to share the access information with all users. + +The administrator can configure global settings on the System Settings page. + +This chapter describes the following features of the public resource console: + +* [Quick start](../4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md) + + + +* [Manage users](3.web-odc-public-resource-permission/4.web-odc-manage-users.md) + + + +* [Manage roles](3.web-odc-public-resource-permission/3.web-odc-manage-roles.md) + + + +* [Manage public connections](3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md) + + + +* [Manage resource groups](3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md) + + + +* [Task processes](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + + + +* [Operation records](../4.web-odc-public-resource-management/5.web-odc-operating-records.md) + + +* [Desensitization Rules](../4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md) + +* [System settings](../4.web-odc-public-resource-management/6.web-odc-system-settings.md) + + + + + + diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md new file mode 100644 index 00000000..da195cd3 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md @@ -0,0 +1,55 @@ +Quick start +================================ + +This document helps you quickly understand and use the public resource console. + +Overview +----------------------------- + +On the ODC homepage, click the **Public Resource Console** tab to go to the **Public** **Resource Console** page. The **Quick Start** page is displayed by default. ![Quick Start](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1303511561/p411751.png) + +Features of the public resource console +------------------------------------------------------------ + +The public resource console of ODC manages resource permissions of users and standardizes the process of configuring risk tasks to ensure the security of data resources. + +* Resource permission management: grants the read/write permissions on public connections and resource groups to users with different roles, to allocate and control database resource permissions. + + + +* Task process management: restricts the content of changes that you can initiate and provides different approval processes based on the task type, to ensure the security of database changes. + + + +* Security audit management: supports 14 types of audit events such as personal settings, password management, connection management, and database operations, to ensure security compliance and allow you to trace critical events and download audit reports. + + + + + + +Resource Permission Management +--------------------------------------------------- + +1. Add public connection resources. + + As the administrator, you can create or edit a public connection resource shared by multiple users. + + +2. Configure a resource group. + + A resource group consists of multiple public connections. It allows you to grant the permissions on multiple public connection resources to a role at a time. + + +3. Manage the permissions of a role. + + You can grant the permissions on multiple public connection resources and individual resources to the role. + + +4. Create a user. + + Specify the username and password of the user, and assign a role to the user to grant it the permissions on required connection resources. + + + + diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md new file mode 100644 index 00000000..e30b3071 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md @@ -0,0 +1,119 @@ +# Manage public connections + + + +## Overview + +OceanBase Developer Center (ODC) allows you to create private and public connections. A private connection is created in ODC by a user who obtains the database access information that is not shared with all users for the sake of security. The administrator can create public connections in ODC, and combine multiple public connections to create resource groups. In this way, users in a resource group can use the public connections in this group. + +Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, choose **Resource Permissions** \> **Public Connection** to display the **Public Connections** page. + + + +## Create a public connection + + +Click **Create Public Connection** in the upper-right corner of the **Public Connections** page. The **Create Public Connection** panel appears. + +Specify the following parameters in the **Create Public Connection** panel. + + +| Field | Description | +|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection Name | Specify the name of the connection. | +| Resource Group | Click the field and select the resource group from the drop-down list. For more information about resource groups, see [Manage resource groups](../3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md). | +| Connection Status | By default, the connection status is **Enabled** . You can set it to **Disabled** . A disabled connection cannot be accessed. | +| Intelligent Parsing | You can paste a connection string to the field. ODC automatically identifies the string and fills in the corresponding fields on the page. | +| Connection Type | Select **MySQL** or **Oracle** . Logical databases support only the MySQL mode. | +| Endpoint | * **Host IP** : the IP address of the server where the target database is located. * **Port** : the port number of the server where the target database is located. * **Cluster name** : the name of the cluster where the target database is located. This parameter is not required for logical databases. * **Rent name** : the name of the tenant in which the target database is located. This parameter is not required for logical databases. **Note** You can obtain the host name and port number from the details page of the tenant in which the target database is located, such as a tenant created on Alibaba Cloud or in OceanBase Cloud Platform (OCP). | +| Read/Write Account | Specify the **Database Username** and **Database Password** for accounts that have permissions to read and write the database. An ODC user with the read/write permissions can use this account to access OceanBase Database. You can click **Test Connection** next to the password field to test the connection to the target database. | +| Read-only Account | Specify the **Database Username** and **Database Password** for accounts that have only permissions to read the database. An ODC user with the read-only permissions can use this account to access OceanBase Database. You can click **Test Connection** next to the password field to test the connection to the target database. | +| Default Database | When you connect to a database in a MySQL tenant, you must specify the default database for the connection. You do not need to specify this field when you connect to a database in an Oracle tenant. | +| Query Tenant Views with sys Tenant Account | When Database Type is set to Physical Database, you can specify an account that has the privilege to query the SYS tenant view, and the password. This field is automatically populated when SYS is specified as the tenant in **Endpoint**. * **Account**: an account having the permission to check the views under the SYS tenant. * **Password** : the password of the account. After you specify the account and password, click **Test Connection** next to the password field to verify whether the account information is valid. In ODC V2.3.0 and later versions, to use the import and export features and check the partition information, you need to configure the root@sys account by using this option. | +|Enable SSL|Select whether to enable the SSL encrypted SSL link to ensure the safe transmission of data between the client and the server.
    **Note**
    • Users created in non-encrypted mode (require none) (require none by default) can choose whether to enable SSL according to their needs. If **Enable SSL** is checked, an SSL connection will be created; if not checked, a normal connection will be created.
    • For users created through the SSL connection method (require ssl), you can create an SSL connection after checking **Enable SSL**; if you don’t check it, the connection will fail.
      Users created through require ssl do not need to upload a certificate but must check **Enable SSL**, otherwise the connection will fail. It is recommended to upload a certificate to verify the identity of both communication parties (not required):
      • Upload the CA certificate, and the client will verify the identity of the server;
      • Upload the client key and client certificate, and the server will verify the identity of the client.
    • Users created by x509 encryption (require x509) must **enable SSL** and upload the CA certificate, client key and client certificate, and the client and server will verify each other's identity; uncheck **Enable SSL ** Neither uploading the certificate nor uploading the certificate will successfully create the connection.
    Before enabling SSL through ODC, you must confirm that SSL is enabled on the OBServer side; if you connect through OBProxy, you also need to ensure that OBProxy has enabled SSL. How to enable SSL on the server side, please refer to [OBServer Transmission Encryption](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000944716) and [ApsaraDB for OceanBase SSL Link Encryption](https://help.aliyun.com/document_detail/254643.html).
    | + + + +After you specify the preceding information, click **Create** in the lower-right corner of the panel. The connection is created. + +> **Notice** +> After you click **Create** , a warning message will appear in the following cases: +>
  • The read/write account is disconnected.
  • +>
  • The read/write account has insufficient permissions. +>
  • The read-only account is disconnected.
  • +>
  • The read-only account has insufficient permissions.
  • + + + + + + +Manage public connections +---------------------------------------------- + +The information of public connections is displayed in a list on the **Public Connections** page. On this page, you can perform the following operations: + +* Use the search icon ![search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) above the list to find the target connection. + + +* Use ![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter connections by type, authority, and label. Button The refresh button can refresh the list information. + +* Use ![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter connections by type, authority, and label. Button The refresh button can refresh the list information. + +* Refresh the list information through ![update](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%B7%E6%96%B0.jpg). + + +* Adjust the column width of the connection list. + + + + + + +### Public connection list + +The information of public connections is provided by columns, which are described in the following table. A filter is provided on top of some columns for you to filter connections. + + +| Field | Description | +|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection ID | The sequence number of the connection. You can click **Connection ID** to sort the connection IDs in ascending or descending order. | +| Connection Name | The name of the connection and the host and port information. You can click the name of a connection to go to the corresponding connection management page. The icon before the connection name indicates the status of the connection. Blue indicates valid, red indicates invalid, and gray indicates that the database password is not saved. You can click **Connection Name** to sort the connection names in ascending or descending order. | +| Cluster | The cluster information. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the cluster information. If you select **Empty** , you can filter connections that do not belong to any clusters. | +| Tenants | The tenant information. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tenant information. If you select **Empty** , you can filter connections that do not belong to any tenants. | +| Resource Group | The name of the resource group to which the connection belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the connections by the resource group. If you select **Empty** , you can filter connections that do not belong to any resource groups. | +| Status | The current connection status. Valid values: **Enable/Disable** . You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the connections by status. | +| Operation Time | The last time when the connection was edited, or the time when the connection was created if the connection has not been edited. | +| Actions | The actions you can take. Valid values: **View** , **Edit** , **Copy** , and **Disable** / **Enable** . * View: View the configuration of the connection. * Edit: Modify the configuration of the connection. * Copy: Quickly modify and create another connection based on the configuration of the connection. * Disable/Enable: Directly change the connection status. | + + + +### View a public connection + +Click **View** in the **Actions** column. The **Public Connection Information** panel appears. You can see the **Connection Details** and **Related Users** tabs. + + +| Field | Description | +|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection Details | * Connection information: displays the information you specified when you created the connection in fields such as **Region** , **Connection Mode** , **Connection Name** , **Resource Group** , **Endpoint** , database username for **Read/Write Account/Read-only Account**, and **Query sys Tenant Account** . * Operation information: displays information in fields such as **Created By** , **Created At** , and **Updated At** . * User deletion: You can click **Delete Public Connection** on the tab to delete the current connection. After the connection is deleted, it is inaccessible to users who are granted the permissions to access it. | +| Related Users | Displays the information about the users who can access the current public connection in fields such as **Name** , **Role** , and **Permissions** . | +| Edit | In the lower-right corner of the **Public Connection Information** panel, you can click **Edit** to go to the **Edit Public Connection** panel. | + + + +### Edit a public connection + +1. Click **Edit** in the **Actions** column of the public connection information list. The **Edit Public Connection** panel appears. + + + +2. The **Edit Public Connection** panel displays all the parameters you specified when you created the connection. **Database Type** , **Region** , and **Connection Mode** cannot be modified after the connection is created. + + + +3. After the editing is complete, click **Save** . + + + + + diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md new file mode 100644 index 00000000..7c7d6758 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md @@ -0,0 +1,109 @@ +Manage resource groups +=========================================== + + + +Overview +----------------------------- + +![Manage resource groups](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2967570461/p341986.png) + +A resource group is an object that aggregates multiple public connections. It allows you to grant a role the permissions to access multiple public connections at a time. + +1. Log on to OceanBase Developer Center (ODC) and go to the **Public Resource Console** page. In the left-side navigation pane, choose **Resource Permissions** + + + +2. Click **Resource Group** to display the **Resource Group Management** page on the right. + + + + + + +Create a resource group +-------------------------------------------- + +![Create a resource group](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2967570461/p361028.png) + +1. In the upper-right corner of the **Resource Group Management** page, click **Create Resource Group** . + + + +2. In the **Create Resource Group** panel that appears, specify the following parameters to create a resource group. + + + + | Field | Description | + |------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Resource Group Name | The name of the resource group. | + | Resource Group Status | By default, the status of the resource group is **Enabled** . You can set it to **Disabled** as needed. The disabled resource group cannot be accessed. | + | Public Connection (optional) | Click **Add Connection** . In the drop-down list that appears, select an existing public resource group to grant the resource group the permission to access the public resource group. | + | Remarks (optional) | The description of the resource group. | + + + +3. After you specify the preceding information, click **Create** in the lower-right corner of the panel. + + + + + + +Manage resource groups +------------------------------------------- + +The information of resource groups is displayed in a list on the **Resource Group Management** page. On this page, you can perform the following operations: + +* Click the refresh icon to manually refresh the list. + + + +* Search for resource groups by using the search box in the upper-right corner of the list. + + + + + + +### Resource group List + +The information of resource groups is provided by columns, which are described in the following table. A filter is provided on top of some columns for you to filter resource groups. + + +| Field | Description | +|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Resource Group ID | The sequence number of the resource group. You can click **Resource Group ID** to sort the resource group IDs in ascending or descending order. | +| Resource Group Name | The name of the resource group. | +| Connections | The number of public connections accessible to the current resource group. | +| Status | The current status of the resource group. Valid values: **Enabled** and **Disabled** . You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the resource groups by status. | +| Updated At | The last time when the resource group was edited, or the time when the resource group was created if the connection has not been edited. You can click **Updated At** to sort the resource groups by update time in ascending or descending order. | +| Actions | The actions you can take. Valid values: **View** , **Edit** , and **Disable/Enable** . You can click **Disable/Enable** in the **Actions** column to change the status of the resource group. | + + + +### View a resource group + +1. Click **View** in the **Actions** column. In the **Resource Group Information** panel, you can see the **Resource Group Details** and **Related Users** tabs. The following table describes the information displayed on the tabs. + + + + | Field | Description | + |------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Resource Group Details | * Resource group information: displays the information you specified when you created the resource group in fields such as **Resource Group Name** , **Remarks** , and **Public Connection** ( **Connection Name** and **Status** ). * Operation information: displays information in fields such as **Created By** , **Created At** , and **Updated At** . * User deletion: You can click **Delete Resource Group** on the tab to delete the current resource group. After the resource group is deleted, it is inaccessible to users who are granted the permissions to access it. | + | Related Users | Displays the information about the users who can access the current resource group in fields such as **Name** , **Role** , and **Permissions** . You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter users by role and permission. | + + + +2. After you specify the preceding information, click **Edit** to go to the **Edit Resource Group** panel. + + + + + + +### Edit a resource group + +Click **Edit** in the **Actions** column to go to the **Edit Resource Group** panel. + +The **Edit Resource Group** panel displays all the parameters you specified when you created the resource group. You can modify the parameters as needed. diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/3.web-odc-manage-roles.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/3.web-odc-manage-roles.md new file mode 100644 index 00000000..b0e02f76 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/3.web-odc-manage-roles.md @@ -0,0 +1,180 @@ +Manage roles +================================= + +A role is an object that holds user permissions, and users of the same role have the same permissions. OceanBase Developer Center (ODC) allows you to grant permissions to customized roles and assign the roles to users. + +Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, choose **Resource Permissions** \> **Role** to display the **Role Management** page on the right. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/1-EN.png) + +Built-in roles +----------------------------------- + +ODC has a built-in administrator role **system_admin** that is automatically assigned to the administrator, whose username is **admin** . The administrator role has all system permissions and has access to all public and individual resources. You cannot edit, delete, or disable the administrator role. + +Create a role +---------------------------------- + +Click **Create Role** in the upper-right corner of the **Role Management** page. The **Create Role** panel appears. + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/2-EN.png) + +You can take the following steps to create a role: + +1. Specify **Role Name** . + + The role name must be specified and cannot exceed 48 characters in length. + + +2. Specify **Role Status** . + + By default, the new role is created in the **Enabled** status. You can specify the **Disabled** status. The permissions for a disabled role do not take effect. + + +3. Specify **Permission Type** . + + Select at least one permission type for the role. + + ODC allows you to select the **Public Resource Permissions** and **Individual Resource Permissions** types. After you select a permission type, the corresponding **Permission Settings** section appears below. When you create a role, you must specify and set at least one permission type for the role. + + +4. Configure **Permission Settings** . + + The following table shows options in each **Permission Type** tab in the **Permission Settings** section. + + + | Permission type | Description | + |--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection Access Permissions | - Resource Type: includes **Connection Access Permissions**, **Resource Management Permissions** and **System Permissions**.
    • Click the first field and select the resources as needed from the drop-down list.
    • Resource Name: Click the second field and select the resources as needed from the drop-down list. Depending on the selected resource type, the list displays the names of the resources that have been created in the current system.
    • Resource Permissions: Click the third field and select the public resource permission as needed from the drop-down list.
      Permissions for public resources include Read-only and Read/Write. For more information, see the Permission description section below. Click **Add Resource** to grant the role the permission for multiple public resources.
    | + | Resource Management Permissions | Supports configuration of permissions for public connections, resource groups, roles, and users.| + |System Permissions|Supports the configuration of permissions for personal connections, task processes, desensitization rules, operation records, and system configuration.| + + + +5. Specify **Remarks (optional)** . + + Enter the description in the field. The remarks are optional and cannot exceed 140 characters in length. + + +6. Complete the creation. + + Click **Create** in the lower-right corner of the panel to create the role. + + + + + +Permission description +------------------------------------------- + +ODC supports **Public Resource Permissions** and **Individual Resource Permissions** . The types of the public resources are **Public Connection** and **Resource Group** . The following table shows the scope and description of supported permissions. + + +| Permission scope | Read-only | Read/Write | +|-------------------------------------------------|-----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| SQL window | Support query statements in the SQL window | Support control statements in the SQL window Support query statements in the SQL window Support data change statements in the SQL window Support structure change statements in the SQL window | +| Result set | View the result set Export the result set | View the result set Export the result set Modify the result set | +| Anonymous block window | Support operations other than writing | Support all operations in the anonymous block window | +| Command-line window | Support operations other than writing | Support all operations in the command-line window | +| Data mocking | Not supported | Support all permissions for data mocking | +| Asynchronous execution | Support operations other than writing | Support all permissions for asynchronous execution | +| Import and export | Export | Support data import Export | +| Session | View session properties View all sessions | View session properties Modify session properties View all sessions Modify the list of sessions | +| Recycle bin | View objects in the recycle bin | View objects in the recycle bin Modify the recycle bin | +| Table (non-SQL statement operations) | View the table definition View table data | View the table definition View table data Modify the table definition Modify table data Create a table Delete a table | +| View (non-SQL statement operations) | View the view definition Check view data | View the view definition Check view data Create a view Delete a view | +| Function (non-SQL statement operations) | View the function definition | View the function definition Modify the function definition Run a function Compile a function Debug a function Create a function Delete a function | +| Stored procedure (non-SQL statement operations) | View the stored procedure definition | View the stored procedure definition Modify the stored procedure definition Run a stored procedure Compile a stored procedure Debug a stored procedure Create a stored procedure Delete a stored procedure | +| Program package (non-SQL statement operations) | View the program package definition | View the program package definition Modify the program package definition Run a program package Compile a program package Debug a program package Create a program package Delete a program package | +| Trigger (non-SQL statement operations) | View the trigger definition | View the trigger definition Modify the trigger definition Create a trigger Delete a trigger Compile a trigger | +| Type (non-SQL statement operations) | View the type definition | View the type definition Modify the type definition Create a type Delete a type Compile a type | +| Synonym (non-SQL statement operations) | View the synonym definition | View the synonym definition Create a synonym Delete a synonym | +| Sequence (non-SQL statement operations) | View the sequence definition | View the sequence definition Modify the sequence definition Create a sequence Delete a sequence | + + + +Manage roles +--------------------------------- + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/3-EN.png) + +The information of roles is displayed in a list on the **Role Management** page, where you can perform the following operations: + +* Click the refresh icon to manually refresh the list. + + + +* Search for roles by using the search box in the upper-right corner of the list. + + + +* You can also view and manage the created roles by using the buttons provided in the Actions column. + + + + + + +### Information of roles + +The information of roles is provided by columns, which are described in the following table. A filter is provided on top of some columns for you to filter roles. + + +| Field | Description | +|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Role Name | The name of the role. | +| Permission Type | The type of permissions granted to the role. | +| Status | The role status. Valid values: **Enabled** and **Disabled** . | +| Updated At | The time of the last update of the role information. | +| Actions | The actions you can take. Valid values: **View** , **Edit** , and **Disable** / **Enable** . You can click **Disable** / **Enable** to change the role status. | + + + +### View a role + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/4-EN.png) + +1. Click **View** in the **Actions** column. In the **Role Information** panel, you can see the tabs **Role Details** and **Related Users.** The following table describes the information displayed on the tabs. + + + + | Field | Description | + |---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Role Details |
    • Role creation information: displays the information that you specified when you created the role in fields such as **Role Name** , **Permission Type**, and **Remarks**.
    • Operation information: displays information in fields such as **Created By** , **Created At** , and **Updated At**.
    • Role deletion: You can click **Delete Role** in the lower part of the tab to delete the role. After the role is deleted, all data related to the role cannot be recovered, and the user permissions granted to the role are revoked. The user logon is not affected. | + | Related Users | The **Related Users** tab displays users that are granted the role. The user information is provided in the following columns: **Username** , **Roles** , and **Status** . | + + + +2. In the lower part of the **Role Information** panel, you can click **Edit** to go to the **Edit Role** panel, and + + + +3. click **Copy Role** to go to the **Create Role** panel. In the panel that appears, the information of the current role is automatically filled. + + + + + + + + +### Edit a role + + +1. Click **Edit** in the **Actions** column to go to the **Edit Role** panel. + + + + | Field | Description | + |---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Role Details | Operation information: displays information in fields such as **Role Name** , **Role Status** , **Permission Type** , **Permission Settings** , and **Remarks** . | + | Related Users | The **Related Users** tab displays users that are granted the role. The user information is provided in the following columns: **Username** , **Roles** , and **Status** . * You can click **Remove** to remove the users granted the current role. * You can select new users in the **Add User** field and grant the role to the selected users. | + + + +2. In the **Edit Role** panel, you can click **Save** in the lower-right corner to save the editing results. + + + + + diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/4.web-odc-manage-users.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/4.web-odc-manage-users.md new file mode 100644 index 00000000..9d9fddd5 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/4.web-odc-manage-users.md @@ -0,0 +1,143 @@ +Manage users +================================= + + + +Overview +----------------------------- + +![Image 867](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0113133561/p308934.png) + +You can create users and manage user permissions on the User Management page of OceanBase Developer Center (ODC). + +Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, choose **Resource Permissions** \> **User** to display the **User Management** page on the right. + +Built-in user +---------------------------------- + +ODC has a built-in account **admin** that is automatically assigned the administrator role **system_admin** . The administrator account has all system permissions and has access to all public resources. You cannot edit, delete, or disable the account. + +Create a user +---------------------------------- + +Click **Create User** in the upper-right corner of the **User Management** page. The **Create User** panel appears. + +![Image 868](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8818379361/p308936.png) + +You can take the following steps to create a user: + +1. Specify the **User Information** . + + a. User information consists of the following three parts: + + * **Account** : the account used to log on to ODC. You must specify a unique account of 4 to 48 characters in length using letters, digits, and special characters. Special characters are . _ + @ # $ % + + + + * **Name** : the screen name to be displayed after the user logs on to ODC. The name must be specified and cannot exceed 110 characters in length. + + + + * **Password** : the password used to log on to ODC. The password must be specified. It must be 8 to 32 characters in length and contain at least two digits, two uppercase letters, two lowercase letters, and two special characters. Special characters are . _ + @ # $ % You can also click **Random Password** next to the field to generate a random password. + + > **Note** + > You will be prompted to change the user password when you log on to ODC as a new user or after the administrator changes the user password. This hardens password security and prevents password leakage. + + + + + + b. ODC allows you to create multiple users at a time. Click **Add User** to specify the information for multiple users. + + + + + + +1. Specify the **Account Status** . + + By default, the new user is created in the **Enabled** status. You can manually disable it. A disabled account is unable to log on. + + +2. Assign roles to the new user. + + The roles are optional and you can assign multiple roles to a user. Click the field. In the drop-down list, select the roles that you want to assign to all users you just added. If no role is available, go to the Create Role page to create one. + + +3. Specify the **Remarks** (optional). + + Enter the description in the field. The remarks are optional and cannot exceed 140 characters in length. + + +4. Submit user information. + + In the lower-right corner of the panel, click **Create** to submit user information. + + +5. Save user information. + + In the **User Created** dialog box appears after you click Create, you can view the information of all users you just created. In the dialog box, you can click **Copy User Information** and **Download User Information** to save the information of multiple users in local storage. + + This operation helps you quickly save user information when you create multiple users at a time. + + + + + +Manage users +--------------------------------- + +On the **User Management** page, you can view the information of all users, and search for specific users by using the search box in the upper-right corner of the page. You can also view and manage the created users by using the buttons provided in the Actions column of the User Management page. + +### Information of users + +The information of users is provided by columns, which are described in the following table. A filter is provided on top of columns for you to filter users. + + +| Column | Description | +|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Name | The name of the user. | +| Account | The account of the user. | +| Role | The role of the user. | +| Status | The user status. Valid values: **Enabled** and **Disabled** . You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the users by status. | +| Updated At | The time of the last update of the user information. You can click **Updated At** to sort the users by update time in ascending or descending order. | +| Logon Time | The time of the last logon to ODC. You can click **Logon Time** to sort the users by logon time in ascending or descending order. | +| Actions | The actions you can take. Valid values: **View** , **Edit** , and **Disable/Enable** . You can click **Disable/Enable** to change the user status.
      **Note**
      After you log on to ODC, you cannot edit or disable your account. | + + + +### View a user + +![View](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5674823561/p421887.png) + +Click **View** in the **Actions** column. In the **User Information** panel, you can see the **User Details** and **Related Resources** tabs. + + +| Field | Description | +|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| User Details |
    • User creation information: **Account** , **Name** , **Password** , **Role** , and **Remarks** that you specified when you created the user. The password is masked, and a **Reset Password** button is provided for you to change the logon password.
    • Operation information: **Created By** , **Created At** , **Updated At** , and **Logon Time** .
    • User deletion: You can click **Delete User** in the lower part of the tab to delete the user. After the user is deleted, the corresponding account cannot log on to ODC and its related data cannot be restored.
    • | +| Related Resources | This tab displays the names of the public connections that are accessible to the current user, the resource groups to which the public connections belong, and the access permissions for the resource groups. | +| Edit | In the **User Information** panel, click **Edit** to go to the **Edit User** panel. | + + + +### Edit a user + +![edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5674823561/p437759.png) + +Click **Edit** in the **Actions** column to go to the **Edit User** panel. + +In the **Edit User** panel, you can view all information specified when you create a user. After the user is created, the **Account** cannot be modified. However, you can modify the **Name** , **Account Status** , **Roles** , and **Remarks** , and can change the **Password** when viewing the user details page. + +### Disable a user + +Click **Disable** in the **Actions** column of the user information list. In the message that appears, click **Yes** . + +> **Note** +>
    • Disabled users cannot log on.
    • +>
    • The account information of disabled users is retained. You can enable them again as needed.
    • + + + + + diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/5.web-odc-manage-automatic-authorization-rules.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/5.web-odc-manage-automatic-authorization-rules.md new file mode 100644 index 00000000..7a16e4be --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/5.web-odc-manage-automatic-authorization-rules.md @@ -0,0 +1,115 @@ +# Automatic authorization rules + + + +## Background + +OceanBase Developer Center (ODC) allows system administrators to define automatic authorization rules. System administrators can create, modify, view, and disable automatic authorization rules in the public resource console. + +The automatic authorization feature automatically grants roles or permissions to users whose names, departments, or logon methods meet specific conditions when they are being created or log on for the first time, to avoid redundant authorization operations. + +This topic describes how to create and manage automatic authorization rules in the public resource console. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/1-EN.png) + +## Create an automatic authorization rule + +### Procedure + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/2-EN.png) + +1. In the upper-right corner of the **Automatic Authorization Rules** page, click **Create** **Rule**. The **Create** **Rule** panel appears. + + +2. Specify the following parameters in the **Create** **Rule** panel. + + | Parameter | Description | + |--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Rule Name | The name of the rule, which must be unique. | + | Status | Select **Enabled** or **Disabled**.
      By default, the status of the rule is **Enabled**. You can set it to **Disabled** as needed. A disabled rule cannot be accessed. | + | Trigger Event | Select a trigger event. Only built-in events are available. Different events correspond to different trigger occasions. | + | Matching Condition (Optional) | Click **Add Condition** and specify the following four fields:
      • **Object**: stores the trigger condition and the information required for executing the action. It can be a complex nested object such as an array, a list, or a map, or a simple object such as a string or a number.
      • **Expression**: the index of the target in the object. Different types of objects use different indexing methods.
      • **Operation**: the supported operation, for example, "Contain", "Match", or "Equal".
      • **Value**: the target value.
        **Note**
        If you do not specify the matching condition, the action is unconditionally executed when the selected event is triggered.
        | + | Actions (Optional) | Select **Grant Role** and/or **Grant Connection Access** and specify the role name and/or public connection name.
        **Note**
        If you do not specify the action, no action is executed regardless of whether the matching condition is met.
        | + | Remarks (Optional) | The description of the rule. | + +3. After you specify the preceding parameters, click **Create** in the lower-right corner of the panel. + +### Example + +After you [integrate ODC in OAuth 2.0 and log on to ODC](https://www.oceanbase.com/docs/enterprise-odc-doc-cn-10000000001031888), assume that the OAuth 2.0 system returns the following data structure: + +```json +{ + "id": 1, + "name": "username", + "mail": "example@email.com", + "memberOf": { + "department": [ + { + "name": "deptA", + "description": "this is a department" + }, + { + "name": "deptB", + "description": "this is a department" + } + ], + "extra": "some other info" + } +} +``` + + +You can use different expressions to obtain corresponding values from the data structure. Example: + +| **Expression** | **Result** | +|--------------------------------|----------------------| +| id | 1 | +| memberOf.department\[0\].name | deptA | +| memberOf.department\[\*\].name | \["deptA", "deptB"\] | + + +The administrator can configure an automatic authorization rule for a user when the user logs on to ODC from OAuth 2.0 for the first time. The example in the following figure shows how to create an authorization rule named `Grant system_admin` for `deptB`. If `memberOf.department` contains any element named `deptB`, the user is granted the `system_admin` role. + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/3-EN.png) + +## Manage automatic authorization rules + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/4-EN.png) + +On the **Automatic Authorization Rules** page, information is displayed in a list, and you can perform the following operations: + +* Click the refresh icon to manually refresh the list. + +* Search for rules by using the search box in the upper-right corner of the list. + +* Adjust the column width of the rule list. + + +### Rule list + +The information of rules is provided by columns, which are described in the following table. A filter is provided in the **Status** column for you to filter rules by status. + +| Parameter | Description | +|------|----------------------------------------------------------------------------------------| +| Rule Name | The name of the rule. | +| Created By | The name of the user who created the rule.
        You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for rules created by a specific user. | +| Status | The current status of the rule. Valid values: **Enabled** and **Disabled**.
        You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter rules by status. | +| Created At | The last time when the rule was edited.
        You can sort rules in ascending or descending order of creation time. | +| Actions | The actions you can take. Valid values: **View**, **Edit**, **Disable/Enable**, and **Delete**. | + + +### View a rule + +Click **View** in the **Actions** column of a rule to go to the **Rule Information** panel. The following information is displayed in the panel. + +| Information | Description | +|------|------------------------------------------------| +| Rule information | Displays the information you specified when you created the rule, such as **Rule Name**, **Trigger Event**, **Matching Condition**, **Actions**, **Role**, and **Remarks**. | +| Operation information | Displays fields such as **Created By** and **Created At**. | + +### Edit a rule + +Click **Edit** in the **Actions** column of a rule to go to the **Edit Rule** panel. + +The **Edit Rule** panel displays all the fields you specified when you created the rule. You can modify the fields as needed. diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md new file mode 100644 index 00000000..d504f4c0 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md @@ -0,0 +1,146 @@ +Task process management +=========================== + + +Background +------------------------- + +OceanBase Developer Center (ODC) allows users with special permissions, such as administrators with permissions on the public resource console, to define change task processes. Users with read-only permissions can initiate [change tasks](../../6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md) based on the defined task processes. + +Users with this special permission can modify, view, and disable change task processes in the public resource console. Supported task processes include data import, export, and mocking, database changes, partition plan, shadow table and connection permission application. + +![Task flowchart](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/public%20connection-manage%20task%20process.png) + +### **Create a task process** + +The following example shows how to create a connection permission application process in ODC. Procedure: + +1. Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, click **Task Process** to go to the task process management page. + +2. In the upper-right corner of the **Task Process Management** page, select the desired task process type and click **Create Process**. The **Create Task Process** panel is displayed. + + ![Create Task Process 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%96%B0%E5%BB%BA%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B1-EN.png) + +3. In the **Create Task Process** panel, specify the following parameters. + ![Create Task Process 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%96%B0%E5%BB%BA%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B2-EN.png) + + | **Item** | **Description** | + |---------|---------------------------------| + | Task Process Name | The name of the task process. | + | Task Type | The task type, which can be Import, Export, Mock Data, Database Change, and Apply for Permission. | + | Risk Levels | The risk levels. | + | Task Approval Process | The approval nodes for the task process. | + | Process Validity Period | The validity period for approval and execution. If the execution times out, the task will expire. | + | Task Process Status | You can enable or disable the task process. | + | Remarks (Optional) | You can enter the description of the task process. | + +4. Click **Next: Associate Connection** to select the associated public connections. + +5. Specify **Associate Connection**. + + ![Create Task Process 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%96%B0%E5%BB%BA%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B3-EN.png) + + | **Item** | **Description** | + |---------|-------------------------------| + | Some Public Connections | When you select **Some Public Connections**, you need to add public connections or public connections in resource groups. | + | All Public Connections | Associates all public connections. | + +6. After you specify the preceding information, click **Create** in the lower-right corner of the panel. + +Manage task process +--------------------------- + +![Task Process](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E7%AE%A1%E7%90%86%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B1-EN.png) + +Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, click **Task Process** to go to the **Task Process Management** page. + +The information about task processes is displayed in a list on the **Task Process Management** page. On this page, you can perform the following operations: + +* Click the refresh icon to manually refresh the list. +* In the upper-right corner of the list, click **Set Priority** to specify the execution sequence for the task process. The task process with the highest priority is associated when you create a task. +* You can select the check box![check box](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416674.jpg) in front of one or more task process names and click the delete icon to delete the selected processes. + +### List of task processes + +The following table describes the columns in the list of task processes. Each column provides a filter for you to filter task processes. + + +| Column | Description | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task Process Name | The name of the task process. | +| Task Type | The type of the task. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter task processes by task type. The following task types are supported: **Import**, **Export**, **Mock Data**, and **Database Change**. | +| Risk Levels | The specified risk levels. The default value is 1. You can modify the value as needed. The maximum value is 10. You can set the risk levels only for database changes. Other types of tasks can have only one risk level. | +| Created By | The user who initiated the task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for the creator. | +| Status | The status of the task process. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter task processes by status. | +| Created At | The time of the last action on the task process. | +| Actions | The actions you can take. Valid values: **View**, **Edit**, and **Disable**/**Enable**.
        - **View**: View the details of the current task process.
        - **Edit**: Modify the details of the current task process.
        - **Disable/Enable**: Change the status of the current task process. | + + + +### View a task process + +![View](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%9F%A5%E7%9C%8B%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B2-EN.png) + +On the **Task Process Management** page, click **View** in the **Actions** column of the target task process. The **Task Process Details** panel appears. + + +#### **View** process information + + +| Item | Description | +|----------|-------------------------------------------------------------------------------------------| +| Basic information | Displays the basic information of the task process in the following fields: **Task Process Name**, **Task Type**, **Risk Levels**, **Approval Validity Period**, **Valid Waiting Period**, **Operation Validity Period**, and **Remarks**. | +| Level | Displays the task level information, which contains the approval node, approval role, and authorized approvers. | +| Created By | The user who initiated the task. | +| Created At | The time when the task process was created. | + + + +#### **View associated connections** + +| Item | Description | +|--------|--------------| +| Associated Connection | The associated public connections. | +| Task Process Status | The status of the task process. | + + + +### Edit a task process + +![Edit](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E7%BC%96%E8%BE%91%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B3-EN.png) + +On the **Task Process Management** page, click **Edit** in the **Actions** column of the target task process. The **Edit Task Process** panel appears. + + +| Item | Description | +|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task Process Name | The name of a task process can contain up to 110 characters in length, and can contain digits, letters, and Chinese characters. The names of task processes in the same organizational structure must be unique. | +| Task Type | The task subtypes of database changes include **Update**, **Delete**, **Insert**, **Select**, **Create, Drop**, **Alter**, and **Other**. | +| Risk Levels | The default value is 1. You can modify the value as needed. The maximum value is 10. We recommend that you set this parameter to 3. You can set the risk levels only for database changes. Other types of tasks can have only one risk level. | +| Task Approval Process | - This section is displayed only for database change processes. By default, only one risk level is set. The risk level contains all task subtypes you selected, does not limit the volume of data to be changed, and requires approval by the system administrator by default. You can set custom approval nodes for the risk level by setting the number of nodes and the approval roles.
        - If multiple risk levels are set, you can set **Task Subcategory**, **Number of SQL Statements Supported**, and **Set Approval Node** for each risk level. | +| Process Validity Period | You can specify the validity period of approval. If the specified period expires, the approval is automatically terminated. The default value is 24 hours (1 day). You can modify the value as needed. The maximum value is 240 hours (10 days).
        - **Approval Validity Period**: the validity period of approval. If this period times out, the task expires.
        - **Valid Waiting Period**: the waiting period before manual execution. If this period times out, the task expires.
        - **Operation Validity Period**: the validity period of execution. If this period times out, the task expires. | +| Task Process Status | You can enable or disable the task process. You cannot initiate tasks of a disabled process. | +| Remarks | The description of the task process. It can contain up to 200 characters in length. | + +### Set priorities of task processes + +1. On the **Task Process Management** page, click **Set Priority**. + + ![Set Task Process Priority 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E8%AE%BE%E7%BD%AE%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E4%BC%98%E5%85%88%E7%BA%A71-EN.png) + +2. In the **Set Priority** panel, select the task type. In the list in the **Process Priority** section, drag and drop the icon in the **Sort** column of a task process to adjust the priority order of the task process. + + > **Note** + > Tasks will be executed based on the priority order set by the administrator in the **Set Priority** panel in the public resource console. + > If a connection is associated with multiple processes, the tasks within the connection are matched against the processes by the priority order. + + ![Set Task Process Priority 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E8%AE%BE%E7%BD%AE%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E4%BC%98%E5%85%88%E7%BA%A72-EN.png) + +3. After the adjustment, click **Save** in the lower-right corner of the panel. The priority is set. + +### Disable a task process + +Click **Disable** in the **Actions** column of the target task process. In the dialog box that appears, click **OK**. + +> **Note** +> After a task process is disabled, it is no longer displayed on the task initiation page, which means that you cannot initiate tasks of it. \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/5.web-odc-operating-records.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/5.web-odc-operating-records.md new file mode 100644 index 00000000..cf594a6e --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/5.web-odc-operating-records.md @@ -0,0 +1,76 @@ +Manage operation records +============================================= + +This topic describes how to manage the records of operation events in the public resource console of OceanBase Developer Center (ODC). + +Operation record list +------------------------------------------ + +**Note** + + + +Any user who owns the system_admin role can manage operation records. + +Operation records are retained permanently. + +Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, click **Operating Records** to display the **Operating Records** page on the right. + +![Operating Records](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p416950.png) + +* You can the refresh icon ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p420125.jpg) to manually refresh the list. + + + +* You can select an option from **Performed At** to filter the operation records by time. Operation records in the last 7 days, 15 days, 30 days, 6 months, or a custom time range can be queried. + + + + + + +The following table describes the basic information displayed in the operation record list. + + +| Field | Description | +|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| No. | The sequence number of the operation record. | +| Event Type | The type of the operation event. The following types of operation events are supported: personal settings, password management, connection management, script management, database operations, organization configuration, member management, resource group management, data mocking, database changes, import, export, and task processes. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by event type. | +| Event Operation | The operation performed in the event. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by event operation. | +| IP Address | The IP address. You can click the search icon to search for the IP address. | +| Operator | The user who performed the operation. You can click the search icon to search for the operator. | +| Performed At | The time when the operation was performed. By default, the operation records are sorted by execution time. The latest record is displayed at the top. You can click the icon ![ASC/DESC](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p420143.jpg) to sort the operation records in ascending or descending order. | +| Execution Result | The execution result. Valid values: **Succeeded** and **Failed** . You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by execution result. | +| Actions | Indicates the actions you can take. Currently, only **View** is available. | + + + +View operation records +------------------------------------------- + +In the operation record list, click **View** in the **Actions** column. The **Record Details** panel appears. + +![View](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p416953.png) + +You can view the details of the record in the following columns: **Operation Type** , **Event Operation** , **Connection** , **IP Address** , **Operation Rules** , **Operator** , **Performed At** , and **Result** . + +Export operation records +--------------------------------------------- + +In the operation record list, click the export icon![Export](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p417273.jpg)in the upper-right corner to display the **Export Operating Records** panel. + +The following table describes the basic information displayed in the Export Operating Records panel. + +![Export Operating Records](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p417275.png) + + +| Field | Description | +|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Operation Time Range | Select the start date and the end date. | +| Event Operation | Select an event operation. | +| Connection | The name of the connection to which the operation belongs. Select the connection to which the operation belongs. All connections are selected by default. | +| Operator | Select the user who performed the operation. | +| Execution Result | Select the execution result. | +| Export File Format | Select the file format for exported data. Valid values: Excel and CSV. | + + diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md new file mode 100644 index 00000000..7e5edc5a --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md @@ -0,0 +1,126 @@ +Data desensitization management +======================= + +**Prerequisites** +------------------------- + +You are granted the administrator role of the public resource console. + +**Overview** +----------------------- + +Data desensitization deforms sensitive privacy information, such as names, ID card numbers, mobile phone numbers, landline numbers, bank accounts, and email addresses. You can set data desensitization rules to protect sensitive privacy data. + +To better identify sensitive columns in databases, ODC supports configuring AI-powered sensitive column identification (optional feature that requires users to deploy AI models themselves). This feature can intelligently identify columns that may contain sensitive information in tables, providing reference for creating data desensitization rules. We recommend using the fylfy111/SensitiveColumn model from ModelScope community (based on qwen2.5 7B Instruct). When deploying, it is recommended to configure --max-model-len=4096 and requires at least a single RTX 3090 GPU server. + +This topic describes how to create and manage data desensitization rules in the public resource console in OceanBase Developer Center (ODC), and how to enable data desensitization strategies in ODC scenarios such as data export and result set export. + +![Data desensitization management - 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-1-EN.png) + +**Create a desensitization rule** +--------------------------- + +![Data desensitization management - 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-2-EN.png) + +1. Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, click **Data Desensitization** to go to the data desensitization management page. + +2. Click **Create Desensitization Rule** in the upper-right corner of the **Desensitization Rules** page. The **Create Desensitization Rule** panel appears. + +3. Specify the following parameters in the **Create Desensitization Rule** panel. + + | **Parameter** | **Description** | + |---------|--------------------------------------------------| + | Rule Name | The name of the desensitization rule. The rule name can contain up to 48 characters in length and must be unique. | + | Rule Status | Select **Enable** or **Disable**. | + | Rule Details | Select a desensitization method so that sensitive characters are treated in the selected desensitization way. | + | Desensitization Effect | In the **Test Data** section, enter the data that you want to desensitize and click **Verify Desensitization** to view the desensitization result. | + +4. After you specify the preceding information, click **Create** in the lower-right corner of the panel. + + +**Manage desensitization rules** +--------------------------- + +Created desensitization rules are displayed in a list on the **Desensitization Rules** page. On this page, you can perform the following operations: + +* Click the refresh icon to manually refresh the list. +* Search for rules by using the search box in the upper-right corner of the list. + + +### **Desensitization Rules** + +The following table describes the columns contained in the list of desensitization rules. + +| **Column** | **Description** | +|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Rule Name | The name of the desensitization rule. | +| Desensitization Method | The desensitization method selected when the rule was created. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter rules by desensitization method. | +| Rule Status | The status of the desensitization rule. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter rules by status. | +| Updated At | The latest time when the current desensitization rule was edited. | +| Actions | The actions you can take. Valid values: **View**, **Edit**, **Disable**/**Enable**, and **Delete**.
        - **View**: View the details of the current desensitization rule.
        - **Edit**: Modify the details of the current desensitization rule.
        - **Disable**: Disable the current desensitization rule.
        - **Delete**: Delete the current desensitization rule. | + +### **View details of a desensitization rule** + +On the **Desensitization Rules** page, click **View** in the **Actions** column of the target rule. The **Details of Desensitization Rule** panel appears. + +![Data desensitization management - 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-3-EN.png) + +| **Parameter** | **Description** | +|---------|----------------------------------------------| +| Rule Name | The name of the desensitization rule. | +| Desensitization Details | The desensitization mode and segment selection. | +| Desensitization Effect | In the **Test Data** section, enter the data that you want to desensitize and click **Verify Desensitization** to view the desensitization result. | +| Created By | The user who created the current desensitization rule. | +| Created At | The time when the current desensitization rule was created. | +| Updated At | The latest time when the current desensitization rule was edited. | + + + +### **Edit a desensitization rule** + +![Data desensitization management - 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-4-EN.png) + +1. On the **Desensitization Rules** page, click **Edit** in the **Actions** column of the target rule. The **Edit Desensitization Rule** panel appears. + +2. In the **Edit Desensitization Rule** panel, edit the rule parameters specified when the rule was created. + +3. After you edit the rule, click **Save**. + +**Scenarios** +------------------------- + +ODC allows you to enable data desensitization strategies in operations such as data export and result set export. + +### **Scenario 1: Enable data desensitization when you export data** + +To enable a data desensitization strategy when you export the department table in ODC, perform the following steps: + +1. In the table list, right-click the department table and select **Export** from the context menu. + + ![Data desensitization management - 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-5-EN.png) + +2. In the **Single Table Export** panel, click **Data Desensitization** and select a data desensitization strategy. + + ![Data desensitization management - 6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-6-EN.png) + +3. In the **Single Table Export** panel, select **Manage Desensitization Strategies** in the **Data Desensitization** drop-down list to add, sort, edit, or remove data desensitization strategies. + + ![Data desensitization management - 7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-7-EN.png) + +### **Scenario 2: Enable data desensitization when you export a result set** + +For more information about data exporting scenarios, see [Batch export and import](../6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md). To enable a data desensitization strategy when you download the result set returned by querying the department table in ODC, perform the following steps: + +1. In the result set, click the **Download Data** icon. In the **Download Data** panel, click **Data Desensitization** and select a data desensitization strategy. + + ![Data desensitization management - 8](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-8-EN.png) + +2. In the **Download Data** panel, click **Manage Desensitization Strategies** in the **Data Desensitization** drop-down list to add, sort, edit, or remove data desensitization strategies. + + ![Data desensitization management - 7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-7-EN.png) + +**Related topics** +------------------------- + +* [Result tab](../5.web-odc-use-workspace/2.web-odc-sql-window.md) +* [Batch export and import](../6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md) diff --git a/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/7.web-odc-system-settings.md b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/7.web-odc-system-settings.md new file mode 100644 index 00000000..6213b675 --- /dev/null +++ b/en-US/6.web-odc-user-guide/4.web-odc-public-resource-management/7.web-odc-system-settings.md @@ -0,0 +1,22 @@ +System settings +==================================== + +The administrator can configure global settings on the System Settings page. Other users can configure the same features on the Personal Settings page. The personal settings have a higher priority than the system settings configured by the administrator. + +Log on to ODC as the administrator, and go to the **Public Resource Console** page. In the left-side navigation pane, click the **System Settings** to display the **System Settings** page on the right. + +![Image 874](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0096712561/p312560.png) + +In the upper-right corner of the page, click **Edit** to edit the settings. The following table shows settings that you can configure. + + +| Field | Description | +|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Session Mode for SQL Window | Set the session mode of the SQL window. | +| Delimiter Settings | Set the default delimiter for executing PL statements in the SQL window. Five types of delimiters are supported: semi-colons ( **;** ), slashes ( **/** ), double slashes ( **//** ), dollar signs ( **$** ), and double dollar signs ( **$$** ). | +| Transaction Commit Mode in Oracle Mode | Set the default transaction commit mode in Oracle mode. Valid values: Manual and Automatic. | +| Transaction Commit Mode in MySQL Mode | Set the default transaction commit mode in MySQL mode. Valid values: Manual and Automatic. | +| Maximum Number of Rows in Result Set | Set the default number of rows returned for an SQL statement executed in the SQL window. | +| Type of Statements Generated by Dragging and Dropping Object | Set the default type of statements generated when you drag and drop table or view objects. | + + diff --git a/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md new file mode 100644 index 00000000..d20d2607 --- /dev/null +++ b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md @@ -0,0 +1,55 @@ +Overview +============================= + +The workspace is the main feature module for you to develop databases in OceanBase Developer Center (ODC). + +After you enter the corresponding database connection, you can click **Workspace** in the navigation bar on the top of the page. The drop-down list provides the following features: + +* **SQL Window** : An SQL window is a working area for database developers to edit SQL and PL statements. ODC also provides the **Snippets** button in the SQL window. + + + +* **Anonymous Block Window** : An anonymous block window is a working area for database developers to edit anonymous block scripts. (The anonymous block window is available only in Oracle mode. ) + + + +* **Command-line Window** : OceanBase command-line web OBweb is integrated in the form of a command-line window. It allows you to execute SQL or PL statements and view the execution results in real time. + + + +* **Stored Scripts** : Database developers can open scripts previously stored in ODC. + + + +* **Snippets** : View and reference built-in and custom code snippets + + + +> **Note** +> Creating anonymous block windows is only supported in Oracle mode. + + +This chapter describes these features in different topics. + +* [SQL window](../../6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md) + + + +* [Anonymous block window](../../6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md) + + + +* [Command-line window](../../6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-command-line-window.md) + + + +* [Stored scripts](../../6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md) + + + +* [Code snippets](../../6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md new file mode 100644 index 00000000..1ffd98c5 --- /dev/null +++ b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md @@ -0,0 +1,148 @@ +SQL window +=========================== + + + +Overview +----------------------- + +On the Database Management page of OceanBase Developer Center (ODC), click **Workspace** in the top navigation bar and click **SQL Window** in the drop-down list that appears. + +The SQL window provides an SQL editing area for editing scripts, an execution record tab, and a result tab for displaying the execution results. The SQL window also supports executing PL/SQL statements. + +![Image 461](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/1SQL%20%E7%AA%97%E5%8F%A3-%E6%A6%82%E8%BF%B0-EN.png) + +SQL editing area +----------------------------- + +The SQL editing area provides many features for you. + +| Operation | Description | +|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Auto-complete | The SQL editing area provides the auto-complete feature to improve your SQL statement editing efficiency. For example, when you edit SQL statements, the table name is auto-completed for cross-database queries. | +| Intelligent identification of keywords and code | Database keywords are highlighted in different colors, and PL/SQL statements are identified. | +| Right-click of object names in the `SELECT` statement | When you right-click the name of a table, view, or function in a `SELECT` statement, some common operations are displayed. When you place the pointer over the name of a table, the field information is displayed. | +| Object drag-and-drop | You can directly drag objects from the object list into an SQL statement in the SQL editing area to fill in an object name in the statement.
        - After you drag a table or view and drop it into the SQL editing area, you can select the type of the SQL statement to be generated in the **Fast Generation** dialog box. You can click the username and select **Personal Settings** from the drop-down list, and set the default statement type in the **Type of Statements Generated by Dragging and Dropping Object** field of the **Edit Personal Settings** panel.
        - If you drag an object other than a table or view, the object name is directly dropped into the SQL editing area.
        ![Editing area2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/2SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F1-EN.png) | +| Shared and independent sessions | The SQL window of ODC supports **Shared Session** and **Independent Session** modes.
        - If you select **Shared Session**, you can open multiple SQL windows in the same connection, but cannot execute SQL statements in multiple windows in parallel.
        - If you select **Independent Session**, you can open multiple SQL windows in the same connection, and execute SQL statements in multiple windows in parallel. To open a new SQL window, click **+** next to the existing SQL window tab. By default, SQL windows are in Shared Session mode. You can click the username in the upper-right corner of the top navigation bar, select **Personal Settings** from the drop-down list, and set the session mode to **Independent Session** on the **Edit Personal Settings** panel.
        ![editing area 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/3SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F2-EN.png) | +| Identification of special symbols | Special symbol abnormality can be identified in the editing area of the SQL window, where abnormal symbols are marked with yellow wavy underlines. | +| Viewing the execution status | When you hover the pointer over an SQL window tab, the window name and execution status are displayed.
        ![editing area 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/4SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F3-EN.png) | + + +> **Note** +> In Oracle mode, the autocommit feature of ODC is set to OFF by default. You can change the transaction commit mode by modifying the value of the `autocommit` variable in the following two ways: click the **Settings** icon in the upper-right corner of the SQL window and modify the variable in the **Session Variables** dialog box, or click **Session** in the top navigation bar and modify the variable on the **Session Properties** page. Note that the settings in the **Set session variable** dialog box are valid only for the current SQL window. For more information, see [Manage sessions](../10.web-odc-session-management.md).
        +> In manual-commit mode, make sure to set `ob_trx_idle_timeout` to a value greater than the timeout value of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of `ob_trx_idle_timeout`, the connection will be terminated. However, if the `ob_trx_idle_timeout` parameter is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you must set this parameter to a proper value. + +![SQL editing area5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/5SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F4-EN.png) + +In addition to the preceding features, the toolbar of the editing area provides the following icons. + +| Icon | Description | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Run | Click this icon to execute all the SQL statements in the current window. This icon is disabled if an SQL statement is being executed in another window of the same session. | +| Run Current Statement | Click this icon to execute all the selected SQL statements or the SQL statement in the line where the pointer is located. This icon is disabled if an SQL statement is being executed in another window of the same session. | +| Abort | Click this icon to abort the statement that is being executed. | +| Execution Plan | Click this icon to view the execution plan for the SQL statement that you select or on which the pointer is located. This execution plan is estimated by the system before execution and is the result of the `EXPLAINPLAN` operation. Therefore, the execution data displayed may differ from the actual execution data. You can use this feature to evaluate SQL statements.
        Click **Execution Plan**. On the **Plan Details** tab, click **View Formatting Info** to switch to the formatted view. | +| Find and Replace | Click this icon and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this icon to undo the last operation. | +| Redo | Click this icon to reverse an **Undo** operation. | +| Format | Click this icon to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| IN Value Conversion | Click this icon to convert the copied rows or columns into the specified format during queries.
        After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format.
        - Column values are separated with line breaks.
        - Row values are separated with spaces or tabs. | +| Case Sensitivity | The system supports three configurations: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click this icon to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | You can add indents to or delete indents from the statements that you selected. | +| Comment | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | +| Save script | Click this icon to save the script in the current window. You can open a saved script when you enter the workspace again. You can view only the SQL scripts saved by yourself. The script names must be unique. After you open a stored script, you can continue to edit it. | +| Settings | - **Delimiter**: Select the character that you want to use as the delimiter from the drop-down list. Five types of delimiters are supported: semi-colons (;), slashes (/), double slashes (//), dollar signs ($), and double dollar signs ($$).
        - **Query Result Limit**: Set the maximum number of lines that a query can return. Default value: 1000.
        - **Session Variables**: You can edit, refresh, and search for variables. | +| Snippet | Click this icon to view and reference built-in and custom code snippets. For more information, see [Snippet](../../6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md). | +| Commit | - By default, `autocommit` is set to `OFF` in Oracle mode. You need to click this icon to commit the current transaction. After you click this icon, a dialog box appears, indicating that the current connection uses a shared session and the commit will apply to all windows. Click **Yes** to commit the transaction.
        - In MySQL mode, `autocommit` is set to `ON` by default, and this icon is not displayed. This icon is disabled if an SQL statement is being executed in another window of the same session.
        **Note**
        You can change the value of the `autocommit` variable in the following two ways: click the **Settings** icon in the upper-right corner of the SQL window and set the variable in the **Session Variables** dialog box, or click **Sessions** in the top navigation bar and set the variable on the **Session Properties** page. | +| Rollback | - In Oracle mode, if the `autocommit` variable in the **Session Variables** dialog box is set to `OFF`, click this icon to roll back the current transaction. After you click this icon, a dialog box appears, indicating that the current connection uses a shared session and the rollback will apply to all windows. Click **Yes** to apply the rollback.
        - In MySQL mode, the `autocommit` variable in the **Session Variables** dialog box is set to `ON`, and this icon is not displayed. This icon is disabled if an SQL statement is being executed in another window of the same session. | + + + +Execute PL/SQL statements +----------------------------- + +You can edit a PL/SQL statement in the SQL window. Note that you must end the PL/SQL statement with the specified delimiter. + +At present, you can use the following methods to specify a delimiter in ODC: + +* Click **Settings** in the toolbar of the SQL editing area. In the window that appears, select the delimiter as needed in the **Delimiter** field. + + + +* On the **Personal Settings** page, select a required delimiter in **Delimiter Settings**. + + + +* The compilation error information displayed includes the PL/SQL row ID and the position at which the error occurred. + +* Right-click the PL object in the left navigation bar and select **Run**, which supports setting the parameter value as DEFAULT, NULL or empty string. + + > **Notice** + >
      • In ODC V2.4.1 and later, you can use the `DELIMITER` statement in the editing area to define a delimiter. In **Settings**, the **Delimiter** field displays the delimiter that you specified.
      • + >
      • You can use slashes (/) to separate PL/SQL statements.
      • + +After you execute a PL/SQL statement in the SQL window, the result tab displays the database management system (DBMS) output. + +![Execute PL/SQL statements6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/6SQL%20%E7%AA%97%E5%8F%A3-%E8%BF%90%E8%A1%8C%20PL%20%E8%AF%AD%E5%8F%A5-EN.png) + +Execution Records tab +--------------------------- + +![Execution Records tab](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E6%89%A7%E8%A1%8C%E8%AE%B0%E5%BD%95%E9%A1%B5%E7%AD%BE-EN.png) + +On the **Execution Records** tab, you can view the history of SQL statements executed in the current connection. You can view the information in several columns, such as **Status**, **Time**, **SQL Statement**, **Results**, **Trace ID**, **Time Spent**, and **Execution Details**. The execution details constitute the execution plan. + +| Column | Description | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Check box | You can select the check box in front of one or more records and then click **Delete** in the upper-right corner of the list to delete the selected records. | +| TRACE ID | The ID of the execution record.
        **Notice**
        If **TRACE ID** is empty, make sure that the `enable_sql_audit` and `ob_enable_trace_log` parameters are set to `ON` when the statement is executed. Procedure:
        1. Choose **Sessions** > **Session Properties** > **Session Variables** and search for the `enable_sql_audit` and `ob_enable_trace_log` parameters.
        2. Click the **Edit** icon on the **Session Variables** tab. In the **Edit Variable** dialog box, change **OFF** to **ON** and click **OK**.
        3. Execute the following statement to enable the system parameter: ```sql obclient> alter system set enable_sql_audit='True'; Query OK, 0 rows affected (0.06 sec)``` | +| DB Time | You can hover the pointer over the icon next to a value in the **DB Time** column. In the prompt box that appears, you can view the total execution duration of the SQL statement and verify whether the duration of each phase adds up to the total execution duration. | +| Execution Details | By default, the execution plan is displayed in text. In the **Execution Details** column, click **View**. The **Execution Details** page displays the basic information, time spent, I/O statistics, executed SQL statements, plan statistics, and outlines. | + + + +Logs tab +------------------------- + +You can view the execution records of the current SQL window in the Logs tab. + +![Log tab](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/SQL%20%E7%AA%97%E5%8F%A3-%E6%97%A5%E5%BF%97%E9%A1%B5%E7%AD%BEEN.png) + +Result tab +------------------------- + +![Result tab](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/7SQL%20%E7%AA%97%E5%8F%A3-%E7%BB%93%E6%9E%9C%E9%A1%B5%E7%AD%BE-1-EN.png) + +You can view the execution result of the current SQL statement on the **Result** tab. The result set in the Result tab can be used in the following interactive operations to facilitate daily development work. + +| Operation | Description | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Select required data | You can select the required data of a result set and copy the data to an external file by using hotkeys. You can also click a field name or row ID to select an entire row or column. You can also click **Export** in the toolbar to export data of a result set to a local file. | +| Select rows and columns |
      • You can select consecutive rows or columns while holding the **Shift** key.
      • You can select inconsecutive rows or columns while holding the **Ctrl** or **Command** key.
      • | +| Right-click a cell | You can right-click a cell and select **Copy** or **Export to Clipboard** to directly export the data into an external file. | +| Right-click a row ID | You can right-click a row ID and select **Copy Row**, **Freeze this row**, or **Unlock all frozen rows**.
      • **Copy Row**: Click this option to copy the selected row.
      • **Freeze this row**: Click this option to freeze the selected row and pin it to the top. You can freeze multiple rows. The rows under the table header and frozen rows can be vertically scrolled.
      • **Unlock all frozen rows**: Click this option to unfreeze all frozen rows.
      • | +| Zoom in | If the data in a cell is too long and cannot be fully displayed, you can hover the pointer over the cell and click the zoom-in icon ![zoom-in icon](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8892277361/p353161.jpg) at the right end of the cell. In the window that appears, view the data in full.


        **Note**
        LOBs are displayed in text by default. You can convert an LOB into the hexadecimal format and download the LOB to a local device. | +| View BLOBs |
      • In Oracle mode, you can directly edit text data of the CLOB, BLOB, or RAW type, edit hexadecimal data, and upload files that are not greater than 200 KB in size.
      • In MySQL mode, you can directly edit text data of the XLOB type such as BLOB, MEDIUMBLOB, or TINYBLOB, edit hexadecimal data, and upload files.
      • | +| Right-click the tab name of a result tab | For example, you can right-click the tab name of the **Result 1** tab and click **Pin** in the context menu to pin the tab, so that it remains displayed. In this way, when you execute a new query, a new result tab appears but does not overwrite the pinned result tab. This allows you to compare the query results. Click **Unpin** to unpin a result tab. | +| Filter, sort, and search for data | Each field name in the result set is provided with a filter icon, a sort icon, and a search icon. You can use them to filter, sort, and search for data in a single column. | +| Drag the column name | You can adjust the order of fields by dragging column names in a result set. | +| Adjust the column width | You can adjust the column width by dragging the column edge. | + + + +The navigation bar of the **Result** tab also provides the following tools. + +| Tool | Description | +|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Column Mode | Click this icon to display the selected data row in the form of a table. On the **Column Mode** tab, you can switch to the previous or next row. ****The column mode makes it easier to view data in a row that has many columns. Procedure:
        1. Select the data that you want to view and click **Column Mode** ![Column Mode](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326038.jpg).
        2. On the **Column Mode** tab, click the left or right arrow to switch between the column values of adjacent rows.
        3. Hover the pointer over a value field and click the zoom-in icon ![Zoom](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326047.jpg) to view the details.
        4. In the table on the **Column Mode** tab, you can view the comments for a column in the **Remarks** column. Perform the following steps to modify the comments:
        a. In the left-side navigation pane, right-click the target table and select **View Table Structure** to go to the **Attribute** tab.
        b. In the left-side navigation pane of the **Attribute** tab, click the **Column** tab.
        c. Select a field and click the **Edit** icon. The field editing dialog box appears.
        d. In the **Comment** field , edit the comments, and click **OK**.
        e. In the **SQL Confirmation** dialog box, click **Execute**.
        f. View the modified comments on the **Column Mode** tab. | +| Columns | Click this icon to select the columns to be displayed on the page. | +| Back to Start | Click this icon to go back to the first page. | +| Previous | Click this icon to go to the previous page. | +| Next | Click this icon to go to the next page. | +| Jump to Bottom | Click this icon to go to the last page. | +| Search | Enter a keyword in the search box to search for the desired results. | +| Edit | Click **Edit** to enable editing mode for the current result set. The editing mode supports the following operations: **Add**, **Copy Current Row**, **Delete**, **Cancel**, **Confirm Modification**, which submits a transaction when autocommit is enabled, and **Modify and Submit**, which is displayed when autocommit is disabled. In the editing mode, you can either double-click target data to directly modify it or click the preceding icons for convenient operations. When you edit a cell, you can right-click the cell and select **Copy** or **Set to Null** from the context menu to operate on the cell.
        **Note**
        The ResultMetaData information is obtained during the execution of an SQL statement to indicate whether the result set can be edited.
        - If the result set cannot be edited, the Edit icon is not displayed and you are prompted that the result set cannot be edited.
        - If the result set can be edited, the Edit icon is available and you can click it to go to the result set editing page. You can edit result sets in single-table and single-view queries.
        - However, result sets that involve the SET and ENUM fields cannot be edited. | +| Download Data | You can export the query results to a CSV, SQL, or Excel file.
        - To export the query results to an SQL file: Edit the SQL statements in the **SQL Query** field, specify **Maximum Number of Lines in Result Set**, **File Name**, **File Format** (SQL)**,** **File Encoding**, **Data Desensitization**, and **SQL File Settings** (**Table Name** ).
        - To export the query results to a CSV file: Edit the SQL statements in the **SQL Query** field, specify **Maximum Number of Lines in Result Set**, **File Name**, **File Format**, **File Encoding**, and **Data Desensitization**. In the **CSV File Settings** section, specify **Include the Column Header**, **Convert the Empty Character String into a Null Value**, **Field Separator**, **Text Identifier**, and **Line Break Symbol**.
        - To export the query results to an EXCEL file: Edit the SQL statements in the **SQL Query** field, specify **Maximum Number of Lines in Result Set**, **File Name**, **File Format**,**File Encoding**, and **Data Desensitization**. In the **Excel File Settings** section, specify **Include the Column Header** and **Export SQL statements to another sheet**.
        **Note**
        - You can desensitize the exported data. You can specify a custom number of rows to export as needed.
        - If you export data in CSV format, the exported CSV file can be opened by Microsoft Excel.
        - If you export data in XLS format, you can specify whether to include the column header and whether to export the SQL statements of the query.
        ![Download data](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/8SQL%20%E7%AA%97%E5%8F%A3-%E7%BB%93%E6%9E%9C%E9%A1%B5%E7%AD%BE-3-%E4%B8%8B%E8%BD%BD%E6%95%B0%E6%8D%AE-EN.png) | +| Plan | Click this icon to view the actual resource consumption and execution plan of an executed SQL statement. This allows you to evaluate the performance of the statement. | + + diff --git a/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md new file mode 100644 index 00000000..e803d6cf --- /dev/null +++ b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md @@ -0,0 +1,123 @@ +Anonymous block window +=========================================== + + + +Overview +----------------------------- + +To open an anonymous block window, perform the following steps: enter the Database Management page of OceanBase Developer Center (ODC), click **Workspace** in the top navigation bar, and click **Anonymous Block Window** . + +An anonymous block window provides a **PL/SQL editing** area, the **PL/SQL Execution Result and DBMS Output** tabs, and the **Debugging** page. + +![Image 460](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2950380461/p263569.png) + +PL editing area +------------------------------------ + +The editing area of the anonymous block window provides many features for you. For example, when you open a new anonymous block window, + +* the guidance code is provided to make your script-writing easier. + + + +* Database keywords are highlighted in different colors. + + + +* It also provides features such as formatting to help you improve your PL/SQL statement writing efficiency. + + In addition to the preceding features, the toolbar of the editing area provides the following buttons. + + + | Button | Description | + |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Run | Click this button to execute the statements in the code area. | + | Abort | Click this button to abort the statement that is being executed. | + | Debug | Click this button to open the debugging page to debug the anonymous objects in the code area. | + | Format | Click this button to apply the formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | + | Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | + | Undo | Click this button to undo the last operation. | + | Redo | Click this button to reverse an **Undo** operation. | + | Case Sensitivity | The system supports three capitalization options: **All C** **aps** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | + | Indent | You can add indents to or delete indents from the statements that you selected. | + | Comments | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | + | Save | Click this button to save the script in the current window. You can open a saved script when you enter the workspace again.
        **Note**
        - You can view only the SQL scripts saved by yourself. The script names must be unique.
        - After you open a saved script, you can continue to edit it. | + + + + + + +PL/SQL Execution Result and DBMS Output tabs +----------------------------------------------------------------- + +After you click the run icon![run](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2950380461/p378301.jpg)in the toolbar of the editing area to execute the anonymous block, you can view the information in the **Execution Result** and **DBMS Output** tabs under the editing area. + +* The **Execution Result** tab displays the execution result of the script. If the execution was successful, **Executed** is displayed. Otherwise, an error message is displayed. + +* The **DBMS Output** tab displays the output of a subprogram that contains PL/SQL output statements, such as `dbms_output.put_line`. + + + + +Debugging page +----------------------------------- + +You can debug an anonymous block on the debugging page. To enter this page, click **Debug** in the toolbar of the editing area. + +On the debugging page, you can debug the anonymous block. +**Notice** + + + +* We recommend that you upgrade to OBServer V2.2.77 or later. This is because some versions of OBServer have been found with PL/SQL debugging issues, which may compromise the OBServer stability. + + + +* ODC V3.2.2 or earlier does not support the debugging feature when you connect ODC to the target instance by using OBProxy. To use the debugging feature, directly connect ODC to the target instance. + + + +* ODC V3.2.2 and later support PL/SQL debugging when you connect to OBServer by using OBProxy. + + + +* You have installed the debugging packages such as DBMS_DEBUG and DBMS_OUTPUT in the connected database. + + + + + + +![Debug](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3950380461/p203467.png) + +In debugging mode, the toolbar in the editing area provides the following buttons. + + +| Button | Description | +|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Batch Execute | Runs till the next breakpoint. If no breakpoint exists, runs till the end. | +| Step Over | Click this button to step over a given line without stepping into any subprogram. | +| Step Into | Click this button to execute code line by line. If the line includes a call to a stored procedure or function, it steps into the called subprogram. | +| Step Out | For a subprogram, you can click this button to return to the next line of the upper-layer call position. For the main program, this button achieves the same effect as **Auto Debugging** . | +| Abort Debugging | Click this button to execute the stored procedure till the end and skip breakpoints. | +| Debug Again | Click this button to initiate a new round of debugging on the current object. Unlike **Debug** , it does not establish a new debugging connection. | +| Exit Debugging | Click this button to close the debugging connection and exit the debugging window. | + + + +In addition to the editing area, the debugging mode also provides the following tabs: + +* **Parameters** : displays the definition information and values of all the parameters of the object to be debugged. The definition information includes the parameter name, mode, and type. The values may change as a result of the debugging process. + +* **Stacks and Variables** : displays the variables in the current stack and the values of the variables. + +* **DBMS Output** : If a subprogram contains PL/SQL output statements, such as `dbms_output.put_line`, the output is displayed on this tab. + +* **Breakpoint** : You can click the line number in the editing area to set a breakpoint, and click the line number again to remove the breakpoint. The Breakpoint tab displays all the breakpoints that you set in their execution order. You can select multiple breakpoints to cancel them at a time. The Actions column of each breakpoint information row provides the **Cancel** and **View** actions. You can click Cancel to cancel a breakpoint. After you click View, the cursor moves to the location of the breakpoint in the editing area. + +* **Debugging Logs** : displays the debugging logs and error logs. Debugging logs include information about the start and end of debugging and the addition and cancellation of breakpoints. + + + diff --git a/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/4.web-odc-command-line-window.md b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/4.web-odc-command-line-window.md new file mode 100644 index 00000000..aaf9df75 --- /dev/null +++ b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/4.web-odc-command-line-window.md @@ -0,0 +1,48 @@ +Command-line window +======================================== + +OceanBase Developer Center (ODC) integrates the OceanBase command-line client OBClient in the form of a command-line window. OBClient is the recommended command-line client for OceanBase. The command-line window allows you to use OBClient without a need to download or install it. It allows you to execute SQL or PL statements and view the execution results in real time. It also allows you to run the `SOURCE` command to execute files uploaded to the server. + +Create a command-line window +------------------------------------------------- + +Log on to ODC and click the name of the target connection to go to the corresponding connection management page. Click **Workspace** in the navigation bar on the top of the page and select **Command-line Window** from the drop-down list, to create a command-line window. The window that opens automatically connects to the current instance, and displays a default code segment that contains the connection ID, version information, and help information. +**Notice** + + + +You can create up to three command-line windows at a time. + +If a command-line window is disconnected, the **Reconnect** button appears in the upper-right corner of the command-line window. Click the button to reconnect the window.![Image 511](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6199620261/p267517.png) + +Script management +-------------------------------------- + +If you need to reference a script in your development work, you can the **Script Management** feature of the **Command-line Window** to import the script and then reference it. + +To reference a script, perform the following steps: + +1. Enter Script Management panel. + + Click the **Script Management** button in the upper-right corner of the command-line window to open the **Script Management** panel. + + +2. Import the script that you want to reference. + + Click the file pool under **Import Script** to start the file explorer, and select the script that you want to reference. Alternatively, you can directly drag the script file into the file pool to upload it. The maximum file size supported is 250 MB. + + +3. Obtain the file path. + + After the script is uploaded, you can view information about the script in the **Scripts** table in the panel. The table contains the following columns: **Script Path** , **Script Name** , **File Size** , and **Uploaded At** . To reference a script, click the **Copy Path** button in the Actions column and paste the path in the command-line window. + + +4. Delete a script file. + + You can view only script files uploaded by yourself. A file will be automatically deleted 30 minutes later after it is uploaded, to avoid unnecessary space consumption. You can also click the **Delete** button in the Actions column to delete a file. + + + + + +![Image 513](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6199620261/p267667.png) diff --git a/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md new file mode 100644 index 00000000..0f590dc6 --- /dev/null +++ b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md @@ -0,0 +1,113 @@ +Stored scripts +=================================== + +Log on to OceanBase Developer Center (ODC), and click the name of the target connection to go to the corresponding connection management page. Click **Workspace** in the top navigation bar, choose **Stored Scripts** from the drop-down list, and then choose a script that you previously stored in an SQL window or anonymous block window. + +Overview +----------------------------- + +![Image 560](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2295211561/p269155.png) + +After you choose the script, you can proceed to edit or run the script. If the script is an SQL script, ODC opens the script in an SQL window. If the script is an anonymous block script, ODC opens the script in an anonymous block window. In the script list, buttons with the following features are provided after each script name. + + +| Feature | Description | +|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| +| Edit | Click ![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424761.jpg) to modify the name and content of the script. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424762.jpg) to delete the script. | +| Script management | Click ![Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424763.jpg) to edit, import, download, or delete scripts. | + + + +Script management +-------------------------------------- + +### Edit a script + +![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2295211561/p424769.png) + +1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. Choose **Workspace** \> **Stored Scripts** . + + + +2. Select a script from the drop-down list of **Stored Scripts** , and click ![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424782.jpg) to go to the Edit Script panel. You can also click ![Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424763.jpg) to go to the Script Management panel, select a script, and click Edit. + + + +3. In the **Edit Script** panel, modify **Script Name** and **Script Content** and click **Save** . + + + + + + +### Delete a script + +1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. Choose **Workspace** \> **Stored Scripts** . + + + +2. Select a script from the drop-down list of **Stored Scripts** and click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424762.jpg) to delete it. + + + + + + +### Manage scripts + +![Script Management](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2295211561/p424794.png) + +1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. Choose **Workspace** \> **Stored Scripts** . + + + +2. Click **Stored Scripts** , and then click ![Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424763.jpg) in the drop-down list to go to the Script Management panel. + +3. In the Import Script section, click or drag files to import one or more scripts. + + > **Note**
        + > - The size of a single file cannot exceed 250 MB.
        + > - Files suffixed with .sql, .pl, and .txt are supported. + + + + + + + +4. Take the following actions in the script list: + + * Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424801.jpg) to refresh the script list. + + + + * Enter a script name in the search box to search for the script. + + + + * Click ![Check box](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424802.jpg) the check box to select multiple scripts for batch download or deletion. + + + + * Click **Copy Path** to copy the script path. + + + + * Click **Edit** to edit the script. + + + + * Click **Download** to download the script. + + + + * Click **Delete** to delete the script. + + + + + + + + diff --git a/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md new file mode 100644 index 00000000..7e8672f4 --- /dev/null +++ b/en-US/6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md @@ -0,0 +1,80 @@ +Snippet +============================ + +As an enterprise-grade database development platform, OceanBase Developer Center (ODC) provides the code snippet module to facilitate database development. If you forget about the usage of some statements, you can query in the code snippet module. The code snippet module provides suitable code snippets based on whether you are in Oracle or MySQL mode. In addition to the built-in code snippets, you can also create custom code snippets to store frequently used code segments. A custom code snippet can be viewed only by its creator. + +To open the Snippets panel, click **Snippets** in the toolbar of an SQL window, an anonymous block window, or a PL object editing page.![Image 225](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3143849361/p242639.png) + +View code snippets +--------------------------------------- + +In the Snippets panel, the code snippets are displayed in a list of cards. Each card displays information about a code snippet, such as its name, description, and type. When you place the pointer over the tips icon![Snippet tips icon](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3143849361/p325006.png) next to a code snippet name, a tip window appears, displaying the entire code in the snippet. + +You can directly search for specific code snippets in the search box above the card list. A filter is provided below the search box for you to filter code snippets by type. The filter provides the following options: **Others** , **DML** , **DDL** , **Process Control Statement** , and **All Types** . By default, All Types is selected. + +Create a code snippet +------------------------------------------ + +Click the **+Create** button in the upper-right corner of the code snippet list. The **Create Snippets** panel appears. Specify the following information in the panel: + +* **Snippet Name** : specifies the name of the code snippet. It can contain letters, digits, and underscores (_), and can contain a maximum of 60 characters. This parameter must be specified. + + + +* **Snippet Type** : specifies the type of the code snippet. The types include **Others** , **DML** , **DDL** , and **Process Control Statement** . By default, **Others** is selected. + + + +* **Snippets** : specifies the actual code of the snippet. The length cannot exceed 2000 characters. This parameter must be specified. Similar to the SQL window, the toolbar of the editing area also provides buttons such as Format, Find and Replace, Undo, Redo, Case Sensitivity, Indent, and Comment. It also provides code highlighting and association features. + + + +* **Snippet Description** : provides additional notes on the code snippet. The length cannot exceed 200 characters. This parameter is optional. + + **Note** + + + + If you specified an additional notes in the description field, the snippet card in the Snippets panel displays the notes. Otherwise, the first 30 characters of the code are displayed. + + + + + +![Image 224](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3143849361/p242637.png) + +Reference a code snippet +--------------------------------------------- + +You not only can view the content of a created code snippet when you edit scripts, but also can reference it in your script. You can reference a code snippet by using one of the following three methods: + +* Method 1: Drag the target card from the code snippet list to the editing area, and the code in the code snippet is copied to the editing area. + + + +* Method 2: Click the copy icon in the lower-right corner of the target code snippet card to copy the code, and then press Ctrl+V or Cmd+V to paste the code to the editing area. + + + +* Method 3: The editing area of the SQL window supports code association. When you edit a script in the editing area, existing code snippets appear in the code association window for you to view and reference. + + + + + + +Manage code snippets +----------------------------------------- + +ODC provides the **Edit** and **Delete** options for you to manage custom code snippets. You cannot edit or delete built-in code snippets. + +* **Edit** : Click the management icon (···) in the upper-right corner of the target code snippet card. In the menu that appears, click the **Edit** button to go to the **Edit Snippet** panel. The panel displays parameters such as **Snippet Name** , **Snippet Type** , **Snippets** , and **Snippet Description** that were specified at creation of the code snippet. You can modify the information as needed. + + + +* **Delete** : Click the management icon (···) in the upper-right corner of the target code snippet card. In the menu that appears, click the **Delete** button to delete the code snippet. + + + + + diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md new file mode 100644 index 00000000..9d985dba --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md @@ -0,0 +1,33 @@ +Overview +============================= + +OceanBase Developer Center (ODC) provides the database import and export features and the table import and export features, to facilitate database data maintenance for database developers. The database import and export features allow you to import data to or export data from selected tables in the database in batches. The table import and export features allow you to import data to or export data from the target table. + +ODC provides a **Task Center** page. After you create an import or export task, this page displays the current import or export task. You can also view task details and logs on this page. + +> **Notice**
        +>
      • OceanBase Database of a version earlier than V2.2.30 supports only UTF8.
      • +>
      • In ODC V2.2.1 and earlier versions, to use the import and export features, you must connect ODC to the target instance through OBProxy. If you directly connect ODC to the target instance, the import and export features are unavailable.
      • +>
      • In ODC V2.4.1 and later, you can use the sys tenant account to accelerate the import and export tasks. To export objects other than tables and views, you must configure the sys tenant account.
      • + + + + + + +This chapter describes the import/export features in different topics. + +* [Export and import formats](../../../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md) + + + +* [Batch export and import](../1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md) + + + +* [Single table export and import](../1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md) + + + + + diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md new file mode 100644 index 00000000..5705959e --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md @@ -0,0 +1,30 @@ +Export and import formats +============================================== + +OceanBase Developer Center (ODC) supports three data export modes: Export Schema and Data, Export Data Only, and Export Schema Only. A schema is the DDL file of an exported object, while data is the data file stored in the object. The types of schemas and data files vary with the export and import formats. + +ODC supports exporting data in CSV and SQL formats and importing ZIP, SQL (batch import), and CSV (single table import) files. + +Export file formats +---------------------------------------- + +ODC exports data in a zip file, which contains the metadata file MANIFEST.bin, the schema definition files of the exported objects, and the data files. + +When you create an export task, if you set **Data Format** to **SQL Format** , the zip file contains the schema definition files named in the pattern of `object_name-schema.sql` and data files named in the pattern of `object_name.sql`. The object names are the same as those of the objects in the database. + +![Image 614](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5199620261/p270049.png) + +If you set **Data Format** to **CSV Format** , the zip file contains the schema definition files named in the pattern of `object name-schema.sql` and data files named in the pattern of `object name.csv`. The object names are the same as those of the objects in the database. + +![Image 613](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5199620261/p270050.png) + +Import file formats +---------------------------------------- + +ODC supports importing ZIP (batch import and single table import), SQL (batch import), and CSV (single table import) files. + +The ZIP file here is a compressed package that is suffixed with .zip. When you create an import task, if you select **ZIP Files** as the **Import Content** , you must specify whether **Data Format** in the zip file is **CSV Format** or **SQL Format** . For more information about the content of different formats of files to be exported, see **Export file formats**. + +SQL files supported for batch data import are suffixed with .sql and contain statements that can be directly executed in the database. These statements include `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `CREATE`, and `DROP`. + +CSV files supported for single table import are data files that are suffixed with .csv or .txt. These files support custom delimiters. diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md new file mode 100644 index 00000000..05dfdb98 --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md @@ -0,0 +1,255 @@ +# Batch export and import + + + +## Overview + +OceanBase Developer Center (ODC) allows you to export and import the schemas and data of database objects in batches. + +After you open a database connection, click **Tools** in the top navigation bar, and then select **Export**or **Import** from the drop-down list to go to the corresponding settings panel. + +The following table describes the requirements for the size of imported and exported data and the retention period of files in ODC. + +| Requirement | Description | +|------------------------|------------| +| Limits on the size of imported and exported data in web ODC |
      • The maximum size of files imported in one batch cannot exceed 2 GB after compression. To import data of a larger size, use the data import tool [OBLOADER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610772).
      • The maximum size of files exported in one batch cannot exceed 2 GB before compression. To export data of a larger size, use the data export tool [OBDUMPER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610778).
      • | +| File retention period on the server |
      • The status of a task, such as Succeeded, Failed, and Canceled, does not affect the lifecycle of the task files.
      • Tasks are permanently retained. Task-related files are retained for 14 days by default.
      • | + + + +## Batch export + +In the **Create Export Task** panel, you can export multiple database objects to files in the specified format at the same time. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export1-EN.png) + + +The following example shows how to batch export the employee table and the salary view in the ODC. Procedure: + +### Step 1: Specify the export content + +As shown in the preceding figure, ODC supports three export modes: **Export Schema and Data**, **Export Data Only**, and **Export Schema Only**. **Export Schema Only** exports the definition statements of the target object. You can select the export content from the **Export Content** drop-down list. + +### Step 2: Select a database + +Select the database where the object to export resides. The name of the database connection to which the task belongs is also displayed. + +### Step 3: Specify the export range + +You can select **Partial Export** or **Full Export**. + +* If you select **Partial Export**, you can select the objects you want to export in the **Select Objects** pane in the **Export Objects** section. You can use the search box to search for desired objects. + + + +* If you select **Full Export**, all objects in the database are exported. + + + + + + +### Step 4: Go to the Export Settings panel + +Click **Next: Export Settings** to specify the file export settings and the sys tenant account. + +### Step 5: Go to the Data File Settings panel + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export2-EN.png) + +1. Specify **Data Format**. + + ODC supports exporting data to files in the CSV format and SQL format. If you specify **Export Schema Only** for **Export Content**, you can only export data to files in the SQL format. For more information about formats, see [Export and import formats](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md). + + +2. Specify **File Encoding**. + + ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + + +3. Specify **Data Desensitization**. + + By default, desensitization is disabled. You can select and manage the names of the desensitization strategies. In the **Manage Desensitization Strategies** section, you can add, edit, or delete strategies. For more information, see [Manage data desensitization](../../4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md). + + +4. Specify **Data File Settings**. + + If you select **Export Schema Only** for **Export Content**, you do not need to configure the export data settings. You need to specify the following fields: + + * **Use Global Snapshot**: If you select this option, ODC exports the data in the latest global snapshot of the specified table to ensure global data consistency. + + + + * **Batch Commit Quantity (SQL Format)**: You can click **Advanced** next to **Export Data Settings** to specify this field. If you select **SQL Format** for **Data Format**, you can specify the number of rows to be committed during the export. When this number is reached, a `COMMIT` command is executed. + + + + * Specify information for the CSV format. If you select **CSV Format** for **Data Format** and **Export Schema and Data** for **Export Content**, you can specify following information: + + * **Include the Column Header**: specifies whether to include column headers when data is exported in CSV format. This option is selected by default. + + + + * **Convert the Empty String into a Null Value**: This option is selected by default to determine whether to convert empty strings in the table to NULL values when data is exported in CSV format. + + + + * **Field Separator**: specifies the separator between fields. The following signs are supported: commas, semicolons, and colons. You can also use a character as the separator. + + + + * **Text Identifier**: specifies the identifier for the text content. Single quotation marks (') and double quotation marks (") are supported. + + + + * **Line Break Symbol**: specifies the line break symbol. The following characters are supported: \\n, \\r, and \\r\\n. + + + + + + + + + + + + +### Step 6: Specify schema file settings + +Choose whether to select **Add DROP TABLE Statement before CREATE TABLE Statement**. If you select this option, a `DROP` statement is added before the corresponding `CREATE` statement of an object when the schema files of the object are exported. + +### Step 7: Select an execution method + +Select **Execute immediately** or **Timed execution**. + +### Step 8: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + +**Notice** +- The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
        +![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + +- If the account of the sys tenant is not configured, indexes are not imported or exported. + + +### Step 9: Retain Current Configuration + +Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + + +#### Step 10: Generate an export task + +After you specify all preceding information, you can click **Export** in the lower-right corner of the panel to create an export task. + +#### Step 11: View the export task + +![Batch Export 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export3-EN.png) + +After the export task is generated, the **Task Center** page automatically appears, where you can view the task information and download exported data and schema files. For more information, see [Export tasks](../../../6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md). + +Batch import +------------------------- + +In the **Create Import Task** panel, you can choose to import schemas and data to multiple database objects at the same time. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import1-EN.png) + +Take the import of ZIP files (6000219_import_file) in the ODC as an example. The file contains an employee table and a salary view. Procedure: + +### Step 1: Specify **Import Format** + +As shown in the preceding figure, ODC supports batch import of **CSV Files**, **SQL Files**, and **ZIP Files**. You can select the desired file format from the **Import Format** drop-down list. For more information about formats, see [Export and import formats](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md). + +### Step 2: Upload the file to be imported + +Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. The format of the uploaded file must be the same as that of the value you specified for Import Format. Upload files suffixed with .zip if you have selected ZIP Files for Import Format, upload files suffixed with .sql if you have selected SQL Files for Import Format, and upload files suffixed with .csv if you have selected CSV Files for Import Format. + +### Step 3: Specify **File Encoding** + +ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + +### Step 4: Go to the Import Settings panel + +Click **Next: Import Settings** to specify file import settings and the sys tenant account. + +### Step 5: Specify **Import Content** + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import2-EN.png) + +You must specify this parameter when you select **ZIP Files** for **Import Format**. ODC supports **Import Data Only**, **Import Schema Only**, and **Import Schema and Data**. **Import Schema Only** imports the definition statements of the target object. You can select the import content from the **Import Content** drop-down list. + +### Step 6: Select a database + +Select the database to which the data object is to be imported. The name of the database connection to which the task belongs is also displayed. + +### Step 7: Specify **Import Data Settings** + +If you select **ZIP Files** for **Import Format** and **Import Data Only** or **Import Schema and Data** for **Import Content**, this option must be specified. You need to specify the following fields: + +* **Clear Data Before Import**: If you select this option, the original data in the destination object is cleared during data import. + + + +* **Batch Commit Quantity**: You can click **Advanced** next to **Export Data Settings** to specify this field. After you specify this field, a `COMMIT` statement is executed when the number of exported data rows reaches the specified quantity. + + + +* **Skipped Data Type (Optional)**: You can specify the data types to be skipped during data import. The data types that can be skipped are different in MySQL and Oracle modes. You can select multiple data types. + + + + + + +### Step 8: Specify **Import Schema Settings** + +You cannot specify this field if you select Import Data Only for **Import Content**. This field involves operations on schemas that already exist. If you select **Skip**, the system skips the schema definition statement in the file to be imported and directly imports the data. The original data in the object is retained. If you select **Replace**, the system executes the schema definition statement in the file to be imported to re-create an object and replace the original one. Data in the original object is cleared. + +### Step 9: Specify **Task Error Handling Method** and the execution method + +* ODC supports two error handling methods: **Abort Task** and **Ignore Error and Continue**. You need to select the handling method as required. + + + +* Select **Execute immediately** or **Timed execution**. + + + + + + +### Step 10: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + + **Notice** + - The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
        + ![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + + - If the account of the sys tenant is not configured, comments and indexes are not imported or exported. + + +### Step 11: Retain Current Configuration + +Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + +### Step 12: Generate an import task + +After you specify all preceding information, you can click **Submit** in the lower-right corner of the panel to create an import task. + +#### Step 13: View the import task + +![Batch Import 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import3-EN.png) + +After the task is generated, the **Task Center** page automatically appears, where you can view the task information. For more information, see [Import tasks](../../../6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md). + diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md new file mode 100644 index 00000000..f1c44822 --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md @@ -0,0 +1,217 @@ +Single table export and import +============================ + + + +Overview +----------------------- + +OceanBase Developer Center (ODC) allows you to import and export data and schemas from a specified table. + +After you open a database connection, you can click Objects in the left-side navigation pane to view the objects. Right-click the name of the target object in the object list, or click **Tools** in the top navigation bar and then select **Export** or **Import** from the drop-down list to export or import the data and schema in the current table. + +The following table describes the requirements for the size of imported and exported data and the retention period of files in ODC. + + +| Requirement | Description | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Limits on the size of imported and exported data in web ODC |
      • The maximum size of files imported in one batch cannot exceed 2 GB after compression. To import data of a larger size, use the data import tool [OBLOADER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610772).
      • The maximum size of files exported in one batch cannot exceed 2 GB before compression. To export data of a larger size, use the data export tool [OBDUMPER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610778).
      • | +| File retention period on the server |
      • The status of a task, such as Succeeded, Failed, and Canceled, does not affect the lifecycle of the task files.
      • Tasks are permanently retained. Task-related files are retained for 14 days by default.
      • | + + + +Single table export +------------------------- + +![Single Table Export - 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/export1-EN.png) + +The procedure for exporting a single table is basically the same as the that of [batch export](../1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md). The following example shows how to export an employee table in ODC. Procedure: + +### Step 1: Specify the export content + +As shown in the preceding figure, ODC supports three export modes: **Export Schema and Data**, **Export Data Only**, and **Export Schema Only**. **Export Schema Only** exports the definition statements of the target object. You can select the export content from the **Export Content** drop-down list. + +### Step 2: Select a database + +Select the database where the object to export resides. The name of the database connection to which the task belongs is also displayed. + +### Step 3: Specify the export range + +By default, the current table is exported. You can select **Partial Export** or **Full Export**. + +* If you select **Partial Export**, you can select the objects you want to export in the **Select Objects** pane in the **Export Objects** section. You can use the search box to search for desired objects. +* If you select **Full Export**, all objects in the database are exported. + +### Step 4: Go to the Export Settings panel + +Click **Next: Export Settings** to specify the file export settings and the sys tenant account. + +### Step 5: Go to the Data File Settings panel + +![Single Table Export - 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/export2-EN.png) + +1. Specify **Data Format**. + + ODC supports exporting data to files in the CSV format and SQL format. If you specify **Export Schema Only** for **Export Content**, you can only export data to files in the SQL format. For more information about formats, see [Export and import formats](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md). + + +2. Specify **File Encoding**. + + ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + + +3. Specify **Data Desensitization**. + + By default, desensitization is disabled. You can select and manage the names of the desensitization strategies. In the **Manage Desensitization Strategies** section, you can add, edit, or delete strategies. For more information, see [Manage data desensitization](../../4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md). + + +4. Specify **Data File Settings**. + + If you select **Export Schema Only** for **Export Content**, you do not need to configure the export data settings. You need to specify the following fields: + * **Use Global Snapshot**: If you select this option, ODC exports the data in the latest global snapshot of the specified table to ensure global data consistency. + * **Batch Commit Quantity (SQL Format)**: You can click **Advanced** next to **Export Data Settings** to specify this field. If you select **SQL Format** for **Data Format**, you can specify the number of rows to be committed during the export. When this number is reached, a `COMMIT` command is executed. + * Specify information for the CSV format. If you select **CSV Format** for **Data Format** and **Export Schema and Data** for **Export Content**, you can specify following information: + + * **Include the Column Header**: specifies whether to include column headers when data is exported in CSV format. This option is selected by default. + * **Convert the Empty String into a Null Value**: This option is selected by default to determine whether to convert empty strings in the table to NULL values when data is exported in CSV format. + * **Field Separator**: specifies the separator between fields. The following signs are supported: commas, semicolons, and colons. You can also use a character as the separator. + * **Text Identifier**: specifies the identifier for the text content. Single quotation marks (') and double quotation marks (") are supported. + * **Line Break Symbol**: specifies the line break symbol. The following characters are supported: \\n, \\r, and \\r\\n. + +### Step 6: Specify schema file settings + +Choose whether to select **Add DROP TABLE Statement before CREATE TABLE Statement**. If you select this option, a `DROP` statement is added before the corresponding `CREATE` statement of an object when the schema files of the object are exported. + +### Step 7: Select an execution method + +Select **Execute immediately** or **Timed execution**. + +### Step 8: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + + **Notice** + - The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
        + ![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + + - If the account of the sys tenant is not configured, indexes are not imported or exported. + +### Step 9: Retain Current Configuration + +Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + +### Step 10: Generate an export task + +After you specify all preceding information, you can click **Export** in the lower-right corner of the panel to create an export task. + +### Step 11: View the export task + +![Single Table Export - 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/export3-EN.png) + +After the export task is generated, the **Task Center** page automatically appears, where you can view the task information and download exported data and schema files. For more information, see [Export tasks](../../../6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md). + +Single table import +------------------------- + +![Single Table Import - 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/import1-EN.png) + +Take the import of a ZIP file (6000219_import_file) in ODC as an example. The file contains an employee table. Procedure: + +### Step 1: Specify Import Format + +As shown in the preceding figure, ODC supports **CSV Files** and **ZIP Files** for single table import. You can select the desired file format from the **Import Format** drop-down list. For more information about formats, see [Export and import formats](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md). + +### Step 2: Upload the file to be imported + +Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. The format of the uploaded file must be the same as that of the value you specified for **Import Format**. Upload files suffixed with .zip if you have selected **ZIP Files** for **Import Format**, and upload files suffixed with .csv if you have selected **CSV Files** for **Import Format**. + +> **Note** +> You can upload a single table or multiple tables. + +### Step 3: Specify File Encoding + +ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + +### Step 4: Go to the Import Settings panel + +Click **Next: Import Settings** to specify file import settings and the sys tenant account. + +### Step 5: Specify Import Content + +![Single Table Import - 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/import2-EN.png) + +You must specify this parameter when you select **ZIP Files** for **Import Format**. ODC supports **Import Data Only**, **Import Schema Only**, and **Import Schema and Data**. **Import Schema Only** imports the definition statements of the target object. You can select the import content from the **Import Content** drop-down list. + +### Step 6: Select a database + +Select the database to which the data object is to be imported. The name of the database connection to which the task belongs is also displayed. + +### Step 7: Import the target table + +By default, the current table is imported. To import multiple tables, select the tables to be imported. + +### Step 8: Specify Import Data Settings + +If you select **ZIP Files** for **Import Format** and **Import Data Only** or **Import Schema and Data** for **Import Content**, this option must be specified. You need to specify the following fields: + +* **Clear Data Before Import**: If you select this option, the original data in the destination object is cleared during data import. + + + +* **Batch Commit Quantity**: You can click **Advanced** next to **Import Data Settings** to specify this field. After you specify this field, a `COMMIT` statement is executed when the number of exported data rows reaches the specified quantity. + + + +* **Skipped Data Type (Optional)**: You can specify the data types to be skipped during data import. The data types that can be skipped are different in MySQL and Oracle modes. You can select multiple data types. + + + + + + +### Step 9: Specify Import Schema Settings + +You cannot specify this field if you select **Import Data Only** for **Import Content**. This field involves operations on schemas that already exist. If you select **Skip**, the system skips the schema definition statement in the file to be imported and directly imports the data. The original data in the object is retained. If you select **Replace**, the system executes the schema definition statement in the file to be imported to re-create an object and replace the original one. Data in the original object is cleared. + +### Step 10: Specify Task Error Handling Method and the execution method + +* ODC supports two error handling methods: **Abort Task** and **Ignore Error and Continue**. You need to select the handling method as required. +* Select **Execute immediately** or **Timed execution**. + + + + + + +### Step 11: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + + **Notice** + - The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
        + ![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + + - If the account of the sys tenant is not configured, comments and indexes are not imported or exported. + +### Step 12: Retain Current Configuration + +Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + +### Step 13: Generate an import task + +After you specify all preceding information, you can click **Submit** in the lower-right corner of the panel to create an import task. + +### Step 14: View the import task + + +After the task is generated, the **Task Center** page automatically appears, where you can view the task information. For more information, see [Import tasks](../../../6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md). + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/import3-EN.png) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/2.web-odc-data-mocking.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/2.web-odc-data-mocking.md new file mode 100644 index 00000000..83d09bbc --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/2.web-odc-data-mocking.md @@ -0,0 +1,75 @@ +Data mocking +================================= + +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. + +![Image 171](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8315511561/p240476.png) + +Perform the following steps to generate data by using the data mocking feature: + +1. 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. + + +2. View **Connection** . + + The name of the database connection to which the task belongs is displayed under Connection. + + +3. Specify **Database** . + + Select the database to be changed. + + +4. 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. + + +5. 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. + + +6. Specify the batch size. + + In the Mock Data panel, set **Batch Processing 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. + + +7. 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. + + +8. 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. + + + + + + +9. Set data generation rules. + + In the Mock Data panel, the **Rule Settings** table displays the fields in the table you selected in step 2 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. + + +10. 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** . + + + + + diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md new file mode 100644 index 00000000..aef6240d --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md @@ -0,0 +1,42 @@ +# Partitioning plan + +## Background + +- **RANGE partitioning**: Multiple rows with column values in an ordered, continuous, and non-overlapping range are assigned to a partition. For details, see [Set partitioning rules](../11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md). + +- **Partitioning Plan**: When inserting data in a range-partitioned table, if the inserted data exceeds the upper limit value of the current partition table, the data will not be inserted and an error will be returned. Partitioning plan is an extension function specially for range partitioning. ODC supports automatic management of range-partitioned table according to the partitioning strategy set by the user. Users do not need to manually create new partitions to facilitate the maintenance of range-partitioned table. + +This topic describes how to use a partitioning plan in the OceanBase Development Center (ODC) console, including performing automatic management on created and dropped table partitions. + +## Create a partitioning plan + +1. Log on to the ODC console, and click the name of the target connection to go to the corresponding database object management page. + +2. In the top navigation pane, choose **Tool** > **Partition Plan** to display the **Create a partition plan** panel. + + + ![Partitioning plan 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%921-EN.png) + +3. In the **Create a partition plan** panel, specify the following information. + + ![Partitioning plan 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-2-EN.png) + + | **Parameter** | **Description** | + |---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The connection to which the partitioning plan belongs. The default value is the current connection. | + | Partition policy | The information about the partitioning strategy. Search for and select a RANGE-partitioned table in the database and edit its partitioning strategy.
        • You can select **Only tables that are not set are displayed** on the right side of **Partition policy** to display only tables with no partitioning strategies.
        • You can also select multiple RANGE-partitioned tables and configure a partitioning strategy for them at a time.
        • In the **Partitioning Strategy** column, click the edit icon and then you can edit the number of partitions to create, partitioning interval, retention period, and naming rules.
          • **Number of Partitions**: set the number of partitions to pre-create.
          • **Partition Interval**: pre-create the corresponding number of partitions based on the time interval, unit: day/month/year.
          • **Retention Period**:the created partition is automatically cleared after the retention period expires, unit: day/month/year.
            Example: The number of partitions is 1, the partition interval is 1 month, and the retention period is 1 month, which means that 1 partition is pre-created for the current table, and 1 partition will be created every 1 month, and the created partition will be cleaned up automatically after 1 month.
            ![edit](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-edit-3-EN.png)
        | + | Remarks | The business background of the project, such as the change purposes and expected goals. | + +4. After you specify the preceding information, click **Submit** in the lower-right corner of the panel. + +5. After the task is generated, the **Task Center** panel automatically appears, where you can view the task status and task information. For more information, see [Partitioning plan task](../9.web-odc-task-management/6.web-odc-partition-scheme-task.md). + + ![Partitioning plan 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92%E5%88%97%E8%A1%A83-EN.png) + + +## Related topics + +* [Task process management](./4.web-odc-public-resource-management/4.web-odc-task-process.md) + + +* [Partitioning plan task](../9.web-odc-task-management/6.web-odc-partition-scheme-task.md) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/4.web-odc-database-change.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/4.web-odc-database-change.md new file mode 100644 index 00000000..47b10e3d --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/4.web-odc-database-change.md @@ -0,0 +1,128 @@ +Database changes +===================================== + + + +Overview +----------------------------- + +Statements in the SQL window of OceanBase Developer Center (ODC) are executed synchronously. Therefore, the execution may time out when the statement runs for a long time. You can use the database change tool to run time-consuming SQL statements to avoid execution timeout. + +![Image 441](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6378659361/p293273.png) + +Procedure +------------------------------ + +To create a database change task, perform the following steps: + +1. Go to the **Database Change** panel. + + 1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. + + + + 2. Click **Tool** in the top navigation bar. + + + + 3. Select **Database Change** in the drop-down list. The **Create Database Change Task** panel appears. + + + + + + +2. View **Connection** . The current connection is selected by default and you cannot switch to another connection. + + + +3. Specify **Database** . The current database is selected by default. + + + +4. Specify **SQL Content** . + + The database change supports two ways to specify SQL content: + * **SQL Entry** : This is the default way to specify SQL content. You can directly write the SQL script in the editing area. + + **Note** + + + * You can click **IN Value Conversion** to convert the batch copied data into the in('A','B') format. + + + + + + * **Upload File** : Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. + + **Note** + + + * You can upload up to 500 files. The total file size cannot exceed 256 MB. + + + + * By default, files are sorted by the order in which they were uploaded. You can drag and drop them to change the order. Tasks are executed in the file order. + + + + * Only SQL files suffixed with .sql are supported. + + + + + + + + + + +5. Specify **Rollback Plan** . + + You can write an SQL script or upload a file to specify the rollback plan. For more information, see the step of specifying SQL Content. + + +6. **Delimiter** : The delimiters are supported. + + + +7. **Query Result Limit** : You can set the number of data rows in the query result. Value range: 1 to 1000000. + + + +8. Specify **Task Error Handling Method** . + + The database change tool supports two methods to handle task errors: + * **Abort Task** : This is the default option. When you select this option, the task is aborted if an error occurs when you run the script. + + + + * **Ignore Error and Continue** : When you select this option, the system skips the statement where an error occurs and continues to execute other statements in the script. + + + + + + +9. Specify **Execution Timeout Value** . + + Specify the value in the **Execution Timeout Value** field in hours. Default value: 48. Maximum value: 480. + + +10. Optional. Specify the task description. + + You can enter a description of no more than 200 characters in **Description** . + + +11. Generate a database change task. + + After you specify the above information in the panel, click **Create** to submit the information to generate the database change task. + + +12. After the task is created, the **Task Center** \> **Database Change** page automatically appears. You can click **View** to go to the task details page, which displays **Task Information** , **Result** , and **Task Logs** . + + + + + diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/5.web-odc-shadow-table-synchronization.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/5.web-odc-shadow-table-synchronization.md new file mode 100644 index 00000000..98990bbc --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/5.web-odc-shadow-table-synchronization.md @@ -0,0 +1,63 @@ +# Shadow table synchronization + +## Background + +The shadow table synchronization feature of OceanBase Developer Center (ODC) allows you to automatically create a shadow table in the current database based on the schema of the source table. The shadow table name is the combination of the source table name and a prefix or suffix. This feature applies to scenarios like full-link stress testing. + +This topic describes how to create a shadow table synchronization task in ODC. +> **Note** +>
      • The shadow table synchronization feature of ODC V4.0.0 supports only the MySQL mode. If the source table contains subpartitions, only template-based HASH or KEY subpartitions are supported.
      • +>
      • After a shadow table is created, you can view it on the Table page.
      • +>
      • When a shadow table is created, if a table with the same name but a different schema already exists, a synchronization SQL statement is generated to update the schema of the existing shadow table.
      • + +## Create a shadow table synchronization task + +1. Log on to the ODC console, and click the name of the target connection to go to the corresponding database object management page. + + +2. In the top navigation bar, choose **Tool** > **Synchronize Shadow Table** to display the **Create Shadow Table Synchronization Project** panel. + + ![Shadow table synchronization 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A51-EN.png) + +3. On the **Create Shadow Table Synchronization Project** panel, specify the following information. + + 1. Select a synchronization object. + + ![Shadow table synchronization Create](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A52-EN.png) + + + | **Field** | **Description** | + |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Database | The database to which the shadow table to be created belongs. You can view the name of the current connection. | + | Synchronization Range | The table to be synchronized.
        • **Partial Tables**: Shadow tables will be created in the current database for the selected tables.
        • **All Tables**: Shadow tables will be created in the current database for all tables in the source database.
        | + | Name of Shadow Table | The name of the shadow table, in the format of **prefix** + source table name or source table name + **suffix**. You can use custom prefix or suffix. | + | Synchronization Objects | The source tables to be synchronized as shadow tables. You must specify this field when **Synchronization Range** is set to Partial Tables. | + + + 2. Analyze the schema of the shadow table. + + ![Shadow table synchronization Create 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A53-EN.png) + + + | **Field** | **Description** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Synchronized Tables | The **Synchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **View** to view the source table schema, shadow table schema, and schema change SQL statement, or click **Skip**, indicating that this shadow table is not synchronized. | + | Unsynchronized Tables | The **Unsynchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **Undo Skip** to synchronize this shadow table.
        **Note:**
        A skipped table will be displayed on the **Unsynchronized Tables** tab.
        If a shadow table with the same name and the same schema as the source table already exists, schema synchronization will be skipped.
        | + | SQL Preview | The SQL statement for schema synchronization. | + | Task Settings | Options of **Execution Mode** include:
        • **Execute Immediately**: The synchronization task is executed immediately.
        • **Execute On Schedule**: The synchronization task is executed on schedule.
        | + | Task Settings | Options of **Task Error Handling Method** include:
        • **Abort Task**: If an error occurs during the execution of the synchronization task, the subsequent SQL scripts are interrupted and no longer executed.
        • **Ignore Error and Continue**: If an error occurs during the execution of the synchronization task, the SQL script with the error is skipped, but subsequent SQL scripts will be executed.
        | + | Remarks | The business background of the project, such as the change purpose and expected goal. | + +4. After you specify the preceding information, click **Submit** in the lower-right corner of the panel. + + +5. After the task is generated, the **Task Center** panel automatically appears, where you can view the task status and task information. For more information, see [Shadow table synchronization tasks](../../6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization.md). + + ![Shadow table synchronization Approve task 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A54-EN.png) + + +## Related topics + +* [Task process management](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md) + +* [Shadow table synchronization tasks](../../6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization-task.md) diff --git a/en-US/6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-sql-plan.md b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-sql-plan.md new file mode 100644 index 00000000..758a24af --- /dev/null +++ b/en-US/6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-sql-plan.md @@ -0,0 +1,38 @@ +# SQL plan + +## Background information + +OceanBase Developer Center (ODC) can periodically execute SQL scripts created by users to complete database development and O&M tasks as required by the users. For example, ODC can periodically execute stored procedures, backup, and database and table schema synchronization. + +This topic describes how to create and manage SQL plan in ODC. + +## Create an SQL plan + +1. After logging in to ODC, click the target connection to enter the corresponding database object management page. + +2. In the top navigation bar, click **Tools** > **SQL Plan** . + + +3. In the **Create SQL Plan** panel, specify the following information. + + ![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/sql%20plan/1-EN.png) + + | **Item** | **Description** | + |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | SQL Content | You can specify SQL content in either of the following ways:
        • **SQL Entry**: This is the default way to specify SQL content. You can directly write the SQL script in the editing area.
        • The maximum size of the SQL statements that can be entered in the SQL window is limited to 10 MB. If the content to be entered is more than 10 MB in size, you can directly upload an attachment.
        • You can click **IN Value Conversion** to convert the batch copied data into the in('A','B') format.
        • Column values are separated with line breaks.
        • Row values are separated with spaces or tabs.
        • **Upload File**: Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it.
        • You can upload up to 500 files. The total file size cannot exceed 256 MB.
        • By default, files are sorted by the order in which they were uploaded. You can drag and drop them to change the order. Tasks are executed in the file order.
        • Only SQL files suffixed with .sql are supported.
        | + | Delimiter | The delimiters are supported. | + | Query Result Limit | You can set the maximum number of rows allowed in the query result. Value range: 1 to 1000000. | + | Execution Timeout Value | Specify the value in the **Execution Timeout Value** field in hours. Default value: 48. Maximum value: 480. | + | Scheduled Period |
        • You can directly select a predefined option of Every Hour, Every Night, or Every Friday.
        • You can also set the scheduled execution period in either of the following modes:
          • Default: You can set the scheduled execution period on a daily, weekly, or monthly basis as needed.
            ![SQL plan - Scheduled execution period - Default mode 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/4-EN.png)
          • Custom: You can set the scheduled execution period by specifying the second, minute, hour, day, month, or week as needed.
            ![SQL plan - Scheduled execution period - Custom mode 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/5-EN.png)
          | + | Task Settings | You can handle task errors in either of the following ways:
          • Abort Task: This is the default option. When you select this option, the task is aborted if an error occurs when you run the script.
          • Ignore Error and Continue: When you select this option, the system skips the statement where an error occurs and continues to execute other statements in the script.
          | + | Remarks (Optional) | You can enter a description of up to 200 characters. | + +4. Click **Create** to complete the task application. + + +## References + +* [Manage task processes](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + + +* [SQL plans task](../9.web-odc-task-management/9.web-odc-sql-plan-task.md) diff --git a/en-US/6.web-odc-user-guide/7.web-odc-recycle-bin.md b/en-US/6.web-odc-user-guide/7.web-odc-recycle-bin.md new file mode 100644 index 00000000..57436945 --- /dev/null +++ b/en-US/6.web-odc-user-guide/7.web-odc-recycle-bin.md @@ -0,0 +1,40 @@ +Recycle bin +================================ + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding database object management page. Click **Recycle Bin** in the upper-right corner to go to the recycle bin page. + + + +The recycle bin temporarily stores deleted database objects and allows you to search for and restore the deleted objects. + +Technically, the recycle bin is a data dictionary table that stores the information about deleted database objects. Deletion here refers to the `DROP` operation. Data that is deleted by the `DELETE` operation will not be moved to the recycle bin. Therefore, an object deleted by the `DROP` operation is not permanently deleted and still occupies storage space. You can use the `PURGE` operation or empty the recycle bin in ODC to release the space. + +The following figure shows the recycle bin page.![Recycle bin](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4116211561/p203469.png) + + +| Column | Description | +|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Original Name | The name of the deleted object specified by its creator. You can click Original Name to sort the objects by original name in ascending or descending order. | +| Object Name | The name that ODC gives to the object. Unlike the original name, the object name is never repeated and can uniquely identify an object. | +| Object Type | The type of the deleted object. | +| Recycled At | The timestamp when the object was deleted. The timestamps help you track deleted objects with ease. | + + + +In addition, the navigation bar on the recycle bin page provides buttons with the following features. + + +| Feature | Description | +|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Clear | Click ![Clear](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412872.jpg) to clear the recycle bin so that all the deleted objects in the recycle bin are purged and the storage space is released. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the list of deleted objects in the recycle bin. | +| Purge | Click ![Purge](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412873.jpg) to purge the selected objects from the recycle bin and release the storage space. | +| Restore | Click ![Restore](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412874.jpg) to restore the selected objects from the recycle bin to its original location. | +| Search | Enter the name of a deleted object in the search box to search for it. | +| Settings | Click ![Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p413502.jpg) to specify whether to enable the recycle bin and the Truncate Table feature. * If the recycle bin is enabled, the schema of deleted objects will be moved to the recycle bin. * If the Truncate Table feature is enabled, the data of deleted objects will be retained. | +| Select All | Click the check box icon ![Check box](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p422119.jpg) to select or deselect all objects.
          ![Select All](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p422121.png) | + + + + + diff --git a/en-US/6.web-odc-user-guide/8.web-odc-view-operation-records.md b/en-US/6.web-odc-user-guide/8.web-odc-view-operation-records.md new file mode 100644 index 00000000..37ef40e0 --- /dev/null +++ b/en-US/6.web-odc-user-guide/8.web-odc-view-operation-records.md @@ -0,0 +1,84 @@ +View operation records +=========================================== + +This topic describes how to view the history of operation events in OceanBase Developer Center (ODC). + +Background +------------------------------- + +You can view operation records in ODC for the following purposes: + +* Security compliance: A variety of features provided by operation records help you make sure that operations in your system meet security and compliance requirements. + + + +* Real-time monitoring: You can monitor business operations related to public connections in real time through operation records. + + + +* Event tracing: Database behaviors can be periodically compared based on operation records, which helps you locate anomaly points and abnormal behaviors in the database and allows you to trace risks. Besides, with operation records, correlated queries and analysis can be performed based on the database access source, to help you find the exact operator who accesses the database. + + + + + + +Operation record list +------------------------------------------ + +**Note** + + + +You can view your own operation records in this list. + +Operation records are retained permanently. + +1. On the Database Management page of ODC, click **Operating Records** in the top navigation bar. + + ![Operation record 1](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3716211561/p411756.png) + + +2. The **Operating Records** tab is displayed. + + ![Operating Records](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9185511561/p411758.png) + * You can click the refresh icon ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9185511561/p420126.jpg) to manually refresh the list. + + + + * You can select an option from **Performed At** to filter the operation records by time. Operation records in the last 7 days, 15 days, 30 days, 6 months, or a custom time range can be queried. + + The following table describes the basic information displayed in the operation record list. + + + | Field | Description | + |------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Event Type | The type of the operation event. The following types of operation events are supported: personal settings, password management, connection management, script management, database operations, organization configuration, member management, resource group management, data mocking, database changes, import, export, and task processes. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by event type. | + | Event Operation | The operation performed in the event. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by event operation. | + | Connection | The name of the connection to which the operation belongs. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0365511561/p417135.jpg) to search for the connection to which the operation belongs. | + | IP Address | The IP address. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0365511561/p417135.jpg) to search for the IP address. | + | Performed At | The time when the operation was performed. By default, the operation records are sorted by execution time. The latest record is displayed at the top. You can click the icon ![ASC/DESC](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p420143.jpg) to sort the operation records in ascending or descending order. | + | Execution Result | The execution result. Valid values: **Succeeded** and **Failed** . You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by execution result. | + | Actions | Indicates the actions you can take. Currently, only **View** is available. | + + + + + + + + + +View operation records +------------------------------------------- + +In the operation record list, click **View** in the **Actions** column. The **Record Details** panel appears. + +![View](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0920633561/p420132.png) + +You can view the details of the record in the following columns: **Operation Type** , **Event Operation** , **IP Address** , **Operation Rules** , **Performed At** , and **Result** . + +Related information +---------------------------------------- + +For more information about how to manage the operation records, see **Manage operation records** in the chapter for the public resource console. diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md new file mode 100644 index 00000000..274f77a9 --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md @@ -0,0 +1,29 @@ +Overview +============================= + +OceanBase Developer Center (ODC) provides various **tools** for you to generate tasks. You can view the status and information of tasks in Task Center. + +After you log on to ODC and enter the management page of a database connection, click **Task** in the navigation bar in the upper part of the page to open the **Task Center** page, where you can view the information about the tasks. + +This chapter describes task management features in different topics. + +* [Import tasks](../9.web-odc-task-management/2.web-odc-import-tasks.md) + + + +* [Export tasks](../9.web-odc-task-management/3.web-odc-export-tasks.md) + + + +* [Data mocking tasks](../9.web-odc-task-management/4.web-odc-data-mocking-tasks.md) + + + +* [Database Change](../9.web-odc-task-management/5.web-odc-database-change-task.md) + + +* [Apply for Permission](../9.web-odc-task-management/6.web-odc-apply-for-permissions-task.md) + + + + diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md new file mode 100644 index 00000000..ae0251cd --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md @@ -0,0 +1,100 @@ +Import tasks +================================= + +After you create a batch or single table import task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Import** tab of the **Task Center** panel. + +Task list +------------------------------ + +> **Note** +> The task list displays the tasks in the last 48 hours. ODC allows you to run up to three import tasks in parallel, while subsequent tasks wait in the queue. + +On the management page of the database connection, click **Task Center** in the top navigation bar to open the Task Center panel. Click **Import** to display the list of import tasks. + +![Image 453](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%AF%BC%E5%85%A5%E4%BB%BB%E5%8A%A1-EN.png) + +The following table describes the columns in the task list. You can filter and sort tasks by some of the columns. + + +| Column | Description | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task ID | The ID of the import task. | +| Task Type | The task type specified when the task was created. The following task types are supported: import, export, data mocking, and database change. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tasks by connection. | +| Database | The database to be changed. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the database to which the task belongs. | +| Creator | The user who created the import task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the creator. | +| Creation Time | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The actions you can take. Valid values: **View** , **Approve/Reject** , **Abort** , and **Download** .
          - View: Click this button to go to the task details page to view the **task information** and **task logs**.
          - Approve/Reject: Click this button to approve or reject a running task.
          - Abort: Click this button to abort a running task.
          - Download: Click this button to download the exported file to your local device when the task is complete. | + + + +Create an import task +------------------------------------------ + +![Create Import Task](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2036511561/p415562.png) + +1. Log on to ODC and go to the management page of the target connection. In the top navigation bar, click **Task Center** . In the Task Center panel, choose **All Tasks** \> **Import** \> **Create Import Task** and create an import task. + + + +2. In the **Create Import Task** panel, specify the fields described in the following table. + + + + | Field | Description | + |-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The name of the database connection to which the task belongs. | + | Database | The database to be changed. | + | Operation Mode | Select **Automatically Perform after Approval** or **Manually Perform after Approval** . | + | Import Format | Select **SQL Files** or **ZIP Files** . | + | Import File | Upload the file to be imported. Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool toupload it. | + | Encoding Standard | Select the character set from the drop-down list of **Encoding Standard** . | + | Import Content | You must specify this item when you select ZIP Files for **Import Format** . ODC currently supports **Import Data Only** , **Import Schema Only** , and **Import Schema and Data** **.** | + | Data Format | You must specify this item when you select ZIP Files for **Import Format** . ODC only supports importing data in CSV format and SQL format. For more information about formats, see [Export and import formats](../6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md). | + | Import Data Settings | If you specify ZIP Files for **Import Format** and Import Schema Only for **Import Content** , this step is not required. | + | Task Error Handling Method | Specify **Task Error Handling Method** . ODC supports two error handling methods: **Abort Task** and **Ignore Error and Continue** . You need to select the handling method under the **Task Error Handling Method** label. | + | Sys Tenant Account Settings | Configure **Sys Tenant Account Settings** . Select **Use sys Account to Accelerate Import Task** or not. If you select this option, you need to enter the account and password of the SYS tenant in the **Account** and **Password** fields. Then, you can use permissions of this account to import data, which accelerates the import task.
          **Notice**
          - The account and password of a user in the SYS tenant are required. Do not enter @sys#cluster in the Account field. The following figure shows an example.
          ![Sys Tenant Account Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0342179361/p348256.png)
          - To export objects other than tables and views, you must specify the SYS tenant account.
          - Otherwise, annotations and indexes are not imported or exported.
          | + + + +3. Click **Import** . The import task is created. + + + + + + +View an import task +---------------------------------------- + +### Task information + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Information** in the upper-right corner of the panel to view the basic task information, information about the imported files, and information about the imported objects. + + +| Item | Description | +|------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic information | Displays the basic information of the task, such as **Task ID** , **Connection** , **Database** , and **Task Type** . | +| Information about imported files | Displays information that you specified when you created the import task, such as **Import Format** , **Import File** , **Encoding Standard** , **Import Content** , **Data Format** , **Import Data Settings** , **Task Error Handling Method** , **Sys Tenant Account Settings** , and **CSV Settings** , | +| Information about imported objects | Displays the information of imported objects and the progress of the import task, such as **Object Name** , **Object Type** , **Planned Processing Quantity** , **Actual Processing Quantity** , and **Data Processing Status** . | + + + +### Task logs + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Logs** in the upper-right corner of the panel to view the alert logs and all logs of the task. + + +| Field | Description | +|------------|----------------------------------------------------------------------------------------------------------------------------| +| All Logs | Displays the **INFO** , **ERROR** , and **WARN** logs of the task. | +| Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. | + + +In addition, the toolbar provides the following buttons: +| Action | Description | +|------|-----------------------------------------------------------| +| Find | Click this option to find log information. | +| Download | Click this option to download log information. | +| Copy | Click this option to copy log information. | \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md new file mode 100644 index 00000000..b635f370 --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md @@ -0,0 +1,104 @@ +Export tasks +================================= + +After you create a batch or single table export task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Export** tab of the **Task Center** panel. + + + +Task list +------------------------------ + +> **Note** +> The task list displays the tasks in the last 48 hours. ODC allows you to run up to three export tasks in parallel, while subsequent tasks wait in the queue. + +On the management page of the database connection, click **Task Center** in the top navigation bar to open the **Task Center** panel. Click **Export** to display the task list. + +![Image 454](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%AF%BC%E5%87%BA%E4%BB%BB%E5%8A%A1-EN.png) + +The following table describes the columns in the task list. You can filter and sort tasks by some of the columns. + + +| Column | Description | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task ID | The ID of the export task. | +| Task Type | The task type specified when the task was created. The following task types are supported: import, export, data mocking, and database change. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tasks by connection. | +| Database | The database to be changed. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the database. | +| Creator | The user who created the export task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the creator. | +| Creation Time | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The actions you can take. Valid values: **View** , **Approve/Reject** , **Abort** , and **Download** . * View: Click this button to go to the Task Details page to view the **task information** and **task logs**. * Approve/Reject: Click this button to approve or reject a running task. * Abort: Click this button to abort a running task. * Download: Click this button to download the exported file to your local device when the task is complete. | + + + +Create an export task +------------------------------------------ + +![Create Export](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2036511561/p415562.png) + +1. Log on to ODC and go to the management page of the target connection. In the top navigation bar, click **Task Center** . On the Task Center panel that appears, choose **All Tasks** \> **Export** \> **Create Export Task** and create an export task. + + + +2. In the **Create Export Task** panel, specify information as described in the following table. + + + + | Field | Description | + |-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The name of the database connection to which the task belongs. | + | Database | The database to be changed. | + | Export Content | When you select ZIP for Export File Format, you must specify this parameter. ODC supports three export modes: **Export Data Only** , **Export Schema Only** , and **Export Schema and Data** **.** | + | Data Format | Specify **Data Format** . ODC currently supports exporting data to files in CSV format and SQL format. If you specify **Export Schema Only** for **Export Content** , you can only export data to files in SQL format. For more information about formats, see [Export and import formats](../../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). | + | Encoding Standard | Specify **Encoding Standard** . ODC supports the following character sets: **ASCII** , **ISO-8859-1** , **GB2312** , **GBK** , **GB18030** , **Unicode (UTF-8)** , **Unicode (UTF-16)** , **Unicode (UTF-32)** , and **BIG5** . You can select one from the **Encoding Standard** drop-down list. | + | Export Objects | Specify **Export Objects** . The **Export Objects** tab displays the **Object Name** and **Object Type** of the current table. | + | Export Data Settings | If you specify Export Schema Only for **Export Content** , you do not need to complete the export data settings. You need to specify the following fields: * **Use Global Snapshot** : If you select this option, ODC exports the data in the latest global snapshot of the specified table to ensure global data consistency. * **Skipped Data Types** : You can click **Advanced Settings** next to **Export Data Settings** to specify this field. Here, you can specify the data types that you want to skip when you export the data. The data types that can be skipped are different in MySQL and Oracle modes. You can select multiple data types. * Specify information for the CSV format. If you specify the CSV format for **Data Format** and Export Data Only or Export Schema and Data for **Export Content** , you can click **Advanced Settings** next to **Export Data Settings** to specify the following fields: * **Include Column Header** : This option is selected by default to determine whether to include column headers when data is exported in CSV format. * **Convert Empty String to Null Value** : This option is selected by default to determine whether to convert empty strings in the table to NULL values (\\N) when data is exported in CSV format. * **Field Delimiter** : This option specifies the delimiter between fields. The following signs are supported: commas ( **,** ), semicolons ( **;** ), and colons ( **:** ). You can also use a character as the delimiter. * **Text Identifier** : This option specifies the identifier for the text content. Single quotation marks ( **'** ) and double quotation marks ( **"** ) are supported. * **Line Break Sign** : This option specifies the sign for the line break. The following characters are supported: **\\n** , **\\r** , and **\\r\\n** . | + | Sys Tenant Account Settings | Configure **Sys Tenant Account Settings** . Select **Use sys Account to Accelerate Export Task** or not. If you select this option, you need to enter the account and password of the SYS tenant in the **Account** and **Password** fields. Then, you can use permissions of this account to export data, which accelerates the export task. You can access the views under the SYS tenant to obtain the optimal data routing strategy.
          **Notice**
          - The account and password of a user in the SYS tenant are required. Do not enter @sys#cluster in the Account field. The following figure shows an example. ![Sys Tenant Account Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0342179361/p348256.png)
          - To export objects other than tables and views, you must specify the SYS tenant account.
          - Otherwise, annotations and indexes are not imported or exported.
          | + + + +3. Click **Export** . The export task is created. + + + + + + +View an export task +---------------------------------------- + +### Task details + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Information** in the upper-right corner of the panel to view the basic task information, information about the exported files, and information about the exported objects. + + +| Item | Description | +|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic information | Displays the basic information of the task, such as **Task ID** , **Connection Name** , **Mode Name** , **Task Type** , **Creation Time** , **Retry Limit** , and **Retry Time** . | +| Export file information | Displays the information that you specified when you created the export task, such as **Export Content** , **Data Format** , **Encoding Standard** , **Export Data Settings** , **Export Schema Settings** , **Task Error Handling Method** , and **Sys Tenant Account Settings** . | +| Export object information | Displays the information of exported objects and the progress of the export task, such as **Object Name** , **Object Type** , **Schema Processing Status** , **Total Record Number** , **Processed Data Entries** , and **Data Processing Status** . | + + + +### Task process + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Process** in the upper-right corner of the panel to view information related to task initiation, approval, and execution status. + +### Task logs + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Logs** in the upper-right corner of the panel to view the alert logs and all logs of the task. + + +| Field | Description | +|------------|-------------------------------------------------------------------------------------------------------------------------------------------------| +| All Logs | Displays the **INFO** , **ERROR** , and **WARN** logs of the task. | +| Alert Logs | Displays only the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. | + +In addition, the toolbar provides the following buttons: + +| Action | Description | +|------|-----------------------------------------------------------| +| Find | Click this option to find log information. | +| Download | Click this option to download log information. | +| Copy | Click this option to copy log information. | + diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/4.web-odc-data-mocking-tasks.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/4.web-odc-data-mocking-tasks.md new file mode 100644 index 00000000..7942189c --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/4.web-odc-data-mocking-tasks.md @@ -0,0 +1,94 @@ +Data mocking tasks +======================================= + +After you create a data mocking task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Mock Data** tab of the **Task Center** panel. + +Task list +------------------------------ + +On the management page of the target database connection, click **Task Center** in the top navigation bar to open the Task Center panel. Then, click **Mock Data** to display the task list. + +![Image 455](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%A8%A1%E6%8B%9F%E6%95%B0%E6%8D%AE-EN.png) + +The following table describes the columns in the task list. You can filter and sort tasks by some of the columns. + + +| Column | Description | +|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task ID | The ID of the data mocking task. | +| Task Type | The task type specified when the task was created. The following task types are supported: import, export, data mocking, and database change. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tasks by connection. | +| Database | The database to be changed. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the database to which the task belongs. | +| Creator | The user who created the data mocking task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the creator. | +| Creation Time | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The actions you can take. Valid values: **View** , **Approve/Reject** , **Abort** , and **Download** . * View: Click this button to go to the task details page to view the **task information**, task result, and **task logs**. * Approve/Reject: Click this button to approve or reject a running task. * Abort: Click this button to abort a running task. * Download: Click this button to download the SQL file that corresponds to the mock data to your local device. | + + + +Create a data mocking task +----------------------------------------------- + +![Create](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2211291561/p416187.png) + +1. Log on to ODC and enter the management page of the target connection. In the top navigation bar, click **Task Center** . In the Task Center panel that appears, choose **All Tasks** \> **Mock Data** \> **Create Mock Data Task** and create adata mockingtask. + + + +2. In the **Create Mock Data Task** panel, specify the fields described in the following table. + + + + | Field | Description | + |----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The name of the database connection to which the task belongs. | + | Database | The database to be changed. | + | Table | 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. | + | Mock Data Volume | The volume 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. | + | Batch Size | The size of data processed in a batch. 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. | + | Empty Table Before Inserting Mock Data | Specifies 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. | + | Data Conflict Handling Mode | 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 modes: * **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. | + | Rule Settings | The data generation rules. In the Mock Data panel, the **Rule Settings** table displays **Field Name** and **Field Type** based on the table you selected in step 2. 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. | + + + +3. Click **Submit** . The data mocking task is created. + + + + + + +View a data mocking task +--------------------------------------------- + +### Task information + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Information** in the upper-right corner of the panel to view the basic task information and the data mocking settings. + + +| Item | Description | +|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic information | Displays the basic information of the task in the following fields: **Task ID** , **Database** , and **Task Type** . | +| Data mocking settings | Displays the settings specified when the data mocking task was created in the following fields: **Target Table** , **Mock Data Volume** , **Batch Size** , **Clear Table Before Mock Data Insertion** , **Data Conflict Handling Mode** , **Actual Insertion Records** , **Conflict Records** , **Ignore Insertion** , **Clear Records** , and **Rule Settings** . | + + + +### Task logs + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Logs** in the upper-right corner of the panel to view the alert logs and all logs of the task. + + +| Field | Description | +|------------|--------------------------------------------------------------------------------------------------------------------------------------------| +| All Logs | Displays the **INFO** , **ERROR** , and **WARN** logs of the task. | +| Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. | + +In addition, the toolbar provides the following buttons: + +| Action | Description | +|------|-----------------------------------------------------------| +| Find | Click this option to find log information. | +| Download | Click this option to download log information. | +| Copy | Click this option to copy log information. | + diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/5.web-odc-database-change-task.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/5.web-odc-database-change-task.md new file mode 100644 index 00000000..639e0301 --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/5.web-odc-database-change-task.md @@ -0,0 +1,125 @@ +Database change tasks +========================================== + +After you create a database change task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Database Change** tab of the **Task Center** panel. + +Task list +------------------------------ + +On the management page of the database connection, click **Task Center** in the top navigation bar to open the Task Center panel. Click **Database Change** in the panel to display the task list. + +![Image 456](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E5%BA%93%E5%8F%98%E6%9B%B4-EN.png) + +The following table describes the columns in the task list. You can filter and sort tasks by some of the columns. + + +| Column | Description | +|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task ID | The ID of the database change task. | +| Task Type | The task type specified when the task was created. The following task types are supported: import, export, data mocking, and database change. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tasks by connection. | +| Database | The database to be changed. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the database to which the task belongs. | +| Creator | The user who created the database change task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the creator. | +| Creation Time | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The actions you can take. Valid values: **View** , **Approve/Reject** , **Abort** , **Rollback** , and **Download** . * View: Click this button to go to the task details page to view the **task information**, task result, and **task logs**. * Approve/Reject: Click this button to approve or reject a running task. * Abort: Click this button to abort a running task. * Rollback: Click this button to roll back a completed task. * Download: Click this button to download the exported file to your local device when the task is complete. | + + + +Create a database change task +-------------------------------------------------- + +![p416182](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8891553561/p442685.png) + +1. Log on to ODC and go to the management page of the target connection. In the top navigation bar, click **Task Center** .In the Task Center panel that appears, choose **All Tasks** \> **Database Change** \> **Create Database Change Task** and create a database change task. + + + +2. In the **Create Database Change Task** panel, specify the fields described in the following table. + + + + | Field | Description | + |----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The name of the database connection to which the task belongs. | + | Database | The database to be changed. | + | SQL Content | Select **SQL Entry** or **Upload File** . * **SQL Entry** : This is the default way to specify SQL content. You can directly write the SQL script in the editing area. **Note** * The maximum size of the SQL statements that can be entered in the SQL window is limited to 500,000 characters. If the SQL script to be executed has more than 500,000 characters, you can upload it in the form of a \*.sql file. * You can click **IN Value Conversion** to convert the batch copied data into the in('A','B') format. * Column values are separated with line breaks. * Row values are separated with spaces or tabs. * **Upload File** : Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. **Note** * You can upload up to 500 files. The total file size cannot exceed 256 MB. * By default, files are sorted by the order in which they were uploaded. You can drag and drop them to change the order. Tasks are executed in the file order. * Only SQL files suffixed with .sql are supported. | + | Rollback Plan | Specify **Rollback Plan** . You can write an SQL script or upload a file to specify the rollback plan. For more information, see the description of SQL Content. | + | Delimiter | The delimiters are supported. | + | Query Result Limit | You can set the maximum number of rows allowed in the query result. Value range: 1 to 1000000. | + | Task Error Handling Method | The database change tool supports two methods to handle task errors: * **Abort Task** : This is the default option. When you select this option, the task is aborted if an error occurs when you run the script. * **Ignore Error and Continue** : When you select this option, the system skips the statement where an error occurs and continues to execute other statements in the script. | + | Execution Timeout Value | Specify the value in the **Execution Timeout Value** field in hours. Default value: 48. Maximum value: 480. | + | Description | You can enter a description of no more than 200 characters in **Description** . | + + + +3. Click **Create** . The database change task is created. + + + + + + +View a database change task +------------------------------------------------ + +### Task information + +![Task Details](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4350269361/p325158.png) + +1. Click **View** in the Actions column of the row where the target task is located. The Task Details panel appears. Click the **Task Information** tab to view **Connection** , **Database** , **SQL Content** , and **Rollback Content** . + + + +2. You can click **Initiate Again** to initiate the database change task again. + + + + + + +### Task process + +1. Click **View** in the Actions column of the row where the target task is located. The Task Details panel appears. Click the **Task Process** tab to view information at the following nodes: **Initiate Task** , **Approval Node** , **Perform** , and **Complete** . + + + +2. You can click **Initiate Again** to initiate the database change task again. + + + + + + +### Execution result + +1. Click **View** in the Actions column of the row where the target task is located. The Task Details panel appears. Click the **Result** tab to view the execution success and failure records. + + + +2. You can click **Initiate Again** to initiate the database change task again. + + + + + + +### Task logs + +1. Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Logs** in the upper-right corner of the panel to view the alert logs and all logs of the task. + + + + | Field | Description | + |------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | All Logs | Displays the **INFO** , **ERROR** , and **WARN** logs of the task. You can click **Find** , **Download** , or **Copy** to search for, download, or copy all logs. | + | Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. You can click **Find** , **Download** , or **Copy** to search for, download, or copy alert logs. | + + + +2. You can click **Initiate Again** to initiate the database change task again. + + + + + diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/6.web-odc-partition-scheme-task.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/6.web-odc-partition-scheme-task.md new file mode 100644 index 00000000..e09922c9 --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/6.web-odc-partition-scheme-task.md @@ -0,0 +1,107 @@ +# Partitioning plan task + + + +## Background + +OceanBase Developer Center (ODC) allows users to apply for permissions on partitioning plans from the administrator of the public resource console. + +After a user creates a partitioning plan task in **Task Center**, the administrator can approve the task on the Tasks page in Task Center. The user can view the task information and approval status on the Tasks page in Task Center. + +## Task list + +> **Note** +> The task list displays the tasks in the last 48 hours. + +After you enter the target database connection, click **Task Center** in the top navigation bar to open the Task Center panel. Click the **Partition Plan** tab to view the partitioning plan tasks. + +![Partitioning plan list 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A11-EN.png) + +The following table describes the columns contained in the task list on this tab. You can filter and sort the tasks in the list. + +| **Column** | **Description** | +|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task ID | The ID of the task. | +| Task Type | The type of the task specified when you created the task. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter tasks by connection. | +| Database | The name of the target database where the task operates. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks of a specific database. | +| Created By | The user who created the task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for the creator. | +| Created At | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | Provides task management operations such as **View**, **Approve/Reject**, and **Abort**.
          • View: Click this button to go to the task details page to view information about the target task.
          • Approve/Reject: Click this button to approve or reject the application.
          • Abort: Click this button to abort a running task.
          | + +## Create a partitioning plan task + +![Partitioning plan create 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1-%E6%96%B0%E5%BB%BA1-EN.png) + +1. In the Task Center panel that appears, click the **Partition Plan** tab and then the **Create Partition Plan** button to create a partitioning plan task. + + +2. In the **Create a partition plan** panel, specify the following information. + + | **Parameter** | **Description** | + |---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The connection to which the partitioning plan belongs. The default value is the current connection. | + | Partition policy | The information about the partitioning strategy. Search for and select a RANGE-partitioned table in the database and edit its partitioning strategy.
          • You can select **Only tables that are not set are displayed** on the right side of Partition policy to display only tables with no partitioning strategies.
          • You can also select multiple RANGE-partitioned tables and configure a partitioning strategy for them at a time.
          • In the **Partition policy** column, click the edit icon and then you can edit the number of partitions to create, partitioning interval, retention period, and naming rules.
          | + | Remarks (Optional) | Enter the reason for application. | + +3. Click **Submit**. + + > **Note** + > After you submit the application, the task will automatically match the default partitioning plan task application process in the public resource console. + > For more information about task processes, see [Task process management](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md). + + + +## View a partitioning plan task* + +### **Task information** + +![Partitioning plan view task information 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/N-%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-%E6%9F%A5%E7%9C%8B%E4%BB%BB%E5%8A%A1%E4%BF%A1%E6%81%AF3-EN.png) + +1. Click **Task Center** in the top navigation bar, and click the **Partition Plan** tab. In the task list on the tab, click **View** in the Actions column of the target task to view its details. + + +2. In the **Task Details** panel, click the **Task Information** tab and view the basic task information and task settings. + + | Item | Description | + |---------|--------------------------------------------------------------------------------| + | Basic task information | You can view the task status, task ID, task type, connection, inspection cycle, remarks, creator, and creation time. | + | Task settings | You can view the partitioning strategy of the RANGE-partitioned table selected when you created the partitioning plan task. | + +3. In the task information panel, click **Initiate Again** in the lower-right corner to initiate the task again. + +### **Task Process** + +![Task Information 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A14-EN.png) + +1. In the **Task Details** panel, click the **Task Process** tab to view information about the task process, including the task initiation information, approval status, execution status, and completion status. + + +2. You can click **Initiate Again** in the lower-right corner of the panel to re-initiate the task. + +### Associated records + +1. In the **Task Details** panel, click the **Associated Records** tab to view information including the task ID, database, creation time, task status, and supported actions such as view. + +2. You can click **Initiate Again** in the lower-right corner of the panel to initiate the task again. + +### Task logs + +![Partitioning plan view task logs 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A15-EN.png) + +1. In the **Task Details** panel, click the **Task Logs** tab and view all logs and alert logs of the task. + + | Item | Description | + |------|-----------------------------------------------------------------------------------------------------------------------------| + | All Logs | Displays the **INFO**, **ERROR**, and **WARN** logs of the task. You can click **Find**, **Download**, or **Copy** to search for, download, or copy all logs. | + | Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. You can click **Find**, **Download**, or **Copy** to search for, download, or copy alert logs. | + +2. Click **Initiate Again** to initiate the task again. + + +## Related topics + +* [Task process management](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md) + +* [Create a partitioning plan](../../6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/7.web-odc-apply-for-permissions-task.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/7.web-odc-apply-for-permissions-task.md new file mode 100644 index 00000000..9c7b80df --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/7.web-odc-apply-for-permissions-task.md @@ -0,0 +1,76 @@ +# Permission application tasks + + +## **Background** + +OceanBase Developer Center (ODC) allows users to apply for permissions on public connections and allows administrators to manage these applications on the public resource console. + +After a user creates a public connection permission application task in **Task Center**, the administrator can approve the task on the **Tasks** page in **Task Center**. The user can view the task information and approval status on the **Tasks** page in **Task Center**. + +## **Lists of tasks** + +After you enter the target database connection, click **Task Center** in the top navigation bar to open the **Task Center** panel. Click the **Apply for Permission** tab to view the permission application tasks. + +![Task List 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%9D%83%E9%99%90%E7%94%B3%E8%AF%B7-%E4%BB%BB%E5%8A%A1%E5%88%97%E8%A1%A81-EN.png) +The following table describes the columns contained in the task list on this tab contain. You can filter and sort the tasks in the list. + +| **Column** | **Description** | +|---------|------------------------------------------| +| Task ID | The ID of the permission application task. | +| Task Type | The type of the task specified when you created the task. | +| Connection | The name of the database connection to which the task belongs.
          You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter tasks by connection.
          **Note**
          A permission application task may involve multiple database connections. Therefore, the connection details are not displayed, and **-** is displayed instead. | +| Database | The name of the target database where the task operates.
          You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks of a specific database.
          **Note**
          A permission application task may involve multiple database connections. Therefore, the connection details are not displayed, and **-** is displayed instead. | +| Created By | The user whose created the database connection task.
          You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks created by a specific creator. | +| Created At | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | ODC provides task management options such as **View** and **Approve/Reject**.
          - View: Click this button to go to the task details page to view the task information and task process.
          - Approve/Reject: Click this button to approve or reject the application. | + + +## **Create a permission application task** + +![Create a permission application task 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%9D%83%E9%99%90%E7%94%B3%E8%AF%B7-%E6%96%B0%E5%BB%BA%E6%9D%83%E9%99%90%E7%94%B3%E8%AF%B72-EN.png) + +1. Log on to ODC. Click **Task Center** in the top navigation bar. In the task panel that appears, choose **All Tasks** > **Apply for Permission** \> **Create Permission Application** to create a permission application task. + +2. In the **Apply for Connection Permissions** panel, specify the following information: + + | **Item** | **Description** | + |----------|------------------------------| + | Select a public connection | Select public connections for the application.
          - **Select Connections** pane: You can select multiple public connections at a time to apply for permissions on them.
          - **Selected**: You can clear or delete the selected public connections.
          - You can search for public connections by connection name, host name, cluster name, or tenant name. | + | Permission Type | Select the type of the permission on the target public connections. Valid values: **Read-only** and **Read/Write**. | + | Reason for Application (Optional) | Enter the reason for application. | + + +3. Click **Submit** to apply for permissions on the connections. + + > **Note** + > After a connection permission application task is created, ODC automatically matches the task with the connection permission application process created by the administrator in the public resource console. + > Tasks will be executed based on the priority order set by the administrator in **Set Priority** in the public resource console. + > For more information about task processes, see [Task process management](../4.web-odc-public-resource-management/4.web-odc-task-process.md). + +## **View a permission application task** + +### **Task information** + +![Task information 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%9D%83%E9%99%90%E7%94%B3%E8%AF%B7-%E6%9F%A5%E7%9C%8B%E6%9D%83%E9%99%90%E7%94%B3%E8%AF%B73-EN.png) + +1. Click **Task Center** in the top navigation bar, and click the **Apply for Permission** tab. In the task list on the tab, click **View** in the **Actions** column of the target task to view its details. + + +2. In the **Task Details** panel, click the **Task Information** tab to view the basic information and settings of the task, including **Task Status**, **Task ID**, **Task Type**, **Risk Levels**, and **Apply for Public Connection**. + +| **Item** | **Description** | +|----------|--------------------------------------------------------------------------| +| Basic task information | Displays task information, including **Task Status**, **Task ID**, **Task Type**, **Risk Levels**, **Created By**, and **Created At**. | +| Information about public connections applied for | Displays the **Connection Name**, **Permission Type**, and **Status** values specified when you created the permission application task. | + + + +### **Task Process** + +![Task Information 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%9D%83%E9%99%90%E7%94%B3%E8%AF%B7-%E6%9F%A5%E7%9C%8B%E6%9D%83%E9%99%90%E7%94%B3%E8%AF%B7-%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B4-EN.png) + +1. In the **Task Details** panel, click the **Task Process** tab to view information about the task process, including the task initiation information, approval status, execution status, and completion status. + + +2. You can click **Initiate Again** in the lower-right corner of the panel to re-initiate the permission application task. \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization-task.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization-task.md new file mode 100644 index 00000000..58314664 --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization-task.md @@ -0,0 +1,117 @@ +# Shadow table synchronization tasks + +## Background + +OceanBase Developer Center (ODC) allows you to apply for permissions to create shadow table synchronization tasks from the administrator of the public resource console. + +After you create a shadow table synchronization task in **Task Center**, the administrator can approve the task in the task list in **Task Center**, where you can view the task information and approval status. + +## Task list + +> **Note** +> The task list displays the tasks created in the last 48 hours. + +After you enter the target database connection, click **Task Center** in the top navigation bar to open the **Task Center** panel. Click the **Synchronize Shadow Table** tab to view the shadow table synchronization tasks. + +![Shadow table synchronization List 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E4%BB%BB%E5%8A%A11-EN.png) + +The following table describes the columns contained in the task list on this tab. You can filter and sort the tasks in the list. + +| **Column** | **Description** | +|---------|----------------------------------------------------------------------------------------------------| +| Task ID | The ID of the task. | +| Task Type | The type of the task specified when you created the task. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter tasks by connection. | +| Database | The name of the target database where the task operates. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks of a specific database. | +| Created By | The user who created the task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks created by a specific creator. | +| Created At | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The task management actions, including: **View**, **Approve/Reject**, and **Abort**.
          • View: You can click this button to go to the task details page to view the task information and task process.
          • Approve/Reject: You can click this button to approve or reject the task.
          • Abort: You can click this button to abort a running task.
          | + + +## Create a shadow table synchronization task + +1. On the **Task Center** panel that appears, choose **Synchronize Shadow Table** > **Create Shadow Table Synchronization Project**. + + +2. On the **Create Shadow Table Synchronization Project** panel, specify the following information. + + 1. Select a synchronization object. + + ![Shadow table synchronization 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E4%BB%BB%E5%8A%A12-EN.png) + + + | **Field** | **Description** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Database | The database to which the shadow table to be created belongs. You can view the name of the current connection. | + | Synchronization Range | The table to be synchronized.
          • **Partial Tables**: Shadow tables will be created in the current database for the selected tables.
          • **All Tables**: Shadow tables will be created in the current database for all tables in the source database.
          | + | Name of Shadow Table | The name of the shadow table, in the format of **prefix** + source table name or source table name + **suffix**. You can use custom prefix or suffix. | + | Synchronization Objects | The source tables to be synchronized as shadow tables. You must specify this field when **Synchronization Range** is set to Partial Tables. | + + 2. Analyze the schema of the shadow table. + + ![Shadow table synchronization 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E4%BB%BB%E5%8A%A13-EN.png) + + | **Field** | **Description** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Synchronized Tables | The **Synchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **View** to view the source table schema, shadow table schema, and schema change SQL statement, or click **Skip**, indicating that this shadow table is not synchronized. | + | Unsynchronized Tables | The **Unsynchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **Undo Skip** to synchronize this shadow table.
          **Note**:
          A skipped table will be displayed on the **Unsynchronized Tables** tab. If a shadow table with the same name and the same schema as the source table already exists, schema synchronization will be skipped.
          | + | SQL Preview | The SQL statement for schema synchronization. | + | Task Settings | Options of **Execution Mode** include:
          • **Execute Immediately**: The synchronization task is executed immediately.
          • **Execute On Schedule**: The synchronization task is executed on schedule.
          | + | Task Settings | Options of **Task Error Handling Method** include:
          • **Abort Task**: If an error occurs during the execution of the synchronization task, the subsequent SQL scripts are interrupted and no longer executed.
          • **Ignore Error and Continue**: If an error occurs during the execution of the synchronization task, the SQL script with the error is skipped, but subsequent SQL scripts will be executed.
          | + | Remarks | The business background of the project, such as the change purpose and expected goal. | + +3. Click **Submit**. + + > **Note** + > After a task is created, the task will automatically match the application process of shadow table synchronization task created by the administrator on the public resource console. + > Tasks will be executed based on the priority order set by the administrator in **Set Priority** on the public resource console. + > For more information about task processes, see [Task process management](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md). + +## View the shadow table synchronization task + +### Task information + +![Permission application - View permission application Task information 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E4%BB%BB%E5%8A%A14-EN.png) + +1. Click **Task Center** in the top navigation bar, and click the **Synchronize Shadow Table** tab. In the task list on the tab, click **View** in the **Actions** column of the target task to view its details. + +2. On the **Task Details** panel, click the **Task Information** tab to view the basic task information and task settings. + + | **Information** | **Description** | + |---------|---------------------------------------------------------------------------------------------------------| + | Basic information | You can view the status, ID, type, connection, database, execution mode, error handling method, remarks, creator, and creation time of the task. | + | Task settings | You can view the tables to be synchronized, tables not to be synchronized, and SQL scripts to be executed. | + + +3. On the **Task Details** panel, click **Initiate Again** in the lower-right corner to initiate the task again. + +### **Task Process** + +![Task Information 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E4%BB%BB%E5%8A%A15-EN.png) + +1. In the **Task Details** panel, click the **Task Process** tab to view information about the task process, including the task initiation information, approval status, execution status, and completion status. + + +2. You can click **Initiate Again** in the lower-right corner of the panel to re-initiate the task. + +### Task logs + +![Shadow table synchronization 6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E4%BB%BB%E5%8A%A16-EN.png) + +1. On the **Task Details** panel, click the **Task Logs** tab to view all logs and alert logs of the task. + + | Item | Description | + |------|-----------------------------------------------------------------------------------------------------------------------------| + | All Logs | Displays the complete information of all task logs, including **INFO**, **ERROR **, and **WARN** logs.
          You can click **Search**, **Download**, or **Copy** to search for, download, or copy all logs. | + | Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs.
          You can click **Search**, **Download**, or **Copy** to search for, download, or copy alert logs. | + + +2. You can click **Initiate Again** to initiate the task again. + + + +## Related topics + +* [Task process management](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md) +* [Create a shadow table synchronization task](../../6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-shadow-table-synchronization.md) \ No newline at end of file diff --git a/en-US/6.web-odc-user-guide/9.web-odc-task-management/9.web-odc-sql-plan-task.md b/en-US/6.web-odc-user-guide/9.web-odc-task-management/9.web-odc-sql-plan-task.md new file mode 100644 index 00000000..3e5a0a14 --- /dev/null +++ b/en-US/6.web-odc-user-guide/9.web-odc-task-management/9.web-odc-sql-plan-task.md @@ -0,0 +1,90 @@ +# SQL plan task + +## Background information + +OceanBase Developer Center (ODC) can periodically execute SQL scripts created by users to complete database development and O&M tasks as required by the users. For example, ODC can periodically execute stored procedures, backup, and database and table schema synchronization. + +After a user creates an SQL plan task in **Task Center**, the administrator can approve the task on the Tasks page in Task Center. The user can view the task information and approval status on the Tasks page in Task Center. + +This topic describes how to create and manage SQL plan tasks in ODC. + +## Task list + +> **Note** +> The task list displays the tasks created in the last 336 hours. + +After you enter the target database connection, click **Task Center** in the top navigation bar to open the Task Center panel. Click the **SQL Plan** tab to view the SQL plan tasks. + +![SQL plan 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/1-EN.png) + +The following table describes the columns contained in the task list on this tab. You can filter and sort the tasks in the list. + +| **Column** | **Description** | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| No. | The ID of the task.
          You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for and filter tasks by ID. | +| Connection | The name of the database connection to which the task belongs.
          You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter tasks by connection. | +| Execution Period | - | +| Next Execution Time | The time when the SQL plan task is to be executed the next time. | +| Created By | The user who created the task.
          You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for and filter tasks by creator. | +| Updated At | The date and time when the task was generated. | +| Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The task management actions, including **View**, **Approve/Reject, Edit**, and **Enable/Disable**.
          • View: You can click this button to view task information on the task details page.
          • Approve/Reject: You can click this button to approve or reject the task.
          • Enable/Disable: You can click this button to enable or disable an ongoing task.
          | + + +## Create an SQL plan task + +1. In the Task Center panel that appears, click the plus sign (**+**) on the right of **SQL Plan** to create an SQL plan task. + + ![SQL plan - Create 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/2-EN.png) + +2. In the **Create SQL Plan** panel, specify the following information. + + ![SQL plan - Create 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/3-EN.png) + + | **Item** | **Description** | + |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | SQL Content | You can specify SQL content in either of the following ways:
          • **SQL Entry**: This is the default way to specify SQL content. You can directly write the SQL script in the editing area.
          • The maximum size of the SQL statements that can be entered in the SQL window is limited to 10 MB. If the content to be entered is more than 10 MB in size, you can directly upload an attachment.
          • You can click **IN Value Conversion** to convert the batch copied data into the in('A','B') format.
          • Column values are separated with line breaks.
          • Row values are separated with spaces or tabs.
          • **Upload File**: Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it.
          • You can upload up to 500 files. The total file size cannot exceed 256 MB.
          • By default, files are sorted by the order in which they were uploaded. You can drag and drop them to change the order. Tasks are executed in the file order.
          • Only SQL files suffixed with .sql are supported.
          | + | Delimiter | The delimiters are supported. | + | Query Result Limit | You can set the maximum number of rows allowed in the query result. Value range: 1 to 1000000. | + | Execution Timeout Value | Specify the value in the **Execution Timeout Value** field in hours. Default value: 48. Maximum value: 480. | + | Scheduled Period |
          • You can directly select a predefined option of Every Hour, Every Night, or Every Friday.
          • You can also set the scheduled execution period in either of the following modes:
            • Default: You can set the scheduled execution period on a daily, weekly, or monthly basis as needed.
              ![SQL plan - Scheduled execution period - Default mode 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/4-EN.png)
            • Custom: You can set the scheduled execution period by specifying the second, minute, hour, day, month, or week as needed.
              ![SQL plan - Scheduled execution period - Custom mode 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/5-EN.png)
            | + | Task Settings | You can handle task errors in either of the following ways:
            • Abort Task: This is the default option. When you select this option, the task is aborted if an error occurs when you run the script.
            • Ignore Error and Continue: When you select this option, the system skips the statement where an error occurs and continues to execute other statements in the script.
            | + | Remarks (Optional) | You can enter a description of up to 200 characters. | + +3. Click **Create** to complete the task application. + + > **Note** + > After you submit the application, the task will automatically match the default SQL plan task application process in the public resource console. + > For more information about task processes, see [Manage task processes](../4.web-odc-public-resource-management/4.web-odc-task-process.md). + +## View SQL plan tasks + +### Task information + +![6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/6-EN.png) + +1. Click **Task Center** in the top navigation bar, and click the **SQL Plan** tab. In the task list on the tab, click **View** in the Actions column of the target task to view its details. + + +2. In the **Task Details** panel, click the **Task Information** tab to view the basic task information and task settings. + + | **Item** | **Description** | + |---------|-------------------------------------------------------------------------------------------------------| + | Basic task information | You can view the task status****, task ID****, task type****, connection, ****remarks, creator, and creation time.**** | + | Task settings | You can view the SQL content, scheduled execution period, next execution time, delimiter, query result limit, error handling method, and execution timeout period.**************************** | + + +### Execution records + +In the **Task Details** panel, click the **Execution Records** tab to view information including the task ID, database, creation time, task status, and supported actions.******************** + +### Operating records + +In the **Task Details** panel, click the **Operating Records** tab and view information including the event operation, operation time, approval status, and supported actions.**************** + +## References + +* [Manage task processes](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + + +* [SQL plans](../6.web-odc-use-tools/6.web-odc-sql-plan.md) diff --git a/en-US/7.client-odc-user-guide/1.client-odc-install-odc.md b/en-US/7.client-odc-user-guide/1.client-odc-install-odc.md new file mode 100644 index 00000000..1cda20ca --- /dev/null +++ b/en-US/7.client-odc-user-guide/1.client-odc-install-odc.md @@ -0,0 +1,44 @@ +Install ODC +================================ + +To manage your database, you can either access the web-based OceanBase Developer Center (ODC) console from OceanBase, or download the ODC client. Unlike the web-based ODC console that provides a logon portal, the ODC client uses a default user account for user identification. You just need to install the client and [create a connection](7.client-odc-user-guide/../3.client-odc-connect-database/1.client-odc-create-connection.md) to connect to your database. + +Recommended installation environment +--------------------------------------------- + + + +| Item | Requirement | +|-----------------------|-----------------------------------------------------------------------------------------------------------------| +| Operating system (OS) | Windows: Windows 7 or Windows 10 Mac: 10.13.6 (17G65) | +| Java environment | JDK 1.8.0_242 and later. | +| Port number | Thanks to the dynamic port detection technology, you do not need to reserve port 8989 for ODC V2.3.0 and later. | +| CPU | X86-64 processor with 2 or more cores. | +| Memory | 4 GB or above. | + + + +Procedure +------------------ + +1. Download [ODC Client](https://help.aliyun.com/document_detail/212816.html). + + + +2. Double-click the installation file you downloaded to start the installation. + + + +3. The setup wizard prompts you to select an installation directory. + + + +4. When you run the client after installation, it checks the environment. If the environment does not meet the requirements, the client displays an error message, indicating that you can either continue using the application, or end the process to fix the problem of the environment. If ODC passes the environment check and operates normally, you can create a connection. + > **Notice** + >
          • JRE installation packages for Mac and 64-bit Windows are included in the installation package of ODC V3.2.0. You can install it as needed.
          • + >
          • For more information about installation or startup failures, see Installation of the ODC client in FAQ.
          • + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/1.client-odc-database-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/1.client-odc-database-objects-overview.md new file mode 100644 index 00000000..390128c4 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/1.client-odc-database-objects-overview.md @@ -0,0 +1,42 @@ +Overview +============================= + +A table consists of rows and columns. Each column is called a field, and the title of each column is called the field name. A row contains several columns of information, and a row of data is called a record. A database table consists of one or more records. A table without records is called an empty table. A table usually has one primary key that uniquely identifies each record. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. You can double-click a table name in the table list to go to the table management page. On this page, you can view and modify the table data on the **Data** tab, and view the basic information, columns, partitions, indexes, constraints, and DDL statements of the table on the **Attribute** tab. +**Notice** + + + +The root@sys user privileges are required to view partition information. This requires that you set the root@sys user in Advanced Configuration during connection creation. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.0.0 or a later version | +| OceanBase Database in MySQL mode | V1.4.1 or a later version | + + + +This chapter describes in different topics the operations you can perform on table objects in ODC. + +* [Create a table](../1.client-odc-table-objects/2.client-odc-create-a-table.md) + + + +* [Table list](../1.client-odc-table-objects/3.client-odc-table-list.md) + + + +* [Manage table attributes](../1.client-odc-table-objects/4.client-odc-manage-table-attributes.md) + + + +* [Manage table data](../1.client-odc-table-objects/5.client-odc-manage-table-data.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md new file mode 100644 index 00000000..6c0af892 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md @@ -0,0 +1,258 @@ +# Create a table + +ODC supports visualized table creation. This topic describes how to create a table with ODC. + +## Overview + +OceanBase Developer Center (ODC) allows you to create a table on a GUI. This topic describes how to create a table in the ODC console. + +![Create a table](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%A6%82%E8%BF%B0-EN.png) + +As shown in the preceding figure, you can create a table in the following seven steps: + +1. Specify the basic information. + +2. Set columns. + +3. Set the index. + +4. Set constraints. + +5. Set partitioning rules. + +6. Confirm the SQL statement. + +7. Complete the table creation. + + + + + + +## Procedure + +In the following example, a table named `employee` is created in the ODC console. The table contains the **emp_no**, **birthdate**, **name**, and **gender** columns. Perform the following operations: + +### Step 1: Specify the basic information + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. To create a table, click **+** in the upper-right corner of the table list or click **Create** in the top navigation bar. + +In the **Basic Info** section, specify **Table Name** and **Description**. + +![Step 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A41-EN.png) + +> **Note** +>
          • In MySQL mode, you also need to specify **Default Character Set** and **Default Sorting Rule**.
          • +>
          • After you specify the basic information and switch to the **Column** step, the basic information is submitted.
          • + +### Step 2: Set columns + +The following figure and table show the information that you need to specify when you add a column. + + + +![Step 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A42-EN.png) + +| Field | Description | +|---------------|--------------------------------------------------------------------| +| Name | The name of the column. | +| Type | The data type of the column.
            For more information about data types, see [OceanBase Database Developer Guide](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview). | +| Length | The length of the data type. | +| Scale | The number of decimal places of the data type. | +| Non-empty | Specifies whether the value of the column must be specified. | +| Auto-increment | Specifies whether to set the column to an auto-increment column. This parameter is valid in MySQL mode.
            **Notice**
            Only one auto-increment column is allowed for each table.
            After a column is set to an auto-increment column, the auto-increment checkbox of other columns cannot be selected. | +| Virtual Column | Specifies whether to set the column to a virtual column.
            **Notice**
            When you set a virtual column, you must specify its expression.
            When you create a virtual column, you must define an expression that the virtual column depends on. A virtual column is a generated column. A generated column can be a virtual generated column or a stored generated column. The value of a virtual column is calculated based on the expression only when the column is used. Therefore, when you insert data into the table, you cannot specify values for the virtual column. | +| Default Value/Expression | The default value or expression of the column. | +| Comment | The additional information about the column. | + + + +The following table describes operations that you can perform on the column setting page. + +| Operation | Description | +|--------|-------------------------------------------------------------------------------------------------------------------------------------------| +| Toolbar operations | You can add or delete columns by using the top toolbar of the page. | +| Click a row ID | - You can click a row ID to select the row and display the quick access toolbar that allows you to add or delete a row.
            - You can click a row ID to select the row, and then drag the row to adjust its order. | +| Right-click a row | You can right-click a row to select it, and then select **Copy** or **Move Down** from the context menu that appears. | + + +> **Note** +>
          • After you copy a row, you can paste the row by using the Command + V or Ctrl + V shortcut keys.
          • +>
          • The auxiliary editing section at the bottom of the page displays additional information about the selected column.
          • +>
          • Settings in the Basic Information and Column steps are required. Settings in other configuration steps are optional. After you specify settings in the Basic Information and Column steps, you can click Commit and Confirm SQL Statement to create a table.
          • + + +### Step 3: Set indexes + +If a table contains a large amount of data, you can use indexes to accelerate data queries. An index is a data structure that pre-sorts the values of one or more columns in a table. By using indexes, you can directly locate records that meet the conditions. + +The following figure and table show the information that you need to specify when you set the index. + +![Step 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A43-EN.png) + +| Field | Description | +|------|--------------------------------------------------------------------------------| +| Index Name | The name of the index. | +| Scope | The default value is **GLOBAL**. Valid values: **GLOBAL** and **LOCAL**. | +| Method | The default value is **BTREE**, which is applicable to a global index. Valid values: **Empty, BTREE, and HASH**.
            - A BTREE index stores data in a B+ tree structure, and is suitable for searching for SQL statements in the specified index scope.
            - A HASH index is implemented based on a HASH table, and is used only when the query conditions exactly match all columns in the HASH index. A HASH index can be used only for query conditions that use the equal operator (=), IN operator, or NULL-safe equal operator (<=>). A HASH index cannot be used for sorting and is not suitable for columns with less distinctive values, such as the gender column. | +| Index Type | The default value is **NORMAL**. Valid values: **NORMAL, UNIQUE**, and **FULLTEXT**.
            - **NORMAL** indicates a normal index.
            - **UNIQUE** indicates a unique index that does not allow duplicate values, such as the **emp_no** column.
            - **FULLTEXT** indicates a full-text index, which is used to search a table that contains a large amount of data. | +| Columns | The columns to be indexed. Pay attention to the order of the indexed columns. | +| Invisible | Specify whether the index is invisible. | + + + +The index setting page provides the following icons. + +| Icon | Description | +|-----|------------| +| Create | Click this icon to add an index. | +| Delete | Click this icon to delete the selected index. | + + + +### Step 4: Set constraints + +Constraints are used to specify data rules for a table. A data operation that violates the constraints will be terminated. + +![Step 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A44-EN.png) + +ODC supports the following four table constraints: + +* **Primary Key Constraint**: defines a primary key to uniquely identify each row of data in the table. A primary key constraint can be a field or a group of fields. You can set only one primary key constraint for a table, and you cannot edit the constraint after it is configured. + +* **Unique Constraint**: ensures that the data in a field or a group of fields is unique in the table. You can set multiple unique constraints in one table. + +* **Foreign Key Constraint**: associates one or more columns in two tables. A foreign key constraint is used to maintain the data consistency and integrity between associated tables. After you complete the setting of foreign key constraints, you cannot create new constraints or edit existing constraints. + +* **Check Constraints**: checks the data in the database based on the configured check rules when you edit the data. Data modification is allowed only after the check is passed. + + +OceanBase Database supports different constraints in MySQL and Oracle modes, and different constraints require different information. Therefore, you need to specify the required information based on the constraint you selected and the requirements on the page. + + +| Field | Description | +|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Constraint Name | The name of the constraint. | +| Column Information | The field or a group of fields specified as the constraint. | +| Associated Schema | The schema where the associated table is located when **Foreign Key Constraint** is used. The associated table is the parent table. This field is valid only in Oracle mode. | +| Associated Database | The database where the associated table is located when **Foreign Key Constraint** is used. The associated table is the parent table. This field is valid only in MySQL mode. | +| Associated Table | The associated table when **Foreign Key Constraint** is used. The associated table is the parent table. | +| Associated Field | The associated field when **Foreign Key Constraint** is used. The associated field is in the parent table. | +| Delete | Specifies the action to be performed on the current table when the data in the associated table is deleted. The current table is the child table, and the associated table is the parent table.
            The following four types of action are supported: **CASCADE**, **NO ACTION**, **RESTRICT**, and **SET NULL**. OceanBase Database supports different foreign key actions in MySQL and Oracle modes.
            - In MySQL mode, OceanBase Database allows you to specify **CASCADE**, **NO ACTION, RESTRICT**, and **SET NULL**.
            - In Oracle mode, OceanBase Database allows you to specify **CASCADE**, **NO ACTION**, and **SET NULL**.

            **Notice**
            At present, OceanBase Database does not support **SET NULL**.
            For more information about the syntax, see [Create a table](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000357139), or the official documentation of MySQL or Oracle. | +| Update | Specifies the action to be performed on the current table when the data in the associated table is updated. The current table is the child table, and the associated table is the parent table.
            The following four types of action are supported: **CASCADE**, **NO ACTION**, **RESTRICT**, and **SET NULL**.
            OceanBase Database supports different foreign key actions in MySQL and Oracle modes.
            - In MySQL mode, OceanBase Database allows you to specify **CASCADE**, **NO ACTION, RESTRICT**, and **SET NULL**.
            - In Oracle mode, OceanBase Database allows you to specify **NO ACTION**.
            **Notice**
            At present, OceanBase Database does not support **SET NULL**.
            For more information about the syntax, see [Create a table](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000357139), or the official documentation of MySQL or Oracle. | +| Check Condition | Specifies the check rules for data verification when **Check Constraint** is enabled. | + +The constraint setting page provides the following icons. + + +| Icon | Description | +|-----|------------| +| Create | Click this icon to add a constraint. | +| Delete | Click this icon to delete the selected constraint. | + +### Step 5: Set partitioning rules + +![Step 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A45-EN.png) + +You can partition a table that contains a large amount of data. After a table is partitioned, data in the table is stored in multiple tablespaces. The database does not scan the entire table for a query. + +* In MySQL mode, OceanBase Database supports the following six partitioning methods: **Key**, **Hash**, **Range**, **Range Columns**, **List**, and **List Columns**. + + + +* In Oracle mode, OceanBase Database supports the following three partitioning methods: **List**, **Range**, and **Hash**. + + The definition of a partition in MySQL mode is different from that in Oracle mode. So, the values of the following fields vary in different modes. You need to specify the following fields based on the selected partitioning method. + + | Field | Description | + |------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Partitioning Method | Specifies the partitioning method. The partitioning methods supported in MySQL mode are different from those in Oracle mode.
            - Range partitioning: Multiple rows with column values in an ordered, continuous, and non-overlapping range are assigned to a partition.
            - List partitioning: A table is partitioned based on the enumeration values.
            - Hash partitioning: A table is partitioned based on a given number of partitions. For a table that stores data without a clear pattern or range, you can use hash partitioning to randomly distribute values of the partition column to different partitions based on the HASH algorithm.
            - Key partitioning: This partitioning method is similar to HASH partitioning. The difference is that key partitioning only supports computation of one or more columns, and the MySQL server provides its own hash function. At least one INT type column is required for Key partitioning.
            For more information about partitioning, see [Overview](https://www.oceanbase.com/docs/enterprise/oceanbase-database-cn/V3.2.3/10000000000357153). | + | Field | The column that is used as the partition key. | + | Expression | Partitions are divided based on the return value of the expression. The partition expression is not supported in Oracle mode. | + | Partition | Based on the value specified for **Partitioning Method**, you may need to specify information such as **Partition Name**, **Partition Quantity**, **Upper Limit**, and **Value Enumeration**. You can add multiple partitions and drag selected fields to adjust their order. | + + + + + + +### Step 6: Confirm the SQL statement + +![Step 6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/create%20table-EN.png) + +After you click **Submit**, you can view the statement on the SQL Confirmation page. To view lengthy clauses, click **SQL Check** and **Format** in the lower-right corner of the page. + +Syntax: + +```sql +CREATE TABLE table_name (column_name column_type, column_name column_type,.......); +``` + + + +Parameters + +| Parameter | Description | +|-------------------------|----------------------------------------| +| CREATE TABLE | The key word that indicates the creation ofa table with a specified name. You must have the privileges to create tables. | +| table_name | The name of the table. The table name must conform to the identifier naming rules. | +| column_name column_type | The name and data type of the column in the table. To create multiple columns, separate the tuple with commas (,). | + + + +### Step 7: Complete the table creation + +Click **Execute**. After the table is created, the **employee** table appears in the table list in the left-side navigation pane. + +![Step 7.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A47.1-EN.png) + +> **Note** +> To manage a table, right-click the table name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View Table Structure**, **View DDL**, **View Table Data**, **CreateTable**, **Import**, **Export**, **Download**, **Mock Data**, **Open SQL Window**, **Copy**, **Rename**, **Delete**, and **Refresh**. + +For more information, see [Manage table data](../1.client-odc-table-objects/5.client-odc-manage-table-data.md). + +You can use the `SELECT` statement to query data in the new table. + +Syntax: + +```sql +SELECT + column_name, + column_name +FROM + table_name [WHERE Clause] [LIMIT N] [ OFFSET M] +``` + + + +Parameters + +| Parameter | Description | +|-------------|------------------------------------------------------| +| SELECT | The key word that indicates the name of the statement. You can use the SELECT statement to read one or more records. | +| column_name | The name of the column to be queried. You can use an asterisk (\*) to query all columns | +| WHERE | The key word of the condition clause. | +| LIMIT | The number of records to be returned. | +| OFFSET | The data offset from which the SELECT statement starts to query. The default offset is 0. | + + + +Example: + +```sql +SELECT `emp_no`, `birthdate`, `name`, `gender` FROM `employee`; +``` + +![Step 7.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A47.2-EN.png) + + + +## Related topics +* [Create a view](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [Create a function](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [Create a stored procedure](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [Create a program package](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [Create a trigger](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [Create a type](../8.client-odc-type-objects/2.client-odc-create-a-type.md) +* [Create a synonym](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/3.client-odc-table-list.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/3.client-odc-table-list.md new file mode 100644 index 00000000..6c60ade2 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/3.client-odc-table-list.md @@ -0,0 +1,45 @@ +Table list +=============================== + + + +Overview +----------------------------- + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. + +The table list displays the table objects in the current database. In the table list, you can view the **structure tree** of an object. You can also right-click the target object to perform some **management actions** on the object. + +Structure tree +----------------------- + +You can click the expand icon before the name of the target table in the table list, and the structure tree of the table is displayed in a drop-down list, as shown in the following figure. The structure tree of a table can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section. In this section, you can find the table describing the management options. + +![Image 188](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%88%97%E8%A1%A8-1-EN.png) + +Management actions +--------------------------- + +The names of table objects support ascending example by head character by default in the table list. +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + + +| Action | Description | +|----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Table Structure | Click this option to go to the Attribute tab. On this tab, you can view comprehensive information of the table such as the basic information, columns, indexes, constraints, and DDL statements. | +| View DDL | Click this option to go to the Attribute tab to view the SQL statements that define the table.| +| View Table Data | Click this option to go to the Data tab to view the data in the table. | +| Create Table | Click this option to go to the table creation page, where you can create a table as prompted. | +| Single Table Import | Click this option to import data to the table. For more information, see [Single table export and import](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md). | +| Single Table Export | Click this option to export data from the table. For more information, see [Single table export and import](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md). | +| Download | Download the SQL file for the table object. | +| Mock Data | Click this option to go to the Mock Data panel. | +| Open SQL Window | Click this option to open a new SQL window. | +|Copy|Click this option to copy the table name, SELECT statement, INSERT statement, UPDATE statement, or DELETE statement. | +| Rename | Click this option to rename the table. | +|Delete | Click this option to delete the table. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the table, so that the structure tree displays the latest information. | +| View Column/View Index/View Constraint | Click these options to go to the Attribute tab to view specific information about the columns, indexes, or constraints in the table. | +| Create Column/Create Index/Create Constraint | Click these options to create a column, an index, or a constraint. | + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/4.client-odc-manage-table-attributes.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/4.client-odc-manage-table-attributes.md new file mode 100644 index 00000000..ac8ebb01 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/4.client-odc-manage-table-attributes.md @@ -0,0 +1,184 @@ +Manage table attributes +============================================ + + + +Overview +----------------------------- + +![Overview](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-1-EN.png) + +1. After you log on to OceanBase Developer Center (ODC), click the name of the target connection on the ODC homepage to go to the corresponding connection management page. + + + +2. In the left-side navigation pane, click **Table** to get a list of tables. + + + +3. Double-click the name of a table in the table list to go to the table management page. + + + +4. Click **Attribute** in the top navigation bar to go to the Attribute tab. + + The Attribute tab displays the following table attributes: + + * **Basic information** + + + + * **Column** + + + + * **Index** + + + + * **Constraints** + + + + * **Partition** + + + + * **DDL** + + + + + + + + + +Basic information +-------------------------------------- + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/table%20attribute-basic%20information-EN.png) + +In the left-side navigation pane of the **Attribute** tab, click **Basic Info** to view the basic information about the table. + + +| Field | Description | +|-----------------------|-------------------------------------------------------------------------------------------------------------------------| +| Table Name | Displays the name of the table. You can modify the table name here. | +| Default Character Set | Displays the character set that the table uses. | +| Default Sorting Rule | Displays the sorting rule that the table uses. | +| Description | Displays the description that you specified when you created the table. You can also modify the table description here. | +|Row data volume|Displays the number of rows.| +|Size|Displays the data size.| + + + +The basic information page provides the following buttons. + + +| Button | Description | +|---------|-----------------------------------------------------------------------------------------------------------------------------------------| +| Edit | Click ![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412792.jpg) to modify the basic information. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the basic information. | + + + +Column information +--------------------------------------- + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-3-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Column** to view the columns in the table. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to add a field (or column) to the table. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected field. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the field information. | +| Filter | Click ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412788.jpg) (to the right of **Field Name** ) to filter or search for fields. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.| + + + +Index information +-------------------------------------- + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-4-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Index** to view the indexes on the table. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to add an index to the table. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected index. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the index information. | +| Filter | Click ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412788.jpg) (to the right of **Index Name** ) to filter or search for indexes. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.An index cannot be modified after it is created. | + +> **Note** +> An index cannot be modified after it is created. + +Constraint information +------------------------------------------- + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-5-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Constraint** to view the constraints on the table. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|-----------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to add a constraint to the table. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected constraint. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the constraint list. | +|Filter| ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412788.jpg) (to the right of **Name** ) to filter or search for constraints. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.| + + +> **Note** +>
          • The buttons provided vary with the constraint method. If a button is dimmed out or not present in the navigation bar, it means that the constraint method does not support the corresponding action.
          • +>
          • To view foreign key constraints on a table, you can query the `all_constraints` view in Oracle mode, or the information_schema.key_column_usage table in MySQL mode since OBServer V2.2.6.
          • +>
          • OceanBase Database supports constraint checking only in Oracle mode.
          • + + + + + + +Partition information +------------------------------------------ + +![6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-6-EN.png) + +In the left-side navigation pane of the Attribute tab, click **Partition** to view the information about the partitions in the table. The information includes **Partition Name** , **Order** , **Partitioning Method** , **Expression** , **Upper limit of the range** , and **Enumeration Value** . In Oracle mode, **Expression** indicates the partitioning key. **Partitioning Method** indicates the partitioning method specified when the table was created. The information displayed varies with the partitioning method. The navigation bar also provides the following buttons. + + +| Button | Description | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click + to create a partition from an undefined range. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412794.jpg) to delete the selected partition and destroy the data in the partition. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the partition list. | +| Filter | Click ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p423624.jpg) to filter partitions by partition name, order, partitioning method, expression, or upper limit of the range. | +|Export|Click the export icon in the upper right corner to export single table data.For details, please refer to the Single table export and import.| + + +> **Note** +> In ODC V3.3.0 and later versions, you can view the partitions of table objects not necessarily under the SYS tenant. + + + +DDL information +------------------------------------ + +![7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-7-en.png) + +In the left-side navigation pane of the **Attribute** tab, click **DDL** to view the DDL statements that define the table. You cannot edit these statements. Click ![Format](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412851.jpg) in the toolbar to view the statements. + +| Button | Description | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Format | Click [Format](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4411843561/p412851.jpg) to format the statements. | +| Download | Click Download to download the statements. | +| Refresh | Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8265511561/p412817.jpg) to refresh the statement. | +|Export|Click the export icon in the upper right corner to export single table data. For details, please refer to the Single table export and import.| \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/5.client-odc-manage-table-data.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/5.client-odc-manage-table-data.md new file mode 100644 index 00000000..0ce0b0e4 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/5.client-odc-manage-table-data.md @@ -0,0 +1,135 @@ +Manage table data +====================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Table** in the left-side navigation pane to get a list of tables. Double-click the name of a table in the table list to go to the table management page. Click the **Data** button in the navigation bar on the top of the page to go to the Data tab, where you can view, add, modify, and delete table data. +**Notice** + + + +In ODC, connections to the same database share the same session. In ODC V2.3.2 and later versions, auto-commit is turned off by default in Oracle mode, so you need to manually commit transactions. You can modify the value of the autocommit parameter on the **Session Properties** page to change this setting. For more information, see [Session management](../../9.client-odc-session-management.md). + +![1](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2889620261/p268002.png) + +View data +------------------------------ + +On the Data tab, ODC displays data in the form of a table. The navigation bar provides the following buttons for you to view and manage the data: + +* **Enable Editing** : Click this button to enable the editing mode so that you can edit the data in the table. + + + +* **Commit** : Auto-commit is turned off by default in Oracle mode, so you need to click this button to commit the current transaction. After you click this button, a dialog box appears, indicating that the current connection uses a shared session and the commit will apply to all windows. Click **Yes** to apply the commit. In MySQL mode, auto-commit is turned on by default, so this button is not displayed. + + + +* **Rollback** : Auto-commit is turned off by default in Oracle mode. You can click this button to roll back the current transaction. After you click this button, a dialog box appears, indicating that the current connection uses a shared session and the rollback will apply to all windows. Click **Yes** to apply the rollback. In MySQL mode, auto-commit is turned on by default, so this button is not displayed. + + + +* **Refresh** : Click this button to refresh the data in the table. + + + +* **Column Mode** : Click this button to display the data in the selected rows in the form of a table. On the **Column Mode** page, you can switch to the previous or next row. The column mode makes it easier to view data in a row that has many columns. + + + +* **Columns** : Click this button to select the columns to be displayed on the page. + + + +* **Back to Start** : Click this button to jump to the first page. + + + +* **Previous** : Click this button to go to the previous page. + + + +* **Next** : Click this button to go to the next page. + + + +* **Jump to Bottom** : Click this button to jump to the last page. + + + +* **Display Data Volume** : Click this button to set the maximum number of rows to be displayed on a page. + + + +* **Export** : Click this button to export the data in the table. You can specify the type of the exported file, the character set, and the number of rows to be exported. The file type can be CSV or SQL, and the character set can be GBK or UTF8. You can export up to 10,000 rows from a result set. + + + +* **Mock Data** : Click this button to mock data in the table. For more information, see [Data mocking](../../5.client-odc-use-tools/2.client-odc-data-mocking.md). + + + + + + +Edit data +------------------------------ + +Click **Enable Editing** in the navigation bar on the Data tab to enter the editing mode, as shown in the following figure. ODC use different colors to mark data in different states. New data is marked in green, deleted data in red, and modified data in orange. + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E6%95%B0%E6%8D%AE%E7%AE%A1%E7%90%86-2-EN.png) + +In editing mode, the navigation bar provides the following buttons for you to edit data in the table: + +* **Add Row** : Click this button to insert an empty row to the table. Double-click a cell to insert data to it. ODC provides the verification feature and related tools to help you insert data in a more convenient way. For example, if the current cell is of the date type, ODC displays a calendar for you to select the to-be-inserted date from. + + + +* **Delete Row** : Click this button to delete the selected rows from the table. + + + +* **Copy Current Row** : Click this button to copy the selected rows in the table. + + + +* **Column Mode** : Click this button to display the data in the selected rows in the form of a table. On the **Column Mode** page, you can switch to the previous or next row. The column mode makes it easier to view data in a row that has many columns. + + + +* **Columns** : Click this button to select the columns to be displayed on the page. + + + +* **Back to Start** : Click this button to jump to the first page. + + + +* **Previous** : Click this button to go to the previous page. + + + +* **Next** : Click this button to go to the next page. + + + +* **Jump to Bottom** : Click this button to jump to the last page. + + + +* **Display Data Volume** : Click this button to set the maximum number of rows to be displayed on a page. + + + +* **Cancel** : Click this button to exit the editing mode. + + + +* **Confirm Modification** : Click this button to generate the SQL statement for the action. After you verify the statement, click **Execute** to apply the data modification. If auto-commit is turned on, the transaction is automatically committed after you click this button. + + + +* **Modify and Submit** : Auto-commit is turned off by default in Oracle mode, so you need to click this button to commit the current transaction. After you click this button, a dialog box appears, indicating that the current connection uses a shared session and the commit will apply to all windows. Click **Yes** to apply the commit. In MySQL mode, auto-commit is turned on by default, so this button is not displayed. + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/1.client-odc-view-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/1.client-odc-view-objects-overview.md new file mode 100644 index 00000000..1eb15622 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/1.client-odc-view-objects-overview.md @@ -0,0 +1,29 @@ +Overview +============================= + +A view is a virtual table created based on one or more tables or views. The tables on which the view is based are called base tables. Views do not store data. You can use views to query and modify data in base tables. Therefore, the definition of a view is stored in the data dictionary, and no data copy related to the view definition is stored in the database. Views are similar to physical tables in the database, so you can perform operations on views like on tables. When you modify data in a view, you are actually modifying data in base tables. Conversely, the modification of data in base tables is also reflected in views generated based on these base tables. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click View in the left-side navigation pane to get a list of views. In the view list, you can double-click a view name to go to the view management page. On this page, you can check the data of the view on the Data tab or the attributes such as the basic information, columns, and DDL statements of the view on the Attribute tab. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.0.0 or a later version | +| OceanBase Database in MySQL mode | V1.4.1 or a later version | + + + +This chapter describes in different topics the operations you can perform on view objects in ODC. + +* [Create a view](../2.client-odc-view-objects/2.client-odc-create-a-view.md) + + + +* [Manage views](../2.client-odc-view-objects/3.client-odc-manage-views.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/2.client-odc-create-a-view.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/2.client-odc-create-a-view.md new file mode 100644 index 00000000..1e604a10 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/2.client-odc-create-a-view.md @@ -0,0 +1,199 @@ +# Create a view + +ODC supports visualized view creation. This topic describes how to create a view with ODC. + +## Overview + +A view is a virtual table that consists of data in one or more tables. You can use the `SELECT` statement to query a view. A view itself does not contain data. + +### Purposes of views + +* Simplifies data queries: You can use views to combine data from different tables in a database into a single virtual table, and thereby convert multi-table queries into a single-table query. + + + +* Controls data access: You can use views to present certain data to specific users. These users can view only the data in a specific view. + + + +![Overview](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%A6%82%E8%BF%B0-EN.png) + +As shown in the preceding figure, you can create a view in the following five steps: + +1. Specify the basic information. + + + +2. Select base tables. + + + +3. Select fields. + + + +4. Verify the SQL statement. + + + +5. Complete the view creation. + + + + + + +## Procedure + +In the following example, an employee salary view is created in the OceanBase Developer Center (ODC) console. The salary view consists of the name field in the employee table and the budget and dept_name fields in the consumer table. Procedure: + +### Step 1: Specify the basic information. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **View** in the left-side navigation pane to get a list of views. To create a view, click **+** in the upper-right corner of the view list or click **Create** in the top navigation bar. + +In the **Basic Info** section, specify **View Name** and **Check Item**. + +* **View Name**: specifies the name of the view. + + + +* **Check Item**: specifies the constraints on the input data. OceanBase Database in Oracle mode supports only the read-only mode. Default value: **None**. + + + + + + +![Step 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%80-EN.png) + +After you specify all the basic information, click **OK**. + +After the basic information is specified, you can either click **Next: Verify SQL Statement** to go to Step 4 and verify the SQL statement, or proceed to Step 2 and select base tables. + +### Step 2: Select base tables. + +After you specify the basic information, you can proceed to Step 2 and select base tables, or skip this step. + +In the **Select Base Tables** section, the list on the left displays available base tables in the hierarchy of schema > database > table/view. You can search for base tables in this list. Select tables or views in this base table list, and click the add icon (>) next to the list to add the selected tables or views to the table operation area on the right. + +![Step 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%BA%8C-EN.png) + +In the table operation area, you can perform the following operations on a selected base table. + + +| Operation | Description | +|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Set an alias | You can set an alias for a selected base table. Click **\** next to the table name in the table operation area and enter the alias. This operation is optional. | +| Set association relationships | When two or more tables exist in the table operation area, you can define an association relationship between the tables. The default association is **JOIN**. You do not need to set an association relationship for the last table. Click the ![drop-down list](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E4%B8%8B%E6%8B%89%E5%88%97%E8%A1%A8.jpg) icon next to Alias and select an association relationship. Supported options: **JOIN**, **INNER JOIN**, **LEFT JOIN**, **RIGHT JOIN**, **CROSS JOIN**, **FULL JOIN**, **UNION**, **UNION ALL**, **INTERSECT**, **MINUS**, **LEFT OUTER JOIN**, **RIGHT OUTER JOIN**, and **FULL OUTER JOIN**. | +| Adjust the association order | You can drag the base tables in the table operation area to reorder them. If you drag a table to the bottom of the list, the association relationships of this table are removed. | +| Delete a base table | You can click the delete icon next to a table in the table operation area to delete it from the table operation area. After you delete a table, its associations with the next table are removed. | + + + +After you select and configure the base tables, click **OK**. + +### Step 3: Select fields. + +After you select the base tables, you can proceed to Step 3 and select fields. If you skip Step 2, this step is unavailable. + +In the **Select Fields** section, the list on the left displays the fields of the base tables that you selected in Step 2 in the hierarchy of schema > database > table/view. You can search for fields in this list. Select fields in the field list, and click the add icon (>) next to the list to add the selected fields to the field operation area on the right. + +![Step 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%89-EN.png) + +In the field operation area, you can perform the following operations on a selected field. + + +| Operation | Description | +|--------|-----------------------------------------------------------| +| Set an alias | You can set an alias for a selected field. Click **\** next to the field name in the field operation area and enter the alias. This operation is optional. | +| Adjust the association order | You can drag the fields in the field operation area to reorder them. | +| Delete a field | You can click the delete icon next to a field in the field operation area to delete it from the operation area. | +| Customize fields | Click **+Custom** in the upper-right corner of the field operation area to add a field to the operation area. You must specify a name and an alias for the field. | + + + +After you select and configure the fields, click **OK**. + +### Step 4: Verify the SQL statement. + +After you complete all the previous steps, click **Next: Verify SQL Statement** to go to the statement editing page. + +![Step 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E5%9B%9B-EN.png) + +On the statement editing page, the view definition statements are generated based on the information specified in the **Basic Info**, **Select Base Tables**, and **Select Fields** sections. When two or more tables are included, you must complete the statement according to the relationship between the tables and logical conditions. After you complete the statements, click **Create** in the upper-right corner of the page to create the view. + +You can edit the SQL statements of the created view on the Create View page. Syntax: + +```sql +CREATE VIEW view_name AS +SELECT + column1, + column2..... +FROM + table_name +WHERE + [condition]; +``` + + + +In addition, the toolbar on the editing page provides the following buttons. + + +| Button | Description | +|-------|--------------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | Click this button and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | +|IN Value Conversion|A format such as A B can be converted to ('A','B') format.| +| Previous | Click this button to go back to the **Create View** page, where you can continue to edit or modify the parameters in the **Basic Info**, **Select Base Tables**, and **Select Fields** sections. | + + + +### Step 5: Complete the view creation. + +Click **Create** in the upper-right corner to create the view. After a view is created, you can use the `SELECT` statement to query it, just like how you query a table. + +![Step 4.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E5%9B%9B-2-EN.png) + +> **Note** +> To manage a view, right-click the view name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Delete**, **Download**, and **Copy**. + +For more information, see [Manage views](../2.client-odc-view-objects/3.client-odc-manage-views.md). + +Syntax: + +```sql +SELECT +column1, +column2..... +FROM +table_name; +``` + + + +Example: + +```sql +SELECT `name`, `budget`, `department_name` FROM `salary`; +``` + + + +![Step 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%BA%94-EN.png) + +## Related topics + +* [Create a table](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [Create a function](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [Create a stored procedure](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [Create a program package](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [Create a trigger](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [Create a type](../8.client-odc-type-objects/2.client-odc-create-a-type.md) +* [Create a synonym](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/3.client-odc-manage-views.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/3.client-odc-manage-views.md new file mode 100644 index 00000000..7e66185c --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/3.client-odc-manage-views.md @@ -0,0 +1,53 @@ +Manage views +================================= + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **View** in the left-side navigation pane to get a list of views in the current database. + +In the view list, you can view the **structure tree** of an object. You can also right-click the target object to perform some **management actions** on the object. You can also double-click the name of the target view to go to the view management page, which includes the **Attribute and Data tabs** . + +Structure tree +----------------------- + +You can click the expand icon before the name of the target view in the view list, and the structure tree of the view is displayed in a drop-down list, as shown in the following figure. The structure tree of a view can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section, where you can find the table describing the management options. + +![Image 538](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-1-EN.png) + +Management actions +--------------------------- + +The names of view objects support ascending example by head character by default in the view list. +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Option | Description | +|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Check View Properties | Click this option to go to the **Attribute** tab, where you can view comprehensive information such as the basic information, columns, and code of the view. | +| Check View Data | Click this option to go to the **Data** tab, to check data in the view. | +| Create View | Click this option to go to the Create View page, where you can create a view as prompted. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the view object. | +| Copy | Click this option to copy the object name, SELECT statement, INSERT statement, UPDATE statement, or DELETE statement. | +| Delete | Click this option to delete the current view object. | + + + +Attribute and Data tabs +-------------------------------- + +![en](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-2-EN.png) + +* Attribute tab: + + * **Basic Info** : displays information such as **View Name** , **Check Item** , and **Created By** . + + + + * **Column** : displays information of the base table corresponding to the view, such as **Field Name** , **Data Type** , and **Comment** . + + + + * **Code** : displays the definition script of the view. + + + +* Data tab: displays the columns that the view contains. diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/1.client-odc-functin-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/1.client-odc-functin-objects-overview.md new file mode 100644 index 00000000..2507bfad --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/1.client-odc-functin-objects-overview.md @@ -0,0 +1,29 @@ +Overview +============================= + +A function defines a collection of SQL statements. You can call a function in an SQL statement to get a return value from the execution. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click Function in the left-side navigation pane to get a list of functions. In the function list, double-click the name of a function to go to the function management page, where you can view the basic information, parameters, and data definition language (DDL) statements of the function. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.0.0 or a later version | +| OceanBase Database in MySQL mode | V2.0.0 or a later version | + + + +This chapter describes in different topics the operations you can perform on function objects in ODC. + +* [Create a function](../3.client-odc-function-objects/2.client-odc-create-a-function.md) + + + +* [Manage functions](../3.client-odc-function-objects/3.client-odc-manage-functions.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/2.client-odc-create-a-function.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/2.client-odc-create-a-function.md new file mode 100644 index 00000000..b6f2d21b --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/2.client-odc-create-a-function.md @@ -0,0 +1,200 @@ +# Create a function + +ODC supports visualized function creation. This topic describes how to create a function with ODC. + +## Overview + +A function is a subprogram defined in a database. You can call functions by using built-in SQL statements. If the built-in functions cannot meet your business requirements, OceanBase Developer Center (ODC) allows you to create functions. User-defined functions not only help you perform some calculations and special operations, but also reduce coding redundancy to improve the program readability. + +A function is a procedural object that is similar to a stored procedure in a database. Like a stored procedure, a function is a code snippet of SQL statements and procedural statements, and can be called by applications and other SQL statements. + +Differences between a user-defined function and a stored procedure: + +* A function returns only one result and is suitable for data processing that generates one result. A stored procedure may return zero or multiple results and is suitable for batch insertion and batch update. + +* You can call a function by using a `SELECT` statement. You can call a stored procedure by using a `CALL` statement. + +![Create a function 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%A6%82%E8%BF%B0-EN.png) + +As shown in the preceding figure, you can create a function in the following six steps: + +1. Specify the function name. + +2. Specify the data type of the return value. + +3. Specify parameters. + +4. Verify the parameters of the new function. + +5. Edit the function. + +6. Complete the function creation. + +## Procedure + +In the following example, a function named function_emp is created in the ODC console to obtain the employee name from an employee table based on the employee ID. The function_emp function contains an INT type id parameter. Procedure: + +### Step 1: Specify the function name. + +Log on to the ODC console and click the name of a connection to go to the corresponding connection management page. You can click **Function** in the left-side navigation pane to get a list of functions. To create a function, click + in the upper-right corner of the function list or click **Create** in the top navigation bar. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A41-EN.png) + +### Step 2: Specify the data type of the return value. + +For more information about data types, see [OceanBase Database Developer Guide](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview). + +### Step 3: Specify parameters. + +1. Parameters specify the information passed to a function when the function is called. + + * In Oracle mode, specify the following fields: **Name**, **Mode**, **Type**, and **Default Value**. + + + + * In MySQL mode, specify the following fields: **Name**, **Type**, and **Length**. + + + + + + +2. You can specify parameters by using one of the following three methods. + + + +| Method | Description | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------| +| Use the quick access toolbar | In the quick access toolbar, you can add, delete, and move up and down parameters. | +| Click the row number | - You can click a row number to select a row and display the quick access toolbar that allows you to delete the row or move the row up or down.
            - You can click a row number to select the row, and then drag the row to adjust its order. | +| Right-click | Right-click the mouse to select the entire row, copy row or move down the row. | + + +3. You need to specify the mode for the parameters. + + The parameter mode setting is unavailable in MySQL mode. The Oracle mode supports the following parameter modes: **IN**, **OUT**, and **INOUT**. + + +| **Parameter** | **Type** | +|--------|-------------------------------------------------------------------| +| IN | Indicates an input parameter. When a function is called, the input parameter is passed to the function and used in the execution of the function. | +| OUT | Indicates an output parameter. When a function is called, the value of the output parameter is ignored and an empty value is passed to the function. The output parameter in the function body can be modified. The modified result is returned and passed to the argument that the output parameter represents. | +| INOUT | Indicates an inout parameter. An inout parameter is both an input parameter and an output parameter. | + + + > **Note**
            + > In Oracle mode, both functions and stored procedures support IN, OUT, and INOUT modes. In MySQL mode, functions support only IN mode, and stored procedures support IN, OUT, and INOUT modes. + + + + + +### Step 4: Verify the parameters of the new function. +Click **OK** to go to the Create Function page. + +### Step 5: Edit the function. + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A45-EN.png) + +Edit the function statement on the Create Function page. +You can edit the SQL statements of the created function on the Create Function page. Syntax: + +```sql +CREATE FUNCTION < function name > ([ [ , ] ] …) +RETURNS < type > +< function body > +``` + + + +Parameters + + +| Parameter | Description | +|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| \< function name \> | The name of the user-defined function.
            **Notice**
            The name of a user-defined function cannot be the same as that of a stored procedure. | +| \< parameter \>\< type \> | Parameters of the function. This field contains only the name and type. You cannot specify the IN, OUT, or INOUT keyword. | +| RETURNS\< type \> | The data type of the return value. `` specifies the data type of the return value.
            **Notice**
            The SELECT statement in a RETURN VALUE statement returns only a single-row and single-column value. | +| \< function body \> | The body of the user-defined function. The function body must contain a `RETURN ` statement, where `` specifies the return value of the user-defined function. | + + + +Example: + +```sql +CREATE FUNCTION `function_emp` ( `id` int(45)) RETURNS VARCHAR(300) + +-- The start of the function body. +BEGIN + +-- Declare a variable. +DECLARE + a VARCHAR(300); + +-- Assign a value to the variable. +SELECT + name INTO a +FROM + employee +WHERE + emp_no = id; + +-- The return value. +RETURN a; + +-- The end of the function body. +END +``` + + + +### Step 6: Complete the function creation. + +Click **Create** in the upper-right corner to create the function. After a user-defined function is created, you can use the `SELECT` statement to call it, just like how you call a built-in function. + +> **Note**
            +> To manage a function, right-click the function name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Edit**, **Compile**, **Debug**, **Run**, **Download**, **Delete**, and **Refresh**. **Edit** , **Compile** , and **Debug** are not supported in MySQL mode. +> For more information, see [Manage functions](../3.client-odc-function-objects/3.client-odc-manage-functions.md). + +Syntax: + +```sql +SELECT ([ [,...]]) +``` + + + +Example: + +```sql +SELECT function_emp(2); +``` + + + +* MySQL mode + + ![6.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A46-1-EN.png) + + +* Oracle mode + + ![6.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0-%E6%AD%A5%E9%AA%A46-2-EN.png) + + + > **Notice**
            + > - In Oracle mode, if a user-defined function contains an OUT parameter, you must call the function by using the `CALL` statement.
            + > - A yellow icon in the function list indicates an error or alert. + + + +## Related topics + +[Create a table](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +[Create a view](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +[Create a stored procedure](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +[Create a sequence](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +[Create a program package](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +[Create a trigger](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +[Create a type](../8.client-odc-type-objects/2.client-odc-create-a-type.md) +[Create a synonym](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/3.client-odc-manage-functions.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/3.client-odc-manage-functions.md new file mode 100644 index 00000000..8e4be135 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/3.client-odc-manage-functions.md @@ -0,0 +1,90 @@ +Manage functions +===================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Function** in the left-side navigation pane to get a list of functions. + +In the function list, you can view the **structure tree** of an object, or right-click the target object to perform some **management actions** on the object. You can also double-click the name of the target function to go to the **function management page**. + +Structure tree +----------------------- + +You can click the expand icon before the name of the target function in the function list, and the structure tree of the function is displayed in a drop-down list, as shown in the following figure. The structure tree of a function can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section. In this section, you can find the table describing the management options. + +![Image 194](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-1-EN.png) + +Management actions +--------------------------- + +The names of function objects support ascending order by the head character by default in the function list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create function. | +| Filter | Click this option to display valid/invalid functions. | +| Batch Compile | Click this option to batch compile the function object. Including: compile all objects and compile invalid objects.
            ![batch compile](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91-EN.png) | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the function, so that the structure tree displays the latest information. | + + + +### Right-click function + +After you right-click an item in the structure tree, a shortcut menu appears and displays some actions that you can take to manage the item. The following table describes the management actions in details: + + +| Action | Description | +|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View | Click this option to go to the function management page. On this page, you can view comprehensive information such as the basic information, parameters, and code of the function. | +| Create | Click this option to go to the Create Function page, where you can create a function as prompted. | +| Edit | Click this option to go to the function management page, which displays the statements that define the function and where you can edit the function. | +| Compile | Click this option to compile the function. | +| Debug | Click this option to go to the debugging page. On this page, you can debug the function.
            **Note**
            • We recommend that you upgrade to OBServer V2.2.77 or later. This is because some versions of OBServer have been found with PL/SQL debugging issues, which may compromise the OBServer stability.
            • ODC V3.2.2 or earlier does not support the debugging feature when you connect ODC to the target instance by using OBProxy. To use the debugging feature, directly connect ODC to the target instance.
            • ODC V3.2.2 and later support PL/SQL debugging when you connect to OBServer by using OBProxy.
            • ODC V4.0.0 and later support setting the parameter value as DEFAULT, NULL or empty string.
            | +| Run | Click this option to execute the function. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the function object. | +| Delete | Click this option to delete the function. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the function, so that the structure tree displays the latest information. | + + +Function management page +--------------------------------------------- + +![Image 817](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-2-EN.png) + +You can double-click the name of the target function in the function list to go to the function management page. The function management page displays the following information: + + +| Section | Description | +|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This section displays the basic information about the function in fields such as **Function Name** , **Return Type** , and **Created By** . | +| Parameter | This section displays the information about the parameters in fields such as **Name** , **Order** , **Mode** , **Data Type** , and **Default Value** . Click the ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2672849361/p326053.jpg) icon to refresh the parameters. | +| DDL | This section displays the script that defines the function and provides the **Edit**, **Download**, **Find**, and **Refresh** icons.
            **Note**
            Click the **Edit** icon to go to the PL object editing page. | + + + +Function editing page +------------------------------ + +Right-click the target item in the function list. In the menu that appears, click **Edit** to go to the function editing page. In the code area of the editing page, the statements that define the function are displayed. You can edit the statements. In addition, the toolbar provides the following buttons: + + +| Button | Description | +|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Confirm Modification | Click this button to apply the current modification. | +| Compile | Click this button to compile the statements on the current page. | +| Run | Click this button to execute the statements in the code area. | +| Debug | Click this button to go to the debugging page, where you can debug the PL object in the code area. | +| Format | Click this button to apply the formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All C** **aps** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | +| IN Value Conversion | Click this button to convert the copied rows or columns into the specified format during queries. After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format. * Column values are separated with line breaks. * Row values are separated with spaces or tabs. | + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/1.client-odc-stored-procedure-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/1.client-odc-stored-procedure-objects-overview.md new file mode 100644 index 00000000..b82493da --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/1.client-odc-stored-procedure-objects-overview.md @@ -0,0 +1,46 @@ +Overview +============================= + +In a database system, a stored procedure is a collection of SQL statements for implementing a specific action. A stored procedure is stored in the database, and can be reused after it is compiled. + +Functions and stored procedures are similar in definition. Both are a collection of SQL statements. They have the following differences: + +* A function normally returns a value, whereas a stored procedure does not return values. + + + +* You can embed a function in an SQL statement. For example, you can call a function in a `SELECT` statement. However, usually a stored procedure is independently executed. + + + +* Functions have more limits than stored procedures. In general, stored procedures implement more complex features, whereas a function implements a more specific feature. + + + + + + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Stored Procedure** in the left-side navigation pane to get a list of stored procedures. In the stored procedure list, you can double-click the name of a stored procedure to go to the stored procedure management page, where you can view the basic information, parameters, and data definition language (DDL) statements of the stored procedure. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.0.0 or a later version | +| OceanBase Database in MySQL mode | V2.0.0 or a later version | + + + +This chapter describes in different topics the operations you can perform on stored procedure objects in ODC. + +* [Create a stored procedure](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) + + + +* [Manage stored procedures](../4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md new file mode 100644 index 00000000..879a9009 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md @@ -0,0 +1,223 @@ +# Create a stored procedure + +ODC supports visualized stored procedure creation. This topic describes how to create a stored procedure with ODC. + +## Overview + +A stored procedure is a collection of one or more statements. To perform a series of complex operations on a database, you can use a stored procedure to encapsulate these complex operations into a reusable code block in the database. It helps developers reduce their workload. + +In OceanBase Database, a stored procedure is a collection of SQL statements for implementing a specific feature. After you compile and store a stored procedure in the database, you can specify the stored procedure name and the required parameters to call this stored procedure for accelerated execution of the SQL statements. + +A stored procedure can contain parameters and return values. + +### Differences between a stored procedure and a function + +* The return value of a function is a specific result value, while the return value of a stored procedure only indicates whether the execution is successful. + + + +* You can call a function by using a `SELECT` statement. You can call a stored procedure by using a `CALL` statement. + + + + + + +### Benefits of stored procedures + +* Improve the versatility and portability of the application: After you create a stored procedure, it can be repeatedly called by a program without rewriting the SQL statements of the procedure. In addition, stored procedures can be modified with no impact on the program source code, thereby improving the portability of the program. + + + +* Accelerate SQL execution: If an operation involves a large amount of SQL statements or repeated execution of the same SQL statements, you can compile the code into a stored procedure and execute the stored procedure, which is faster than separately executing the statements. + + + +* Alleviate the workload of the server: If one SQL statement is called at a time to perform operations on the database objects, a large number of SQL statements are transmitted. If an equivalent stored procedure, only the command for calling the procedure is sent, thereby reducing the network load. + + + + +![Overview](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%A6%82%E8%BF%B0-EN.png) + + +As shown in the preceding figure, you can create a stored procedure in the following five steps: + +1. Specify the name of the stored procedure. + +2. Specify parameters. + +3. Verify the parameters of the stored procedure. + +4. Edit the parameters of the stored procedure. + +5. Complete the stored procedure creation. + +## Procedure + +In the following example, a stored procedure named proc_total is created in the ODC console for the calculation of department budgets. The stored procedure contains two INT type input parameters budget_r and budget_s and calculates the sum of the two parameters. Procedure: + +### Step 1: Specify the name of the stored procedure. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Stored Procedure** in the left-side navigation pane to get a list of stored procedures. To create a stored procedure, click **+** in the upper-right corner of the Stored Procedure list or choose **Create** > **Stored Procedure** in the top navigation bar. + +In the **Create Stored Procedure** dialog box, enter a name for the stored procedure. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A41-EN.png) + +### Step 2: Specify parameters. + +1. Parameters specify the information passed to a function when the function is called. + + * In Oracle mode, specify the following fields: **Name**, **Mode**, **Type**, and **Default Value**. + + + + * In MySQL mode, specify **Name**, **Mode**, **Type**, and **Length**. + + + + + + +2. You can specify parameters by using one of the following three methods. + + + +| Method | Description | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------| +| Use the quick access toolbar | In the quick access toolbar, you can add, delete, and move up and down parameters. | +| Click the row number | - You can click a row number to select a row and display the quick access toolbar that allows you to delete the row or move the row up or down.
            - You can click a row number to select the row, and then drag the row to adjust its order. | +| Right-click | - Copy a row or move one row down: Drag the pointer to select a row, right-click it, and then select Copy or Move Down from the context menu that appears.
            - Copy a cell: Select a cell, right-click it, and then select Copy from the context menu that appears. | + +> **Note** +> +> After copying a row, you can select a row and paste the copied row data with the shortcut keys Command + V / Ctrl + V. + + +3. You need to specify the mode for the parameters. + + OceanBase Database in both MySQL mode and Oracle mode supports the following parameter modes: **IN**, **OUT**, and **INOUT**. + + ```sql + CREATE PROCEDURE proc_name ([[IN |OUT |INOUT ] parameter_name parameter_type...]) + ``` + + + * Parameters + + + +| **Parameter** | Type | +| ------------- | ------------------------------------------------------------ | +| IN | Indicates an input parameter.
            When a stored procedure is called, the input parameter is passed to the stored procedure and used in the execution of the stored procedure. Usually, input parameters are only used to pass values in, and are not modified or returned in the call of a stored procedure. | +| OUT | Indicates an output parameter.
            When a stored procedure is called, the value of an output parameter is ignored and an empty value is passed to the stored procedure. The value of the output parameter is modified during the execution of the stored procedure. After the execution is complete, the modified value is assigned to the output parameter. Usually, output parameters are used to obtain the execution results of a stored procedure. Output parameters can be used to modify and return values in the call of a stored procedure. | +| INOUT | Indicates an inout parameter.
            An inout parameter is both an input parameter and an output parameter. | + + * Parameter settings + + + +| Property | Required | Default | Mode | +| ------------- | -------- | ------- | ------------ | +| Name | Yes | Empty | Oracle/MySQL | +| Mode | Yes | IN | Oracle/MySQL | +| Type | Yes | VARCHAR | Oracle/MySQL | +| Length | Yes | 45 | MySQL | +| Default value | No | Empty | Oracle | + + + + + + + +### Step 3: Verify the parameters of the stored procedure. + +Click **OK** to go to the Create Stored Procedure page. + +### Step 4: Edit the stored procedure. + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A44-EN.png) + +Edit the statements on the Create Stored Procedure page. + +In addition, the toolbar on the editing page provides the following buttons. + + +| Button | Description | +|-------|----------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | Click this button and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | + + + +You can edit the SQL statements of the created stored procedure on the Create Stored Procedure page. Syntax: + +```sql +CREATE PROCEDURE proc_name ( + [proc_parameter[,...]]) +IS +BEGIN +proc_body: +  Valid SQL routine statement +END [end_label] +``` + + + +Parameters + + +| Parameter | Description | +|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| proc_name | The name of the stored procedure. By default, a stored procedure is created in the current database. To create a stored procedure in a specific database, add the database name as the prefix to the name of the stored procedure in the format of db_name.sp_name.
            **Notice**
            The name of a stored procedure must differ from that of any built-in MySQL function. Otherwise, an error may occur. | +| [proc_parameter[,…] ] | The list of stored procedure parameters. A parameter is specified in the format of `[IN|OUT|INOUT] parameter_name parameter_type`.
            `parameter_name` specifies the parameter name and `parameter_type` specifies the parameter type, which can be any valid MySQL data type. If you need to specify multiple parameters, separate them with commas (,). A stored procedure can be created without a parameter. In this case, add a pair of parentheses after the name of the stored procedure.
            **Notice**
            The parameter names must differ from the column names in the data table. Otherwise, the SQL statements of the stored procedure may take a parameter name as a column name, which results in errors. | +| proc_body | The body of the stored procedure, which contains the SQL statements to be executed when the stored procedure is called.
            The body begins with **BEGIN** and ends with **END**. If the body contains only one SQL statement, you can omit the BEGIN and END flags. | + + + +### Step 5: Complete the stored procedure creation. + +Click **Create** in the upper-right corner to create the stored procedure. After a stored procedure is created, you can use the `CALL` statement to call it, just like how you call a built-in function. + +![5.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A45-EN.png) + +> **Note** +> To manage a stored procedure, right-click the stored procedure name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Edit**, **Run**, **Download**, **Delete**, and **Refresh**. + +For more information, see [Manage stored procedures](../4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md). + +Syntax: + +```sql +CALL proc_name ([proc_parameter [,...]]); +``` + + + +Example: + +```sql +CALL proc_total (30000, 20000); +``` + + + +![5.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A45-2-EN.png) + +## Related topics + +* [Create a table](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [Create a view](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [Create a function](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [Create a sequence](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [Create a program package](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [Create a trigger](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [Create a type](../8.client-odc-type-objects/2.client-odc-create-a-type.md) +* [Create a synonym](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md new file mode 100644 index 00000000..def254a5 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md @@ -0,0 +1,112 @@ +Manage stored procedures +============================================= + + + +Overview +----------------------------- + +After you log on to OceanBase Developer Center (ODC), you can click the name of a connection on the homepage to go to the corresponding connection management page. In the left-side navigation pane, you can click **Stored Procedure** to get a list of stored procedures in the current database. + +In the stored procedure list, you can view the **Structure tree** of an object, or right-click the object to perform some **Management actions** on the object. You can also double-click the name of the stored procedure in the list to go to the **Stored procedure management page** . + +Structure tree +----------------------------------- + +You can click the expand icon ![2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p377780.jpg) before the name of the target stored procedure in the stored procedure list, and the structure tree of the stored procedure is displayed in a drop-down list, as shown in the following figure. + +The structure tree of a stored procedure can have up to three levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the Management actions section. In this section, you can find the table describing the management options. + +![Image 195](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-1-EN.png) + +Management actions +--------------------------------------- + +The names of stored procedure objects support ascending order by the head character by default in the stored procedure list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create stored procedure. | +| Filter | Click this option to display valid/invalid stored procedures. | +| Batch Compile | Click this option to batch compile the stored procedure object. Including: compile all objects and compile invalid objects.
            ![batch compile](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91-EN.png) | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the stored procedure, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Action | Description | +|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View | Click this option to go to the Stored procedure management page, where you can view comprehensive information such as the basic information, parameters, and code of the stored procedure. | +| Create | Click this option to go to the Create Stored Procedure page, where you can create a stored procedure as prompted. | +| Edit | Click this option to go to the Stored procedure editing page, which displays the statements that define the stored procedure and where you can edit the stored procedure. | +| Compile | Click this option to compile the stored procedure. | +| Debug | Click this option to go to the **debugging page** , where you can debug the stored procedure.
            **Note**
            ODC V4.0.0 and later support setting the parameter value as DEFAULT, NULL or empty string.
            | +| Run | Click this option to execute the stored procedure. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the stored procedure object. | +| Delete | Click this option to delete the stored procedure. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the stored procedure so that the structure tree displays the latest information.
            **Note**
          • We recommend that you upgrade to OBServer V2.2.77 or later. This is because some versions of OBServer have been found with PL/SQL debugging issues, which may compromise the OBServer stability.
          • ODC V3.2.2 or earlier does not support the debugging feature when you connect ODC to the target instance by using OBProxy. To use the debugging feature, directly connect ODC to the target instance.
          • ODC V3.2.2 and later support PL/SQL debugging when you connect to OBServer by using OBProxy.
          • | + + +Stored procedure management page +----------------------------------------------------- + +![Parameters](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-2-EN.png) + +You can double-click the name of a stored procedure in the function list to go to the stored procedure management page. The stored procedure management page displays the following information: + + +| Section | Description | +|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This section displays the basic information about the stored procedure in fields such as **Stored Procedure Name** , **Created By** , **Creation At** , and **Last Modified At** . | +| Parameter | This section displays the information about the parameters in fields such as **Name** , **Mode** , **Data Type** , **Length** , and **Default Value** .Click the ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2672849361/p326053.jpg) icon to refresh the parameters. | +| DDL | This section displays the script that defines the stored procedure and provides the **Edit**, **Download**, **Find** **,** **Format**, and **Refresh** buttons.
            **Note**
            Click the **Edit** icon to go to the PL object editing page. | + + + +Stored procedure editing page +-------------------------------------------------- + +Right-click the target item in the stored procedure list. In the menu that appears, click **Edit** to go to the stored procedure editing page. In the code area of the editing page, the statements that define the stored procedure are displayed. You can edit the statements. In addition, the toolbar provides the following buttons: + + +| Button | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Confirm modification | Click this button to apply the current modification. | +| Compile | Click this button to compile the statements on the current page. **Note** * During the compilation, a code line is highlighted if it contains the name of an external object that cannot be referenced. * After the compilation, the **Compilation Result** tab displays the compilation status. If alerts exist, the alert details are displayed. | +| Run | Click this button ![run](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p377781.jpg) to execute the statements in the code area. | +| Debug | Click this button ![debug](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p377782.jpg) to enter the debug mode, which allows you to edit the PL or SQL object in the code area. After the debugging, you can close the debugging window. | +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can add indents to or delete indents from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | +| IN Value Conversion | Click this button to convert the copied rows or columns into the specified format during queries. After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format. * Column values are separated with line breaks. * Row values are separated with spaces or tabs. | + + + +Stored procedure output page +------------------------------------------------- + +![Output](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1541960461/p350898.png) + +After the stored procedure is executed, you can view the information of execution results in the **Output** and **DBMS Output** tabs. + + +| Tab | Description | +|-------------|----------------------------------------------------------------------------------------------------------------------------| +| Output | Displays the status, parameters, parameter types, parameter values, return type, and return value of the stored procedure. | +| DBMS Output | Displays DBMS outputs of the stored procedure. | + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/1.client-odc-squence-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/1.client-odc-squence-objects-overview.md new file mode 100644 index 00000000..3b6ba18a --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/1.client-odc-squence-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +A sequence is a serial arrangement of numbers that automatically increase based on specific rules in the database. A sequence is generally used as the primary key or unique key of a table because it does not contain duplicate values. +**Notice** + + + +After you connect OceanBase Developer Center (ODC) to OceanBase Database V2.1.0 or a later version in Oracle mode, you can create sequence objects in ODC. The MySQL mode does not support this feature. + +Log on to ODC and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click Sequence in the left-side navigation pane to get a list of sequences. You can double-click a sequence name in the sequence list to go to the sequence management page. On this page, you can view the basic information, parameters, and DDL statements of the sequence. + +This chapter describes in different topics the operations you can perform on sequence objects in ODC. + +* [Create a sequence](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) + + + +* [Manage sequences](../5.client-odc-sequence-objects/3.client-odc-manage-sequence.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md new file mode 100644 index 00000000..61ebbbf8 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md @@ -0,0 +1,38 @@ +Create a sequence +====================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click **Sequence** in the left-side navigation pane to get a list of sequences. To create a sequence, click **+** in the upper-right corner of the sequence list or choose **Create \> Sequence** in the top navigation bar. Perform the following two steps to create a sequence: + +![](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7530269361/p138331.png) + +1. Set **Basic Info** : You need to specify **Sequence Name** and **User** . The User parameter is automatically specified based on the current account. + + + +2. Set columns. This step is optional. You need to specify the following parameters to set columns: + + + + | Parameter | Description | + |-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | From | Specifies the initial value of the sequence, which must not be less than the value of **Minimum Value** . | + | Increment | Specifies the step size for the auto-increment of sequence values. The value can be a negative number. | + | Minimum Value | Specifies the minimum value that can be obtained by the sequence. The minimum value supported by the database is -1026. | + | Maximum Value | Specifies the maximum value that can be obtained by the sequence. The maximum value supported by the database is 1027. | + | Cache Settings | Specifies the cache size for the sequence. A proper cache size can improve the performance in obtaining sequence values. You can also set the value to **No Cache** . | + | Whether to Sort | Specifies whether the sequence obtains values in an ordered manner. The performance of the sequence in obtaining values in an ordered manner is inferior to that in an unordered manner. | + | Cyclic or Not | Specifies whether to start from the minimum value again when the sequence value reaches the maximum value. | + + + +3. Click **Next: Verify SQL Statement** to go to the Create Sequence page. + + ![Confirm](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0582659361/p326072.png) + + +4. An SQL script is pre-generated based on the information you specified. After the SQL script is verified, click **Create** in the upper-right corner to run the script and generate a sequence. + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/3.client-odc-manage-sequence.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/3.client-odc-manage-sequence.md new file mode 100644 index 00000000..427cde11 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/3.client-odc-manage-sequence.md @@ -0,0 +1,44 @@ +Manage sequences +===================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click **Sequence** in the left-side navigation pane to get a list of sequences. + +You can right-click the target object in the sequence list to perform some **Management actions** on the object. You can also double-click the target sequence in the sequence list to go to the **sequence Management** page. + +![Image 196](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-1-EN.png) + +Management actions +--------------------------- + +The names of sequence objects support ascending example by head character by default in the sequence list. +Right-click the target object in the sequence list. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. + +The following table describes the management options. + + +| Action | Description | +|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create Sequence | Click this option to go to the Create Sequence page, where you can create a sequence as prompted. | +| View Sequence | Click this option to go to the **sequence management page** , where you can view comprehensive information such as the basic information, attributes, and DDL statements of the sequence. | +| Modify | Click this option to go to the Attribute tab of the **sequence management page** to modify the information of the sequence. | +| Delete | Click this option to delete the sequence. | +|Export|Export single table, see **Single table export and import**.| +|Download|Download the SQL file for the sequence object.| +| Refresh | Click this option to refresh the list after you perform management actions on the sequence, so that the list displays the latest information. | + + + +Sequence management page +--------------------------------- + +[sequence2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-2-EN.png) +You can view the following information on the Sequence Management page. + + +| Section | Description | +|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This tab displays the basic information of a sequence in fields such as the **Sequence Name** and **Owner** . It also provides the **Edit** and **Refresh** icons.You can click **Edit** to modify the value of the following fields: **Increment** , **Minimum Value** , **Maximum Value** , **Cache Settings** , **Whether to Sort** , and **Cyclic or Not** . **Next Buffer Value** is the value of `last_number` in the sequence view. This value cannot be modified. | +| DDL | This section displays the script that defines the sequence. Click the ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2672849361/p326053.jpg) icon to refresh the parameters. **Note** Click the **Edit** icon to go to the PL object editing page. | + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/1.client-odc-package-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/1.client-odc-package-objects-overview.md new file mode 100644 index 00000000..4c7f6e5c --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/1.client-odc-package-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +A package is a combination of related PL programming elements, such as functions, procedures, variables, and cursors. Packages are similar to classes in Java. Variables in a package are similar to member variables in a class, and functions and procedures are similar to methods in a Java class. A package is used to group identical or similar objects, to facilitate maintenance and management and improve development efficiency and performance. +**Notice** + + + +After you connect OceanBase Developer Center (ODC) to OceanBase Database V2.2.20 or a later version in Oracle mode, you can create package objects in ODC. The MySQL mode does not support this feature. + +Log on to ODC and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click package in the left-side navigation pane to get a list of packages. Double-click a package name in the package list to go to the package management page. On this page, you can view information such as the basic information and codes of the package header and package body. + +This chapter describes in different topics the operations you can perform on package objects in ODC. + +* [Create a package](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) + + + +* [Manage packages](../6.client-odc-package-objects/3.client-odc-manage-program-packages.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/2.client-odc-create-a-program-package.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/2.client-odc-create-a-program-package.md new file mode 100644 index 00000000..f1f35732 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/2.client-odc-create-a-program-package.md @@ -0,0 +1,22 @@ +Create a program package +============================================= + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Program Package** in the left-side navigation pane to get a list of program packages. To create a program package, click **+** in the upper-right corner of the program package list or click **Create** in the navigation bar on the top of the page. To create a program package, you need to create the package header and the package body. + +Create the package header +---------------------------------- + +Click the **+** icon in the upper-right corner of the package list, or click **Create** in the navigation bar to go to the Create Program Package page, where you can create the package header. + +![Create package](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3140269361/p326070.png) + +On the package creation page, specify the package name and click **Next: Verify SQL Statement** to go to the header definition page. + +ODC automatically generates the template statement, as shown in the following figure. In the navigation bar of the header definition page, ODC provides the **Format** button for you to standardize the statement format. After you complete the header definition statements, click **Create** in the upper-right corner to generate the header. + +![Image 197](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2178659361/p241381.png) + +Create the package body +-------------------------------- + +After you create the package header, the new program package appears in the program package list. Right-click the created program package and click **Create Package Body** to go to the package body definition page. This page is similar to the header definition page, as shown in the following figure. ODC automatically generates the template statement and provides the **Format** button for you to standardize the statement format. After you complete the package body definition statements, click **Create** in the upper-right corner to generate the package body.![Image 198](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2178659361/p241382.png) diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/3.client-odc-manage-program-packages.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/3.client-odc-manage-program-packages.md new file mode 100644 index 00000000..6d91d057 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/3.client-odc-manage-program-packages.md @@ -0,0 +1,92 @@ +Manage program packages +============================================ + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Program Package** in the left-side navigation pane to get a list of program package objects in the current database. + +In the program package list, you can view the **structure tree** of an object. You can also right-click the target object to perform some **management actions** on the object. You can also double-click the name of a program package to go to the program package page, which provides a **Package Header** tab and a **Package Body** tab. + +Structure tree +----------------------------------- + +You can click the Expand icon before the name of the target program package in the program package list. Then, the structure tree of the program package displayed in a drop-down list, as shown in the following figure. The structure tree of a program package can have up to six levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section, where you can find the table describing the management options. + +![Image 227](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-1-EN.png) + +Management actions +--------------------------------------- + +The names of program package objects support ascending order by the head character by default in the program package list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create program package. | +| Filter | Click this option to display valid/invalid program packages. | +| Batch Compile | Click this option to batch compile the program package object. Including: compile all objects and compile invalid objects.
            ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91-EN.png) | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the program package, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Action | Description | +|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create Program Package | Click this option to go to the Create Program Package page, where you can create a program package header as prompted. | +| Create Package Body | Click this option to go to the package body definition page and create a program package body. | +| Edit the package header and package body | Click this option to open both the package header editing and package body editing pages, where you can edit the package header and the package body. | +| Delete | Click this option to delete the program package. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the program package, so that the structure tree displays the latest information. | +| View | Click this option to go to the Package Header tab or the Package Body tab, where you can view comprehensive information such as the basic information and code of the program package. | +| Edit | Click this option to go to the package header editing and package body editing pages, which display the package header and package body definition statements and where you can continue to edit the package header and the package body. | +| Compile | Click this option to compile the program package. | +| Debug | Click this option to go to the debugging page, where you can debug the program package. PL object debugging is supported only when OBServer V2.2.73 or a later version, or V3.0.00 or a later version is connected.
            **Note**
            ODC V4.0.0 and later support setting the parameter value as DEFAULT, NULL or empty string.
            | +| Run | Click this option to run the stored procedure or function in a subprogram in the program package body. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the program package object. | +| Delete | Click this option to delete the body of the program package. | + + +Package Body tab +------------------------------------- + +On the program package management page, click the **Package Body** tab. The following information is displayed: + + +| Section | Description | +|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Information | This section displays the basic information about the package header in fields such as **Package Name** , **Created By** , **Created At** , and **Last Modified At** . | +| DDL | This section displays the script that defines the function and provides the **Edit** , **Find** , and **Refresh** icons. **Note** Click the **Edit** icon to go to the PL object editing page. | + + + +Package header/body editing page +----------------------------------------------------- + +![programpackage2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-2-EN.png) + +Right-click the target object in the program package list. In the shortcut menu that appears, click **Edit** to go to the program package editing page. The code area of the editing page displays statements that define the program package. You can edit the statements. In addition, the toolbar provides the following buttons: + + +| Button | Description | +|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Confirm Modification | Click this button to apply the current modification. | +| Compile | Click this button to compile the statements on the current page. This button is available only on the package body editing page. | +| Abort | Click this button to abort the statement that is being executed. | +| Debug | Click this option to go to the debugging page, where you can debug the program package. PL object debugging is supported only when OBServer V2.2.70, V3.0.00, or a later version is connected. | +| Format | Click this button to apply the formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three configurations: **All Uppercase** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding button to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | You can add indents to or delete indents from the statements that you selected. | +| Comment | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | +| IN Value Conversion | Click this button to convert the copied rows or columns into the specified format during queries. After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format. * Column values are separated with line breaks. * Row values are separated with spaces or tabs. | + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/1.client-odc-trigger-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/1.client-odc-trigger-objects-overview.md new file mode 100644 index 00000000..581719d0 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/1.client-odc-trigger-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +Triggers are special stored procedures that are triggered by events but cannot be explicitly called. Therefore, triggers are used to monitor specific situations and trigger corresponding actions. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection in Oracle mode to go to the corresponding connection management page. You can click Trigger in the left-side navigation pane to get a list of triggers. Click **+** in the upper-right corner of the list to go to the Create Trigger page. You can also double-click the name of a trigger in the list to go to the trigger management page. On this page, you can view the basic information and codes of the trigger. +**Notice** + + + +After you connect ODC to OceanBase Database V2.2.20 or a later version in Oracle mode, you can create trigger objects in ODC. The MySQL mode does not support this feature. + +This chapter describes in different topics the operations you can perform on trigger objects in ODC. + +* [Create a trigger](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) + + + +* [Manage triggers](../7.client-odc-trigger-objects/3.client-odc-manage-triggers.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md new file mode 100644 index 00000000..5002b529 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md @@ -0,0 +1,114 @@ +Create a trigger +===================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Trigger** in the left-side navigation pane to get a list of triggers. To create a trigger, click **+** in the upper-right corner of the trigger list or click **Create** in the navigation bar on the top of the page + +To create a trigger, perform the following three steps: + +1. Specify the basic information. + + + +2. Configure the advanced settings. + + + +3. Verify the SQL statement. + + + + + + +![Image 548](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9989620261/p268312.png) + +Specify the basic information +-------------------------------------------------- + +This is Step 1. The **Basic Inf** **ormation** section contains the following parameters: + +* **Trigger Name** : specifies the name of the trigger. + + + +* **Base Object Mode** : specifies the schema where the object that the trigger works on is located. + + + +* **Base Object Type** : specifies the type of the object that the trigger works on. The current version supports only **TABLE** objects. + + + +* **Base Object Name** : specifies the name of the object that the trigger works on. + + + +* **Trigger Status** : specifies the state of the trigger. Valid value: **On** or **Disable** . + + + + + + +Configure the advanced settings +---------------------------------------------------- + +This is Step 2. The **Advanced Settings** section contains the following parameters: + +* **Trigger Type** : specifies the type of the trigger. The current version supports only **SIMPLE** triggers. + + + +* **Trigger** : specifies whether the trigger is activated before or after the triggering event. Valid value: **BEFORE** or **AFTER** . + + + +* **Level** : specifies the level of the trigger. The current version supports only row-level triggers. + + + +* **Event** : specifies the type of operation that activates the trigger. Valid value: **INSERT** , **UPDATE** , or **DELETE** . + + + +* **Column (Optional)** : specifies the range that the event specified in **Event** applies to. This parameter is displayed when you set **Event** to **UPDATE** . The current version allows you to create only row-level triggers in a table. Therefore, the range here is the columns that the event applies to. + + + +* **Referencing Old** **(Optional)** : specifies an alias for the referenced object that corresponds to the value specified for `REFERENCEING OLD` in the trigger creation statement. + + + +* **Referencing New** **(Optional)** : specifies an alias for the referenced object that corresponds to the value specified for `REFERENCEING NEW` in the trigger creation statement. + + + +* **Clause Condition** **(Optional)** : specifies a logical expression for the trigger. After you specify a clause condition, the action specified by the trigger is executed only if the value of the expression is True. + + + + + + +Verify the SQL statement +--------------------------------------------- + +After you specify all the information in the **Basic Info** and **Advanced Settings** sections, click **Next: Verify SQL Statement** to go to the statement editing page. + +The trigger definition statement is generated on the statement editing page based on the information that you specified in the **Basic Info** and **Advanced Settings** sections. You only need to complete the trigger body, which specifies the action to be executed. After you complete the trigger body, click the **Create** button in the upper-right corner of the page to complete the creation of the trigger. + +In addition, the toolbar on the editing page provides the following buttons: + + +| Button | Description | +|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can specify search criteria in the search box to find specific content in the script and enter other content in the replacement box to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three configurations: **All Caps** , **All Lowercase** , and **Capitalize the first letter** . Click this button to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | The **Add Indents** and **Delete Indent** options are provided, to allow you to add indents to or delete indents from the selected statements in the script. | +| Comment | The **Add Comments** and **Delete Comment** options are provided, which respectively allow you to convert the selected statements in the script to comments and convert comments to SQL statements. | +| Previous | Click this button to go back to the **Create Trigger** page, where you can continue to edit or modify the parameters in the **Basic Information** and **Advanced Settings** sections. | + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/3.client-odc-manage-triggers.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/3.client-odc-manage-triggers.md new file mode 100644 index 00000000..02629706 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/3.client-odc-manage-triggers.md @@ -0,0 +1,81 @@ +Manage triggers +==================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Trigger** in the left-side navigation pane to get a list of triggers. The trigger list displays the trigger objects in the current database. You can right-click the target object to perform some management actions on the object. You can also double-click the name of the target trigger in the trigger list to go to the trigger management page. + +![Image 647](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-1-EN.png) + +Management actions +--------------------------------------- + +The names of trigger objects support ascending order by the head character by default in the trigger list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create trigger. | +| Filter | Click this option to display valid/invalid triggers. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the trigger, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the list. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. The following table describes the management options. + + +| Option | Description | +|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Trigger | Click this option to go to the trigger management page, where you can view the basic information, parameters, and code of the trigger. | +| Create Trigger | Click this option to go to the Create Trigger page, where you can create a trigger as prompted. | +| Edit | Click this option to go to the trigger editing page, which displays the statements that define the trigger and where you can continue to edit the trigger. | +| Compile | Click this option to compile the trigger. | +| Enable | Click this option to enable the trigger. | +| Disable | Click this option to disable the trigger. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the trigger object. | +| Delete | Click this option to delete the trigger. | +| Refresh | Click this option to refresh the list after you perform management actions on the trigger, so that the list displays the latest information. | + + + +Trigger management page +-------------------------------------------- + +[trigger2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-2-EN.png) + +You can double-click the name of the target trigger in the trigger list to go to the trigger management page, which provides the following three tabs: + +* **Basic Info** : displays information such as **Name** , **Owner** , and the **Trigger State** of the trigger. + +* **Base Object** : displays information such as **Name** , **Owner** , and **Type** of the base object of the trigger. + +* **DDL** : displays the script that defines the trigger and provides the **Edit** , **Find** , and **Refresh** buttons. You can click Edit to go to the trigger editing page. + + + + + + +Trigger editing page +----------------------------------------- + +To go to the trigger editing page, right-click the target trigger in the trigger list and choose **Edit** from the shortcut menu that appears. You can also click the **Edit** button on the DDL tab of the trigger management page to go to this page. The code area on the editing page displays the statements that define the trigger. You can edit the statements. In addition, the toolbar provides the following buttons: + + +| Button | Description | +|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | You can specify search criteria in the search box to find specific content in the script and enter other content in the replacement box to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three configurations: **All Caps** , **All Lowercase** , and **Capitalize the first letter** . Click this button to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | The **Add Indents** and **Delete Indent** options are provided, to allow you to add indents to or delete indents from the selected statements in the script. | +| Comment | The **Add Comments** and **Delete Comment** options are provided, which respectively allow you to convert the selected statements in the script to comments and convert comments to SQL statements. | +| Confirm Modification | Click this button to apply the current modification. | + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/1.client-odc-type-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/1.client-odc-type-objects-overview.md new file mode 100644 index 00000000..78dcebed --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/1.client-odc-type-objects-overview.md @@ -0,0 +1,24 @@ +Overview +============================= + +You can create custom object types in OceanBase Database. A type in OceanBase Database is similar to a class in Java. A class has attributes and methods, and methods in Java are equivalent to functions and stored procedures in OceanBase Database. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. Click Type in the left-side navigation pane to get a list of types. Click the **+** button in the upper-right corner of the list to go to the type creation page. You can double-click the name of a type in the list to go to the type management page, where you can view the basic information and code of the type. +**Notice** + + + +After you connect ODC to OceanBase Database V2.2.20 or a later version in Oracle mode, you can create type objects in ODC. The MySQL mode does not support this feature. + +This chapter describes in different topics the operations you can perform on type objects in ODC. + +* [Create a type](../8.client-odc-type-objects/2.client-odc-create-a-type.md) + + + +* [Manage types](../8.client-odc-type-objects/3.client-odc-manage-types.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/2.client-odc-create-a-type.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/2.client-odc-create-a-type.md new file mode 100644 index 00000000..82dc0684 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/2.client-odc-create-a-type.md @@ -0,0 +1,159 @@ +# Create a type + +ODC supports visualized type creation. This topic describes how to create a type with ODC. + +## Overview + +A database type object specifies the name, method, and other attributes of a type. + +OceanBase Developer Center (ODC) supports three types: object type, array type, and table type. + +* Object type: an abstract data type (ADT), which is an expression that encapsulates database objects, relationships between database objects, and basic operations on database objects. + + + +* Array type: a variable array, which is a collection similar to a nested table. A variable array is a collection of objects, where each object is of the same data type. The size of a variable array is determined when the array is created. The data type of a column in a table can be a variable-length multidimensional array. The type of the array can be any of the primitive types, the enumerated type, the composite type, or a user-defined type. + + + +* Table type: an independent nested table type. The created arrays are directly defined in the columns of the table. + + +![Create a type](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-EN.png) + + +As shown in the preceding figure, you can create a type in the following four steps:. + +1. Specify the type name. +2. Select a type object. +3. Edit SQL statements. +4. Complete the type creation. + +## Procedure + +In the following example, the ob_var object type is created in the ODC console. The type contains two VARCHAR type parameters: var and var1. Procedure: + +### Step 1: Specify the name of the type. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Type** in the left-side navigation pane to get a list of types. To create a type, click **+** in the upper-right corner of the type list or click **Create** in the top navigation bar. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A41-EN.png) + +### Step 2: Select a type object. + + + +| Type | Description | Example | +|------|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| Object Type | The ADT.
            **Note**
            Only the object type can contain a subprogram. | ``` CREATE OR REPLACE TYPE ob_var AS OBJECT( var varchar2(10), var1 varchar(10) ); ``` | +| Array Type | The independent variable array (VARRAY) type. | ``` CREATE OR REPLACE TYPE test AS VARRAY(20) of varchar2(20); ``` | +| Table Type | The independent nested table type. | ```CREATE OR REPLACE TYPE test AS TABLE OF varchar2(100 BYTE);``` The `AS TABLE OF` clause allows you to create an array list\. | + + + +### Step 3: Edit SQL statements. + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A43-EN.png) + +After you specify the information in Step 2, click **Next: Verify SQL Statement** to go to the statement editing page. This page displays the corresponding type definition statements generated based on the information you specified in the **Create Type** dialog box. You must complete the statements based on your needs. After you complete the statements, click **Create** in the upper-right corner to complete the type creation. + +In addition, the toolbar on the editing page provides the following buttons. + + +| Button | Description | +|-------|----------------------------------------------------------------| +| Format | Click this button to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| Find and Replace | Click this button and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this button to undo the last operation. | +| Redo | Click this button to reverse an **Undo** operation. | +| Case Sensitivity | The system supports three capitalization options: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | +| Indent | You can **add indents** to or **delete indents** from the statements that you selected. | +| Comments | You can click **Add Comments** to convert the statements that you selected into comments or click **Delete Comment** to convert comments to SQL statements. | +|IN Value Conversion|A format such as A B can be converted to ('A','B') format.| + + + +### Step 4: Complete the type creation. + +Click **Create** in the upper-right corner to create the type. After a user-defined type is created, you can use the `INSERT` key word to call it in a PL statement. + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A44-EN.png) + +> **Note** +> To manage a type, right-click the type name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Delete**, **Download**, and **Refresh**. +> For more information, see [Manage types](../8.client-odc-type-objects/3.client-odc-manage-types.md). + +Example: + +```sql +-- Create a table. +create table data_type (id number(10),name varchar2(50),age int,address varchar2(50),salary float); + +-- Insert table data. +insert into data_type values(1,'baba',20,'hangzhou',3000.00); + +-- Create a type. +create or replace type ob_var as object( + var varchar2(10), + var1 varchar(10) +); + +delimiter / +-- Create a stored procedure. +create or replace procedure p_datatype is +begin + declare + rec data_type%rowtype; + v_age rec.age%type; + var varchar2(50); + v_name var%type; + v_salary data_type.salary%type; + +-- Define a type. + type salary is table of number index by varchar2(20); + arr salary; + v_arr arr%type; + + CURSOR c2 IS SELECT name, age FROM data_type; + c_row c2%rowtype; + v_rec c_row%type; + + ob ob_var; + v_obj ob%type; + + begin + v_name := 'ali '; + v_age := 30; + v_salary := 2000; + dbms_output.put_line('Referenced item: variable, record, and table column name: ' || v_name || ' * ' || v_age || ' * ' || v_salary); + + v_arr('James') := 78000; + dbms_output.put_line('Referenced item: name of collection variable ' || v_arr.FIRST); + + open c2; + fetch c2 into v_rec; + dbms_output.put_line('Referenced item: name of cursor variable: ' || v_rec.name || ' * ' || v_rec.age); + close c2; + + v_obj:=ob_var('test','object'); + dbms_output.put_line('Referenced item: name of object instance: ' || v_obj.var || ' * ' || v_obj.var1); + end; +end; +/ + +begin + p_datatype; +end; +/ +``` + +## Related topics + +* [Create a table](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [Create a view](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [Create a function](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [Create a stored procedure](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [Create a program package](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [Create a trigger](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [Create a synonym](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/3.client-odc-manage-types.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/3.client-odc-manage-types.md new file mode 100644 index 00000000..7d9b5722 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/3.client-odc-manage-types.md @@ -0,0 +1,56 @@ +Manage types +================================= + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Type** in the left-side navigation pane to get a list of types The type list displays the type objects in the current database. You can right-click the target object in the type list to perform some management actions on the object. You can also double-click the target type in the type list to go to the type management page. + +Structure tree +----------------------------------- + +You can click the expand icon before the name of the target type in the type list, and the structure tree of the type is displayed in a drop-down list, as shown in the following figure. The structure tree of a type can have up to five levels. When you right-click an item in the tree, the shortcut menu displays some actions that you can perform on the item. For more information about these actions, see the **Management actions** section, where you can find the table describing the management options. + +![Image 648](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%B1%BB%E5%9E%8B-1-EN.png) + +Management actions +--------------------------------------- + +The names of type objects support ascending order by the head character by default in the type list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create type. | +| Filter | Click this option to display valid/invalid types. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the type, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. + +The following table describes the management options. + + +| Option | Description | +|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Type | Click this option to go to the type management page, where you can view the basic information and codes of the type. | +| Create Type | Click this option to go to the **Create Type** page, where you can create a type as prompted. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the type object. | +| Delete | Click this option to delete the type. | +| Refresh | Click this option to refresh the list after you perform management actions on the type, so that the list displays the latest information. | + + + +Type management page +----------------------------------------- + +You can double-click the name of the target type in the type list to go to the type management page. This page provides two tabs: + +* **Basic Info** : displays information such as **Name** , **Owner** , **Type** , **Creation Time** , and **Modified At** of the type object. + +* **DDL** : displays the script that defines the type and provides the **Download**, **Find**, **Refresh** and **Format** buttons. You can click Edit to go to the type editing page. \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/1.client-odc-synonym-objects-overview.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/1.client-odc-synonym-objects-overview.md new file mode 100644 index 00000000..0d1b12e2 --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/1.client-odc-synonym-objects-overview.md @@ -0,0 +1,29 @@ +Overview +============================= + +A synonym is an alias of a database object. It is often used to simplify object access and improve the security of object access. Similar to views, synonyms do not consume storage space, and only the synonym definitions are stored in the data dictionary. Synonyms are divided into public synonyms and common synonyms. + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click Synonym in the left-side navigation pane to get a list of synonyms. You can click **+** in the upper-right corner of the list to go to the synonym creation page. You can also double-click a synonym name in the list to go to the synonym management page. On this page, you can view the basic information and codes of the synonym. + +The database version must meet the following requirements: + + +| Database | Version | +|-----------------------------------|---------------------------| +| OceanBase Database in Oracle mode | V2.2.0 or a later version | +| OceanBase Database in MySQL mode | V2.2.0 or a later version | + + + +This chapter describes in different topics the operations you can perform on synonym objects in ODC. + +* [Create a synonym](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) + + + +* [Manage synonyms](../9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md new file mode 100644 index 00000000..7579739b --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md @@ -0,0 +1,139 @@ +# Create a synonym + +ODC supports visualized synonym creation. This topic describes how to create a synonym with ODC. + +## Overview + +A synonym is an alias that you create for a database object of another user. You can perform operations on the object by querying and operating the synonym. + +Synonyms are similar to views. You can use synonyms to add, delete, modify, and query table data. You can define synonyms for most database objects in OceanBase Database, such as tables, views, materialized views, sequences, functions, stored procedures, packages, and synonyms. + +Synonyms extend the availability of database objects and allow them to be accessed by different database users with the required privileges. This design simplifies and secures access to database objects. + +### Synonym types + +OceanBase Database supports synonyms and public synonyms. + +* Synonyms: In general, a synonym created by a regular user is a private synonym. A private synonym can be accessed by the user who created it or other users who are granted the required privileges. To create a private synonym under the current user, you must have the CREATE SYNONYM privilege. + + + +* Public synonyms: A public synonym is created by a user who is granted the administrator role, such as the system user account, and can be accessed by all users. + + + +For more information, see [Synonyms](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.2/synonyms). + +![Create a synonym](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-EN.png) + +As shown in the preceding figure, you can create a synonym in the following eight steps: + +1. Specify the synonym name. +2. Specify the object owner. +3. Specify the object type. +4. Specify the object name. +5. Specify the synonym type. +6. Verify the information about the synonym. +7. Edit the synonym. +8. Complete the synonym creation. + +## Procedure + +In this example, a synonym named syn_employee is created in the OceanBase Developer Center (ODC) console for an employee table in the SYS database. Procedure: + +### Step 1: Specify the name of the synonym. + +Log on to the ODC console and click the name of the desired connection to go to the corresponding connection management page. You can click **Synonym** in the left-side navigation pane to get a list of synonyms and a list of public synonyms. To create a synonym, click **+** in the upper-right corner of the synonym list or choose **Create** > **Synonym** in the top navigation bar. + +In the **Create Synonym** dialog box, specify the name of the synonym. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-1-EN.png) + +### Step 2: Specify the object owner. + +Specify the schema where the object is located. + +### Step 3: Specify the object type. + +Specify the object type. Valid values: Table and View. + +### Step 4: Specify the object name. + +Specify the name of the object for which the synonym is created. + +### Step 5: Specify the synonym type. + +Specify the synonym type. Valid values: Synonym and Public Synonym. + +### Step 6: Verify the information about the synonym. + +Click **Next: Verify SQL Statement** to go to the Create Synonym page. + +### Step 7: Edit the synonym. + +![7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-7-EN.png) + +Edit the statement on the Create Synonym page. + +On the statement editing page, a synonym definition statement is generated based on the information specified in the **Create Synonym** dialog box. You can modify this statement. After you confirm the statement, click the **Create** button in the upper-right corner of the page to complete the synonym creation. A synonym cannot be modified after it is created. + +Before a synonym is created, you can edit the SQL statements of the synonym on the Create Synonym page. Syntax: + +```sql +CREATE OR REPLACE SYNONYM syn_name FOR schema_name.object_name; +``` + + + +Parameters + + +| Parameter | Description | +|-------------|----------------------------------------------------| +| OR REPLACE | Updates a synonym if the synonym already exists. | +| syn_name | The name of the synonym. The name of a synonym must be unique in the specified schema. | +| schema_name | The database schema to which the object belongs. | +| object_name | The name of the object. | + + + +### Step 8: Complete the synonym creation. + +Click **Create**. After you create a synonym, you can use it in the same way as a built-in synonym. + +![8.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-8-1-EN.png) + + +> **Note** +> To manage a synonym, right-click the synonym name in the left-side navigation pane, and select the required operation from the context menu, which provides the following options: **View**, **Create**, **Delete**, **Download**, and **Refresh**. + +For more information, see [Manage synonyms](../9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md). + +Syntax: + +```sql +SELECT * FROM syn_name ([syn_parameter[,...]) +``` + + + +Example: + +```sql +SELECT * FROM syn_employee; +``` + + + +![8.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-8-2-EN.png) + +## Related topics + +* [Create a table](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [Create a view](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [Create a function](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [Create a stored procedure](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [Create a sequence](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [Create a program package](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [Create a trigger](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [Create a type](../8.client-odc-type-objects/2.client-odc-create-a-type.md) diff --git a/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md new file mode 100644 index 00000000..ec6d003e --- /dev/null +++ b/en-US/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md @@ -0,0 +1,56 @@ +Manage synonyms +==================================== + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding connection management page. You can click **Synonym** in the left-side navigation pane to get a list of synonyms or a list of public synonyms. The synonym list displays the synonym objects in the current database. You can right-click the target object in the synonym list to perform some management actions on the object. You can also double-click the target synonym to go to the synonym management page. +![Image 690](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%90%8C%E4%B9%89%E8%AF%8D-1-EN.png) + +Management actions +--------------------------------------- + +The names of type objects support ascending order by the head character by default in the type list. + +### Shortcut function + +The following functions are provided in the upper right corner of the tree: + + +| Action | Description | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Create | Click this option to create type. | +| Filter | Click this option to display valid/invalid types. | +| Refresh | Click this option to refresh the structure tree after you perform management actions on the type, so that the structure tree displays the latest information. | + + + +### Right-click function + +Right-click the target object in the structure tree. A shortcut menu appears, displaying some management options provided by ODC for you to conveniently manage the target object. + +The following table describes the management options. + + +| Option | Description | +|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View Type | Click this option to go to the type management page, where you can view the basic information and codes of the type. | +| Create Type | Click this option to go to the **Create Type** page, where you can create a type as prompted. | +|Export|Export single table, see **Single table export and import**.| +| Download | Download the SQL file for the type object. | +| Delete | Click this option to delete the type. | +| Refresh | Click this option to refresh the list after you perform management actions on the type, so that the list displays the latest information. | + + + + +Synonym management page +-------------------------------------------- + +Double-click the target synonym in the synonym list to go to the synonym management page, which provides the following two tabs: + +* **Basic Info** : displays synonym information such as **Name** , **Object** **Owner** , **Object Name** , **Creation Time** , and **Modified At** . + +* **DDL** : displays the script that defines the synonym. A synonym cannot be modified after it is created. You can **Download** and **Format** the synonym. + + + + + diff --git a/en-US/7.client-odc-user-guide/11.client-odc-help-center.md b/en-US/7.client-odc-user-guide/11.client-odc-help-center.md new file mode 100644 index 00000000..9b06a1fa --- /dev/null +++ b/en-US/7.client-odc-user-guide/11.client-odc-help-center.md @@ -0,0 +1,64 @@ +Help center +================================ + + + +Overview +----------------------------- + +In the upper-right corner of the OceanBase Developer Center (ODC) homepage, you can click **Help** in the top navigation bar to view **New Features** and **View Help Documentation** . You can also obtain service information and email address on **About Developer Center** and **Feedback** tabs. + +![Image 909](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1413960461/p313332.png) + +Features +----------------------------- + +When you access ODC for the first time, the **Features** dialog box automatically appears. It displays the features and core functions of the current version to help you quickly learn about ODC. + +After you close the dialog box, you can select **Features** in the **Help** menu to open it again. +**Note** + + + +The Features dialog box may display different information based on user permissions. + +View help documentation +-------------------------------------------- + +To view the help documentation, click **Help** in the top navigation bar, and select **View Help Documentation** in the drop-down list. + +* If you are using Web ODC, the help documentation is displayed on a new tab of the browser. + + + +* If you are using the ODC client, the help documentation is displayed in a browse window. + + To view the service documentation of the latest or history versions, you can go to **[OceanBase documentation center](https://www.oceanbase.com/en/docs/enterprise/oceanbase-developer-center/odc/V3.3.1/product-updates)**. + + + + + +About developer center +------------------------------------------- + +Select **About Developer Center** in the drop-down list of **Help** to display a window. This window displays information such as the service name, version number, release date, official website URL, and copyright. + +![Image 910](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0897962561/p313341.png) + +Feedback +----------------------------- + +To send your feedback, select **Feedback** in the drop-down list of **Help** . + +* If you are using Web ODC, you can see the email address of ODC technical support odcsupport@service.alipay.com in the dialog box that appears. You can send your suggestions to that email address. + + + +* If you are using the ODC client, the dialog box of Feedback also provides you the feature of downloading the feedback package. You can click **Generate information package** in the dialog box to pack frontend and backend logs, system environment, and other information into a feedback package. + + ![Image 911](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1413960461/p313345.png) + + + + diff --git a/en-US/7.client-odc-user-guide/2.client-odc-homepage.md b/en-US/7.client-odc-user-guide/2.client-odc-homepage.md new file mode 100644 index 00000000..17a7279b --- /dev/null +++ b/en-US/7.client-odc-user-guide/2.client-odc-homepage.md @@ -0,0 +1,90 @@ +ODC homepage +================================= + + + +Overview +----------------------------- + +After you log on to OceanBase Developer Center (ODC), the ODC homepage automatically appears. + +On the ODC homepage, you can click [Task](8.client-odc-task-management/1.client-odc-task-management-overview.md), [Operating Records](../7.client-odc-user-guide/7.view-operation-records.md), or [Help](../7.client-odc-user-guide/11.client-odc-help-center.md) in the top navigation bar to go to the corresponding page. You can also perform the following operations on the page: managing database connections, switching the language, setting personal information, changing the password, and logging off from ODC. On the right side of the homepage, you can also find the Help, Related Tools, and Related Resources tabs. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/homepage/1-EN.png) + +Manage database connections +------------------------------------------------ + +The ODC homepage provides the **Private Connection** tab that shows the connections you have created in a list. + +On the **All Connections** tab, you can [create a private connection](../7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md), and search for, filter, sort, and refresh connections. + + +# View session history + +On the ODC homepage, you can click **History** in the left-side navigation pane to go to the session history page. + +The page shows a list that has the following columns. + + +| Column | Description | +|-----------|----------------------------------------------------| +| Connection Name | The name of the connection you accessed. | +| Database/Schema Name | The name of the database or schema that you accessed by using the connection. | +| Recently Opened At | The time when you last accessed the connection. | +| SQL/PL Window | The workspace window that you created when you accessed the connection. Move the pointer to a window name, and the script that you edited in the window is displayed. | +| Actions | You can click **Open** to resume the connection in a new window. The corresponding workspace window and its content are also resumed. | + + +> **Note** +> By default, the historical records in the panel are stored for 48 hours. You can restore the content in an unsaved SQL window based on records in the panel. + + + +## Manage tasks + +On the ODC homepage, you can click **Task** in the left-side navigation pane to create and view tasks. For more information, see [Manage tasks](../6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md). + + +Switch the theme +------------------------- + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/homepage/3-EN.png) + +In the lower-left corner of the ODC homepage, choose **Me** > **Theme** to switch the theme to **Default Theme** or **Dark Theme**. + +Switch the language +------------------------- + +In the lower-left corner of the ODC logon page or ODC homepage, choose **Me** > **Language** to view the display language of ODC. The default language is **Simplified Chinese**. You can click the language option to switch the display language. ODC supports **English**, **Simplified Chinese**, and **Traditional Chinese**. + +Personal Settings +------------------------- + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/homepage/4-EN.png) + +In the lower-left corner of the ODC homepage, choose **Me** > **Preferences**. The **Edit Personal Settings** panel appears. + +In the panel, you can globally modify the settings of the customizable features. You can also select a connection and configure these features in the connection. The configurations take effect on the current connection. The priority of personal settings is lower than that of settings you configured for each connection. In addition, the personal settings are persisted. + +Your modifications to fields in the Edit Personal Settings panel take global effect. + + +| Field | Description | +|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Session Mode for SQL Window | Set the session mode of the SQL window. | +| Delimiter Settings | Set the default delimiter for executing PL statements in the SQL window. Five types of delimiters are supported: semi-colons ( **;** ), slashes ( **/** ), double slashes ( **//** ), dollar signs ( **$** ), and double dollar signs ( **$$** ). | +| Transaction Commit Mode in Oracle Mode | Set the default transaction commit mode in Oracle mode. Valid values: Manual and Automatic. | +| Transaction Commit Mode in MySQL Mode | Set the default transaction commit mode in MySQL mode. Valid values: Manual and Automatic. | +| Maximum Number of Rows in Result Set | Set the default number of rows returned for an SQL statement executed in the SQL window. | +| Type of Statements Generated by Dragging and Dropping Object | Set the default type of statements generated when you drag and drop table or view objects. | + + + +Set an application password +------------------------------------------------ + +You do not need to log on when you start Client ODC, because a default user is used. For security purposes, Client ODC allows you to set an application password. After you set an application password, you must enter the password when you start Client ODC. If you enter the wrong password three times, the system will prompt you to reset the data. If you reset the data, connection information saved in ODC will be cleared. + + +In the lower-left corner of the ODC homepage, choose **Me** > **Application Password**. The **Set Application Password** dialog box appears. \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md b/en-US/7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md new file mode 100644 index 00000000..2c3351d5 --- /dev/null +++ b/en-US/7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md @@ -0,0 +1,74 @@ +Create a private connection +================================================ + + + +Overview +----------------------------- + +After you log on to the homepage of OceanBase Developer Center (ODC), you can click **Create Connection** in the upper-right corner of the **Private Connection** tab to create a private connection. + +After you create the connection, you can view the saved database connection in the connection list on the ODC homepage. + + + +> **Notice**
            +>
          • In ODC V2.3.0 and later versions, the root@sys user permissions are required to query views when you use the import and export features. Therefore, to use the import and export features, you need to set the root@sys user in the Advanced Configuration section during connection creation.
          • +>
          • The root@sys user permissions are also required to view the partition information. Therefore, to display the table partition information, you must also set the root@sys user in the Advanced Configuration section during connection creation.
          • +>
          • ODC V3.3.0 and later versions support independent sessions and shared sessions. In independent session mode, each SQL window corresponds to one database session, and all modifications affect only the current window. In shared session mode, all SQL windows share one database session, and modifications in any SQL window affect other SQL windows.
          • +>
          • In manual-commit mode, make sure to set the `ob_trx_idle_timeout` parameter to a value greater than or equal to the timeout value of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of the `ob_trx_idle_timeout` parameter, the connection is terminated. However, if the `ob_trx_idle_timeout` parameter is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you must set this parameter to a proper value.
          • + + + + + + +Procedure +------------------------------ + +Perform the following steps to create a connection: + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/402/client-pravite%20connection-1-EN.png) + +1. Log on to ODC and click **Create Connection** in the upper-right corner of the **Private Connection** tab. + + + +2. In the Create Connection panel, specify the fields described in the following table. If you have an OceanBase connection string, which follows the mysql -h **host name** -P **port number** -u **database username@tenant name** # **cluster name** -D **default database** -p ' **database password** ' format, you can obtain the information from the string. You can also paste the string in the field of Intelligent Parsing on the panel to automatically populate the corresponding fields. + + + + | Field | Description | + |-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Database Type | Select **Physical Database** or **Logical Database** . * Physical Database: regular databases. * Logical Database: ODP (Sharding). | + | Region | Select **Independent Deployment/Apsara Stack** if your database instance is deployed in your own environment, or select **Public Cloud** if your database instance is deployed on Alibaba Cloud. | + | Intelligent Parsing | You can paste a connection string to the field. ODC automatically identifies the string and fills in the corresponding fields on the page. | + | Connection Mode | Select **MySQL** or **Oracle** . Logical databases support only the MySQL mode. | + | Endpoint | * **Host IP** : the IP address of the server where the target database is located. * **Port** : the port number of the server where the target database is located. * **Cluster name** : the name of the cluster where the target database is located. This parameter is not required for logical databases. * **Rent name** : the name of the tenant in which the target database is located. This parameter is not required for logical databases. **Note** You can obtain the host name and port number from the details page of the tenant in which the target database is located, such as a tenant created on Alibaba Cloud or in OceanBase Cloud Platform (OCP). | + | Database Account | * Database Username: an account under the tenant. In MySQL mode, this account must have access to the default database. * Database Password: the password of the account under the tenant. You can click **Test Connection** next to the password field to check the connection to the target database. * Save Database Password * If you disable this option, the database password for the connection is not saved. Each time you use or test the connection, you must enter the database password in the password dialog box. * If you enable this option, the database password for the connection is saved. You do not need to enter the database password each time you use the connection. **Note** * An error will be returned if the configurations such as the username, password, and network settings are invalid. * You can only connect to a database in the current tenant. Otherwise, a test failure error will be returned. | + | Default Database/schema | When you connect to a database in a MySQL tenant, you must specify the default database for the connection. You do not need to specify this field when you connect to a database in an Oracle tenant. **Note** If you leave this parameter unspecified, the information_schema database is connected by default. However, if the connection to the information_schema database fails, you need to specify a database that the current user has access permissions. | + | SQL Query Timeout Value | You can specify a timeout value for SQL queries. A query whose execution time exceeds the timeout value is automatically terminated. The default timeout value is 60 seconds. | + | Query sys Tenant View | When Database Type is set to Physical Database, you can specify an account that has the privilege to query the SYS tenant view, and the password. This field is automatically populated when SYS is specified as the tenant in **Endpoint** . * **Account** : an account having the privilege to check the views under the SYS tenant. * **Password** : the password of the account. After you specify the account and password, click **Test Connection** next to the password field to verify whether the account information is valid. **Note** * In ODC V2.3.0 and later versions, to use the import and export features, you need to configure the root@sys account in the Advanced Configuration section during connection creation. * In ODC V2.4.1 and later versions, the dependency of the import and export features on the root@sys user is removed when you query views. If the root@sys account is not configured, some ODC objects such as stored procedures and functions do not support the export feature. If the root@sys account is configured, you can access the views under the SYS tenant to obtain the optimal data routing strategy, which can increase the export speed. | + + + +3. Click **Save** to save the current configuration in the ODC connection list, and enter the connection name. Next time you log on to ODC, you can directly select the connection from the list. The connection configuration does not necessarily need to pass the connection test when you save the configuration. + + ![Image 802](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/402/pravite%20connection-2-EN.png) + + > **Notice** + > + > Before saving, you can click **Test Connection** to test the database connection. If the database user name and password are correct, it will prompt **Connected**. + + +4. Click **Copy Connection String** in the lower part of the panel to copy the connection information being edited on the current panel as a connection string if necessary. This allows you to obtain the connection information with ease. + + + +5. Click **Cancel** if you do not need to save the current connection configuration. Then, a confirmation dialog box appears. + + + + + + diff --git a/en-US/7.client-odc-user-guide/3.client-odc-connect-database/2.client-odc-manage-connections.md b/en-US/7.client-odc-user-guide/3.client-odc-connect-database/2.client-odc-manage-connections.md new file mode 100644 index 00000000..4027addf --- /dev/null +++ b/en-US/7.client-odc-user-guide/3.client-odc-connect-database/2.client-odc-manage-connections.md @@ -0,0 +1,169 @@ +Manage connections +======================================= + + + +Overview +----------------------------- + +On the homepage of OceanBase Developer Center (ODC), the **Private Connection** tab displays the information of connections that you created and saved. + +All the connections you created are displayed in a list on the **Private Connection** tab for you to view and manage them. + +![Image 905](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8416118461/p313323.png) + +View connections +------------------------------------- + +On the **Private Connection** tab, you can perform the following operations: + +* Click the refresh icon to manually refresh the list. + + + +* Click **All Modes** to select the MySQL or Oracle mode. + + + +* Search for connections by using the search box. + + + +* Adjust the column width of the connection list. + + + + + + +The following table describes columns in the list of private connections. + + +| Column | Description | +|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection Name | The name of the connection and the host, port, cluster, and tenant information. You can click the name of a connection to go to the corresponding connection management page. The icon before the connection name indicates the status of the connection. Blue indicates valid, red indicates invalid, and gray indicates that the database password is not saved. | +| Cluster | The cluster information. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the cluster information. If you select **Empty** , you can filter connections that do not belong to any clusters. | +| Tenant | The tenant information. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tenant information. If you select **Empty** , you can filter connections that do not belong to any tenants. | +| Tag | The tag of the connection. You can create a tag and assign it to a connection. You can assign only one tag to each connection. | +| Operation Time | The time when the connection was edited, or the time when the connection was created if the connection has not been edited. | +| Actions | The actions you can take. Valid values: **Open** , **Edit** , **Copy** , and **Delete** . | + + + +View connection history +-------------------------------------------- + +In the upper-right corner of the list, click **History** . The **Historical Opened Windows** panel appears. + +![Client - History](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5218379361/p342503.png) + +The panel shows a list that has the following columns. + + +| Column | Description | +|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection Name | The name of the connection you accessed. | +| Database/Schema Name | The name of the database or schema that you accessed by using the connection. | +| Recently Opened At | The time when you last accessed the connection. | +| SQL/PL Window | The workspace window that you created when you accessed the connection. Move the pointer to a window name, and the script that you edited in the window is displayed. | +| Actions | You can click **Open** to resume the connection in a new window. The corresponding workspace window and its content are also resumed. | + + +**Note** + + + +By default, the historical records in the panel are saved for 48 hours. You can quickly restore the content in an unsaved SQL window based on records in the panel. + +Set a tag +------------------------------ + +ODC allows you to create a tag and assign it to a connection. You can assign only one tag to each connection. + +* Tag creation: You can create a tag by using the following two methods: + + * Click **Set Tag** next to the **Connection Name** field in the **Create Connection** panel. + + + + * Move the pointer in the tag column of the row where the target connection is located in the connection list, click **Set Tag** and click **Create Tag** in the drop-down list. On the **Tags** page, specify the name and color of the tag, and click the tick icon to complete the creation. + + + + + + +* Tag setting: Select the target tag from the drop-down list that displays all the tags that you created, and modify related parameters to finish the setting. + + + +* Tag management: Click the settings icon in the upper-right corner of the drop-down list to go to the **Tags** page, where you can edit or delete created tags. + + + + + + +Pin a connection to the top +------------------------------------------------ + +By default, the connections in the connection list are sorted by creation time, with the most recently created connection on top. The list does not support custom sorting, but you can pin frequently used connections to the top. + +You can click the flag ![Homepage - Pin Connection Name to Top](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6818379361/p342106.png) next to the name of a connection to pin the connection to the top. This turns the flag yellow. You can click the flag again to unpin the connection from the top. + +Edit a connection +-------------------------------------- + +Click **Edit** in the **Actions** column of the target connection. The **Edit Connection** panel appears, which has the same structure as the **Create Connection** panel and displays the configuration information of the current connection. You can edit the information displayed in the **Edit Connection** panel. + +Before you change **Database Password** , you must first click **Change Password** next to the password box. To abort the current change, click **Cancel** next to the password box, and the input in the password box is restored to its original value. + +Copy a connection +-------------------------------------- + +Click **Copy** in the **Actions** column of the target connection. The **Create Connection** panel appears. The copied information is automatically filled in the panel. This allows you to quickly create a connection by modifying existing information. + +The copy feature allows you to easily create database connections having similar information. + +Delete a connection +---------------------------------------- + +To delete a connection, click **Delete** in the **Actions** column of the target connection. + +For example, when the connected database no longer exists or you do not need to access the connected database, you can directly delete the corresponding connection. + +Other operations +------------------------------------- + +* In addition to the management actions that the **Private Connection** tab provides, after you go to the management page of a database connection, the homepage menu icon ![Homepage menu](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7767860461/p352089.jpg) in the top navigation bar further provides the following buttons: + + * **Open Connection in New Window** : After you click a connection in the connection list that appears, ODC opens the connection in a new window. + + + + * **Connections** : Click this button to open the ODC homepage in a new window. On the ODC homepage, you can view and manage the configuration information of all connections. + + + + * **Reload** : Click this button to reload the current page. + + + + * **Exit Connection** : Click this button to exit the current connection and go to the ODC homepage. + + ![Image 031](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9906118461/p232235.png) + +* On the database connection page, the `@{database name}` information is included in the window name of Client ODC. + ![Image 032](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%BF%9E%E6%8E%A5%E7%AE%A1%E7%90%86-%E8%BF%9E%E6%8E%A5%E5%B7%A5%E4%BD%9C%E5%8F%B0%E9%A1%B5%E9%9D%A2%E9%A1%B6%E9%83%A8%E6%98%BE%E7%A4%BA%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%8D-EN.png) + +* Information such as the connection name, schema (in Oracle mode), and database name (in MySQL mode) appears in the top navigation bar of the workspace. + + * Move your pointer over the connection name in the top navigation bar. In the tooltip that appears, you can see information in the following fields: **Connection Mode** , **Host/Port**, **Cluster/Tenant** , and **Database Username** . + + * Click the drop-down arrow next to the displayed schema name or database name. In the drop-down list that appears, click a schema or database name to go to the target schema or database. + + ![Manage private connections - Other operations](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9102553561/p358120.png) + + + + diff --git a/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/1.client-odc-use-workspace-overview.md b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/1.client-odc-use-workspace-overview.md new file mode 100644 index 00000000..4d4a961f --- /dev/null +++ b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/1.client-odc-use-workspace-overview.md @@ -0,0 +1,55 @@ +Overview +============================= + +The workspace is the main feature module for you to develop databases in OceanBase Developer Center (ODC). + +After you enter the corresponding database connection, you can click **Workspace** in the navigation bar on the top of the page. The drop-down list provides the following features: + +* **SQL Window** : An SQL window is a working area for database developers to edit SQL and PL statements. ODC also provides the **Snippets** button in the SQL window. + + + +* **Anonymous Block Window** : An anonymous block window is a working area for database developers to edit anonymous block scripts. (The anonymous block window is available only in Oracle mode. ) + + + +* **Command-line Window** : OceanBase command-line client OBClient is integrated in the form of a command-line window. It allows you to execute SQL or PL statements and view the execution results in real time. + + + +* **Stored Scripts** : Database developers can open scripts previously stored in ODC. + + + +* **Snippets** : View and reference built-in and custom code snippets + + + +> **Note** +> Creating anonymous block windows is only supported in Oracle mode. + + +This chapter describes these features in different topics. + +* [SQL window](../4.client-odc-use-workspace/2.client-odc-sql-window.md) + + + +* [Anonymous block window](../4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md) + + + +* [Command-line window](../4.client-odc-use-workspace/4.client-odc-command-line-window.md) + + + +* [Stored scripts](../4.client-odc-use-workspace/5.client-odc-stored-scripts.md) + + + +* [Code snippets](../4.client-odc-use-workspace/6.client-odc-snippet.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/2.client-odc-sql-window.md b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/2.client-odc-sql-window.md new file mode 100644 index 00000000..85c19a29 --- /dev/null +++ b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/2.client-odc-sql-window.md @@ -0,0 +1,149 @@ +SQL window +=========================== + + + +Overview +----------------------- + +On the Database Management page of OceanBase Developer Center (ODC), click **Workspace** in the top navigation bar and click **SQL Window** in the drop-down list that appears. + +The SQL window provides an SQL editing area for editing scripts, an execution record tab, and a result tab for displaying the execution results. The SQL window also supports executing PL/SQL statements. + +![Image 461](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/1SQL%20%E7%AA%97%E5%8F%A3-%E6%A6%82%E8%BF%B0-EN.png) + +SQL editing area +----------------------------- + +The SQL editing area provides many features for you. + +| Operation | Description | +|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Auto-complete | The SQL editing area provides the auto-complete feature to improve your SQL statement editing efficiency. For example, when you edit SQL statements, the table name is auto-completed for cross-database queries. | +| Intelligent identification of keywords and code | Database keywords are highlighted in different colors, and PL/SQL statements are identified. | +| Right-click of object names in the `SELECT` statement | When you right-click the name of a table, view, or function in a `SELECT` statement, some common operations are displayed. When you place the pointer over the name of a table, the field information is displayed. | +| Object drag-and-drop | You can directly drag objects from the object list into an SQL statement in the SQL editing area to fill in an object name in the statement.
            - After you drag a table or view and drop it into the SQL editing area, you can select the type of the SQL statement to be generated in the **Fast Generation** dialog box. You can click the username and select **Personal Settings** from the drop-down list, and set the default statement type in the **Type of Statements Generated by Dragging and Dropping Object** field of the **Edit Personal Settings** panel.
            - If you drag an object other than a table or view, the object name is directly dropped into the SQL editing area.
            ![Editing area2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/2SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F1-EN.png) | +| Shared and independent sessions | The SQL window of ODC supports **Shared Session** and **Independent Session** modes.
            - If you select **Shared Session**, you can open multiple SQL windows in the same connection, but cannot execute SQL statements in multiple windows in parallel.
            - If you select **Independent Session**, you can open multiple SQL windows in the same connection, and execute SQL statements in multiple windows in parallel. To open a new SQL window, click **+** next to the existing SQL window tab. By default, SQL windows are in Shared Session mode. You can click the username in the upper-right corner of the top navigation bar, select **Personal Settings** from the drop-down list, and set the session mode to **Independent Session** on the **Edit Personal Settings** panel.
            ![editing area 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/3SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F2-EN.png) | +| Identification of special symbols | Special symbol abnormality can be identified in the editing area of the SQL window, where abnormal symbols are marked with yellow wavy underlines. | +| Viewing the execution status | When you hover the pointer over an SQL window tab, the window name and execution status are displayed.
            ![editing area 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/4SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F3-EN.png) | + + +> **Note** +> In Oracle mode, the autocommit feature of ODC is set to OFF by default. You can change the transaction commit mode by modifying the value of the `autocommit` variable in the following two ways: click the Settings icon in the upper-right corner of the SQL window and modify the variable in the Session Variables dialog box, or click Session in the top navigation bar and modify the variable on the Session Properties page. Note that the settings in the Set session variable dialog box are valid only for the current SQL window. For more information, see [Manage sessions](../../6.web-odc-user-guide/10.web-odc-session-management.md).
            +> In manual-commit mode, make sure to set `ob_trx_idle_timeout` to a value greater than the timeout value of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of `ob_trx_idle_timeout`, the connection will be terminated. However, if the `ob_trx_idle_timeout` parameter is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you must set this parameter to a proper value. + +![SQL editing area5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/5SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F4-EN.png) + +In addition to the preceding features, the toolbar of the editing area provides the following icons. + +| Icon | Description | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Run | Click this icon to execute all the SQL statements in the current window. This icon is disabled if an SQL statement is being executed in another window of the same session. | +| Run Current Statement | Click this icon to execute all the selected SQL statements or the SQL statement in the line where the pointer is located. This icon is disabled if an SQL statement is being executed in another window of the same session. | +| Abort | Click this icon to abort the statement that is being executed. | +| Execution Plan | Click this icon to view the execution plan for the SQL statement that you select or on which the pointer is located. This execution plan is estimated by the system before execution and is the result of the `EXPLAINPLAN` operation. Therefore, the execution data displayed may differ from the actual execution data. You can use this feature to evaluate SQL statements.
            Click **Execution Plan**. On the **Plan Details** tab, click **View Formatting Info** to switch to the formatted view. | +| Find and Replace | Click this icon and enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | +| Undo | Click this icon to undo the last operation. | +| Redo | Click this icon to reverse an **Undo** operation. | +| Format | Click this icon to apply formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | +| IN Value Conversion | Click this icon to convert the copied rows or columns into the specified format during queries.
            After you paste the copied data to the SQL editing area, select the copied data and click **IN Value Conversion** to convert it into the in('A','B') format.
            - Column values are separated with line breaks.
            - Row values are separated with spaces or tabs. | +| Case Sensitivity | The system supports three configurations: **All Caps**, **All Lowercase**, and **Capitalize First Letter**. Click this icon to convert the selected statements in the script to the corresponding capitalization format. | +| Indent | You can add indents to or delete indents from the statements that you selected. | +| Comment | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | +| Save script | Click this icon to save the script in the current window. You can open a saved script when you enter the workspace again. You can view only the SQL scripts saved by yourself. The script names must be unique. After you open a stored script, you can continue to edit it. | +| Settings | - **Delimiter**: Select the character that you want to use as the delimiter from the drop-down list. Five types of delimiters are supported: semi-colons (;), slashes (/), double slashes (//), dollar signs ($), and double dollar signs ($$).
            - **Query Result Limit**: Set the maximum number of lines that a query can return. Default value: 1000.
            - **Session Variables**: You can edit, refresh, and search for variables. | +| Snippet | Click this icon to view and reference built-in and custom code snippets. For more information, see [Snippet](../4.client-odc-use-workspace/6.client-odc-snippet.md). | +| Commit | - By default, `autocommit` is set to `OFF` in Oracle mode. You need to click this icon to commit the current transaction. After you click this icon, a dialog box appears, indicating that the current connection uses a shared session and the commit will apply to all windows. Click **Yes** to commit the transaction.
            - In MySQL mode, `autocommit` is set to `ON` by default, and this icon is not displayed. This icon is disabled if an SQL statement is being executed in another window of the same session.
            **Note**
            You can change the value of the `autocommit` variable in the following two ways: click the **Settings** icon in the upper-right corner of the SQL window and set the variable in the **Session Variables** dialog box, or click **Sessions** in the top navigation bar and set the variable on the **Session Properties** page. | +| Rollback | - In Oracle mode, if the `autocommit` variable in the **Session Variables** dialog box is set to `OFF`, click this icon to roll back the current transaction. After you click this icon, a dialog box appears, indicating that the current connection uses a shared session and the rollback will apply to all windows. Click **Yes** to apply the rollback.
            - In MySQL mode, the `autocommit` variable in the **Session Variables** dialog box is set to `ON`, and this icon is not displayed. This icon is disabled if an SQL statement is being executed in another window of the same session. | + + + +Execute PL/SQL statements +----------------------------- + +You can edit a PL/SQL statement in the SQL window. Note that you must end the PL/SQL statement with the specified delimiter. + +At present, you can use the following methods to specify a delimiter in ODC: + +* Click **Settings** in the toolbar of the SQL editing area. In the window that appears, select the delimiter as needed in the **Delimiter** field. + + + +* On the **Personal Settings** page, select a required delimiter in **Delimiter Settings**. + + + +* The compilation error information displayed includes the PL/SQL row ID and the position at which the error occurred. + +* Right-click the PL object in the left navigation bar and select **Run**, which supports setting the parameter value as DEFAULT, NULL or empty string. + + > **Notice** + > * In ODC V2.4.1 and later, you can use the `DELIMITER` statement in the editing area to define a delimiter. In **Settings**, the **Delimiter** field displays the delimiter that you specified. + > + > * You can use slashes (/) to separate PL/SQL statements. + +After you execute a PL/SQL statement in the SQL window, the result tab displays the database management system (DBMS) output. + +![Execute PL/SQL statements6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/6SQL%20%E7%AA%97%E5%8F%A3-%E8%BF%90%E8%A1%8C%20PL%20%E8%AF%AD%E5%8F%A5-EN.png) + +Execution Records tab +--------------------------- + +![Execution Records tab](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E6%89%A7%E8%A1%8C%E8%AE%B0%E5%BD%95%E9%A1%B5%E7%AD%BE-EN.png) + +On the **Execution Records** tab, you can view the history of SQL statements executed in the current connection. You can view the information in several columns, such as **Status**, **Time**, **SQL Statement**, **Results**, **Trace ID**, **Time Spent**, and **Execution Details**. The execution details constitute the execution plan. + +| Column | Description | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Check box | You can select the check box in front of one or more records and then click **Delete** in the upper-right corner of the list to delete the selected records. | +| TRACE ID | The ID of the execution record.
            **Notice**
            If **TRACE ID** is empty, make sure that the `enable_sql_audit` and `ob_enable_trace_log` parameters are set to `ON` when the statement is executed. Procedure:
            1. Choose **Sessions** > **Session Properties** > **Session Variables** and search for the `enable_sql_audit` and `ob_enable_trace_log` parameters.
            2. Click the **Edit** icon on the **Session Variables** tab. In the **Edit Variable** dialog box, change **OFF** to **ON** and click **OK**.
            3. Execute the following statement to enable the system parameter: ```sql obclient> alter system set enable_sql_audit='True'; Query OK, 0 rows affected (0.06 sec)``` | +| DB Time | You can hover the pointer over the icon next to a value in the **DB Time** column. In the prompt box that appears, you can view the total execution duration of the SQL statement and verify whether the duration of each phase adds up to the total execution duration. | +| Execution Details | By default, the execution plan is displayed in text. In the **Execution Details** column, click **View**. The **Execution Details** page displays the basic information, time spent, I/O statistics, executed SQL statements, plan statistics, and outlines. | + + + +Logs tab +------------------------- + +You can view the execution records of the current SQL window in the Logs tab. + +![Log tab](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/SQL%20%E7%AA%97%E5%8F%A3-%E6%97%A5%E5%BF%97%E9%A1%B5%E7%AD%BEEN.png) + +Result tab +------------------------- + +![Result tab](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/7SQL%20%E7%AA%97%E5%8F%A3-%E7%BB%93%E6%9E%9C%E9%A1%B5%E7%AD%BE-1-EN.png) + +You can view the execution result of the current SQL statement on the **Result** tab. The result set in the Result tab can be used in the following interactive operations to facilitate daily development work. + +| Operation | Description | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Select required data | You can select the required data of a result set and copy the data to an external file by using hotkeys. You can also click a field name or row ID to select an entire row or column. You can also click **Export** in the toolbar to export data of a result set to a local file. | +| Select rows and columns |
          • You can select consecutive rows or columns while holding the **Shift** key.
          • You can select inconsecutive rows or columns while holding the **Ctrl** or **Command** key.
          • | +| Right-click a cell | You can right-click a cell and select **Copy** or **Export to Clipboard** to directly export the data into an external file. | +| Right-click a row ID | You can right-click a row ID and select **Copy Row**, **Freeze this row**, or **Unlock all frozen rows**.
          • **Copy Row**: Click this option to copy the selected row.
          • **Freeze this row**: Click this option to freeze the selected row and pin it to the top. You can freeze multiple rows. The rows under the table header and frozen rows can be vertically scrolled.
          • **Unlock all frozen rows**: Click this option to unfreeze all frozen rows.
          • | +| Zoom in | If the data in a cell is too long and cannot be fully displayed, you can hover the pointer over the cell and click the zoom-in icon ![zoom-in icon](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8892277361/p353161.jpg) at the right end of the cell. In the window that appears, view the data in full.


            **Note**
            LOBs are displayed in text by default. You can convert an LOB into the hexadecimal format and download the LOB to a local device. | +| View BLOBs |
          • In Oracle mode, you can directly edit text data of the CLOB, BLOB, or RAW type, edit hexadecimal data, and upload files that are not greater than 200 KB in size.
          • In MySQL mode, you can directly edit text data of the XLOB type such as BLOB, MEDIUMBLOB, or TINYBLOB, edit hexadecimal data, and upload files.
          • | +| Right-click the tab name of a result tab | For example, you can right-click the tab name of the **Result 1** tab and click **Pin** in the context menu to pin the tab, so that it remains displayed. In this way, when you execute a new query, a new result tab appears but does not overwrite the pinned result tab. This allows you to compare the query results. Click **Unpin** to unpin a result tab. | +| Filter, sort, and search for data | Each field name in the result set is provided with a filter icon, a sort icon, and a search icon. You can use them to filter, sort, and search for data in a single column. | +| Drag the column name | You can adjust the order of fields by dragging column names in a result set. | +| Adjust the column width | You can adjust the column width by dragging the column edge. | + + + +The navigation bar of the **Result** tab also provides the following tools. + +| Tool | Description | +|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Column Mode | Click this icon to display the selected data row in the form of a table. On the **Column Mode** tab, you can switch to the previous or next row. ****The column mode makes it easier to view data in a row that has many columns. Procedure:
            1. Select the data that you want to view and click **Column Mode** ![Column Mode](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326038.jpg).
            2. On the **Column Mode** tab, click the left or right arrow to switch between the column values of adjacent rows.
            3. Hover the pointer over a value field and click the zoom-in icon ![Zoom](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326047.jpg) to view the details.
            4. In the table on the **Column Mode** tab, you can view the comments for a column in the **Remarks** column. Perform the following steps to modify the comments:
            a. In the left-side navigation pane, right-click the target table and select **View Table Structure** to go to the **Attribute** tab.
            b. In the left-side navigation pane of the **Attribute** tab, click the **Column** tab.
            c. Select a field and click the **Edit** icon. The field editing dialog box appears.
            d. In the **Comment** field , edit the comments, and click **OK**.
            e. In the **SQL Confirmation** dialog box, click **Execute**.
            f. View the modified comments on the **Column Mode** tab. | +| Columns | Click this icon to select the columns to be displayed on the page. | +| Back to Start | Click this icon to go back to the first page. | +| Previous | Click this icon to go to the previous page. | +| Next | Click this icon to go to the next page. | +| Jump to Bottom | Click this icon to go to the last page. | +| Search | Enter a keyword in the search box to search for the desired results. | +| Edit | Click **Edit** to enable editing mode for the current result set. The editing mode supports the following operations: **Add**, **Copy Current Row**, **Delete**, **Cancel**, **Confirm Modification**, which submits a transaction when autocommit is enabled, and **Modify and Submit**, which is displayed when autocommit is disabled. In the editing mode, you can either double-click target data to directly modify it or click the preceding icons for convenient operations. When you edit a cell, you can right-click the cell and select **Copy** or **Set to Null** from the context menu to operate on the cell.
            **Note**
            The ResultMetaData information is obtained during the execution of an SQL statement to indicate whether the result set can be edited.
            - If the result set cannot be edited, the Edit icon is not displayed and you are prompted that the result set cannot be edited.
            - If the result set can be edited, the Edit icon is available and you can click it to go to the result set editing page. You can edit result sets in single-table and single-view queries.
            - However, result sets that involve the SET and ENUM fields cannot be edited. | +| Download Data | You can export the query results to a CSV, SQL, or Excel file.
            - To export the query results to an SQL file: Edit the SQL statements in the **SQL Query** field, specify **Maximum Number of Lines in Result Set**, **File Name**, **File Format** (SQL)**,** **File Encoding**, **Data Desensitization**, and **SQL File Settings** (**Table Name** ).
            - To export the query results to a CSV file: Edit the SQL statements in the **SQL Query** field, specify **Maximum Number of Lines in Result Set**, **File Name**, **File Format**, **File Encoding**, and **Data Desensitization**. In the **CSV File Settings** section, specify **Include the Column Header**, **Convert the Empty Character String into a Null Value**, **Field Separator**, **Text Identifier**, and **Line Break Symbol**.
            - To export the query results to an EXCEL file: Edit the SQL statements in the **SQL Query** field, specify **Maximum Number of Lines in Result Set**, **File Name**, **File Format**,**File Encoding**, and **Data Desensitization**. In the **Excel File Settings** section, specify **Include the Column Header** and **Export SQL statements to another sheet**.
            **Note**
            - You can desensitize the exported data. You can specify a custom number of rows to export as needed.
            - If you export data in CSV format, the exported CSV file can be opened by Microsoft Excel.
            - If you export data in XLS format, you can specify whether to include the column header and whether to export the SQL statements of the query.
            ![Download data](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/8SQL%20%E7%AA%97%E5%8F%A3-%E7%BB%93%E6%9E%9C%E9%A1%B5%E7%AD%BE-3-%E4%B8%8B%E8%BD%BD%E6%95%B0%E6%8D%AE-EN.png) | +| Plan | Click this icon to view the actual resource consumption and execution plan of an executed SQL statement. This allows you to evaluate the performance of the statement. | + + diff --git a/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md new file mode 100644 index 00000000..127d1f47 --- /dev/null +++ b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md @@ -0,0 +1,113 @@ +Anonymous block window +=========================================== + + + +Overview +----------------------------- + +To open an anonymous block window, perform the following steps: enter the Database Management page of OceanBase Developer Center (ODC), click **Workspace** in the top navigation bar, and click **Anonymous Block Window** . + +An anonymous block window provides a **PL/SQL editing** area, the **PL/SQL Execution Result and DBMS Output** tabs, and the **Debugging** page. + +![Image 460](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2950380461/p263569.png) + +PL editing area +------------------------------------ + +The editing area of the anonymous block window provides many features for you. For example, when you open a new anonymous block window, + +* the guidance code is provided to make your script-writing easier. + + + +* Database keywords are highlighted in different colors. + + + +* It also provides features such as formatting to help you improve your PL/SQL statement writing efficiency. + + In addition to the preceding features, the toolbar of the editing area provides the following buttons. + + + | Button | Description | + |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Run | Click this button to execute the statements in the code area. | + | Abort | Click this button to abort the statement that is being executed. | + | Debug | Click this button to open the debugging page to debug the anonymous objects in the code area. | + | Format | Click this button to apply the formatting, such as indentation, line break, and keyword highlighting, to the selected SQL statements or all the SQL statements in the current SQL window. | + | Find and Replace | You can enter text in the search field to find the specific content and enter text in the replacement field to replace the content found. | + | Undo | Click this button to undo the last operation. | + | Redo | Click this button to reverse an **Undo** operation. | + | Case Sensitivity | The system supports three capitalization options: **All C** **aps** , **All Lowercase** , and **Capitalize First Letter** . Click the corresponding option to convert the selected statements in the script to the desired capitalization format. | + | Indent | You can add indents to or delete indents from the statements that you selected. | + | Comments | You can click **Add Comments** to convert the statements that you select into comments or click **Delete Comment** to convert comments to SQL statements. | + | Save | Click this button to save the script in the current window. You can open a saved script when you enter the workspace again. **Note** * You can view only the SQL scripts saved by yourself. The script names must be unique. * After you open a saved script, you can continue to edit it. | + + + + + + +PL/SQL Execution Result and DBMS Output tabs +----------------------------------------------------------------- + +After you click the run icon![run](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2950380461/p378301.jpg)in the toolbar of the editing area to execute the anonymous block, you can view the information in the **Execution Result** and **DBMS Output** tabs under the editing area. + +* The **Execution Result** tab displays the execution result of the script. If the execution was successful, **Executed** is displayed. Otherwise, an error message is displayed. + +* The **DBMS Output** tab displays the output of a subprogram that contains PL/SQL output statements, such as `dbms_output.put_line`. + + + + +Debugging page +----------------------------------- + +You can debug an anonymous block on the debugging page. To enter this page, click **Debug** in the toolbar of the editing area. + +On the debugging page, you can debug the anonymous block. + + +> **Notice** +>
          • We recommend that you upgrade to OBServer V2.2.77 or later. This is because some versions of OBServer have been found with PL/SQL debugging issues, which may compromise the OBServer stability.
          • +>
          • ODC V3.2.2 or earlier does not support the debugging feature when you connect ODC to the target instance by using OBProxy. To use the debugging feature, directly connect ODC to the target instance.
          • +>
          • ODC V3.2.2 and later support PL/SQL debugging when you connect to OBServer by using OBProxy.
          • +>
          • You have installed the debugging packages such as DBMS_DEBUG and DBMS_OUTPUT in the connected database.
          • + + + + + + +![Debug](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3950380461/p203467.png) + +In debugging mode, the toolbar in the editing area provides the following buttons. + + +| Button | Description | +|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Batch Execute | Runs till the next breakpoint. If no breakpoint exists, runs till the end. | +| Step Over | Click this button to step over a given line without stepping into any subprogram. | +| Step Into | Click this button to execute code line by line. If the line includes a call to a stored procedure or function, it steps into the called subprogram. | +| Step Out | For a subprogram, you can click this button to return to the next line of the upper-layer call position. For the main program, this button achieves the same effect as **Auto Debugging** . | +| Abort Debugging | Click this button to execute the stored procedure till the end and skip breakpoints. | +| Debug Again | Click this button to initiate a new round of debugging on the current object. Unlike **Debug** , it does not establish a new debugging connection. | +| Exit Debugging | Click this button to close the debugging connection and exit the debugging window. | + + + +In addition to the editing area, the debugging mode also provides the following tabs: + +* **Parameters** : displays the definition information and values of all the parameters of the object to be debugged. The definition information includes the parameter name, mode, and type. The values may change as a result of the debugging process. + +* **Stacks and Variables** : displays the variables in the current stack and the values of the variables. + +* **DBMS Output** : If a subprogram contains PL/SQL output statements, such as `dbms_output.put_line`, the output is displayed on this tab. + +* **Breakpoint** : You can click the line number in the editing area to set a breakpoint, and click the line number again to remove the breakpoint. The Breakpoint tab displays all the breakpoints that you set in their execution order. You can select multiple breakpoints to cancel them at a time. The Actions column of each breakpoint information row provides the **Cancel** and **View** actions. You can click Cancel to cancel a breakpoint. After you click View, the cursor moves to the location of the breakpoint in the editing area. + +* **Debugging Logs** : displays the debugging logs and error logs. Debugging logs include information about the start and end of debugging and the addition and cancellation of breakpoints. + + + diff --git a/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/4.client-odc-command-line-window.md b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/4.client-odc-command-line-window.md new file mode 100644 index 00000000..aaf9df75 --- /dev/null +++ b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/4.client-odc-command-line-window.md @@ -0,0 +1,48 @@ +Command-line window +======================================== + +OceanBase Developer Center (ODC) integrates the OceanBase command-line client OBClient in the form of a command-line window. OBClient is the recommended command-line client for OceanBase. The command-line window allows you to use OBClient without a need to download or install it. It allows you to execute SQL or PL statements and view the execution results in real time. It also allows you to run the `SOURCE` command to execute files uploaded to the server. + +Create a command-line window +------------------------------------------------- + +Log on to ODC and click the name of the target connection to go to the corresponding connection management page. Click **Workspace** in the navigation bar on the top of the page and select **Command-line Window** from the drop-down list, to create a command-line window. The window that opens automatically connects to the current instance, and displays a default code segment that contains the connection ID, version information, and help information. +**Notice** + + + +You can create up to three command-line windows at a time. + +If a command-line window is disconnected, the **Reconnect** button appears in the upper-right corner of the command-line window. Click the button to reconnect the window.![Image 511](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6199620261/p267517.png) + +Script management +-------------------------------------- + +If you need to reference a script in your development work, you can the **Script Management** feature of the **Command-line Window** to import the script and then reference it. + +To reference a script, perform the following steps: + +1. Enter Script Management panel. + + Click the **Script Management** button in the upper-right corner of the command-line window to open the **Script Management** panel. + + +2. Import the script that you want to reference. + + Click the file pool under **Import Script** to start the file explorer, and select the script that you want to reference. Alternatively, you can directly drag the script file into the file pool to upload it. The maximum file size supported is 250 MB. + + +3. Obtain the file path. + + After the script is uploaded, you can view information about the script in the **Scripts** table in the panel. The table contains the following columns: **Script Path** , **Script Name** , **File Size** , and **Uploaded At** . To reference a script, click the **Copy Path** button in the Actions column and paste the path in the command-line window. + + +4. Delete a script file. + + You can view only script files uploaded by yourself. A file will be automatically deleted 30 minutes later after it is uploaded, to avoid unnecessary space consumption. You can also click the **Delete** button in the Actions column to delete a file. + + + + + +![Image 513](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6199620261/p267667.png) diff --git a/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/5.client-odc-stored-scripts.md b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/5.client-odc-stored-scripts.md new file mode 100644 index 00000000..0f590dc6 --- /dev/null +++ b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/5.client-odc-stored-scripts.md @@ -0,0 +1,113 @@ +Stored scripts +=================================== + +Log on to OceanBase Developer Center (ODC), and click the name of the target connection to go to the corresponding connection management page. Click **Workspace** in the top navigation bar, choose **Stored Scripts** from the drop-down list, and then choose a script that you previously stored in an SQL window or anonymous block window. + +Overview +----------------------------- + +![Image 560](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2295211561/p269155.png) + +After you choose the script, you can proceed to edit or run the script. If the script is an SQL script, ODC opens the script in an SQL window. If the script is an anonymous block script, ODC opens the script in an anonymous block window. In the script list, buttons with the following features are provided after each script name. + + +| Feature | Description | +|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| +| Edit | Click ![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424761.jpg) to modify the name and content of the script. | +| Delete | Click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424762.jpg) to delete the script. | +| Script management | Click ![Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424763.jpg) to edit, import, download, or delete scripts. | + + + +Script management +-------------------------------------- + +### Edit a script + +![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2295211561/p424769.png) + +1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. Choose **Workspace** \> **Stored Scripts** . + + + +2. Select a script from the drop-down list of **Stored Scripts** , and click ![Edit](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424782.jpg) to go to the Edit Script panel. You can also click ![Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424763.jpg) to go to the Script Management panel, select a script, and click Edit. + + + +3. In the **Edit Script** panel, modify **Script Name** and **Script Content** and click **Save** . + + + + + + +### Delete a script + +1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. Choose **Workspace** \> **Stored Scripts** . + + + +2. Select a script from the drop-down list of **Stored Scripts** and click ![Delete](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424762.jpg) to delete it. + + + + + + +### Manage scripts + +![Script Management](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/2295211561/p424794.png) + +1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. Choose **Workspace** \> **Stored Scripts** . + + + +2. Click **Stored Scripts** , and then click ![Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424763.jpg) in the drop-down list to go to the Script Management panel. + +3. In the Import Script section, click or drag files to import one or more scripts. + + > **Note**
            + > - The size of a single file cannot exceed 250 MB.
            + > - Files suffixed with .sql, .pl, and .txt are supported. + + + + + + + +4. Take the following actions in the script list: + + * Click ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424801.jpg) to refresh the script list. + + + + * Enter a script name in the search box to search for the script. + + + + * Click ![Check box](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4384511561/p424802.jpg) the check box to select multiple scripts for batch download or deletion. + + + + * Click **Copy Path** to copy the script path. + + + + * Click **Edit** to edit the script. + + + + * Click **Download** to download the script. + + + + * Click **Delete** to delete the script. + + + + + + + + diff --git a/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/6.client-odc-snippet.md b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/6.client-odc-snippet.md new file mode 100644 index 00000000..7e8672f4 --- /dev/null +++ b/en-US/7.client-odc-user-guide/4.client-odc-use-workspace/6.client-odc-snippet.md @@ -0,0 +1,80 @@ +Snippet +============================ + +As an enterprise-grade database development platform, OceanBase Developer Center (ODC) provides the code snippet module to facilitate database development. If you forget about the usage of some statements, you can query in the code snippet module. The code snippet module provides suitable code snippets based on whether you are in Oracle or MySQL mode. In addition to the built-in code snippets, you can also create custom code snippets to store frequently used code segments. A custom code snippet can be viewed only by its creator. + +To open the Snippets panel, click **Snippets** in the toolbar of an SQL window, an anonymous block window, or a PL object editing page.![Image 225](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3143849361/p242639.png) + +View code snippets +--------------------------------------- + +In the Snippets panel, the code snippets are displayed in a list of cards. Each card displays information about a code snippet, such as its name, description, and type. When you place the pointer over the tips icon![Snippet tips icon](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3143849361/p325006.png) next to a code snippet name, a tip window appears, displaying the entire code in the snippet. + +You can directly search for specific code snippets in the search box above the card list. A filter is provided below the search box for you to filter code snippets by type. The filter provides the following options: **Others** , **DML** , **DDL** , **Process Control Statement** , and **All Types** . By default, All Types is selected. + +Create a code snippet +------------------------------------------ + +Click the **+Create** button in the upper-right corner of the code snippet list. The **Create Snippets** panel appears. Specify the following information in the panel: + +* **Snippet Name** : specifies the name of the code snippet. It can contain letters, digits, and underscores (_), and can contain a maximum of 60 characters. This parameter must be specified. + + + +* **Snippet Type** : specifies the type of the code snippet. The types include **Others** , **DML** , **DDL** , and **Process Control Statement** . By default, **Others** is selected. + + + +* **Snippets** : specifies the actual code of the snippet. The length cannot exceed 2000 characters. This parameter must be specified. Similar to the SQL window, the toolbar of the editing area also provides buttons such as Format, Find and Replace, Undo, Redo, Case Sensitivity, Indent, and Comment. It also provides code highlighting and association features. + + + +* **Snippet Description** : provides additional notes on the code snippet. The length cannot exceed 200 characters. This parameter is optional. + + **Note** + + + + If you specified an additional notes in the description field, the snippet card in the Snippets panel displays the notes. Otherwise, the first 30 characters of the code are displayed. + + + + + +![Image 224](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3143849361/p242637.png) + +Reference a code snippet +--------------------------------------------- + +You not only can view the content of a created code snippet when you edit scripts, but also can reference it in your script. You can reference a code snippet by using one of the following three methods: + +* Method 1: Drag the target card from the code snippet list to the editing area, and the code in the code snippet is copied to the editing area. + + + +* Method 2: Click the copy icon in the lower-right corner of the target code snippet card to copy the code, and then press Ctrl+V or Cmd+V to paste the code to the editing area. + + + +* Method 3: The editing area of the SQL window supports code association. When you edit a script in the editing area, existing code snippets appear in the code association window for you to view and reference. + + + + + + +Manage code snippets +----------------------------------------- + +ODC provides the **Edit** and **Delete** options for you to manage custom code snippets. You cannot edit or delete built-in code snippets. + +* **Edit** : Click the management icon (···) in the upper-right corner of the target code snippet card. In the menu that appears, click the **Edit** button to go to the **Edit Snippet** panel. The panel displays parameters such as **Snippet Name** , **Snippet Type** , **Snippets** , and **Snippet Description** that were specified at creation of the code snippet. You can modify the information as needed. + + + +* **Delete** : Click the management icon (···) in the upper-right corner of the target code snippet card. In the menu that appears, click the **Delete** button to delete the code snippet. + + + + + diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/1.client-odc-data-export-and-import-overview.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/1.client-odc-data-export-and-import-overview.md new file mode 100644 index 00000000..419244e7 --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/1.client-odc-data-export-and-import-overview.md @@ -0,0 +1,33 @@ +Overview +============================= + +OceanBase Developer Center (ODC) provides the database import and export features and the table import and export features, to facilitate database data maintenance for database developers. The database import and export features allow you to import data to or export data from selected tables in the database in batches. The table import and export features allow you to import data to or export data from the target table. + +ODC provides a **Task Center** page. After you create an import or export task, this page displays the current import or export task. You can also view task details and logs on this page. + +> **Notice**
            +>
          • OceanBase Database of a version earlier than V2.2.30 supports only UTF8.
          • +>
          • In ODC V2.2.1 and earlier versions, to use the import and export features, you must connect ODC to the target instance through OBProxy. If you directly connect ODC to the target instance, the import and export features are unavailable.
          • +>
          • In ODC V2.4.1 and later, you can use the sys tenant account to accelerate the import and export tasks. To export objects other than tables and views, you must configure the sys tenant account.
          • + + + + + + +This chapter describes the import/export features in different topics. + +* [Export and import formats](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md) + + + +* [Batch export and import](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md) + + + +* [Single table export and import](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md new file mode 100644 index 00000000..5705959e --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md @@ -0,0 +1,30 @@ +Export and import formats +============================================== + +OceanBase Developer Center (ODC) supports three data export modes: Export Schema and Data, Export Data Only, and Export Schema Only. A schema is the DDL file of an exported object, while data is the data file stored in the object. The types of schemas and data files vary with the export and import formats. + +ODC supports exporting data in CSV and SQL formats and importing ZIP, SQL (batch import), and CSV (single table import) files. + +Export file formats +---------------------------------------- + +ODC exports data in a zip file, which contains the metadata file MANIFEST.bin, the schema definition files of the exported objects, and the data files. + +When you create an export task, if you set **Data Format** to **SQL Format** , the zip file contains the schema definition files named in the pattern of `object_name-schema.sql` and data files named in the pattern of `object_name.sql`. The object names are the same as those of the objects in the database. + +![Image 614](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5199620261/p270049.png) + +If you set **Data Format** to **CSV Format** , the zip file contains the schema definition files named in the pattern of `object name-schema.sql` and data files named in the pattern of `object name.csv`. The object names are the same as those of the objects in the database. + +![Image 613](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5199620261/p270050.png) + +Import file formats +---------------------------------------- + +ODC supports importing ZIP (batch import and single table import), SQL (batch import), and CSV (single table import) files. + +The ZIP file here is a compressed package that is suffixed with .zip. When you create an import task, if you select **ZIP Files** as the **Import Content** , you must specify whether **Data Format** in the zip file is **CSV Format** or **SQL Format** . For more information about the content of different formats of files to be exported, see **Export file formats**. + +SQL files supported for batch data import are suffixed with .sql and contain statements that can be directly executed in the database. These statements include `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `CREATE`, and `DROP`. + +CSV files supported for single table import are data files that are suffixed with .csv or .txt. These files support custom delimiters. diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md new file mode 100644 index 00000000..c0fac5b7 --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md @@ -0,0 +1,241 @@ +Batch export and import +============================ + + + +Overview +----------------------- + +OceanBase Developer Center (ODC) allows you to export and import the schemas and data of database objects in batches. + +After you open a database connection, click **Tools** in the top navigation bar, and then select **Export**or **Import** from the drop-down list to go to the corresponding settings panel. + +The following table describes the requirements for the size of imported and exported data and the retention period of files in ODC. + +| Requirement | Description | +|------------------------|------------| +| File retention period on the server |
          • The status of a task, such as Succeeded, Failed, and Canceled, does not affect the lifecycle of the task files.
          • Tasks are permanently retained. Task-related files are retained for 14 days by default.
          • | + + + +Batch export +------------------------- + +In the **Create Export Task** panel, you can export multiple database objects to files in the specified format at the same time. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export1-EN.png) + + +The following example shows how to batch export the employee table and the salary view in the ODC. Procedure: + +### Step 1: Specify the export content + +As shown in the preceding figure, ODC supports three export modes: **Export Schema and Data**, **Export Data Only**, and **Export Schema Only**. **Export Schema Only** exports the definition statements of the target object. You can select the export content from the **Export Content** drop-down list. + +### Step 2: Select a database + +Select the database where the object to export resides. The name of the database connection to which the task belongs is also displayed. + +### Step 3: Specify the export range + +You can select **Partial Export** or **Full Export**. + +* If you select **Partial Export**, you can select the objects you want to export in the **Select Objects** pane in the **Export Objects** section. You can use the search box to search for desired objects. + + + +* If you select **Full Export**, all objects in the database are exported. + + + + + + +### Step 4: Go to the Export Settings panel + +Click **Next: Export Settings** to specify the file export settings and the sys tenant account. + +### Step 5: Go to the Data File Settings panel + +![Batch export 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export2-EN.png) + +1. Specify Data Format. + + ODC supports exporting data to files in the CSV format and SQL format. If you specify **Export Schema Only** for **Export Content**, you can only export data to files in the SQL format. For more information about formats, see [Export and import formats](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). + + +2. Specify File Encoding. + + ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + + +3. Specify Data File Settings. + + If you select **Export Schema Only** for **Export Content**, you do not need to configure the export data settings. You need to specify the following fields: + + * **Use Global Snapshot**: If you select this option, ODC exports the data in the latest global snapshot of the specified table to ensure global data consistency. + + + + * **Batch Commit Quantity (SQL Format)**: You can click **Advanced** next to **Export Data Settings** to specify this field. If you select **SQL Format** for **Data Format**, you can specify the number of rows to be committed during the export. When this number is reached, a `COMMIT` command is executed. + + + + * Specify information for the CSV format. If you select **CSV Format** for **Data Format** and **Export Schema and Data** for **Export Content**, you can specify following information: + + * **Include the Column Header**: specifies whether to include column headers when data is exported in CSV format. This option is selected by default. + + + + * **Convert the Empty String into a Null Value**: This option is selected by default to determine whether to convert empty strings in the table to NULL values when data is exported in CSV format. + + + + * **Field Separator**: specifies the separator between fields. The following signs are supported: commas, semicolons, and colons. You can also use a character as the separator. + + + + * **Text Identifier**: specifies the identifier for the text content. Single quotation marks (') and double quotation marks (") are supported. + + + + * **Line Break Symbol**: specifies the line break symbol. The following characters are supported: \\n, \\r, and \\r\\n. + + + +### Step 6: Specify schema file settings + +Choose whether to select **Add DROP TABLE Statement before CREATE TABLE Statement**. If you select this option, a `DROP` statement is added before the corresponding `CREATE` statement of an object when the schema files of the object are exported. + +### Step 7: Select an execution method + +Select **Execute immediately** or **Timed execution**. + +### Step 8: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + +**Notice** +- The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
            +![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + +- If the account of the sys tenant is not configured, comments and indexes are not imported or exported. + + +### Step 9: Retain Current Configuration + +Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + + +### Step 10: Generate an export task + +After you specify all preceding information, you can click **Export** in the lower-right corner of the panel to create an export task and export the backup file directly to a local directory. + +#### Step 11: View the export task + +After the export task is generated, the **Task Center** page automatically appears, where you can view the task information and download exported data and schema files. For more information, see [Export tasks](../../8.client-odc-task-management/3.client-odc-export-tasks.md). + +Batch import +------------------------- + +In the **Create Import Task** panel, you can choose to import schemas and data to multiple database objects at the same time. + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import1-EN.png) + +Take the import of ZIP files (6000219_import_file) in the ODC as an example. The file contains an employee table and a salary view. Procedure: + +### Step 1: Specify **Import Format** + +As shown in the preceding figure, ODC supports batch import of **CSV Files**, **SQL Files**, and **ZIP Files**. You can select the desired file format from the **Import Format** drop-down list. For more information about formats, see [Export and import formats](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). + +### Step 2: Upload the file to be imported + +Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. The format of the uploaded file must be the same as that of the value you specified for Import Format. Upload files suffixed with .zip if you have selected ZIP Files for Import Format, upload files suffixed with .sql if you have selected SQL Files for Import Format, and upload files suffixed with .csv if you have selected CSV Files for Import Format. + +### Step 3: Specify **File Encoding** + +ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + +### Step 4: Go to the Import Settings panel + +Click **Next: Import Settings** to specify file import settings and the sys tenant account. + +### Step 5: Specify **Import Content** + +![Batch Import 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import2-EN.png) + +You must specify this parameter when you select **ZIP Files** for **Import Format**. ODC supports **Import Data Only**, **Import Schema Only**, and **Import Schema and Data**. **Import Schema Only** imports the definition statements of the target object. You can select the import content from the **Import Content** drop-down list. + +### Step 6: Select a database + +Select the database to which the data object is to be imported. The name of the database connection to which the task belongs is also displayed. + +### Step 7: Specify **Import Data Settings** + +If you select **ZIP Files** for **Import Format** and **Import Data Only** or **Import Schema and Data** for **Import Content**, this option must be specified. You need to specify the following fields: + +* **Clear Data Before Import**: If you select this option, the original data in the destination object is cleared during data import. + + + +* **Batch Commit Quantity**: You can click **Advanced** next to **Export Data Settings** to specify this field. After you specify this field, a `COMMIT` statement is executed when the number of exported data rows reaches the specified quantity. + + + +* **Skipped Data Type (Optional)**: You can specify the data types to be skipped during data import. The data types that can be skipped are different in MySQL and Oracle modes. You can select multiple data types. + + + + + + +### Step 8: Specify **Import Schema Settings** + +You cannot specify this field if you select Import Data Only for **Import Content**. This field involves operations on schemas that already exist. If you select **Skip**, the system skips the schema definition statement in the file to be imported and directly imports the data. The original data in the object is retained. If you select **Replace**, the system executes the schema definition statement in the file to be imported to re-create an object and replace the original one. Data in the original object is cleared. + +### Step 9: Specify **Task Error Handling Method** and the execution method + +* ODC supports two error handling methods: **Abort Task** and **Ignore Error and Continue**. You need to select the handling method as required. + + + +* Select **Execute immediately** or **Timed execution**. + + + + + + +### Step 10: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + + **Notice** + - The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
            + ![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + + - If the account of the sys tenant is not configured, comments and indexes are not imported or exported. + +### Step 11: Retain Current Configuration + +Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + + +### Step 12: Generate an import task + +After you specify all preceding information, you can click **Submit** in the lower-right corner of the panel to create an import task. + +### Step 13: View the import task + +![Batch Import 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5-3-EN.png) + +After the task is generated, the **Task Center** page automatically appears, where you can view the task information. For more information, see [Import tasks](../../8.client-odc-task-management/2.client-odc-import-tasks.md). + diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md new file mode 100644 index 00000000..7cdc5ef9 --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md @@ -0,0 +1,205 @@ +Single table export and import +============================ + + + +Overview +----------------------- + +OceanBase Developer Center (ODC) allows you to import and export data and schemas from a specified table. + +After you open a database connection, you can click Objects in the left-side navigation pane to view the objects. Right-click the name of the target object in the object list, or click **Tools** in the top navigation bar and then select **Export** or **Import** from the drop-down list to export or import the data and schema in the current table. + +The following table describes the requirements for the size of imported and exported data and the retention period of files in ODC. + + +| Requirement | Description | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| File retention period on the server |
          • The status of a task, such as Succeeded, Failed, and Canceled, does not affect the lifecycle of the task files.
          • Tasks are permanently retained. Task-related files are retained for 14 days by default.
          • | + + + +Single table export +------------------------- + +![Single Table Export - 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%87%BA-1-EN.png) + +### Procedure + +The procedure for exporting a single table is basically the same as the that of [batch export](../1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md). The following example shows how to export an employee table in ODC. Procedure: + +#### Step 1: Specify the export content + +As shown in the preceding figure, ODC supports three export modes: **Export Schema and Data**, **Export Data Only**, and **Export Schema Only**. **Export Schema Only** exports the definition statements of the target object. You can select the export content from the **Export Content** drop-down list. + +#### Step 2: Select a database + +Select the database where the object to export resides. The name of the database connection to which the task belongs is also displayed. + +#### Step 3: Specify the export range + +By default, the current table is exported. You can select **Partial Export** or **Full Export**. + +* If you select **Partial Export**, you can select the objects you want to export in the **Select Objects** pane in the **Export Objects** section. You can use the search box to search for desired objects. +* If you select **Full Export**, all objects in the database are exported. + +#### Step 4: Go to the Export Settings panel + +Click **Next: Export Settings** to specify the file export settings and the sys tenant account. + +#### Step 5: Go to the Data File Settings panel + +![Single Table Export - 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%87%BA-2-EN.png) + +1. Specify **Data Format**. + + ODC supports exporting data to files in the CSV format and SQL format. If you specify **Export Schema Only** for **Export Content**, you can only export data to files in the SQL format. For more information about formats, see [Export and import formats](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). + + +2. Specify **File Encoding**. + + ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + + +3. Specify **Data File Settings**. + + If you select **Export Schema Only** for **Export Content**, you do not need to configure the export data settings. You need to specify the following fields: + * **Use Global Snapshot**: If you select this option, ODC exports the data in the latest global snapshot of the specified table to ensure global data consistency. + * **Batch Commit Quantity (SQL Format)**: You can click **Advanced** next to **Export Data Settings** to specify this field. If you select **SQL Format** for **Data Format**, you can specify the number of rows to be committed during the export. When this number is reached, a `COMMIT` command is executed. + * Specify information for the CSV format. If you select **CSV Format** for **Data Format** and **Export Schema and Data** for **Export Content**, you can specify following information: + + * **Include the Column Header**: specifies whether to include column headers when data is exported in CSV format. This option is selected by default. + * **Convert the Empty String into a Null Value**: This option is selected by default to determine whether to convert empty strings in the table to NULL values when data is exported in CSV format. + * **Field Separator**: specifies the separator between fields. The following signs are supported: commas, semicolons, and colons. You can also use a character as the separator. + * **Text Identifier**: specifies the identifier for the text content. Single quotation marks (') and double quotation marks (") are supported. + * **Line Break Symbol**: specifies the line break symbol. The following characters are supported: \\n, \\r, and \\r\\n. + +#### Step 6: Specify schema file settings + +Choose whether to select **Add DROP TABLE Statement before CREATE TABLE Statement**. If you select this option, a `DROP` statement is added before the corresponding `CREATE` statement of an object when the schema files of the object are exported. + +#### Step 7: Select an execution method + +Select **Execute immediately** or **Timed execution**. + +#### Step 8: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + + **Notice** + - The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
            + ![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + + - If the account of the sys tenant is not configured, comments and indexes are not imported or exported. + +#### Step 9: Generate an export task + +After you specify all preceding information, you can click **Export** in the lower-right corner of the panel to create an export task. + +#### Step 10: View the export task + +![Single Table Export - 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%87%BA-3-EN.png) + +After the export task is generated, the **Task Center** page automatically appears, where you can view the task information and download exported data and schema files. For more information, see [Export tasks](../../8.client-odc-task-management/3.client-odc-export-tasks.md). + +Single table import +------------------------- + +![Single Table Import - 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%85%A5-1-EN.png) + +### Procedure + +Take the import of a ZIP file (6000219_import_file) in ODC as an example. The file contains an employee table. Procedure: + +#### Step 1: Specify Import Format + +As shown in the preceding figure, ODC supports **CSV Files** and **ZIP Files** for single table import. You can select the desired file format from the **Import Format** drop-down list. For more information about formats, see [Export and import formats](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). + +#### Step 2: Upload the file to be imported + +Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. The format of the uploaded file must be the same as that of the value you specified for **Import Format**. Upload files suffixed with .zip if you have selected **ZIP Files** for **Import Format**, and upload files suffixed with .csv if you have selected **CSV Files** for **Import Format**. + +> **Note** +> You can upload a single table or multiple tables. + +#### Step 3: Specify File Encoding + +ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + +#### Step 4: Go to the Import Settings panel + +Click **Next: Import Settings** to specify file import settings and the sys tenant account. + +#### Step 5: Specify Import Content + +![Single Table Import - 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%85%A5-2-EN.png) + +You must specify this parameter when you select **ZIP Files** for **Import Format**. ODC supports **Import Data Only**, **Import Schema Only**, and **Import Schema and Data**. **Import Schema Only** imports the definition statements of the target object. You can select the import content from the **Import Content** drop-down list. + +#### Step 6: Select a database + +Select the database to which the data object is to be imported. The name of the database connection to which the task belongs is also displayed. + +#### Step 7: Import the target table + +By default, the current table is imported. To import multiple tables, select the tables to be imported. + +#### Step 8: Specify Import Data Settings + +If you select **ZIP Files** for **Import Format** and **Import Data Only** or **Import Schema and Data** for **Import Content**, this option must be specified. You need to specify the following fields: + +* **Clear Data Before Import**: If you select this option, the original data in the destination object is cleared during data import. + + + +* **Batch Commit Quantity**: You can click **Advanced** next to **Import Data Settings** to specify this field. After you specify this field, a `COMMIT` statement is executed when the number of exported data rows reaches the specified quantity. + + + +* **Skipped Data Type (Optional)**: You can specify the data types to be skipped during data import. The data types that can be skipped are different in MySQL and Oracle modes. You can select multiple data types. + + + + + + +#### Step 9: Specify Import Schema Settings + +You cannot specify this field if you select **Import Data Only** for **Import Content**. This field involves operations on schemas that already exist. If you select **Skip**, the system skips the schema definition statement in the file to be imported and directly imports the data. The original data in the object is retained. If you select **Replace**, the system executes the schema definition statement in the file to be imported to re-create an object and replace the original one. Data in the original object is cleared. + +#### Step 10: Specify Task Error Handling Method and the execution method + +* ODC supports two error handling methods: **Abort Task** and **Ignore Error and Continue**. You need to select the handling method as required. +* Select **Execute immediately** or **Timed execution**. + + + + + + +#### Step 11: Set up the sys tenant account + +1. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + +2. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + + **Notice** + - The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
            + ![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + + - If the account of the sys tenant is not configured, comments and indexes are not imported or exported. + +#### Step 12: Generate an import task + +After you specify all preceding information, you can click **Submit** in the lower-right corner of the panel to create an import task. + +#### Step 13: View the import task + + +After the task is generated, the **Task Center** page automatically appears, where you can view the task information. For more information, see [Import tasks](../../8.client-odc-task-management/2.client-odc-import-tasks.md). diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/2.client-odc-data-mocking.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/2.client-odc-data-mocking.md new file mode 100644 index 00000000..8f1824a4 --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/2.client-odc-data-mocking.md @@ -0,0 +1,65 @@ +Data mocking +================================= + +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. + +![Image 622](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7199620261/p270066.png) + +Perform the following steps to generate data by using the data mocking feature: + +1. 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. + + +2. 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. + + +3. Specify the task name. + + By default, the data mocking task is named in the format of \< **Connection name\>_\_\_\** . After you select the table to store the generated data, the task name is automatically generated in the field under **Task Name** . You can modify the task name. + + +4. 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 100,000 rows of data. You can set the value to an integer between 1 and 100000. + + +5. Specify the batch size. + + In the Mock Data panel, set **Batch Processing 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. + + +6. 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. + + +7. 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. + + + + + + +8. Set data generation rules. + + In the Mock Data panel, the **Rule Settings** table displays the fields in the table you selected in Step 2 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. + + +9. 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** page. For more information, see [Data mocking tasks](../8.client-odc-task-management/4.client-odc-data-mocking-tasks.md). \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/3.client-odc-partition-scheme.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/3.client-odc-partition-scheme.md new file mode 100644 index 00000000..f2aa0949 --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/3.client-odc-partition-scheme.md @@ -0,0 +1,41 @@ +# Partitioning plan + +## **Background** + +- **RANGE partitioning**: Multiple rows with column values in an ordered, continuous, and non-overlapping range are assigned to a partition. For details, see [Set partitioning rules](../10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md). + +- **Partitioning Plan**: When inserting data in a range-partitioned table, if the inserted data exceeds the upper limit value of the current partition table, the data will not be inserted and an error will be returned. Partitioning plan is an extension function specially for range partitioning. ODC supports automatic management of range-partitioned table according to the partitioning strategy set by the user. Users do not need to manually create new partitions to facilitate the maintenance of range-partitioned table. + +This topic describes how to use a partitioning plan in the OceanBase Development Center (ODC) console, including performing automatic management on created and dropped table partitions. + +## **Create a partitioning plan** + +1. Log on to the ODC console, and click the name of the target connection to go to the corresponding database object management page. + +2. In the top navigation pane, choose **Tool** > **Partition Plan** to display the **Create a partition plan** panel. + + + ![Partitioning plan 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%921-EN.png) + +3. In the **Create a partition plan** panel, specify the following information. + + ![Partitioning plan 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-2-EN.png) + + | **Parameter** | **Description** | + |---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The connection to which the partitioning plan belongs. The default value is the current connection. | + | Partition policy | The information about the partitioning strategy. Search for and select a RANGE-partitioned table in the database and edit its partitioning strategy.
            • You can select **Only tables that are not set are displayed** on the right side of **Partition policy** to display only tables with no partitioning strategies.
            • You can also select multiple RANGE-partitioned tables and configure a partitioning strategy for them at a time.
            • In the **Partition policy** column, click the edit icon and then you can edit the number of partitions to create, partitioning interval, retention period, and naming rules.
              • **Number of Partitions**: set the number of partitions to pre-create.
              • **Partition Interval**: pre-create the corresponding number of partitions based on the time interval, unit: day/month/year.
              • **Retention Period**:the created partition is automatically cleared after the retention period expires, unit: day/month/year.
                Example: The number of partitions is 1, the partition interval is 1 month, and the retention period is 1 month, which means that 1 partition is pre-created for the current table, and 1 partition will be created every 1 month, and the created partition will be cleaned up automatically after 1 month.
                ![edit](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-edit-3-EN.png)
            | + | Remarks | The business background of the project, such as the change purposes and expected goals. | + +4. After you specify the preceding information, click **Submit** in the lower-right corner of the panel. + +5. After the task is generated, the **Task Center** panel automatically appears, where you can view the task status and task information. + + ![Partitioning plan 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%AE%A2%E6%88%B7%E7%AB%AF-%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92%E5%88%97%E8%A1%A83-EN.png) + + +**Related topics** +------------------------- + + +[Partitioning plan task](../../8.client-odc-task-management/6.client-odc-partition-scheme-task.mdcheme-task.md) \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/4.client-odc-database-change.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/4.client-odc-database-change.md new file mode 100644 index 00000000..0eef392b --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/4.client-odc-database-change.md @@ -0,0 +1,118 @@ +Asynchronous execution +=========================================== + + + +Overview +----------------------------- + +Statements in the SQL window of OceanBase Developer Center (ODC) are executed synchronously. Therefore, the execution may time out when the statement runs for a long time. You can use the asynchronous execution tool to run time-consuming SQL statements to avoid execution timeout. + +![Image 441](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6378659361/p293273.png) + +Procedure +------------------------------ + +To use the asynchronous execution tool to execute SQL statements, perform the following steps: + +1. Enter the **Asynchronous Execution** panel. + + 1. Log on to the ODC homepage, and click the name of the target connection to go to the corresponding database object management page. + + + + 2. Click **Tool** in the top navigation bar. + + + + 3. Select **Asynchronous Execution** in the drop-down list. The **Create Async Task** panel appears + + + + + + +2. Specify the task name. + + Specify the task name in the **Task Name** field in the panel. The task name must be unique and must not exceed 110 characters in length. + + +3. Specify **SQL Content** . + + The asynchronous execution tool provides two ways to specify SQL content: + * **SQL Entry** : This is the default way to specify SQL content. You can directly write the SQL script in the editing area. + + **Note** + + + * The maximum size of the SQL statements that can be entered in the SQL window is limited to 500,000 characters. If the SQL script to be executed has more than 500,000 characters, you can upload it in the form of a \*.sql file. + + + + * Click **IN Value Conversion** to convert batch copied and pasted data into the in('A','B') format. + + * Column values are separated with line breaks. + + + + * Row values are separated with spaces or tabs. + + + + + + + + + + + * **Upload File** : Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool to upload it. The file size cannot exceed 20 MB and only SQL files suffixed with .sql are supported. + + + + + + +4. Specify the delimiter. + + + +5. Specify the query result limit. Value range: 1 to 1000000. + + + +6. Specify **Task Error Handling Method** . + + The asynchronous execution tool provides two methods to handle task errors: + * **Abort Task** : This is the default option. When you select this option, the task is aborted if an error occurs when you run the script. + + + + * **Ignore Error and Continue** : When you select this option, the system skips the statement where an error occurs and continues to execute other statements in the script. + + + + + + +7. Specify **Execution Timeout Value** . + + Specify the value in the **Execution Timeout Value** field in hours. Default value: 48. Maximum value: 480. + + +8. Optional. Specify the task description. + + You can enter a description of no more than 200 characters in **Task Description** . + + +9. Create the asynchronous task. + + After you specify the above information in the panel, click **Create** to submit the information to create the asynchronous execution task. + + +10. After the task is created, ODC will direct you to the **Asynchronous Execution** page of the task center. On the Task Details page, you can click **View** to view the **Task Information** and **Task Logs** . + + + + + diff --git a/en-US/7.client-odc-user-guide/5.client-odc-use-tools/5.client-odc-shadow-table-synchronization.md b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/5.client-odc-shadow-table-synchronization.md new file mode 100644 index 00000000..07377a48 --- /dev/null +++ b/en-US/7.client-odc-user-guide/5.client-odc-use-tools/5.client-odc-shadow-table-synchronization.md @@ -0,0 +1,62 @@ +# Shadow table synchronization + +## Background + +The shadow table synchronization feature of OceanBase Developer Center (ODC) allows you to automatically create a shadow table in the current database based on the schema of the source table. The shadow table name is the combination of the source table name and a prefix or suffix. This feature applies to scenarios like full-link stress testing. + +This topic describes how to create a shadow table synchronization task in ODC. +> **Note** +>
          • The shadow table synchronization feature of ODC V4.0.0 supports only the MySQL mode. If the source table contains subpartitions, only template-based HASH or KEY subpartitions are supported.
          • +>
          • After a shadow table is created, you can view it on the Table page.
          • +>
          • When a shadow table is created, if a table with the same name but a different schema already exists, a synchronization SQL statement is generated to update the schema of the existing shadow table.
          • + + +## Create a shadow table synchronization task + +1. Log on to the ODC console, and click the name of the target connection to go to the corresponding database object management page. + + +2. In the top navigation bar, choose **Tool** > **Synchronize Shadow Table** to display the **Create Shadow Table Synchronization Project** panel. + + ![Shadow table synchronization 1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A51-EN.png) + +3. On the **Create Shadow Table Synchronization Project** panel, specify the following information. + + 1. Select a synchronization object. + + ![Shadow table synchronization Create](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A52-EN.png) + + + | **Field** | **Description** | + |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Database | The database to which the shadow table to be created belongs. You can view the name of the current connection. | + | Synchronization Range | The table to be synchronized.
            • **Partial Tables**: Shadow tables will be created in the current database for the selected tables.
            • **All Tables**: Shadow tables will be created in the current database for all tables in the source database.
            | + | Name of Shadow Table | The name of the shadow table, in the format of **prefix** + source table name or source table name + **suffix**. You can use custom prefix or suffix. | + | Synchronization Objects | The source tables to be synchronized as shadow tables. You must specify this field when **Synchronization Range** is set to Partial Tables. | + + + 2. Analyze the schema of the shadow table. + + ![Shadow table synchronization Create 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A53-EN.png) + + + | **Field** | **Description** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Synchronized Tables | The **Synchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **View** to view the source table schema, shadow table schema, and schema change SQL statement, or click **Skip**, indicating that this shadow table is not synchronized. | + | Unsynchronized Tables | The **Unsynchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **Undo Skip** to synchronize this shadow table.
            **Note:**
            A skipped table will be displayed on the **Unsynchronized Tables** tab.
            If a shadow table with the same name and the same schema as the source table already exists, schema synchronization will be skipped.
            | + | SQL Preview | The SQL statement for schema synchronization. | + | Task Settings | Options of **Execution Mode** include:
            • **Execute Immediately**: The synchronization task is executed immediately.
            • **Execute On Schedule**: The synchronization task is executed on schedule.
            | + | Task Settings | Options of **Task Error Handling Method** include:
            • **Abort Task**: If an error occurs during the execution of the synchronization task, the subsequent SQL scripts are interrupted and no longer executed.
            • **Ignore Error and Continue**: If an error occurs during the execution of the synchronization task, the SQL script with the error is skipped, but subsequent SQL scripts will be executed.
            | + | Remarks | The business background of the project, such as the change purpose and expected goal. | + +4. After you specify the preceding information, click **Submit** in the lower-right corner of the panel. + + +5. After the task is generated, the **Task Center** panel automatically appears, where you can view the task status and task information. For more information, see [Shadow table synchronization tasks](../../6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization.md). + + ![Shadow table synchronization Approve task 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%AE%A2%E6%88%B7%E7%AB%AF-%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E5%88%97%E8%A1%A84-EN.png) + + +## Related topics + +[Shadow table synchronization tasks](../8.client-odc-task-management/7.client-odc-shadow-table-synchronization-task.md) diff --git a/en-US/7.client-odc-user-guide/6.client-odc-recycle-bin.md b/en-US/7.client-odc-user-guide/6.client-odc-recycle-bin.md new file mode 100644 index 00000000..2ccafb44 --- /dev/null +++ b/en-US/7.client-odc-user-guide/6.client-odc-recycle-bin.md @@ -0,0 +1,48 @@ +Recycle bin +================================ + +Log on to OceanBase Developer Center (ODC) and click the name of the target connection to go to the corresponding database object management page. Click **Recycle Bin** to go to the recycle bin page. + + + +The recycle bin temporarily stores deleted database objects and allows you to search for and restore the deleted objects. Technically, the recycle bin is a data dictionary table that stores the information about the database objects deleted by users. Deletion here refers to the `DROP` operation. Data that is deleted by the `DELETE` operation does not enter the recycle bin. Therefore, an object deleted by the `DROP` operation is not permanently deleted and still occupies storage space. You can use the `PURGE` operation or empty the recycle bin in ODC to release the space. + +The recycle bin page displays the following information, as shown in the following figure: + + + +| Information | Description | +|---------------|-----------------------------------------------------------------------------------------------------------------------------------------| +| Original Name | The name of the deleted object specified by its creator. | +| Object Name | The name that ODC gives to the object. Unlike the original name, the object name is never repeated and can uniquely identify an object. | +| Object Type | The type of the deleted object. | +| Recycled At | The timestamp of when the object was deleted. The timestamps help you track deleted objects with ease. | + + + +![Image 638](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8973141261/p272818.png) + +In addition, the navigation bar on the recycle bin page provides the following buttons: + +* **Empty Recycle Bin** : Click this button to purge all the objects from the recycle bin and release the storage space. + + + +* **Refresh** : Click this button to refresh the list of deleted objects in the recycle bin. + + + +* **Prompt** : After you set a time for purging the recycle bin, ODC displays, in the prompt bar based on your settings, the time that deleted objects can be stored in the recycle bin. + + + +* **Clear** : Click this button to purge the selected object from the recycle bin and release the storage space. + + + +* **Restore** : Click this button to restore the selected object from the recycle bin to its original location. + + + + + diff --git a/en-US/7.client-odc-user-guide/7.view-operation-records.md b/en-US/7.client-odc-user-guide/7.view-operation-records.md new file mode 100644 index 00000000..37ef40e0 --- /dev/null +++ b/en-US/7.client-odc-user-guide/7.view-operation-records.md @@ -0,0 +1,84 @@ +View operation records +=========================================== + +This topic describes how to view the history of operation events in OceanBase Developer Center (ODC). + +Background +------------------------------- + +You can view operation records in ODC for the following purposes: + +* Security compliance: A variety of features provided by operation records help you make sure that operations in your system meet security and compliance requirements. + + + +* Real-time monitoring: You can monitor business operations related to public connections in real time through operation records. + + + +* Event tracing: Database behaviors can be periodically compared based on operation records, which helps you locate anomaly points and abnormal behaviors in the database and allows you to trace risks. Besides, with operation records, correlated queries and analysis can be performed based on the database access source, to help you find the exact operator who accesses the database. + + + + + + +Operation record list +------------------------------------------ + +**Note** + + + +You can view your own operation records in this list. + +Operation records are retained permanently. + +1. On the Database Management page of ODC, click **Operating Records** in the top navigation bar. + + ![Operation record 1](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/3716211561/p411756.png) + + +2. The **Operating Records** tab is displayed. + + ![Operating Records](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9185511561/p411758.png) + * You can click the refresh icon ![Refresh](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9185511561/p420126.jpg) to manually refresh the list. + + + + * You can select an option from **Performed At** to filter the operation records by time. Operation records in the last 7 days, 15 days, 30 days, 6 months, or a custom time range can be queried. + + The following table describes the basic information displayed in the operation record list. + + + | Field | Description | + |------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Event Type | The type of the operation event. The following types of operation events are supported: personal settings, password management, connection management, script management, database operations, organization configuration, member management, resource group management, data mocking, database changes, import, export, and task processes. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by event type. | + | Event Operation | The operation performed in the event. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by event operation. | + | Connection | The name of the connection to which the operation belongs. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0365511561/p417135.jpg) to search for the connection to which the operation belongs. | + | IP Address | The IP address. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0365511561/p417135.jpg) to search for the IP address. | + | Performed At | The time when the operation was performed. By default, the operation records are sorted by execution time. The latest record is displayed at the top. You can click the icon ![ASC/DESC](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/9014511561/p420143.jpg) to sort the operation records in ascending or descending order. | + | Execution Result | The execution result. Valid values: **Succeeded** and **Failed** . You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the operation records by execution result. | + | Actions | Indicates the actions you can take. Currently, only **View** is available. | + + + + + + + + + +View operation records +------------------------------------------- + +In the operation record list, click **View** in the **Actions** column. The **Record Details** panel appears. + +![View](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0920633561/p420132.png) + +You can view the details of the record in the following columns: **Operation Type** , **Event Operation** , **IP Address** , **Operation Rules** , **Performed At** , and **Result** . + +Related information +---------------------------------------- + +For more information about how to manage the operation records, see **Manage operation records** in the chapter for the public resource console. diff --git a/en-US/7.client-odc-user-guide/8.client-odc-task-management/1.client-odc-task-management-overview.md b/en-US/7.client-odc-user-guide/8.client-odc-task-management/1.client-odc-task-management-overview.md new file mode 100644 index 00000000..48d30efd --- /dev/null +++ b/en-US/7.client-odc-user-guide/8.client-odc-task-management/1.client-odc-task-management-overview.md @@ -0,0 +1,39 @@ +Overview +============================= + +OceanBase Developer Center (ODC) provides various **tools** for you to generate tasks. You can view the status and information of tasks in Task Center. + +After you log on to ODC and enter the management page of a database connection, click **Task** in the navigation bar in the upper part of the page to open the **Task Center** page, where you can view the information about the tasks. + +View tasks +------------------------- + +You can enter the task center to view tasks through the ODC homepage or connection page. + +* View via the ODC homepage: On the top navigation bar of the ODC homepage, click **Task** . + +* View through the connection page: After logging in to ODC and entering the target connection, click the **Task Center** button in the top navigation bar to pop up the **Task Center** panel, in which you can view the detailed information of the corresponding task. + +Support function +------------------------- + +This chapter describes task management features in different topics. + +* [Import tasks](../8.client-odc-task-management/2.client-odc-import-tasks.md) + + + +* [Export tasks](../8.client-odc-task-management/3.client-odc-export-tasks.md) + + + +* [Data mocking tasks](../8.client-odc-task-management/4.client-odc-data-mocking-tasks.md) + + + +* [Database Change](../8.client-odc-task-management/5.client-odc-database-change-task.md) + + + + + diff --git a/en-US/7.client-odc-user-guide/8.client-odc-task-management/2.client-odc-import-tasks.md b/en-US/7.client-odc-user-guide/8.client-odc-task-management/2.client-odc-import-tasks.md new file mode 100644 index 00000000..07053aaf --- /dev/null +++ b/en-US/7.client-odc-user-guide/8.client-odc-task-management/2.client-odc-import-tasks.md @@ -0,0 +1,95 @@ +Import tasks +================================= + +After you create a batch or single table import task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Import** tab of the **Task Center** panel. + +Task list +------------------------------ + +> **Note** +> The task list displays the tasks in the last 48 hours. + +ODC allows you to run up to three import tasks in parallel, while subsequent tasks wait in the queue. + +On the management page of the database connection, click **Task Center** in the top navigation bar to open the Task Center panel. Click **Import** to display the list of import tasks. + + +The following table describes the columns in the task list. You can filter and sort tasks by some of the columns. + + +| Column | Description | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task ID | The ID of the import task. | +| Task Type | The task type specified when the task was created. The following task types are supported: import, export, data mocking, and database change. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/8487860461/p352180.jpg) to filter the tasks by connection. | +| Database | The database to be changed. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the database to which the task belongs. | +| Creator | The user who created the import task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/1036511561/p416691.jpg) to search for the creator. | +| Creation Time | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The actions you can take. Valid values: **View** , **Approve/Reject** , **Abort** , and **Download** . * View: Click this button to go to the task details page to view the **task information** and **task logs**. * Approve/Reject: Click this button to approve or reject a running task. * Abort: Click this button to abort a running task. * Download: Click this button to download the exported file to your local device when the task is complete. | + + + +Create an import task +------------------------------------------ + +1. In the pop-up task center panel, click **+** on the right side of **Import** to pop up the new import task panel. + + + +2. In the **Create Import Task** panel, specify the fields described in the following table. + + + + | Field | Description | + |-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The name of the database connection to which the task belongs. | + | Database | The database to be changed. | + | Operation Mode | Select **Automatically Perform after Approval** or **Manually Perform after Approval** . | + | Import Format | Select **SQL Files** or **ZIP Files** . | + | Import File | Upload the file to be imported. Click the file pool to go to the file explorer and select the file to be imported. You can also directly drag the file to the file pool toupload it. | + | Encoding Standard | Select the character set from the drop-down list of **Encoding Standard** . | + | Import Content | You must specify this item when you select ZIP Files for **Import Format** . ODC currently supports **Import Data Only** , **Import Schema Only** , and **Import Schema and Data** **.** | + | Data Format | You must specify this item when you select ZIP Files for **Import Format** . ODC only supports importing data in CSV format and SQL format. For more information about formats, see [Export and import formats](../5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). | + | Import Data Settings | If you specify ZIP Files for **Import Format** and Import Schema Only for **Import Content** , this step is not required. | + | Task Error Handling Method | Specify **Task Error Handling Method** . ODC supports two error handling methods: **Abort Task** and **Ignore Error and Continue** . You need to select the handling method under the **Task Error Handling Method** label. | + | Sys Tenant Account Settings | Configure **Sys Tenant Account Settings** . Select **Use sys Account to Accelerate Import Task** or not. If you select this option, you need to enter the account and password of the SYS tenant in the **Account** and **Password** fields. Then, you can use permissions of this account to import data, which accelerates the import task.
            **Notice**
            - The account and password of a user in the SYS tenant are required. Do not enter @sys#cluster in the Account field. The following figure shows an example. ![Sys Tenant Account Settings](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/0342179361/p348256.png)
            - To export objects other than tables and views, you must specify the SYS tenant account.
            - Otherwise, annotations and indexes are not imported or exported. | + + + +3. Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + +4. Click **Import** . The import task is created. + + + + + + +View an import task +---------------------------------------- + +### Task information + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Information** in the upper-right corner of the panel to view the basic task information, information about the imported files, and information about the imported objects. + + +| Item | Description | +|------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic information | Displays the basic information of the task, such as **Task ID** , **Connection** , **Database** , and **Task Type** . | +| Information about imported files | Displays information that you specified when you created the import task, such as **Import Format** , **Import File** , **Encoding Standard** , **Import Content** , **Data Format** , **Import Data Settings** , **Task Error Handling Method** , **Sys Tenant Account Settings** , and **CSV Settings** , | +| Information about imported objects | Displays the information of imported objects and the progress of the import task, such as **Object Name** , **Object Type** , **Planned Processing Quantity** , **Actual Processing Quantity** , and **Data Processing Status** . | + + + +### Task logs + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Logs** in the upper-right corner of the panel to view the alert logs and all logs of the task. + + +| Field | Description | +|------------|----------------------------------------------------------------------------------------------------------------------------| +| All Logs | Displays the **INFO** , **ERROR** , and **WARN** logs of the task. | +| Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. | + + diff --git a/en-US/7.client-odc-user-guide/8.client-odc-task-management/3.client-odc-export-tasks.md b/en-US/7.client-odc-user-guide/8.client-odc-task-management/3.client-odc-export-tasks.md new file mode 100644 index 00000000..2f96b2ea --- /dev/null +++ b/en-US/7.client-odc-user-guide/8.client-odc-task-management/3.client-odc-export-tasks.md @@ -0,0 +1,169 @@ +Export tasks +================================= + +After you create a batch or single table export task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Import** tab of the **Task Center** page. + +On the management page of the database connection, click **Task** in the navigation bar on the top of the page to go to the Task Center page. Click **Export** to display the task list. + +> **Note** +> ODC allows you to run up to three export tasks in parallel, while subsequent tasks wait in the queue. + + + +Task list +------------------------------ + +On the Export tab, the task list displays the tasks created in the recent 48 hours. The list displays the following information. You can filter and sort the tasks based on the information. + +* Connection: the name of the database connection to which the task belongs. + + + +* Task Name: the name of the task that you specified when you created the task. + + + +* Creation Time: the date and time when the task was created. + + + +* Task Status: the current status of the task. Valid values: **Running** , **Aborted** , **Completed** , and **Failed** . ODC provides different management actions for tasks in different states. + + + +* Actions: This column provides task management options, such as **View** , **Download** , **Retry** , **Abort** , and **Delete** . + + + + + + +| Action | Description | +|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View | Click this button to go to the task details page to view the **task information** and **task logs**. | +| Download | Click this button to download the exported file to your local device when the task is completed. | +| Retry | Click this button to restart the task when the task fails. | +| Abort | Click this button to abort a task that is not completed. | +| Delete | Click this button to delete the task from the task list when the task is aborted, completed, or failed. | + +Create an import task +------------------------------------------ + +1. In the task center panel that pops up, click **+** on the right side of **Export**, and a new export task panel will pop up. + +2. Specify the export content + + ODC supports three export modes: **Export Schema and Data**, **Export Data Only**, and **Export Schema Only**. **Export Schema Only** exports the definition statements of the target object. You can select the export content from the **Export Content** drop-down list. + +3. Select a database + + Select the database where the object to export resides. The name of the database connection to which the task belongs is also displayed. + +4. Specify the export range + + You can select **Partial Export** or **Full Export**. + + * If you select **Partial Export**, you can select the objects you want to export in the **Select Objects** pane in the **Export Objects** section. You can use the search box to search for desired objects. + + + * If you select **Full Export**, all objects in the database are exported. + +5. Go to the Export Settings panel + + Click **Next: Export Settings** to specify the file export settings and the sys tenant account. + + +6. Go to the Data File Settings panel + + a. Specify Data Format. + + ODC supports exporting data to files in the CSV format and SQL format. If you specify **Export Schema Only** for **Export Content**, you can only export data to files in the SQL format. For more information about formats, see [Export and import formats](../5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md). + + b. Specify File Encoding. + + ODC supports the following encoding standards: **ASCII**, **ISO-8859-1**, **GB2312**, **GBK**, **GB18030**, **Unicode (UTF-8)**, **Unicode (UTF-16)**, **Unicode (UTF-32)**, and **BIG5**. You can select the encoding standard from the **File Encoding** drop-down list. + + c. Specify Data File Settings. + + If you select **Export Schema Only** for **Export Content**, you do not need to configure the export data settings. You need to specify the following fields: + + * **Use Global Snapshot**: If you select this option, ODC exports the data in the latest global snapshot of the specified table to ensure global data consistency. + + + + * **Batch Commit Quantity (SQL Format)**: You can click **Advanced** next to **Export Data Settings** to specify this field. If you select **SQL Format** for **Data Format**, you can specify the number of rows to be committed during the export. When this number is reached, a `COMMIT` command is executed. + + + + * Specify information for the CSV format. + +7. Specify schema file settings + + Choose whether to select **Add DROP TABLE Statement before CREATE TABLE Statement**. If you select this option, a `DROP` statement is added before the corresponding `CREATE` statement of an object when the schema files of the object are exported. + +8. Select an execution method + + Select **Execute immediately** or **Timed execution**. + +9. Set up the sys tenant account + + a. Choose whether to select **Use sys Tenant Account to Accelerate Export Task**. If you select this option, specify **Account** and **Password**. + + + + b. After you specify the account and password, you can click the **Test Connection** button next to the password box to verify whether the account information is valid. By default, the account for the connection settings is automatically filled in. If the connection fails, we recommend that you change the password for this export. + + > **Notice** + > - The account and password of the sys tenant are the account and password of a user in a cluster tenant. Do not enter `@sys#cluster` in the **Account** field. The following figure shows an example.
            ![Sys Tenant Account Settings](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%20sys%20%E7%A7%9F%E6%88%B7%E8%B4%A6%E5%8F%B7%E8%AE%BE%E7%BD%AE.png) + > + > - If the account of the sys tenant is not configured, comments and indexes are not imported or exported. + + +10. Retain Current Configuration + + Check **Retain Current Configuration** to keep the current part of the data file and structure file configuration. + +11. Generate an export task + + + After you specify all preceding information, you can click **Export** in the lower-right corner of the panel to create an export task and export the backup file directly to a local directory. + + + +Task details +--------------------------------- + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Information** in the upper-right corner of the panel to view the basic task information, information about the exported files, and information about the exported objects. + +* Basic task information: displays information such as **Task Name** , **Connection Name** , **Mode Name** , **Task Type** , **Creation Time** , **Retry Limit** , and **Retry Time** . + + + +* Information about exported files: displays information that you specified when you created the import task, such as **Export** **Content** , **Data Format** , **Encoding Standard** , **Export Data Settings** , **Export Schema Settings, Task Error Handling Method** , and **Sys Tenant Account Settings** . + + + +* Information about exported objects: displays the data export progress of the selected object, including + + information such as **Object Name** , **Object Type** , **Schema Processing Status** , **Total Record Number** , **Processed Data Entries** , and **Data Processing Status** . + + + + + +Task logs +------------------------------ + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Logs** in the upper-right corner of the panel to view the alert logs and all logs of the task. + +* All Logs: displays the full information of all task logs, including **INFO** , **ERROR** , and **WARN** logs. + + + +* Alert Logs: Alert logs include the **ERROR** and **WARN** logs of the task. If the task failed, you can view alert logs to learn of the error information. + + + + + + diff --git a/en-US/7.client-odc-user-guide/8.client-odc-task-management/4.client-odc-data-mocking-tasks.md b/en-US/7.client-odc-user-guide/8.client-odc-task-management/4.client-odc-data-mocking-tasks.md new file mode 100644 index 00000000..7c45e0e6 --- /dev/null +++ b/en-US/7.client-odc-user-guide/8.client-odc-task-management/4.client-odc-data-mocking-tasks.md @@ -0,0 +1,59 @@ +Data mocking tasks +======================================= + +After you create a data mocking task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Mock Data** tab of the **Task Center** page. + +On the management page of the database connection, click **Task** in the navigation bar in the upper part of the page to go to the Task Center page. Then, click **Mock Data** to display the task list. + +Task list +------------------------------ + +On the Mock Data task tab, the task list displays the following fields. You can filter and sort the tasks based on these fields. + +* Connection: the name of the database connection to which the task belongs. + + + +* Task Name: the name of the task that you specified when you created the task. + + + +* Creation Time: the date and time when the task was created. + + + +* Task Status: the current status of the task. Valid values: **Running** , **Aborted** , **Completed** , and **Failed** . ODC provides different management actions for tasks in different states. + + + +* Actions: provides task management options, such as **View,** **Download** , **Abort,** and **Delete.** + + + + + + +| Action | Description | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| View | Click this button to go to the Task Details page to view the **task information** and **task details**. | +| Download | Click this button to download the SQL file that corresponds to the mock data to your local device. | +| Abort | Click this button to abort a task that is not completed. | +| Delete | Click this button to delete the task from the task list when the task is aborted, completed, or failed. | + + + +Task details +--------------------------------- + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Information** in the upper-right corner of the panel to view the basic task information and the data mocking settings. + +* Basic task information: displays information such as **Task Name** , **Connection Name** , **Mode Name** , **Task Type** , and **Creation Time** . + + + +* Data mocking settings: displays the settings information specified when the data mocking task was created, including **Target Table** , **Mock Data Volume** , **Batch Size** , **Clear Table Before Mock Data Insertion** , **Data Conflict Handling Mode** , **Actual Insertion Records** , **Conflict Records** , **Ignore Insertion** , **Clear Records** , and **Rule Settings** . + + + + + diff --git a/en-US/7.client-odc-user-guide/8.client-odc-task-management/5.client-odc-database-change-task.md b/en-US/7.client-odc-user-guide/8.client-odc-task-management/5.client-odc-database-change-task.md new file mode 100644 index 00000000..155b86f4 --- /dev/null +++ b/en-US/7.client-odc-user-guide/8.client-odc-task-management/5.client-odc-database-change-task.md @@ -0,0 +1,50 @@ +Database Change +==================================== + +After you create a data mocking task in OceanBase Developer Center (ODC), you can view the task in the task list on the **Asynchronous Execution** tab of the **Task Center** page. + +Task list +------------------------------ + +In the management page of the database connection, click **Task Center** in the top navigation bar to open the Task Center page. Click **Asynchronous Execution** to display the task list. + + +After you open the Asynchronous Execution tab, the following list appears. You can filter and sort the tasks in the list. + + +| Parameter | Description | +|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Connection | The name of the database connection to which the task belongs. | +| Task Name | The name of the task. | +| Created At | The date and time when the task was generated. | +| Task Status | The current status of the task. Valid values: **Preparing** , **Running** , **Aborted** , **Completed** , and **Failed** . ODC provides different management actions for tasks in different states. | +| Actions | Provides task management options such as **View** , **Abort** , and **Delete** . * View: Click this button to go to the task details page to view the **task information** and **task logs**. * Abort: Click this button to abort a task that is not completed. * Delete: Click this button to delete the task from the task list when the task is aborted, completed, or failed. | + + + +Task information +------------------------------------- + + +Click **View** in the Actions column of the row where the target task is located. The Task Details panel appears. Click the **Task Information** tab to view the basic task information and the asynchronous execution settings. + + +| Parameter | Description | +|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Basic Task Information | Displays the basic information about the task, including **Task Name** , **Created At** , **SQL Content** , **Delimiter, Query Result Limit, Task Error Handling Method** , **Execution Timeout Value** , and **Description** . | +| Task Execution Information | Displays the execution information about the task, including **Execution Result** , and **Execution Failure Records** . **Note** If the task contains a SELECT statement, the **Query** **Results** and **Download Results** buttons are provided in the task details. * Query Results: Click this button to go to the SQL window that displays the SQL query results. * Download Results: Click this button to download a compressed file that contains the query results (in CSV format) of one or more SELECT statements. | + + + +Task logs +------------------------------ + +Click **View** in the Actions column of the row where the target task is located. The task details panel appears. Click **Task Logs** in the upper-right corner of the panel to view the alert logs and all logs of the task. + + +| Parameter | Description | +|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| All Logs | Displays the full information of all task logs, including **INFO** , **ERROR** , and **WARN** logs. You can click **Find** , **Download** , or **Copy** to search for, download, or copy all logs. | +| Alert Logs | Alert logs include the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. You can click **Find** , **Download** , or **Copy** to search for, download, or copy all alert logs. | + + diff --git a/en-US/7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-partition-scheme-task.md b/en-US/7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-partition-scheme-task.md new file mode 100644 index 00000000..098de9a1 --- /dev/null +++ b/en-US/7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-partition-scheme-task.md @@ -0,0 +1,99 @@ +# Partitioning plan task + + + +## Background + +OceanBase Developer Center (ODC) allows users to apply for permissions on partitioning plans from the administrator of the public resource console. + +After a user creates a partitioning plan task in **Task Center**, the administrator can approve the task on the Tasks page in Task Center. The user can view the task information and approval status on the Tasks page in Task Center. + +## Task list + +> **Note** +> The task list displays the tasks in the last 48 hours. + +After you enter the target database connection, click **Task Center** in the top navigation bar to open the Task Center panel. Click the **Partition Plan** tab to view the partitioning plan tasks. + + +The following table describes the columns contained in the task list on this tab. You can filter and sort the tasks in the list. + +| **Column** | **Description** | +|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Task ID | The ID of the task. | +| Task Type | The type of the task specified when you created the task. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter tasks by connection. | +| Database | The name of the target database where the task operates. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks of a specific database. | +| Created By | The user who created the task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for the creator. | +| Created At | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | Provides task management operations such as **View**, **Approve/Reject**, and **Abort**.
            • View: Click this button to go to the task details page to view information about the target task.
            • Approve/Reject: Click this button to approve or reject the application.
            • Abort: Click this button to abort a running task.
            | + +## Create a partitioning plan task + + +1. In the Task Center panel that appears, click the **Partition Plan** tab and then the **Create Partition Plan** button to create a partitioning plan task. + + +2. In the **Create a partition plan** panel, specify the following information. + + | **Parameter** | **Description** | + |---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Connection | The connection to which the partitioning plan belongs. The default value is the current connection. | + | Partition policy | The information about the partitioning strategy. Search for and select a RANGE-partitioned table in the database and edit its partitioning strategy.
            • You can select **Only tables that are not set are displayed** on the right side of Partition policy to display only tables with no partitioning strategies.
            • You can also select multiple RANGE-partitioned tables and configure a partitioning strategy for them at a time.
            • In the **Partition policy** column, click the edit icon and then you can edit the number of partitions to create, partitioning interval, retention period, and naming rules.
            | + | Remarks (Optional) | Enter the reason for application. | + +3. Click **Submit**. + + > **Note** + > After you submit the application, the task will automatically match the default partitioning plan task application process in the public resource console. + > For more information about task processes, see [Task process management](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md). + + + +## View a partitioning plan task + +### **Task information** + + +1. Click **Task Center** in the top navigation bar, and click the **Partition Plan** tab. In the task list on the tab, click **View** in the Actions column of the target task to view its details. + + +2. In the **Task Details** panel, click the **Task Information** tab and view the basic task information and task settings. + + | Item | Description | + |---------|--------------------------------------------------------------------------------| + | Basic task information | You can view the task status, task ID, task type, connection, inspection cycle, remarks, creator, and creation time. | + | Task settings | You can view the partitioning strategy of the RANGE-partitioned table selected when you created the partitioning plan task. | + +3. In the task information panel, click **Initiate Again** in the lower-right corner to initiate the task again. + +### **Task Process** + +1. In the **Task Details** panel, click the **Task Process** tab to view information about the task process, including the task initiation information, approval status, execution status, and completion status. + + +2. You can click **Initiate Again** in the lower-right corner of the panel to re-initiate the task. + +### Associated records + +1. In the **Task Details** panel, click the **Associated Records** tab to view information including the task ID, database, creation time, task status, and supported actions such as view. + +2. You can click **Initiate Again** in the lower-right corner of the panel to initiate the task again. + +### Task logs + +1. In the **Task Details** panel, click the **Task Logs** tab and view all logs and alert logs of the task. + + | Item | Description | + |------|-----------------------------------------------------------------------------------------------------------------------------| + | All Logs | Displays the **INFO**, **ERROR**, and **WARN** logs of the task. You can click **Find**, **Download**, or **Copy** to search for, download, or copy all logs. | + | Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs. You can click **Find**, **Download**, or **Copy** to search for, download, or copy alert logs. | + +2. Click **Initiate Again** to initiate the task again. + + +## Related topics + + +[Create a partitioning plan](../../7.client-odc-user-guide/5.client-odc-use-tools/3.client-odc-partition-scheme.md) \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-shadow-table-synchronization-task.md b/en-US/7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-shadow-table-synchronization-task.md new file mode 100644 index 00000000..2c3ed2ba --- /dev/null +++ b/en-US/7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-shadow-table-synchronization-task.md @@ -0,0 +1,108 @@ +# Shadow table synchronization tasks + +## Background + +OceanBase Developer Center (ODC) allows you to apply for permissions to create shadow table synchronization tasks from the administrator of the public resource console. + +After you create a shadow table synchronization task in **Task Center**, the administrator can approve the task in the task list in **Task Center**, where you can view the task information and approval status. + +## Task list + +> **Note** +> The task list displays the tasks created in the last 48 hours. + +After you enter the target database connection, click **Task Center** in the top navigation bar to open the **Task Center** panel. Click the **Synchronize Shadow Table** tab to view the shadow table synchronization tasks. + + +The following table describes the columns contained in the task list on this tab. You can filter and sort the tasks in the list. + +| **Column** | **Description** | +|---------|----------------------------------------------------------------------------------------------------| +| Task ID | The ID of the task. | +| Task Type | The type of the task specified when you created the task. | +| Connection | The name of the database connection to which the task belongs. You can click the filter icon ![Filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg) to filter tasks by connection. | +| Database | The name of the target database where the task operates. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks of a specific database. | +| Created By | The user who created the task. You can click the search icon ![Search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg) to search for tasks created by a specific creator. | +| Created At | The date and time when the task was generated. | +| Task Status | The current status of the task. ODC provides different management actions for tasks in different states. | +| Actions | The task management actions, including: **View**, **Approve/Reject**, and **Abort**.
            • View: You can click this button to go to the task details page to view the task information and task process.
            • Approve/Reject: You can click this button to approve or reject the task.
            • Abort: You can click this button to abort a running task.
            | + + +## Create a shadow table synchronization task + +1. On the **Task Center** panel that appears, choose **Synchronize Shadow Table** > **Create Shadow Table Synchronization Project**. + + +2. On the **Create Shadow Table Synchronization Project** panel, specify the following information. + + 1. Select a synchronization object. + + + | **Field** | **Description** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Database | The database to which the shadow table to be created belongs. You can view the name of the current connection. | + | Synchronization Range | The table to be synchronized.
            • **Partial Tables**: Shadow tables will be created in the current database for the selected tables.
            • **All Tables**: Shadow tables will be created in the current database for all tables in the source database.
            | + | Name of Shadow Table | The name of the shadow table, in the format of **prefix** + source table name or source table name + **suffix**. You can use custom prefix or suffix. | + | Synchronization Objects | The source tables to be synchronized as shadow tables. You must specify this field when **Synchronization Range** is set to Partial Tables. | + + 2. Analyze the schema of the shadow table. + + + | **Field** | **Description** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Synchronized Tables | The **Synchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **View** to view the source table schema, shadow table schema, and schema change SQL statement, or click **Skip**, indicating that this shadow table is not synchronized. | + | Unsynchronized Tables | The **Unsynchronized Tables** tab displays the source table name, shadow table name, and analysis result. You can click **Undo Skip** to synchronize this shadow table.
            **Note**:
            A skipped table will be displayed on the **Unsynchronized Tables** tab. If a shadow table with the same name and the same schema as the source table already exists, schema synchronization will be skipped.
            | + | SQL Preview | The SQL statement for schema synchronization. | + | Task Settings | Options of **Execution Mode** include:
            • **Execute Immediately**: The synchronization task is executed immediately.
            • **Execute On Schedule**: The synchronization task is executed on schedule.
            | + | Task Settings | Options of **Task Error Handling Method** include:
            • **Abort Task**: If an error occurs during the execution of the synchronization task, the subsequent SQL scripts are interrupted and no longer executed.
            • **Ignore Error and Continue**: If an error occurs during the execution of the synchronization task, the SQL script with the error is skipped, but subsequent SQL scripts will be executed.
            | + | Remarks | The business background of the project, such as the change purpose and expected goal. | + +3. Click **Submit**. + + > **Note** + > After a task is created, the task will automatically match the application process of shadow table synchronization task created by the administrator on the public resource console. + > Tasks will be executed based on the priority order set by the administrator in **Set Priority** on the public resource console. + +## View the shadow table synchronization task + +### Task information + + +1. Click **Task Center** in the top navigation bar, and click the **Synchronize Shadow Table** tab. In the task list on the tab, click **View** in the **Actions** column of the target task to view its details. + +2. On the **Task Details** panel, click the **Task Information** tab to view the basic task information and task settings. + + | **Information** | **Description** | + |---------|---------------------------------------------------------------------------------------------------------| + | Basic information | You can view the status, ID, type, connection, database, execution mode, error handling method, remarks, creator, and creation time of the task. | + | Task settings | You can view the tables to be synchronized, tables not to be synchronized, and SQL scripts to be executed. | + + +3. On the **Task Details** panel, click **Initiate Again** in the lower-right corner to initiate the task again. + +### **Task Process** + + +1. In the **Task Details** panel, click the **Task Process** tab to view information about the task process, including the task initiation information, approval status, execution status, and completion status. + + +2. You can click **Initiate Again** in the lower-right corner of the panel to re-initiate the task. + +### Task logs + + +1. On the **Task Details** panel, click the **Task Logs** tab to view all logs and alert logs of the task. + + | Item | Description | + |------|-----------------------------------------------------------------------------------------------------------------------------| + | All Logs | Displays the complete information of all task logs, including **INFO**, **ERROR **, and **WARN** logs.
            You can click **Search**, **Download**, or **Copy** to search for, download, or copy all logs. | + | Alert Logs | Displays the **ERROR** and **WARN** logs of the task. When a task fails, you can view the error message in the alert logs.
            You can click **Search**, **Download**, or **Copy** to search for, download, or copy alert logs. | + + +2. You can click **Initiate Again** to initiate the task again. + + + +## Related topics + +[Create a shadow table synchronization](../5.client-odc-use-tools/5.client-odc-shadow-table-synchronization.md) \ No newline at end of file diff --git a/en-US/7.client-odc-user-guide/9.client-odc-session-management.md b/en-US/7.client-odc-user-guide/9.client-odc-session-management.md new file mode 100644 index 00000000..af3b36df --- /dev/null +++ b/en-US/7.client-odc-user-guide/9.client-odc-session-management.md @@ -0,0 +1,81 @@ +Session management +======================================= + +A session is a connection between an application and a database. On the Session Management page of OceanBase Developer Center (ODC), you can view the details of all the sessions connected to the current database. The Session Properties page of ODC provides a graphical interface where you can view and modify the session variables and global variables that the current database supports. + +After you enter a database connection in ODC, click **Session** in the top navigation bar and then choose **Session properties** or **Session management** to go to the corresponding page. + +![Image 186](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86-1-EN.png) + +Session properties +--------------------------------------- + +![Session management 2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7729169361/p203464.png) + +The session properties are database variables. OceanBase Database provides two types of variables: session variables and global variables. + +* **Session variables** : When a client connects to a database, the database copies the global variables to automatically generate session variables. The modification of session variables takes effect on the current session only. + +* **Global variables** : Global variables are shared by all the instances of a database. These variables are shared among different users. When you modify a global variable, the database saves the modification, which remains valid after you disconnect from and reconnects to the database. + + + +> **Note**
            +>
          • The current ODC version does not allow you to edit global variables. You can modify session variables.
          • +>
          • In ODC, multiple identical connections share one single session. In ODC V2.3.2 and later versions, auto-commit is turned off by default in Oracle mode, so you need to manually commit transactions. You can modify the value of the autocommit parameter to change this setting.
          • +>
          • In manual-commit mode, make sure to set ob_trx_idle_timeout to a value greater than the timeout duration of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of ob_trx_idle_timeout, the connection will be terminated. However, if ob_trx_idle_timeout is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you need to set this parameter to a proper value.
          • + + + + + + +ODC provides a graphical interface where you can view and modify the variables that the current database supports. Take note of the following items related to the modification of variables: + +* In the current ODC version, session variables have two modes: display mode and edit mode. To modify a variable, select the variable and click Edit in the toolbar to go to the editing page. After you edit a variable, click **OK** . On the SQL Confirmation page, click **Execute** to apply the modification. + + + +* To modify a variable of a character or numeric type, you can directly enter the new value on the Edit page. + + + +* To modify a variable of an enumeration type, ODC lists the values that the variable supports in the edit box. This allows you to modify the variable in a graphical interface without having to memorize its name or value, which saves your memorization efforts and increases the efficiency of variable modification. + + + + + + +Session management +--------------------------------------- + +A session is a connection between an application and a database. On the Session Management page, you can view all the sessions connected to the current database and the following session information: + + +| Information | Description | +|--------------------|---------------------------------------------------------------------| +| Session ID | The ID that uniquely identifies the current session. | +| User | The username used to log on to the database in the current session. | +| Source | The address from which the session is initiated. | +| Database name | The name of the database accessed in the session. | +| Status | The state of the session. Valid values: **SLEEP** and **ACTIVE** . | +| Command | The type of the command being executed in the session. | +| Execution Time (s) | The time in seconds spent on executing the current SQL query. | +| SQL | The actual SQL query being executed in the session. | +| OBProxy | The address of the proxy used for the session. | + + +![Manage sessions](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/7729169361/p203463.png) + +The Session Management page provides the following buttons in the navigation bar for you to manage sessions. + +* **Refresh** : Click this button to refresh the session list. + +* **Close Session**: Click this button to terminate the current session. + +* **Close current query processes of the session** : Click this button to terminate the ongoing SQL execution processes in the session. +> **Note**
            +> On the Session Management page, you can move the pointer over the SQL column of a session to view the SQL statements of the session in full. + + diff --git a/en-US/8.deployment-guide/1.deployment-overview.md b/en-US/8.deployment-guide/1.deployment-overview.md new file mode 100644 index 00000000..1ff1c9a2 --- /dev/null +++ b/en-US/8.deployment-guide/1.deployment-overview.md @@ -0,0 +1,18 @@ +Deployment overview +======================================== + +ODC is an enterprise-level database development platform tailored for OceanBase Database. ODC adopts the mature browser/server architecture and is accessible through either the Web or client version. + +This topic shows you how to deploy the web version of ODC. The client version does not need deployment and you can use it directly after installation. For more information about installing the client, see [Install ODC](../7.client-odc-user-guide/1.client-odc-install-odc.md). + +Single-node deployment +------------------------------------------- + +In single-node deployment, only one ODC node is deployed. This node handles all user requests. This deployment is simple and consumes fewer resources. + +High-availability deployment +------------------------------------------------- + +In high-availability deployment, the ODC application is deployed on several server nodes. NGINX is installed on one of the servers as a reverse proxy to handle user requests. Therefore, in single-node deployment, user requests are sent directly to the ODC application, while in high-availability deployment, user requests are first sent to the server where NGINX is deployed, and are then directed to the ODC application on different servers. + +One benefit of high-availability deployment is service continuity. If one node is down, NGINX automatically forwards the traffic to other nodes. In addition, high-availability deployment supports more concurrent users and handles more requests than single-node deployment. diff --git a/en-US/8.deployment-guide/2.preparations-before-deployment.md b/en-US/8.deployment-guide/2.preparations-before-deployment.md new file mode 100644 index 00000000..f6d3f2c6 --- /dev/null +++ b/en-US/8.deployment-guide/2.preparations-before-deployment.md @@ -0,0 +1,76 @@ +Preparations before deployment +=================================================== + +Before you deploy OceanBase Developer Center (ODC), you must prepare the MetaDB and the server. After ODC is deployed, log on to Web ODC in Google Chrome. + +MetaDB +--------------------------- + +The MetaDB stores connections created by users in ODC and user data generated in ODC after operations such as script execution. You must get the MetaDB (in MySQL mode of OceanBase Database) ready before you deploy Web ODC. The MetaDB of Client ODC is automatically created when you use Client ODC for the first time. Therefore, you do not need to manually prepare the MetaDB for Client ODC. + +**Procedure:** + +1. Apply for a tenant in MySQL mode of OceanBase Database. Allocate 2 CPU cores and 8 GB of memory to the tenant. You can name the tenant as you like. This topic uses the cluster name of odc_cluster and the tenant name of odc_tenant as an example. + + > **Note**
            + > - ODC V3.3.0 and later versions provide management capabilities for enterprises, such as change process and operation audit.
            + > - For ODC V3.3.1 and later versions, there is no restriction on MetaDB versions. + > - 2C8G or a higher configuration is recommended for the OceanBase tenant of MetaDB. A low configuration may cause performance problems. + + + + + + + +2. Create a database in the tenant as the MetaDB, and then create a user to access this MetaDB. You can set the MetaDB name, username, and password as you like. This topic uses odc_metadb as the sample MetaDB name. Both the database username and password are obodc. + + + +3. Note down the name of the MetaDB, the username, the password, the tenant name, and the cluster name, which will be passed as parameters during the deployment of ODC. + + + + + + +Server +--------------------------- + +The server on which Web ODC is deployed must be configured based on the number of ODC users: + +* ≤ 20 ODC users: 4 CPU cores and 8 GB of memory; + + + +* ≤ 100 ODC users: 4 CPU cores and 16 GB of memory; + + + +* ≤ 500 ODC users: 8 CPU cores and 32 GB of memory; + + + +* \> 500 ODC users: Adjust the resource specifications as needed. + + + + + + +To enable the lightweight deployment, ODC uses a container image. Make sure that Docker is installed on the server so that you can pull and run the image. + +Browser +---------------------------- + +We recommend that you use Google Chrome 78 or later to access Web ODC. + +Configure whitelist +---------------------------------------- + +For ODC V3.3.1 and later versions, the whitelist configuration feature is added for defense against server-side request forgery (SSRF) attacks: To configure a whitelist, connect to MetaDB of ODC as the deployment administrator, access this connection, and execute ``UPDATE config_system_configuration SET `value`='x.x.x.x' WHERE `key` = 'odc.connect.host-white-list';``. The whitelist can contain multiple IP addresses separated with commas, but does not support CIDR blocks. + +Install and run the Docker container +--------------------------------------------------------- + +For more information about how to install and run the Docker container, see [Use bind mounts](https://docs.docker.com/storage/bind-mounts/). diff --git a/en-US/8.deployment-guide/3.deploy-a-single-odc-node/1.deployment-process.md b/en-US/8.deployment-guide/3.deploy-a-single-odc-node/1.deployment-process.md new file mode 100644 index 00000000..e46c897f --- /dev/null +++ b/en-US/8.deployment-guide/3.deploy-a-single-odc-node/1.deployment-process.md @@ -0,0 +1,16 @@ +Deployment process +======================================= + +To deploy OceanBase Developer Center (ODC) on a single server, load and run the ODC image on the server to install ODC. + +When you log on to Web ODC in a browser over HTTP for the first time, you will receive a message indicating that the connection is not secure. To ensure access security, you can configure an SSL certificate and deploy the NGINX image on the single-node ODC server by referring to the procedure for the high-availability deployment mode. + +> **Note**
            +> - The default username and password can be obtained from the administrator.
            +> * For the administrator, the default username is admin, and the default password is aaAA 11__. + +For more information about how to log on to Web ODC, see User Guide (Web ODC) > Log on to ODC > Log on to ODC with an account. + + + + diff --git a/en-US/8.deployment-guide/3.deploy-a-single-odc-node/2.load-and-run-single-odc-images.md b/en-US/8.deployment-guide/3.deploy-a-single-odc-node/2.load-and-run-single-odc-images.md new file mode 100644 index 00000000..68d37e9a --- /dev/null +++ b/en-US/8.deployment-guide/3.deploy-a-single-odc-node/2.load-and-run-single-odc-images.md @@ -0,0 +1,87 @@ +Load and run an ODC image +============================================== + +After you initialize the MetaDB of OceanBase Developer Center (ODC), you need to obtain and run the ODC image on each node to install ODC. The single-node deployment of ODC is completed after the image runs successfully. + +Load the image +----------------------------------- + +To obtain the ODC image on the host, select the required image from the following list and click **Download** . + +* Image for X86: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz) + +* Image for ARM: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +After you obtain the image, run the following command in the command-line tool to load it: + +```javascript +gunzip -c obodc-{$version}.tar.gz docker load +``` + + + +Run the image +---------------------------------- + +Execute the following sample statement in the command-line tool to run the image: + +```javascript +#!/usr/bin/env bash +docker run --volume /var/log/odc:/opt/odc/log \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +You can run the `docker images` command to view the {image_tag} parameter on the host after you load the image. The following table describes other parameters used in the preceding sample statement. + + +| Parameter | Description | +|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --volume | Maps the `/var/log/odc` directory of the host to the `/opt/odc/log` directory in the ODC container. If the `/var/log/odc` directory does not exist on the host, run the `mkdir -p /var/log/odc` command to create one. | +| --net | The network configuration of the Docker container. If you set this parameter to `host`, the host network is directly used. You can also use the `--publish` (`-p`) parameter to configure port mapping. However, the Docker container may fail to start in some circumstances due to incorrect DNS resolution in the Docker container. In this case, run the `--net host` command to start the Docker container. | +| --cpu-period --cpu-quota | * The `---cpu-period` parameter specifies the interval at which the CPU cores of the Docker container are reallocated. Unit: microseconds. * The `---cpu-quota` parameter specifies the maximum time for running the current Docker container in this interval. Unit: microseconds. You can use these two parameters in combination to specify the number of CPU cores that the Docker container uses. The value is calculated by dividing `cpu-quota` by `cpu-period`. In the preceding sample statement, the values of cpu-quota and cpu-period are respectively 400000 and 100000, indicating that the Docker container can use at most four CPU cores. | +| --memory | The maximum memory size for the Docker container. | +| --name | The name of the container. | +| DATABASE_HOST | The IP address of the MetaDB. | +| DATABASE_PORT | The port number of the MetaDB. | +| DATABASE_USERNAME | The username of the MetaDB. In OceanBase Database, the username is given in the `db_user@tenant_name#cluster_name` format. | +| DATABASE_PASSWORD | The password for connecting to the database. | +| DATABASE_NAME | The name of the MetaDB. | +| ODC_PROFILE_MODE | The mode. Default value: `alipay`. | + + + +In addition to the preceding parameters, you can also use the following parameters when running the image. + + +| Parameter | Description | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | The log directory. Default value: `/opt/odc/log`. | +| OBCLIENT_WORK_DIR | The working directory of OBClient. Default value: `/opt/odc/data`. | +| ODC_JAR_FILE | The directory of JAR files. Default value: `/opt/odc/lib/odc-web-starter-*.jar`. | +| ODC_WORK_DIR | The working directory of ODC. Default value: `/opt/odc/script`. | +| ODC_JVM_HEAP_OPTIONS | The JVM stack memory. The default maximum value of the parameter `-Xmx` is 60% of available physical memory size. ODC checks whether the available memory in the current environment reaches 2048 MB before it starts a script. Assume that this parameter is set to 60%, the available memory must be at least 3.4 GB to start the script. If the available memory of the host or Docker container is less than 3.4 GB, you can skip memory check by setting the `ODC_JVM_HEAP_OPTIONS` parameter. For example, you can set it to `"-Xmx2048m -Xms2048m"`. | +| ODC_JVM_GC_OPTIONS | The garbage collection (GC) strategy for JVM. Default value: `-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`. | +| ODC_JVM_OOM_OPTIONS | The OutOfMemory strategy for JVM. Default value: `-XX:+ExitOnOutOfMemoryError`. | +| ODC_JVM_EXTRA_OPTIONS | Other JVM parameters. By default, no parameter is specified. | +| ODC_SERVER_PORT | The HTTP listening port for ODC-Server. Default value: 8989. | +| ODC_HOST | The IP address of ODC, which can be used as the destination IP address for remote procedure calls in high-availability deployment scenarios. | +| ODC_RPC_PORT | The port number of ODC, which can be used as the destination port number for remote procedure calls in high-availability deployment scenarios.
            **Note**
            This parameter is independent of the ODC_SERVER_PORT parameter. It is required only for initiating remote procedure calls. | +| ODC_APP_EXTRA_ARGS | Other App parameters need to be specified.
            For example, `--server.servlet.session.timeout=10m`, indicating that the Session period is 10 minutes. The default value is empty. | +| ODC_MAPPING_PORT | +The port number of the ODC runtime to avoid the problem that the port number cannot be used due to the deployment environment. This parameter is suitable for port mapping when deploying ODC in Docker. | +| ODC_APP_EXTRA_ARGS | Other App parameters need to be specified.
            For example, `--server.servlet.session.timeout=10m`, indicating that the Session period is 10 minutes. The default value is empty. | +| ODC_SERVER_RPC_PORT | The internal RPC listening port for ODC-Server. Default value: 8990. | diff --git a/en-US/8.deployment-guide/4.deploy-the-ha-odc/1.ha-odc-deployment-process.md b/en-US/8.deployment-guide/4.deploy-the-ha-odc/1.ha-odc-deployment-process.md new file mode 100644 index 00000000..75cf4b14 --- /dev/null +++ b/en-US/8.deployment-guide/4.deploy-the-ha-odc/1.ha-odc-deployment-process.md @@ -0,0 +1,29 @@ +Deployment process +======================================= + +To deploy OceanBase Developer Center (ODC) in high-availability deployment mode, you can load and run the ODC image on multiple servers. Then, you can deploy the NGINX image on one of these servers to distribute user requests among them. + +![deploy ha](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E9%83%A8%E7%BD%B2%E9%AB%98%E5%8F%AF%E7%94%A8-EN.png) + +The high-availability deployment of ODC requires four steps: + +1. [Load and run an ODC image](../4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md): Run the ODC image separately on multiple nodes to install ODC. + + + +2. [Deploy SSL certificate](../4.deploy-the-ha-odc/3.deploy-ssl-certificates.md): When you log on to Web ODC in a browser over HTTP for the first time, you will receive a message indicating that the connection is not secure. To ensure access security, you can deploy an SSL certificate to access ODC over HTTPS. If you do not want to access ODC over HTTPS, you can skip this step and directly deploy NGINX. + + + +3. [Deploy the NGINX proxy](../4.deploy-the-ha-odc/4.deploy-nginx-proxy.md): Pull and run the NGINX image on one of the nodes to implement high-availability deployment. + + + +4. [Configure certificate trust](../4.deploy-the-ha-odc/5.configure-certificate-trust.md): Some browsers do not trust a self-signed certificate. You need to manually configure certificate trust in the browser. + + > **Note**
            + > - The default username and password can be obtained from the administrator.
            + > - For the administrator, the default username is admin, and the default password is aaAA 11__. + + + For more information about how to log on to Web ODC, see User Guide (Web ODC) > Log on to ODC > Log on to ODC with an account. \ No newline at end of file diff --git a/en-US/8.deployment-guide/4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md b/en-US/8.deployment-guide/4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md new file mode 100644 index 00000000..896f5086 --- /dev/null +++ b/en-US/8.deployment-guide/4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md @@ -0,0 +1,88 @@ +Load and run an ODC image +============================================== + +After you initialize the MetaDB of OceanBase Developer Center (ODC), you need to obtain and run the ODC image on each node to install ODC. + +Load the image +----------------------------------- + +To obtain the ODC image on the host, select the required image from the following list and click **Download** . + +* Image for X86: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz) + +* Image for ARM: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +After you obtain the image, run the following command in the command-line tool to load it: + +```javascript +gunzip -c obodc-{$version}.tar.gz docker load +``` + + + +Run the image +---------------------------------- + +Execute the following sample statement in the command-line tool to run the image: + +```javascript +#!/usr/bin/env bash +docker run --volume /var/log/odc:/opt/odc/log \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +You can run the `docker images` command to view the {image_tag} parameter on the host after you load the image. The following table describes other parameters used in the preceding sample statement. + + +| Parameter | Description | +|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --volume | Maps the `/var/log/odc` directory of the host to the `/opt/odc/log` directory in the ODC container. If the `/var/log/odc` directory does not exist on the host, run the `mkdir -p /var/log/odc` command to create one. | +| --net | The network configuration of the Docker container. If you set this parameter to `host`, the host network is directly used. You can also use the `--publish` (`-p`) parameter to configure port mapping. However, the Docker container may fail to start in some circumstances due to incorrect DNS resolution in the Docker container. In this case, run the `--net host` command to start the Docker container. | +| --cpu-period --cpu-quota | * The `---cpu-period` parameter specifies the interval at which the CPU cores of the Docker container are reallocated. Unit: microseconds. * The `---cpu-quota` parameter specifies the maximum time for running the current Docker container in this interval. Unit: microseconds. You can use these two parameters in combination to specify the number of CPU cores that the Docker container uses. The value is calculated by dividing cpu-quota by cpu-period. In the preceding sample statement, the values of cpu-quota and cpu-period are respectively 400000 and 100000, indicating that the Docker container can use at most four CPU cores. | +| --memory | The maximum memory size for the Docker container. | +| --name | The name of the container. | +| DATABASE_HOST | The IP address of the MetaDB. | +| DATABASE_PORT | The port number of the MetaDB. | +| DATABASE_USERNAME | The username of the MetaDB. In OceanBase Database, the username is given in the db_user@tenant_name#cluster_name format. | +| DATABASE_PASSWORD | The password for connecting to the database. | +| DATABASE_NAME | The name of the MetaDB. | +| ODC_PROFILE_MODE | The mode. Default value: `alipay`. | + + + +In addition to the preceding parameters, you can also use the following parameters when running the image. + + +| Parameter | Description | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | The log directory. Default value: `/opt/odc/log`. | +| OBCLIENT_WORK_DIR | The working directory of OBClient. Default value: `/opt/odc/data`. | +| ODC_JAR_FILE | The directory of JAR files. Default value: `/opt/odc/lib/odc-web-starter-*.jar`. | +| ODC_WORK_DIR | The working directory of ODC. Default value: `/opt/odc/script`. | +| ODC_JVM_HEAP_OPTIONS | The JVM stack memory. The default maximum value of the parameter `-Xmx` is 60% of available physical memory size. ODC checks whether the available memory in the current environment reaches 2048 MB before it starts a script. Assume that this parameter is set to 60%, the available memory must be at least 3.4 GB to start the script. If the available memory of the host or Docker container is less than 3.4 GB, you can skip memory check by setting the `ODC_JVM_HEAP_OPTIONS` parameter. For example, you can set it to `"-Xmx2048m -Xms2048m"`. | +| ODC_JVM_GC_OPTIONS | The garbage collection (GC) strategy for JVM. Default value: `-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`. | +| ODC_JVM_OOM_OPTIONS | The OutOfMemory strategy for JVM. Default value: `-XX:+ExitOnOutOfMemoryError`. | +| ODC_JVM_EXTRA_OPTIONS | Other JVM parameters. By default, no parameter is specified. | +| ODC_SERVER_PORT | The HTTP listening port for ODC-Server. Default value: 8989. | +| ODC_HOST | The IP address of ODC, which can be used as the destination IP address for remote procedure calls in high-availability deployment scenarios. | +| ODC_MAPPING_PORT | +The port number of the ODC runtime to avoid the problem that the port number cannot be used due to the deployment environment. This parameter is suitable for port mapping when deploying ODC in Docker. | +| ODC_APP_EXTRA_ARGS | Other App parameters need to be specified.
            For example, `--server.servlet.session.timeout=10m`, indicating that the Session period is 10 minutes. The default value is empty. | +| ODC_SERVER_RPC_PORT | The internal RPC listening port for ODC-Server. Default value: 8990. | + + + diff --git a/en-US/8.deployment-guide/4.deploy-the-ha-odc/3.deploy-ssl-certificates.md b/en-US/8.deployment-guide/4.deploy-the-ha-odc/3.deploy-ssl-certificates.md new file mode 100644 index 00000000..d4c4952c --- /dev/null +++ b/en-US/8.deployment-guide/4.deploy-the-ha-odc/3.deploy-ssl-certificates.md @@ -0,0 +1,71 @@ +Deploy SSL certificate +=========================================== + +When you log on to Web ODC in a browser over HTTP for the first time, you will receive a message indicating that the connection is not secure. To ensure access security, you can deploy an SSL certificate to access ODC over HTTPS. You can apply for a CA certificate or configure an HTTPS self-signed certificate. If you do not want to access ODC over HTTPS, you can skip this step and directly deploy NGINX. + +Apply for a CA certificate +----------------------------------------------- + +To apply for a CA certificate, we recommend that you purchase an SSL certificate and an SSL certificate service on Alibaba Cloud. For more information, see [SSL certificate](https://www.aliyun.com/product/cas). + +In the intranet environment, you can consult your IT administrator for the procedure of applying for a CA certificate. + +Configure an SSL self-signed certificate +------------------------------------------------------------- + +The ODC image package contains an executable file that can generate a certificate and private keys: generate-odc-ssl-certificate.sh. You can run this file on the host to generate a certificate. The self-signed certificate can implement encrypted communication. However, an OS does not trust a self-signed certificate by default. You can add the certificate to the **Trusted Root Certificate Authorities** in the browser to configure certificate trust. + +The following code shows how to run the executable file. The value for `domain` must be consistent with the domain name used by your ODC. Otherwise, the browser considers that the certificate does not match the site. + +```shell +$./generate-odc-ssl-certificate.sh +Enter your domain [www.example.com]: +Enter your province [Zhejiang]: +Enter your city [Hangzhou]: +Enter your company name [OceanBase]: +Enter your company unit name [DBA]: +generate certificate... +Generating a 2048 bit RSA private key +.......................................+++ +....................... +......+++ +writing new private key to '/etc/pki/nginx/odcserver.key' +----- +end of string encountered while processing type of subject name element #5 +problems making Certificate Request +check generated files: +-rw-r--r-- 1 root root 1424 Jun 3 15:18 server.crt +-rw-r--r-- 1 root root 1708 Jun 3 15:18 server.key +``` + + + +The following code shows the content of the generate-odc-ssl-certificate.sh file. You can directly run the following command to generate a self-signed certificate. + +```unknow +#!/usr/bin/env bash +# for generate self certificated ssl certificate files + +echo try create directory '/etc/pki/nginx' if not exists... +sudo mkdir -p /etc/pki/nginx +cd /etc/pki/nginx || exit + +#read configurations +read -rp "Enter your domain [www.example.com]: " DOMAIN +read -rp "Enter your province [Zhejiang]: " PROVINCE +read -rp "Enter your city [Hangzhou]: " CITY +read -rp "Enter your company name [OceanBase]: " COMPANY +read -rp "Enter your company unit name [DBA]: " UNIT + +echo generate certificate... +SUBJ="/C=CN/ST=${PROVINCE}/L=${CITY}/O=${COMPANY}/OU=${UNIT}/CN=${DOMAIN}" +sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \ + -keyout /etc/pki/nginx/odcserver.key \ + -out /etc/pki/nginx/odcserver.crt \ + -subj "${SUBJ}" + +echo "check generated files (use ls -l odcserver.*):" +ls -l odcserver.* +``` + + diff --git a/en-US/8.deployment-guide/4.deploy-the-ha-odc/4.deploy-nginx-proxy.md b/en-US/8.deployment-guide/4.deploy-the-ha-odc/4.deploy-nginx-proxy.md new file mode 100644 index 00000000..516aeb3d --- /dev/null +++ b/en-US/8.deployment-guide/4.deploy-the-ha-odc/4.deploy-nginx-proxy.md @@ -0,0 +1,309 @@ +Deploy the NGINX proxy +=========================================== + +After you deploy the image of OceanBase Developer Center (ODC) on all nodes, you need to deploy an NGINX proxy on an ODC node to route your requests to applications on different nodes. To deploy the NGINX proxy, you need to obtain and run the NGINX image on one node, copy the configuration file locally, and then modify the file. After the modification, stop running the NGINX image and then restart it to apply the modified configuration file. + +Load the image +----------------------------------- + +Select a node and load and run the NGINX image. You can use the following methods to load the NGINX image: + +* Pull the image from the Docker warehouse on the host. + + + +* Download the image package to a local device, copy the package to the host, and decompress the package. + + + + + + +### Pull the image from the Docker warehouse + +Ensure that Docker is installed on the host and the host has access to the Internet. Then, run the following command in the command-line tool to pull the NGINX image from the Docker warehouse: + +```javascript +docker pull nginx +``` + + + +### Copy the image package to the host and decompress the package + +1. Ensure that Docker is installed on the host and the host has access to the Internet. Then, run the following command on the host to download the image package to a local device: + + ```unknow + docker save nginx:latest | gzip - >nginx.tar.gz + ``` + + + +2. Copy the image package to the host and run the following command to load the image: + + ```javascript + gunzip -c nginx.tar.gz | docker load + ``` + + + + + + +Configure the configuration file +----------------------------------------------------- + +Before you start running the NGINX image, you must modify settings of the configuration file. The ODC image package contains templates of the configuration file. You can copy a template to a local device and edit the configuration where necessary. The templates of the configuration file vary, depending on whether you have deployed a self-signed certificate. We recommend that you copy a template based on the deployment and modify the configuration where necessary. + +### Configure the configuration file that does not contain the self-signed certificate + +Run the following command to copy the configuration file from the image package to the host for editing. You can customize the copy path as needed, and replace the tilde (\~) with the local path of the configuration file: + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.template ~/ +``` + + + +The following code shows a template of the configuration file. We recommend that you pay attention to the content that requires changes based on the comments. + +```javascript +# Nginx conf template for http deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address (Optional) + server 127.0.0.1:8989; + # add more servers here + } + + #https server, proxy to odc-server 8989 port + server { + listen 80; + # uncomment below if ipv6 enabled + + #listen [::]:80; + + # PLEASE CHANGE to your site domain (Optional) + server_name odc.oceanbase.com; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + + +### Configure the configuration file that contains a self-signed certificate + +Run the following command to copy the configuration file from the image package to the host for editing. You can customize the copy path as needed, and replace the tilde (\~) with the local path of the configuration file: + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.https.template ~/ +``` + + + +The following code shows a template of the configuration file. We recommend that you pay attention to the content that requires changes based on the comments. + +```unknow +# Nginx conf template for https deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address (Optional) + server 127.0.0.1:8989; + #add more servers here + } + + # redirect http to https + server { + listen 80 default_server; + + # uncomment below if ipv6 enabled + + #listen [::]:80 default_server; + + location / { + return 301 https://$host$request_uri; + } + } + + # https server, proxy to odc-server 8989 port + server { + listen 443 ssl http2; + # uncomment below if ipv6 enabled + + #listen [::]:443 ssl http2; + + # PLEASE CHANGE to your site domain (Optional) + server_name odc.oceanbase.com; + + # you can use /opt/odc/bin/generate-odc-ssl-certificate.sh + # to generate self certificated SSL certificates + + + # PLEASE CHANGE certificate file location if unmatched + + ssl_certificate /etc/pki/nginx/odcserver.crt; + ssl_certificate_key /etc/pki/nginx/odcserver.key; + ssl_session_timeout 1d; + ssl_session_cache shared:MozSSL:10m; # about 40000 sessions + ssl_session_tickets off; + + # intermediate configuration + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; + ssl_prefer_server_ciphers off; + + # HSTS (ngx_http_headers_module is required) (63072000 seconds) + add_header Strict-Transport-Security "max-age=63072000" always; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + +**Note** + + + +You can modify the load balancing configurations to ensure sufficient proxy server timeout. The modification takes effect after you restart the NGINX proxy. +We recommend that you set the `proxy_connect_timeout` parameter to a value of no longer than 75 seconds. For more information, see [proxy_connect_timeout](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout). + +If you do not set the `proxy_next_upstream` parameter to off, the NGINX proxy will forward your requests to the next ODC node. In this case, you need to log on to ODC again, and cannot use features related to file upload and download, such as downloading the result set of an asynchronous task. + +Start an image +----------------------------------- + +After the configuration file is modified locally, run the following command in the command-line tool to restart the NGINX image. The tilde (\~) indicates the local path of the configuration file. + +```shell +docker run --network host --name nginx -v ~/:/etc/nginx/nginx.conf -v /etc/pki/nginx/:/etc/pki/nginx/ -d nginx +``` + + + +The following table lists parameters in the statement. + + +| Parameter | Description | +|-------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --network host | Specifies to use a network port of the host. You do not need to configure port mapping in this case. If you do not want to directly use the port of the host, you can specify the mapping ports using the `-p` parameter. For example, `-p 8080:80` specifies to map port 8080 of the host to port 80 of the Docker container. Likewise, `-p 8443:443` specifies to map port 8443 of the host to port 443 of the Docker container. | +| --name nginx | Sets the name of the container to nginx for easier management. You can use other names, for example, odc-nginx. | +| -v \~/\:/etc/nginx/nginx.conf | Mounts the Docker container to the specified directory of the host and maps the local files of the host to the Docker container. `` specifies a local path of the configuration file on the host, and then maps the configuration file to the /etc/nginx/nginx.conf file in the Docker container. | +| -v /etc/pki/nginx/:/etc/pki/nginx/ | Maps the /etc/pki/nginx/ path of the host to the /etc/pki/nginx/ path of the Docker container. | +| -d nginx | Specifies to run the Docker container in the background. | + + diff --git a/en-US/8.deployment-guide/4.deploy-the-ha-odc/5.configure-certificate-trust.md b/en-US/8.deployment-guide/4.deploy-the-ha-odc/5.configure-certificate-trust.md new file mode 100644 index 00000000..df83f8d9 --- /dev/null +++ b/en-US/8.deployment-guide/4.deploy-the-ha-odc/5.configure-certificate-trust.md @@ -0,0 +1,102 @@ +Configure certificate trust +================================================ + +A browser does not trust a self-signed certificate. You must manually configure certificate trust in the browser. + +> **Notice** +> Google Chrome does not trust a self-signed certificate. After you complete the certificate trust configuration, you will receive a message indicating that the connection is not secure. + +Configure certificate trust in Windows +----------------------------------------------------------- + +Google Chrome is used as an example to describe the certificate trust configuration procedure. + +1. Log on to ODC in Chrome. When the system prompts that the connection is not secure, click **Not Secure** on the left side of the address bar and click **Certificate** in the list that appears to view the certificate details. + + ![Image 739](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5561103461/p284267.png) + + +2. In the **Certificate** window that appears, click the **Details** tab and click **Copy to File** in the lower-right corner of the tab. + + ![window2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/6507903461/p394659.png) + + +3. In the **Certificate Export Wizard** step, click **Next** . + + + +4. In the file export format setting step, select DER encoded binary X.509 (CER) and click **Next** . + + + +5. In the file path selection step, click **Browse** . In the file resource manager window, select an export path, enter a file name in the **File Name** field, and click **Save** to go back to the Certificate Export Wizard step. Then, click **Next** . + + + +6. In the Completing the Certificate Export Wizard step, click **Finish** in the lower-right corner to export the file to a local device. + + + +7. Find the certificate file in the path specified in Step 5, right-click the certificate file, and then select **Install Certificate** from the context menu that appears. + + + +8. In the Certificate Import Wizard window, click **Next** . + + + +9. In the Certificate Store step, select **Place all certificates in the following store** and click **Browse** . In the Select Certificate Store window, select **Trusted Root Certification Authorities** and click **OK** . In the Certificate Store step, click **Next** . + + + +10. In the Completing the Certificate Export Wizard step, click **Finish** in the lower-right corner. + + + +11. After the certificate trust configuration is completed, log on to ODC again in the browser. + + + + + + +Configure certificate trust in macOS +--------------------------------------------------------- + +Google Chrome is used as an example to describe the certificate trust configuration procedure. + +1. Log on to ODC in Chrome. When the system prompts that the connection is not secure, click **Not Secure** on the left side of the address bar and click **Certificate** in the list that appears to view the certificate details. + + ![Image 749](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5561103461/p284535.png) + + +2. Details of the certificate are displayed. + + ![Image 750](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/5299803461/p284536.png) + + +3. Create a file with the extension of .cer, copy the certificate details to this file, and save the file. + + ![配置证书信任-macios3](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4489253461/p392977.png) + + +4. In macOS, choose **Applications** \> **Utilities** \> **Keychain Access** . The **Keychain Access** window appears. In the left-side navigation pane, click **System** and click the **plus** sign (+) in the quick access toolbar. In the window that appears, select the certificate file that is created in the previous step to add the certificate into the system. + + ![配置证书信任新-macios4](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4489253461/p397479.png) + + +5. Double-click the **odc.oceanbase.com,odc.oceanbse.net** certificate. In the certificate details window that appears, click **Trust** . In the configuration list that appears, set **When using this certificate** to **Always Trust** . + + ![配置证书信任新-macios5](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4489253461/p397480.png) + + +6. Close the certificate details window. When you try to close the window, the system reminds you to enter a password to make the configuration take effect. Enter the password to finish the configuration. + + + +7. After the certificate trust configuration is completed, log on to ODC again in the browser. + + + + + diff --git a/en-US/8.deployment-guide/5.deployment-verification.md b/en-US/8.deployment-guide/5.deployment-verification.md new file mode 100644 index 00000000..29938fde --- /dev/null +++ b/en-US/8.deployment-guide/5.deployment-verification.md @@ -0,0 +1,6 @@ +Deployment verification +============================================ + +After ODC is deployed, you can use the IP address and port number, for example, http://IP:PORT or http://DOMAIN:PORT, of the host (where the NGINX proxy resides) to access Web ODC in a browser. + +After you log on to Web ODC, the homepage appears. If you are logging on to Web ODC for the first time, register an account and then log on. If you can create a connection and operate the database normally in ODC, it indicates that Web ODC is deployed successfully. For more information about the use of Web ODC, see User Guide (Web ODC). diff --git a/en-US/9.upgrade-guide/1.upgrade-guide-overview.md b/en-US/9.upgrade-guide/1.upgrade-guide-overview.md new file mode 100644 index 00000000..aea1e78f --- /dev/null +++ b/en-US/9.upgrade-guide/1.upgrade-guide-overview.md @@ -0,0 +1,14 @@ +Overview +============================= + +OceanBase Developer Center (ODC) is an enterprise-level database development platform tailored for OceanBase Database. ODC adopts the mature browser/server architecture and is accessible through either the web or client version. This document describes the entire process of upgrading Web ODC. You do not need to upgrade the ODC client. You can directly install the latest version. + +Upgrade in single-node deployment mode +----------------------------------------------------------- + +If your ODC is deployed in single-node mode, you only need to upgrade ODC on the node to the new version. + +Upgrade in high-availability deployment mode +----------------------------------------------------------------- + +If your ODC is deployed in high availability mode, you only need to upgrade ODC to the new version on all nodes in high-availability deployment mode. You can choose to upgrade the NGINX image to the latest version when you upgrade ODC applications in high-availability deployment mode. diff --git a/en-US/9.upgrade-guide/2.preparation-for-upgrade.md b/en-US/9.upgrade-guide/2.preparation-for-upgrade.md new file mode 100644 index 00000000..73214a67 --- /dev/null +++ b/en-US/9.upgrade-guide/2.preparation-for-upgrade.md @@ -0,0 +1,49 @@ +Preparations before upgrade +================================================ + +Before you deploy OceanBase Developer Center (ODC), you must prepare the MetaDB and the server. + +MetaDB +--------------------------- + +The MetaDB was created when you deploy Web ODC to store user data that is generated during operation. + +To upgrade ODC, you must reinitialize the MetaDB and run the ODC image of the target version. Before the upgrade, check the name of the MetaDB tenant, name of the cluster to which the tenant belongs, database name, username, and password. + +> **Note**
            +> * ODC V3.3.0 and later versions provide management capabilities for enterprises, such as change process and operation audit. For Web ODC, the version of MetaDB must be OceanBase Database V2.2.76 or later. Otherwise, the startup will fail due to verification failures. +> * For ODC V3.3.1 and later versions, there is no restriction on MetaDB versions. +> * 2C8G or a higher configuration is recommended for the OceanBase tenant of MetaDB. A low configuration may cause performance problems. + + + + + + +Server +--------------------------- + +The server that runs Web ODC must be configured based on the number of ODC users: + +* ≤ 20 ODC users: 4 CPU cores and 8 GB of memory; + + + +* ≤ 100 ODC users: 4 CPU cores and 16 GB of memory; + + + +* ≤ 500 ODC users: 8 CPU cores and 32 GB of memory; + + + +* \> 500 ODC users: Adjust the resource specifications as needed. + + + + + + +The server that runs Web ODC must be configured with the preceding resource specifications. Therefore, you need to check the server before upgrading ODC. + +To upgrade ODC, you need to re-obtain and run the ODC image on the server. Make sure that Docker is installed and can run normally on the server before the upgrade. diff --git a/en-US/9.upgrade-guide/3.upgrade-single-node-odc/1.upgrade-process.md b/en-US/9.upgrade-guide/3.upgrade-single-node-odc/1.upgrade-process.md new file mode 100644 index 00000000..1f727f7c --- /dev/null +++ b/en-US/9.upgrade-guide/3.upgrade-single-node-odc/1.upgrade-process.md @@ -0,0 +1,37 @@ +Upgrade process +==================================== + + + +The upgrade of OceanBase Developer Center (ODC) in single-node deployment mode requires three steps. + +1. [Stop ODC of the earlier version](../3.upgrade-single-node-odc/2.stop-the-old-odc-version.md): Stop the ODC container of the earlier version in Docker. + + + +2. [Load and run the ODC image](../3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md): Load and run the image of the new version on the server to upgrade ODC. + + + +3. [Upgrade the NGINX image](../4.upgrade-high-availability-odc/4.upgrade-nginx-image.md): You can upgrade the NGINX image on a single ODC node if an SSL certificate is configured and the NGINX image is deployed on the node. For more information about the upgrade procedure, see the ODC upgrade procedure in the high-availability deployment mode. + +
            +

            Note

            +
              +
            • You can obtain the default logon username and password from the administrator.
            • +
            • For more information about how to log on to Web ODC, see User Guide (Web ODC) > Log on to ODC > Log on to ODC with an account.
            • +
            +
            + + + + + + + + + + + + + diff --git a/en-US/9.upgrade-guide/3.upgrade-single-node-odc/2.stop-the-old-odc-version.md b/en-US/9.upgrade-guide/3.upgrade-single-node-odc/2.stop-the-old-odc-version.md new file mode 100644 index 00000000..69957b32 --- /dev/null +++ b/en-US/9.upgrade-guide/3.upgrade-single-node-odc/2.stop-the-old-odc-version.md @@ -0,0 +1,37 @@ +Stop ODC of the earlier version +==================================================== + +When upgrading OceanBase Developer Center (ODC) deployed in single-node mode, you need to stop running ODC of the earlier version after you update the MetaDB. + +**Procedure:** + +1. Run the `docker ps -a` statement in the command line tool of the host to view the running container. You can find the container ID of ODC of the earlier version in the `IMAGE` column (image name). The ID is the corresponding value in the `CONTAINER ID` column. Execution result: + + ```javascript + C:\Users\ob>docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 8bfecbc1cd03 acs-reg.alipay.com/oceanbase/obodc:2.0.1 "/bin/sh -c '/usr/bi..." 13 days ago Up 13 days 80/tcp, 8080/tcp, 0.0.0.0:8989->8989/tcp obodc + ``` + + + +2. After you obtain the container ID, run the `docker stop ;` command in the command-line tool to stop the ODC container of the earlier version. Execution result: + + ```javascript + C:\Users\ob>docker stop 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + +3. Run the `docker rm ;` command in the command-line tool to delete the ODC image of the earlier version and release the port occupied. Execution result: + + ```javascript + C:\Users\ob>docker rm 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + + + diff --git a/en-US/9.upgrade-guide/3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md b/en-US/9.upgrade-guide/3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md new file mode 100644 index 00000000..3116ecc2 --- /dev/null +++ b/en-US/9.upgrade-guide/3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md @@ -0,0 +1,89 @@ +Load and run an ODC image +============================================== + +When you upgrade OceanBase Developer Center (ODC) deployed in single-node mode, you need to obtain and run the ODC image again after you update the MetaDB and stop the ODC container of the earlier version. + +Load the image +----------------------------------- + +To obtain the ODC image on the host, select the required image from the following list and click **Download** . + +* Image for X86: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz) + +* Image for ARM: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +After you obtain the image, run the following command in the command-line tool to load it: + +```javascript +gunzip -c obodc-{$version}.tar.gz docker load +``` + + + +Run the image +---------------------------------- + +Execute the following sample statement in the command-line tool to run the image: + +```javascript +#!/usr/bin/env bash +docker run -v /var/log/odc:/opt/odc/log -v /var/data/odc:/opt/odc/data \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +You can run the `docker images` command to view the {image_tag} parameter on the host after you load the image. The following table describes other parameters used in the preceding sample statement. + + +| Parameter | Description | +|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| -v |
            • Maps the `/var/log/odc` directory of the host to the `/opt/odc/log` directory in the ODC container. If the `/var/log/odc` directory does not exist on the host, run the `mkdir -p /var/log/odc` command to create one.
            • Mounts the `/var/data/odc` directory of the host to the `/opt/odc/data` directory in the ODC container. If the `/var/data/odc` directory does not exist on the host, run the `mkdir -p /var/data/odc` command to create one.
            | +| --net | The network configuration of the Docker container. If you set this parameter to `host`, the host network is directly used. You can also use the `--publish` (`-p`) parameter to configure port mapping. However, the Docker container may fail to start in some circumstances due to incorrect DNS resolution in the Docker container. In this case, run the `--net host` command to start the Docker container. | +| --cpu-period --cpu-quota | * The `---cpu-period` parameter specifies the interval at which the CPU cores of the Docker container are reallocated. Unit: microseconds. * The `---cpu-quota` parameter specifies the maximum time for running the current Docker container in this interval. Unit: microseconds. You can use these two parameters in combination to specify the number of CPU cores that the Docker container uses. The value is calculated by dividing cpu-quota by cpu-period. In the preceding sample statement, the values of cpu-quota and cpu-period are respectively 400000 and 100000, indicating that the Docker container can use at most four CPU cores. | +| --memory | The maximum memory size for the Docker container. | +| --name | The name of the container. | +| DATABASE_HOST | The IP address of the MetaDB. | +| DATABASE_PORT | The port number of the MetaDB. | +| DATABASE_USERNAME | The username of the MetaDB. In OceanBase Database, the username is given in the db_user@tenant_name#cluster_name format. | +| DATABASE_PASSWORD | The password for connecting to the database. | +| DATABASE_NAME | The name of the MetaDB. | +| ODC_PROFILE_MODE | The mode. Default value: `alipay`. | + + + +In addition to the preceding parameters, you can also use the following parameters when running the image. + + +| Parameter | Description | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | The log directory. Default value: `/opt/odc/log`. | +| OBCLIENT_WORK_DIR | The working directory of OBClient. Default value: `/opt/odc/data`. | +| ODC_JAR_FILE | The directory of JAR files. Default value: `/opt/odc/lib/odc-web-starter-*.jar`. | +| ODC_WORK_DIR | The working directory of ODC. Default value: `/opt/odc/script`. | +| ODC_JVM_HEAP_OPTIONS | The JVM stack memory. The default maximum value of the parameter `-Xmx` is 60% of available physical memory size. ODC checks whether the available memory in the current environment reaches 2048 MB before it starts a script. Assume that this parameter is set to 60%, the available memory must be at least 3.4 GB to start the script. If the available memory of the host or Docker container is less than 3.4 GB, you can skip memory check by setting the `ODC_JVM_HEAP_OPTIONS` parameter. For example, you can set it to `"-Xmx2048m -Xms2048m"`. | +| ODC_JVM_GC_OPTIONS | The garbage collection (GC) strategy for JVM. Default value: `-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`. | +| ODC_JVM_OOM_OPTIONS | The OutOfMemory strategy for JVM. Default value: `-XX:+ExitOnOutOfMemoryError`. | +| ODC_JVM_EXTRA_OPTIONS | Other JVM parameters. By default, no parameter is specified. | +| ODC_SERVER_PORT | The HTTP listening port for ODC-Server. Default value: 8989. | +| ODC_HOST | The IP address of ODC, which can be used as the destination IP address for remote procedure calls in high-availability deployment scenarios. | +| ODC_MAPPING_PORT | +The port number of the ODC runtime to avoid the problem that the port number cannot be used due to the deployment environment. This parameter is suitable for port mapping when deploying ODC in Docker. | +| ODC_APP_EXTRA_ARGS | Other App parameters need to be specified.
            For example, `--server.servlet.session.timeout=10m`, indicating that the Session period is 10 minutes. The default value is empty. | +| ODC_SERVER_RPC_PORT | The internal RPC listening port for ODC-Server. Default value: 8990. | + + + + diff --git a/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/1.ha-odc-upgrade-process.md b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/1.ha-odc-upgrade-process.md new file mode 100644 index 00000000..15ec16b5 --- /dev/null +++ b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/1.ha-odc-upgrade-process.md @@ -0,0 +1,37 @@ +Upgrade process +==================================== + + + +The upgrade of OceanBase Developer Center (ODC) in high-availability deployment mode requires three steps: + +1. [Stop ODC of the earlier version](../4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md): Stop the ODC container of the earlier version in Docker. + + + +2. [Load and run the ODC image](../4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md): Load and run the new ODC image on each node in high-availability deployment mode to upgrade ODC. + + + +3. [Upgrade the NGINX image](../4.upgrade-high-availability-odc/4.upgrade-nginx-image.md): You can choose whether to upgrade the NGINX image to the latest version. To upgrade the NGINX image, you must stop and delete the old image, obtain the image of the latest version on the host, and deploy the NGINX proxy. + +
            +

            Note

            +
              +
            • You can obtain the default logon username and password from the administrator.
            • +
            • For more information about how to log on to Web ODC, see User Guide (Web ODC) > Log on to ODC > Log on to ODC with an account.
            • +
            +
            + + + + + + + + + + + + + diff --git a/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md new file mode 100644 index 00000000..b7872374 --- /dev/null +++ b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md @@ -0,0 +1,37 @@ +Stop ODC of the earlier version +==================================================== + +When upgrading OceanBase Developer Center (ODC) deployed in high availability mode, you need to stop running ODC of the earlier version after you update the MetaDB. + +**Procedure:** + +1. Run the `docker ps -a` command in the command-line tool of the host to view the running containers.You can find the container ID of the earlier NGINX image in the `CONTAINER ID` column based on the image name in the `IMAGE` column. Execution result: + + ```javascript + C:\Users\ob>docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 8bfecbc1cd03 acs-reg.alipay.com/oceanbase/obodc:2.0.1 "/bin/sh -c '/usr/bi..." 13 days ago Up 13 days 80/tcp, 8080/tcp, 0.0.0.0:8989->8989/tcp obodc + ``` + + + +2. After you obtain the container ID, run the `docker stop ;` command in the command-line tool to stop the ODC container of the earlier version. Execution result: + + ```javascript + C:\Users\ob>docker stop 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + +3. Run the `docker rm ;` command in the command-line tool to delete the ODC image of the earlier version and release the port occupied. Execution result: + + ```javascript + C:\Users\ob>docker rm 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + + + diff --git a/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md new file mode 100644 index 00000000..62eea577 --- /dev/null +++ b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md @@ -0,0 +1,88 @@ +Load and run an ODC image +============================================== + +When you upgrade OceanBase Developer Center (ODC) deployed in high availability mode, you need to obtain and run the ODC image again on each node after you update the MetaDB. + +Load the image +----------------------------------- + +To obtain the ODC image on the host, select the required image from the following list and click **Download** . + +* Image for X86: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz) + +* Image for ARM: [Download](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +After you obtain the image, run the following command in the command-line tool to load it: + +```javascript +gunzip -c obodc-{$version}.tar.gz docker load +``` + + + +Run the image +---------------------------------- + +Execute the following sample statement in the command-line tool to run the image: + +```javascript +#!/usr/bin/env bash +docker run -v /var/log/odc:/opt/odc/log -v /var/data/odc:/opt/odc/data \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +You can run the `docker images` command to view the {image_tag} parameter on the host after you load the image. The following table describes other parameters used in the preceding sample statement. + + +| Parameter | Description | +|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| -v |
            • Maps the `/var/log/odc` directory of the host to the `/opt/odc/log` directory in the ODC container. If the `/var/log/odc` directory does not exist on the host, run the `mkdir -p /var/log/odc` command to create one.
            • Mounts the `/var/data/odc` directory of the host to the `/opt/odc/data` directory in the ODC container. If the `/var/data/odc` directory does not exist on the host, run the `mkdir -p /var/data/odc` command to create one.
            | +| --net | The network configuration of the Docker container. If you set this parameter to `host`, the host network is directly used. You can also use the `--publish` (`-p`) parameter to configure port mapping. However, the Docker container may fail to start in some circumstances due to incorrect DNS resolution in the Docker container. In this case, run the `--net host` command to start the Docker container. | +| --cpu-period --cpu-quota | * The `---cpu-period` parameter specifies the interval at which the CPU cores of the Docker container are reallocated. Unit: microseconds. * The `---cpu-quota` parameter specifies the maximum time for running the current Docker container in this interval. Unit: microseconds. You can use these two parameters in combination to specify the number of CPU cores that the Docker container uses. The value is calculated by dividing cpu-quota by cpu-period. In the preceding sample statement, the values of cpu-quota and cpu-period are respectively 400000 and 100000, indicating that the Docker container can use at most four CPU cores. | +| --memory | The maximum memory size for the Docker container. | +| --name | The name of the container. | +| DATABASE_HOST | The IP address of the MetaDB. | +| DATABASE_PORT | The port number of the MetaDB. | +| DATABASE_USERNAME | The username of the MetaDB. In OceanBase Database, the username is given in the db_user@tenant_name#cluster_name format. | +| DATABASE_PASSWORD | The password for connecting to the database. | +| DATABASE_NAME | The name of the MetaDB. | +| ODC_PROFILE_MODE | The mode. Default value: `alipay`. | + + + +In addition to the preceding parameters, you can also use the following parameters when running the image. + + +| Parameter | Description | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | The log directory. Default value: `/opt/odc/log`. | +| OBCLIENT_WORK_DIR | The working directory of OBClient. Default value: `/opt/odc/data`. | +| ODC_JAR_FILE | The directory of JAR files. Default value: `/opt/odc/lib/odc-web-starter-*.jar`. | +| ODC_WORK_DIR | The working directory of ODC. Default value: `/opt/odc/script`. | +| ODC_JVM_HEAP_OPTIONS | The JVM stack memory. The default maximum value of the parameter `-Xmx` is 60% of available physical memory size. ODC checks whether the available memory in the current environment reaches 2048 MB before it starts a script. Assume that this parameter is set to 60%, the available memory must be at least 3.4 GB to start the script. If the available memory of the host or Docker container is less than 3.4 GB, you can skip memory check by setting the `ODC_JVM_HEAP_OPTIONS` parameter. For example, you can set it to `"-Xmx2048m -Xms2048m"`. | +| ODC_JVM_GC_OPTIONS | The garbage collection (GC) strategy for JVM. Default value: `-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`. | +| ODC_JVM_OOM_OPTIONS | The OutOfMemory strategy for JVM. Default value: `-XX:+ExitOnOutOfMemoryError`. | +| ODC_JVM_EXTRA_OPTIONS | Other JVM parameters. By default, no parameter is specified. | +| ODC_SERVER_PORT | The HTTP listening port for ODC-Server. Default value: 8989. | +| ODC_HOST | The IP address of ODC, which can be used as the destination IP address for remote procedure calls in high-availability deployment scenarios. | +| ODC_MAPPING_PORT | +The port number of the ODC runtime to avoid the problem that the port number cannot be used due to the deployment environment. This parameter is suitable for port mapping when deploying ODC in Docker.| +| ODC_APP_EXTRA_ARGS | Other App parameters need to be specified.
            For example, `--server.servlet.session.timeout=10m`, indicating that the Session period is 10 minutes. The default value is empty. | +| ODC_SERVER_RPC_PORT | The internal RPC listening port for ODC-Server. Default value: 8990. | + + + diff --git a/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/4.upgrade-nginx-image.md b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/4.upgrade-nginx-image.md new file mode 100644 index 00000000..dcd318a8 --- /dev/null +++ b/en-US/9.upgrade-guide/4.upgrade-high-availability-odc/4.upgrade-nginx-image.md @@ -0,0 +1,344 @@ +Upgrade NGINX image +======================================== + +When you upgrade Web ODC, you can choose whether to upgrade the NGINX image to the latest version. To upgrade the NGINX image, you must stop and delete the old image, obtain the image of the latest version on the host, and deploy the NGINX proxy. + +Stop and delete the old image +-------------------------------------------------- + +Before you deploy the NGINX image of the latest version, you must stop and delete the NGINX image that is running on the host. + +Procedure: + +1. Run the `docker ps -a` command in the command-line tool of the host to view the running containers. You can find the container ID of the earlier NGINX image in the `CONTAINER ID` column based on the image name in the `IMAGE` column. Execution result: + + ```javascript + " C:\Users\ob>docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 8bfecbc1cd03 bdd6f8916e8b "/bin/sh -c '/usr/bi... 13 days ago Up 13 days 80/tcp, 8080/tcp, 0.0.0.0:8989->8989/tcp nginx + ``` + + + +2. After you obtain the container ID, run the `docker stop ;` command in the command-line tool to stop the ODC container of the earlier version. Execution result: + + ```javascript + C:\Users\ob>docker stop 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + +3. Run the `docker rm ;` command in the command-line tool to delete the ODC image of the earlier version and release the port occupied. Execution result: + + ```javascript + C:\Users\ob>docker rm 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + + + + +Load the new image +--------------------------------------- + +You can use the following methods to load the NGINX image of the latest version: + +* Pull the image from the Docker warehouse on the host. + + + +* Download the image package to a local device, copy the package to the host, and decompress the package. + + + + + + +### Pull the image from the Docker warehouse + +Ensure that Docker is installed on the host and the host has access to the Internet. Then, run the following command in the command-line tool to pull the NGINX image from the Docker warehouse: + +```javascript +docker pull nginx +``` + + + +### Copy the image package to the host and decompress the package + +Ensure that Docker is installed on the host and the host has access to the Internet. Then, run the following command on the host to download the image package to a local device: + +```unknow +docker save nginx:latest | gzip - >nginx.tar.gz +``` + + + +Copy the image package to the host and run the following command to load the image: + +```javascript +gunzip -c nginx.tar.gz | docker load +``` + + + +Configure the configuration file +----------------------------------------------------- + +Before you start running the NGINX image, you must modify settings of the configuration file. The ODC image package contains templates of the configuration file. You can copy a template to a local device and edit the configuration where necessary. The templates of the configuration file vary, depending on whether you have deployed a self-signed certificate. We recommend that you copy a template based on the deployment and modify the configuration where necessary. + +### Configure the configuration file that does not contain the self-signed certificate + +Run the following command to copy the configuration file from the image package to the host for editing. You can customize the copy path as needed, and replace the tilde (\~) with the local path of the configuration file: + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.template ~/ +``` + + + +The following code shows a template of the configuration file. We recommend that you pay attention to the content that requires changes based on the comments. + +```javascript +# Nginx conf template for http deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address (Optional) + server 127.0.0.1:8989; + # add more servers here + } + + #https server, proxy to odc-server 8989 port + server { + listen 80; + # uncomment below if ipv6 enabled + + #listen [::]:80; + + # PLEASE CHANGE to your site domain (Optional) + server_name odc.oceanbase.com; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + + +### Configure the configuration file that contains a self-signed certificate + +Run the following command to copy the configuration file from the image package to the host for editing. You can customize the copy path as needed, and replace the tilde (\~) with the local path of the configuration file: + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.https.template ~/ +``` + + + +The following code shows a template of the configuration file. We recommend that you pay attention to the content that requires changes based on the comments. + +```unknow +# Nginx conf template for https deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address (Optional) + server 127.0.0.1:8989; + #add more servers here + } + + # redirect http to https + server { + listen 80 default_server; + + # uncomment below if ipv6 enabled + + #listen [::]:80 default_server; + + location / { + return 301 https://$host$request_uri; + } + } + + # https server, proxy to odc-server 8989 port + server { + listen 443 ssl http2; + # uncomment below if ipv6 enabled + + #listen [::]:443 ssl http2; + + # PLEASE CHANGE to your site domain (Optional) + server_name odc.oceanbase.com; + + # you can use /opt/odc/bin/generate-odc-ssl-certificate.sh + # to generate self certificated SSL certificates + + + # PLEASE CHANGE certificate file location if unmatched + + ssl_certificate /etc/pki/nginx/odcserver.crt; + ssl_certificate_key /etc/pki/nginx/odcserver.key; + ssl_session_timeout 1d; + ssl_session_cache shared:MozSSL:10m; # about 40000 sessions + ssl_session_tickets off; + + # intermediate configuration + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; + ssl_prefer_server_ciphers off; + + # HSTS (ngx_http_headers_module is required) (63072000 seconds) + add_header Strict-Transport-Security "max-age=63072000" always; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + +**Note** + + + +You can modify the load balancing configurations to ensure sufficient proxy server timeout. The modification takes effect after you restart the NGINX proxy. +We recommend that you set the `proxy_connect_timeout` parameter to a value of no longer than 75 seconds. For more information, see proxy_connect_timeout: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout. + +If you do not set the `proxy_next_upstream` parameter to off, the NGINX proxy will forward your requests to the next ODC node. In this case, you need to log on to ODC again, and cannot use features related to file upload and download, such as downloading the result set of an asynchronous task. + +Start an image +----------------------------------- + +After the configuration file is modified locally, run the following command in the command-line tool to restart the NGINX image. The tilde (\~) indicates the local path of the configuration file. + +```shell +docker run --network host --name nginx -v ~/:/etc/nginx/nginx.conf -v /etc/pki/nginx/:/etc/pki/nginx/ -d nginx +``` + + + +The following table lists parameters in the statement. + + +| Parameter | Description | +|-------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --network host | Specifies to use a network port of the host. You do not need to configure port mapping in this case. If you do not want to directly use the port of the host, you can specify the mapping ports using the `-p` parameter. For example, `-p 8080:80` specifies to map port 8080 of the host to port 80 of the Docker container. Likewise, `-p 8443:443` specifies to map port 8443 of the host to port 443 of the Docker container. | +| --name nginx | Sets the name of the container to nginx for easier management. You can use other names, for example, odc-nginx. | +| -v \~/\:/etc/nginx/nginx.conf | Mounts the Docker container to the specified directory of the host and maps the local files of the host to the Docker container. `` specifies a local path of the configuration file on the host, and then maps the configuration file to the /etc/nginx/nginx.conf file in the Docker container. | +| -v /etc/pki/nginx/:/etc/pki/nginx/ | Maps the /etc/pki/nginx/ path of the host to the /etc/pki/nginx/ path of the Docker container. | +| -d nginx | Specifies to run the Docker container in the background. | + + diff --git a/en-US/9.upgrade-guide/5.upgrade-verification.md b/en-US/9.upgrade-guide/5.upgrade-verification.md new file mode 100644 index 00000000..6ced152b --- /dev/null +++ b/en-US/9.upgrade-guide/5.upgrade-verification.md @@ -0,0 +1,9 @@ +Upgrade verification +========================================= + +After OceanBase Developer Center (ODC) is upgraded, you can use the IP address and port number (http://IP:PORT or http://DOMAIN:PORT) of the ODC host to access Web ODC in a browser. In the high-availability deployment mode, use the IP address and port number of the host where the NGINX proxy resides. + +After you log on to ODC, click Help Center in the upper-right corner of the connection list page. Then, click **About Developer Center** in the drop-down list, and a window appears. You can view the ODC version number in this window to check whether the upgrade is succeeded. For more information about the use of Web ODC, see User Guide (Web ODC). + + +![Image 246](https://help-static-aliyun-doc.aliyuncs.com/assets/img/en-US/4239586261/p243828.png) diff --git a/en-US/9.upgrade-guide/6.rooback-after-upgrade-failed.md b/en-US/9.upgrade-guide/6.rooback-after-upgrade-failed.md new file mode 100644 index 00000000..0dbd6dca --- /dev/null +++ b/en-US/9.upgrade-guide/6.rooback-after-upgrade-failed.md @@ -0,0 +1,38 @@ +Rollback after upgrade failed +================================================== + +After you upgrade Web ODC, you can roll back it if serious problems occur after the upgrade. + +To roll back Web ODC, run the following commands in the command-line tool of the host and run the ODC image of the version that you want to roll back to: + +```javascript +#!/usr/bin/env bash +docker run -d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" +-e "DATABASE_HOST=100.00.00.00" +-e "DATABASE_PORT=60805" +-e "DATABASE_USERNAME=[username]@[tenantname]#[clustername]" +-e "DATABASE_PASSWORD=******" +-e "DATABASE_NAME=odc_metadb" +-e "ODC_PROFILE_MODE=alipay" +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +You can run the `docker images` statement to view {image_tag} on the host after you load the image. The following table describes other parameters. + + +| Parameter | Description | +|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --net | Specifies the network configuration of the Docker container. If you set this parameter to `host`, the host network is directly used. You can also use the `--publish` (`-p`) parameter to configure port mapping. However, the Docker container may fail to start up in some circumstances due to incorrect domain name resolution (DNS) in the Docker container. In this case, run the `--net host` command to start the Docker container. | +| --cpu-period --cpu-quota | The --cpu-period option specifies the interval in which the CPU cores of the Docker container is reallocated. Unit: microseconds. The --cpu-quota option specifies the maximum time for running the current Docker container in this interval. Unit: microseconds. You can use these two options in combination to specify the number of CPU cores that the Docker container uses. The value is calculated by dividing cpu-quota by cpu-period. In the preceding sample statement, the values of cpu-quota and cpu-period are respectively 400000 and 100000, indicating that the Docker container can use at most four CPU cores. | +| --memory | Specifies the maximum memory size for the Docker container. | +| --name | Specifies the name of the container. | +| DATABASE_HOST | Specifies the IP address of the MetaDB. | +| DATABASE_PORT | Specifies the port number of the MetaDB. | +| DATABASE_USERNAME | Specifies the username of the MetaDB. In OceanBase Database, the username is given in the db_user@tenant_name#cluster_name format. | +| DATABASE_PASSWORD | Specifies the username for connecting to the database. | +| DATABASE_NAME | Specifies the name of the MetaDB. | +| ODC_PROFILE_MODE | Specifies the mode, which is `alipay` by default. | + + diff --git a/zh-CN/1.oceanbase-developer-center-documentation-odc-v3-3-0.md b/zh-CN/1.oceanbase-developer-center-documentation-odc-v3-3-0.md new file mode 100644 index 00000000..2e11e8f1 --- /dev/null +++ b/zh-CN/1.oceanbase-developer-center-documentation-odc-v3-3-0.md @@ -0,0 +1,11 @@ +文档概览 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)是为 OceanBase 数据库量身打造的企业级数据库开发平台。ODC 支持连接 OceanBase 中 MySQL 和 Oracle 模式下的数据库,同时为数据库开发者提供了数据库日常开发操作、WebSQL、SQL 诊断、会话管理和数据导入导出等功能。 + + +| 快速了解 | 常用操作| 常见问题| +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [入门概述](4.quickstart/1.quickstart-overview.md)
            [安装 ODC](7.client-odc-user-guide/1.client-odc-install-odc.md)
            [登录账号](6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md)
            [创建个人连接](6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md)
            [如何导出数据](5.tutorials/3.tutorials-export.md)
            [如何导入数据](5.tutorials/4.tutorials-import.md)
            [如何使用 SQL 窗口](6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md) | [个人连接管理](6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md)
            [公共连接管理](6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md)
            [使用工作台](6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md)
            [使用工具](6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md)
            [任务管理](6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md)
            [会话管理](6.web-odc-user-guide/10.web-odc-session-management.md)
            [数据库对象管理述](6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-database-objects-overview.md)
            [使用回收站](6.web-odc-user-guide/7.web-odc-recycle-bin.md)
            [查看操作记录](6.web-odc-user-guide/8.web-odc-view-operation-records.md) |[常见问题](10.faq)| + + diff --git a/zh-CN/10.system-integration/1.bastion-host-integration-guide/1.bastion-overview.md b/zh-CN/10.system-integration/1.bastion-host-integration-guide/1.bastion-overview.md new file mode 100644 index 00000000..973b8ead --- /dev/null +++ b/zh-CN/10.system-integration/1.bastion-host-integration-guide/1.bastion-overview.md @@ -0,0 +1,41 @@ +概述 +======================= + + + +什么是堡垒机 +--------------------------- + +堡垒机是一种运维安全审计系统,为了保障网络和数据不受外部和内部用户的入侵和破坏,可以通过堡垒机访问 ODC 以监控和记录运维人员对 ODC 的操作行为。 + +什么是 OceanBase 开发者中心 +---------------------------------------- + +OceanBase 开发者中心(OceanBase Developer Center,ODC)是为 OceanBase 数据库量身打造的企业级数据库开发平台。ODC 支持连接 OceanBase 中 MySQL 和 Oracle 模式下的数据库,同时为数据库开发者提供了数据库日常开发操作、WebSQL、SQL 诊断、会话管理和数据导入导出等功能。ODC 采用成熟的浏览器-服务端架构,拥有跨平台、轻量化和易部署的特点。同时,ODC 还提供客户端版本,不仅能满足个人开发者快速上手使用 OceanBase 的需求,还可提升开发人员与 DBA 的协作效率。 + +应用场景 +------------------------- + +ODC 提供桌面版和 Web 版两种产品形态。 + +* 桌面版支持 Windows 和 Mac 操作系统。 + + + +* Web 版支持 X86/ARM 架构。 + + + + + + +ODC Web 版支持堡垒机集成,ODC Web 版内置账号体系,因此在集成时需配置外部账号服务。Web 版支持场景如下表所示: + + +| 支持场景 | 说明 | +|----------|---------------------------------------------------------------------------| +| 跳转到登录页 | 跳转后用户需自行填入 ODC 账号密码登录 ODC; 管理员可通过公共连接分配权限,普通用户不需要掌握数据库帐密。 | +| 跳转到连接列表页 | 需配置账号集成; 管理员可通过公共连接分配权限,普通用户不需要掌握数据库帐密。 | +| 跳转进入临时连接 | 需配置账号集成,跳转参数需包含数据库连接配置。 | + + diff --git a/zh-CN/10.system-integration/1.bastion-host-integration-guide/2.bastion-application-integration.md b/zh-CN/10.system-integration/1.bastion-host-integration-guide/2.bastion-application-integration.md new file mode 100644 index 00000000..6651e05f --- /dev/null +++ b/zh-CN/10.system-integration/1.bastion-host-integration-guide/2.bastion-application-integration.md @@ -0,0 +1,290 @@ +应用集成 +========================= + + + +跳转过程 +------------------------- + +跳转过程如下图所示。 +![应用集成-跳转过程-1](http://icms-x-dita.oss-cn-zhangjiakou.aliyuncs.com/xdita-output/zh-CN/task18902554/images/p459719.png?Expires=7258140845&OSSAccessKeyId=LTAIJfoPL6wmrirR&Signature=RB3PdaEi6TP7KhwFmuBomYdUOiw%3D) + +上述跳转过程涉及参数传递、账号集成、连接配置创建等环节,此类环节的具体流程由 ODC 内部处理,调用端只需根据本堡垒机集成参考内容在跳转到 ODC 的 URL 内包含参数即可。 + +### 账号集成和安全鉴权 + +考虑到 URL 参数可能泄漏,为避免 URL 泄漏导致的权限泄漏,跳转过程包含以下安全相关设计。 + +* URL 参数加密算法和加密密钥可配置。 + + * 部署时,确保堡垒机传参、ODC 使用相同的密钥。 + + + + * 加密算法可选值包括:RAW 不加密;AES256_BASE64 使用 AES-256 加密算法,设置的密钥作为 SEED 生成实际的 KeySecret。 + + + + + + +* 跳转参数包含账号查询 API 访问 Token,ODC 基于该 Token 验证账号身份有效性。 + + * Token 只能单次使用,再次使用无效。 + + + + * 跳转时 ODC 会调用用户查询 API,验证 Token 是否有效、获取账户信息(包括姓名、昵称等信息):查询账户信息成功则自动登录 ODC 成功,若查询无此账号则 ODC 会自动创建;查询账户信息失败则自动登录失败。 + + + + + + + + + +### 连接配置维护 + +跳转 URL 参数中可包含连接配置参数。 + +* 参数包含连接配置时,跳转到 ODC 后 ODC 会自动创建响应的临时连接并打开该连接进入 SQL 控制台。 + + + +* 参数不包含连接配置时,跳转到 ODC 后 ODC 会进入首页连接列表页。 + + * 客户端版 ODC:用户可自行添加连接配置。 + + + + * Web 版 ODC:管理员可通过配置公共连接并分配权限给普通用户。 + + + + + + + + + +调用方式 +------------------------- + +调用地址语法: + +`${odc_site}/#/gateway/${param}` + +示例: + +ODC 地址为 `http://192.168.0.1:2883`,参数是 `abc`, 对应跳转地址是`http://192.168.0.1:2883/#/gateway/abc`。 + +调用示例代码: + +```unknow +// Web 页面内 JavaScript 调用跳转到 ODC +window.open('192.168.0.1:2883/#/gateway/' + param) + +// chrome 唤起 +chrome.exe --new-window 192.168.0.1:2883/#/gateway/param +``` + + + +参数说明 +------------------------- + +参数形式为 **Base64 编码之后的 JSON 字符串** 。 + +```unknow +{ + action: string, // 类型 + data: any, // 调用参数(加密情况下,需要先序列化成一个字符串,非加密情况,直接传递下方表格对应的参数类型) + encrypt: boolean // 参数是否加密 +} +``` + + + +其中,由三部分组成的参数说明如下: + + +| 参数 | 说明 | +|---------|------------------------------------------------------------------| +| action | 类型。 | +| data | 调用参数。 加密情况下,需要先序列化成一个字符串;非加密情况下,直接传递下方表格对应的参数类型。 | +| encrypt | 是否加密。 | + + + +### action 类型 + +**action: string** + + +| 可选值值 | 作用 | +|----------------|--------| +| start | 启动 ODC | +| newTempSession | 创建连接 | + + + +### data 调用参数 + +**data: any** + + +| action | 值类型 | 值 | 备注 | +|----------------|---------------------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| +| start | JSON (可选) | accountVerifyToken string | 账户登录凭证,可选 * 不为空时会做自动登录 * 为空时会跳转到登录页,用户自行输入帐密登录 ODC | +| newTempSession | JSON | accountVerifyToken string | 外部账号集成场景必填,登录凭证 | +| newTempSession | JSON | type 'OB_ORACLE' \| 'OB_MYSQL' | 数据库类型 ,必填 | +| newTempSession | JSON | clusterName string | 集群名称,非必填,unionDbUser 不为空时无效 | +| newTempSession | JSON | username string | 数据库用户名,unionDbUser 为空时必填 | +| newTempSession | JSON | tenantName string | 租户名称,unionDbUser 为空时必填 | +| newTempSession | JSON | unionDbUser string | 混合的集群用户名与租户信息,有这个参数就不需要单独传集群,租户和用户信息。 例: username@tenant#clusterName 或 obdemo:obmysql:username | +| newTempSession | JSON | defaultSchema string | 默认数据库(Oracle默认取用户名) | +| newTempSession | JSON | host string | 主机 IP/域名,必填 | +| newTempSession | JSON | password string | 数据库密码,必填 | +| newTempSession | JSON | port string | 端口,必填 | +| newTempSession | JSON | sysTenantUsername string | sys 租户账号,非必填 | +| newTempSession | JSON | sysTenantPassword string | sys 租户密码,非必填 | +| newTempSession | JSON | properties map | 连接的自定义配置字段,ODC 不理解 properties 内字段的值,用于集成方案的扩展功能,非必填。 | + + + +### encrypt 是否加密 + +**encrypt: boolean** + +标注参数中的 data 字段值是否加密。 + +* true:加密 + + + +* false: 不加密 + + + + + + +调用样例 +------------------------- + +### 场景一 跳转到首页连接列表页 + +此场景不涉及数据库连接配置,只包含 ODC 账号自动登录。 + +JavaScript 调用示例代码: + +```javascript +// 构造 data 参数 +const data = { + accountVerifyToken: 'token_value' +} + +// 构造 ODC 调用参数 +const ODCData = { + action: 'start', + data: encrypt(JSON.stringify(data)), // 加密数据 + encrypt: true +} + +// 把 json 类型转成base64字符串 +const param = base64(JSON.stringify(ODCData)); + +// Web 方式调用 Web 版本 ODC +window.open(' +192.168.0.1:2883 +/#/gateway/' + param) + +//chrome 唤起 +chrome.exe --new-window 192.168.0.1:2883/#/gateway/param +``` + + + +### 场景二 跳转时自动创建临时连接配置并进入连接 + +传入参数包含连接配置时,ODC 会自动创建一个临时连接配置并打开该连接进入到 SQL 窗口。 + +样例数据库连接配置 + +* 数据库类型:Oracle + + + +* 主机地址:'192.168.0.1' + + + +* 端口:2883 + + + +* 用户名:'\*\*\*\*' + + + +* 密码:'\*\*\*\*\*' + + + +* 租户:'oracle' + + + +* 默认库名:'default' + + + + + + +JavaScript 调用示例代码: + +```javascript +// 构造 data 参数 +// 注意 properties 内具体的字段和含义 ODC 并不理解,需要和集成的审批、审计系统确认 +const data = { + accountVerifyToken: 'token_value', + type: 'OB_ORACLE', + host: ' +192.168.0.1', + port: 2883, + + username: 'username', + password: '****', + tenantName: 'oracle', + defaultSchema: 'default', + properties: { + accountName: '****', + dbInstance: '****', + instanceType: 2, + ipAddress: '****', + operateSessionId: '****', + serviceName: '****', + userCode: '****', + } +} + +// 构造 ODC 调用参数 +const ODCData = { + action: 'newTempSession', + data: encrypt(JSON.stringify(data)), // 加密数据 + encrypt: true +} + +// 把 json 类型转成 base64 字符串 +const param = base64(JSON.stringify(ODCData)); + +// Web 方式调用 Web 版本 ODC +window.open('192.168.0.1:2883/#/gateway/' + param) + +//chrome 唤起 +chrome.exe --new-window 192.168.0.1:2883/#/gateway/param +``` + + diff --git a/zh-CN/10.system-integration/1.bastion-host-integration-guide/3.bastion-odc-system-configuration.md b/zh-CN/10.system-integration/1.bastion-host-integration-guide/3.bastion-odc-system-configuration.md new file mode 100644 index 00000000..b491480e --- /dev/null +++ b/zh-CN/10.system-integration/1.bastion-host-integration-guide/3.bastion-odc-system-configuration.md @@ -0,0 +1,52 @@ +ODC 系统配置 +============================= + + + +ODC 系统配置维护在 ODC 元数据库的 `config_system_configuration` 表,配置类型包括: + +* Web 版账号集成配置, key 统一前缀 `odc.integration.bastion.` + + + +* 连接配置保留策略,key 前缀 `odc.connect.temp.` + + + + + + +账号集成相关参数 +----------------------------- + + + +| key 名称 | 默认值 | 说明 | +|---------------------------------------------------------------------------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| odc.integration.bastion.encryption.enabled | false | 堡垒机集成参数是否加密。 默认值:false。 | 新增配置项 | +| odc.integration.bastion.encryption.algorithm | RAW | 堡垒机集成参数加密算法。 可选值:RAW、AES256_BASE64,默认值:RAW,表示不加密。 | +| odc.integration.bastion.encryption.secret | \<空\> | 堡垒机集成参数加密秘钥,当 algorithm 值非 RAW 时有效。 跳转时 data 参数值需使用此秘钥加密后传递,ODC 会使用此密钥对参数值解密。 | 新增配置项 | +| odc.integration.bastion.account.auto-login-enabled | false | 是否支持账号集成自动登录。 默认值:false。 | +| odc.integration.bastion.account.query.request-url | \<空\> | 账号查询 API 请求 URL,用于堡垒机集成场景 ODC 调用外部服务确认账号信息是否有效。 值可引用模板变量,支持的模板变量包括: `${account_verify_token}`。 | +| odc.integration.bastion.account.query.request-method | POST | 账号查询 API 请求 方法,用于堡垒机集成场景 ODC 调用外部服务确认账号信息是否有效。可选值:GET/POST/PUT/PATCH,默认值:POST。 | +| odc.integration.bastion.account.query.request-headers | \<空\> | 账号查询 API 请求 headers,可选。 可配置多个 headers 语法为 `Header1=Value1,Header2=Value2` Header 的值可引用模板变量,支持的模板变量包括:`${account_verify_token}`。 | +| odc.integration.bastion.account.query.request-encrypted| true| 用于判断发送请求时是否对 request body 进行加密。默认值:true,表示加密。| +| odc.integration.bastion.account.query.response-encrypted| true| 用于控制接收到响应之后,是否对 response body 进行加密。默认值:true,表示加密。| +| odc.integration.bastion.account.query.request-body | \<空\> | 账号查询 API 请求 body,值可引用模板变量,支持的模板变量包括:`${account_verify_token}`,为空表示不包含 request body。 | +| odc.integration.bastion.account.query.response-body-valid-expression | true | 账号查询 API 调用成功判断 response body 判定表达式。默认值:true,表示不校验 response body。 | +| odc.integration.bastion.account.query.response-body-username-extract-expression | \<空\> | 账号查询 API response body 账户名称提取表达式。 | +| odc.integration.bastion.account.query.response-body-nickname-extract-expression | \<空\> | 账号查询 API response body 账户昵称提取表达式。 | + + + +临时连接配置保留周期参数 +--------------------------------- + + + +| key 名称 | 默认值 | 说明 | +|---------------------------------------------------------|-------|-------------------------------------------------| +| odc.connect.temp.expire-after-inactive-interval-seconds | 86400 | 临时连接不活跃之后的保留周期。 单位:秒,默认值:86400。 | + + + diff --git a/zh-CN/10.system-integration/1.bastion-host-integration-guide/4.bastion-appendix.md b/zh-CN/10.system-integration/1.bastion-host-integration-guide/4.bastion-appendix.md new file mode 100644 index 00000000..fe09eb5b --- /dev/null +++ b/zh-CN/10.system-integration/1.bastion-host-integration-guide/4.bastion-appendix.md @@ -0,0 +1,288 @@ +# 附录 + + + +## AES 加解密参考代码 + +### AES 加解密参考代码 + +> **注意** +> Oracle JDK 版本需要为 1.8.0_200 以上版本,低版本 JDK 有 AES 加密位数限制,不能支持 256 位加密。 + +```JavaScript +package com.oceanbase.odc.example; + +import java.nio.charset.StandardCharsets; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.KeySpec; +import java.util.Arrays; +import java.util.Base64; +import java.util.Objects; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.PBEKeySpec; +import javax.crypto.spec.SecretKeySpec; + +/** + * AES Base64 文本格式加解密 + */ +public class AesBase64TextEncryptor { + private final AesBytesEncryptor encryptDecrypt; + + /** + * @param key 加密密钥串 + * @param salt 计算密钥使用功能的盐,可选;如果 为空,则不使用 salt + */ + public AesBase64TextEncryptor(String key, String salt) { + this.encryptDecrypt = new AesBytesEncryptor(key, salt); + } + + /** + * @param key 加密密钥串 + * @param salt 计算密钥使用功能的盐,可选 + * @param keyLength 密钥长度 + */ + public AesBase64TextEncryptor(String key, String salt, int keyLength) { + this.encryptDecrypt = new AesBytesEncryptor(key, salt, keyLength); + } + + /** + * 加密 + */ + public synchronized String encrypt(String plainText) { + if (plainText == null) { + return null; + } + byte[] bytes = plainText.getBytes(StandardCharsets.UTF_8); + byte[] encrypted = encryptDecrypt.encrypt(bytes); + return base64Encode(encrypted); + } + + /** + * 解密 + */ + public synchronized String decrypt(String encryptedText) { + if (encryptedText == null) { + return null; + } + byte[] encrypted = base64Decode(encryptedText); + byte[] decrypt = encryptDecrypt.decrypt(encrypted); + return new String(decrypt, StandardCharsets.UTF_8); + } + + private byte[] base64Decode(String right) { + byte[] bytes = right.getBytes(StandardCharsets.UTF_8); + return Base64.getDecoder().decode(bytes); + } + + private String base64Encode(byte[] left) { + byte[] encoded = Base64.getEncoder().encode(left); + if (Objects.isNull(encoded)) { + return null; + } + return new String(encoded, StandardCharsets.UTF_8); + } + + public static class AesBytesEncryptor { + + private static final String FACTORY_INSTANCE = "PBKDF2WithHmacSHA256"; + private static final String CIPHER_INSTANCE = "AES/CBC/PKCS5PADDING"; + private static final String SECRET_KEY_TYPE = "AES"; + private static final String NO_SALT_SECURE_RANDOM_INSTANCE = "SHA1PRNG"; + + /** + * 默认 KEY 长度 + */ + private static final int DEFAULT_KEY_LENGTH = 256; + + /** + * IV 指的是 initialization vector,
            + * 在 CBC 模式中使用随机的初始化向量,可以使得同一个源每次加密得到的值是不一样的 + */ + private static final int IV_LENGTH = 16; + + /** + * 迭代次数,越大则加解密成本越大,暴力破解耗时越久,一般不少于 1000 + */ + private static final int ITERATION_COUNT = 1024; + + /** + * 秘钥长度 + */ + private final int keyLength; + + private final SecretKeySpec secretKey; + private final Cipher encryptor; + private final Cipher decryptor; + + public AesBytesEncryptor(String key, String salt, int keyLength) { + Validate.notEmpty(key, "parameter 'key' must not be empty"); + Validate.validState(keyLength > 0, "parameter 'keyLength' must greater than 0"); + this.keyLength = keyLength; + this.secretKey = newSecretKey(key, salt); + this.encryptor = createCipher(); + this.decryptor = createCipher(); + } + + public AesBytesEncryptor(String key, String salt) { + this(key, salt, DEFAULT_KEY_LENGTH); + } + + public byte[] encrypt(byte[] origin) { + Validate.notNull(origin, "parameter 'origin' may not be null"); + // Generating random IV + SecureRandom random = new SecureRandom(); + byte[] iv = new byte[IV_LENGTH]; + random.nextBytes(iv); + initCipher(encryptor, Cipher.ENCRYPT_MODE, iv); + byte[] encrypted = doFinal(encryptor, origin); + return addIVToCipher(encrypted, iv); + } + + public byte[] decrypt(byte[] encrypted) { + Validate.notNull(encrypted, "parameter 'encrypted' may not be null"); + Validate.isTrue(encrypted.length >= IV_LENGTH, + "length of parameter 'encrypted' may not less than IV length " + IV_LENGTH); + byte[] iv = new byte[IV_LENGTH]; + System.arraycopy(encrypted, 0, iv, 0, IV_LENGTH); + initCipher(decryptor, Cipher.DECRYPT_MODE, iv); + byte[] original = doFinal(decryptor, encrypted); + return Arrays.copyOfRange(original, IV_LENGTH, original.length); + } + + private byte[] doFinal(Cipher cipher, byte[] input) { + try { + return cipher.doFinal(input); + } catch (IllegalBlockSizeException e) { + throw new IllegalStateException( + "Unable to invoke Cipher due to illegal block size", e); + } catch (BadPaddingException e) { + throw new IllegalStateException("Unable to invoke Cipher due to bad padding", + e); + } + } + + private SecretKeySpec newSecretKey(String key, String salt) { + try { + if (Objects.isNull(salt) || salt.isEmpty()) { + SecureRandom random = SecureRandom.getInstance(NO_SALT_SECURE_RANDOM_INSTANCE); + random.setSeed(key.getBytes()); + + KeyGenerator keyGenerator = KeyGenerator.getInstance(SECRET_KEY_TYPE); + keyGenerator.init(keyLength, random); + + SecretKey secretKey = keyGenerator.generateKey(); + return new SecretKeySpec(secretKey.getEncoded(), SECRET_KEY_TYPE); + } else { + SecretKeyFactory factory = SecretKeyFactory.getInstance(FACTORY_INSTANCE); + KeySpec keySpec = new PBEKeySpec(key.toCharArray(), salt.getBytes(), ITERATION_COUNT, keyLength); + SecretKey secretKey = factory.generateSecret(keySpec); + return new SecretKeySpec(secretKey.getEncoded(), SECRET_KEY_TYPE); + } + } catch ( + + NoSuchAlgorithmException e) { + throw new IllegalArgumentException("Not a valid encryption algorithm", e); + } catch (InvalidKeySpecException e) { + throw new IllegalArgumentException("Not a valid secret key", e); + } + } + + private void initCipher(Cipher cipher, int mode, byte[] iv) { + try { + cipher.init(mode, secretKey, new IvParameterSpec(iv)); + } catch (InvalidKeyException e) { + throw new IllegalArgumentException("Not a valid secret key", e); + } catch (InvalidAlgorithmParameterException e) { + throw new IllegalArgumentException("Not a valid encryption algorithm", e); + } + } + + private Cipher createCipher() { + try { + return Cipher.getInstance(CIPHER_INSTANCE); + } catch (NoSuchAlgorithmException e) { + throw new IllegalArgumentException("Not a valid encryption algorithm", e); + } catch (NoSuchPaddingException e) { + throw new IllegalStateException("Should not happen", e); + } + } + + private byte[] addIVToCipher(byte[] encrypted, byte[] iv) { + byte[] cipherWithIv = new byte[iv.length + encrypted.length]; + System.arraycopy(iv, 0, cipherWithIv, 0, iv.length); + System.arraycopy(encrypted, 0, cipherWithIv, iv.length, encrypted.length); + return cipherWithIv; + } + } + + public static class Validate { + public static T notEmpty(final T chars, final String message, final Object... values) { + Objects.requireNonNull(chars, () -> String.format(message, values)); + if (chars.length() == 0) { + throw new IllegalArgumentException(String.format(message, values)); + } + return chars; + } + + public static void validState(final boolean expression, final String message, final Object... values) { + if (!expression) { + throw new IllegalStateException(String.format(message, values)); + } + } + + public static T notNull(final T object, final String message, final Object... values) { + return Objects.requireNonNull(object, () -> String.format(message, values)); + } + + public static void isTrue(final boolean expression, final String message, final Object... values) { + if (!expression) { + throw new IllegalArgumentException(String.format(message, values)); + } + } + } +} +``` + +### AES 加解密调用示例 + +```JavaScript +package com.oceanbase.odc.example; + +import org.junit.Assert; +import org.junit.Test; + +public class AesBase64TextEncryptorTest { + + @Test + public void encryptDecrypt_NoSalt() { + AesBase64TextEncryptor encryptor = new AesBase64TextEncryptor("1234567890123456_1", null); + + String origin = "abcd1234"; + String encrypt = encryptor.encrypt(origin); + String decrypt = encryptor.decrypt(encrypt); + Assert.assertEquals(origin, decrypt); + } + + @Test + public void sameKeyTwice_Different() { + AesBase64TextEncryptor encryptor = new AesBase64TextEncryptor("1234567890123456_1", null); + + String encrypted1 = encryptor.encrypt("123654"); + String encrypted2 = encryptor.encrypt("123654"); + Assert.assertNotEquals(encrypted1, encrypted2); + } + +} +``` \ No newline at end of file diff --git a/zh-CN/10.system-integration/2.oauth2-account-integration-guide/1.oauth2-overview.md b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/1.oauth2-overview.md new file mode 100644 index 00000000..60d0bb08 --- /dev/null +++ b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/1.oauth2-overview.md @@ -0,0 +1,22 @@ +# 概述 +## 什么是 OAuth2 +OAuth(Open Authorization,开放授权)是一个开放标准的授权协议,允许用户授权第三方应用访问其存储在资源服务上受保护的信息,而不需要将用户名和密码提供给第三方应用,解耦了认证和授权。OAuth 作为一种国际标准,目前传播广泛并被持续采用。OAuth2.0 是 OAuth 协议的延续版本,更加安全,更易于实现,但不兼容 OAuth1.0,即完全废止了 OAuth1.0。 +OAuth(Open Authorization,开放授权)是为用户资源的授权定义了一个安全、开放及简单的标准,第三方无需获知用户的账号和密码,即可获取到用户的授权信息。 + +- OAuth2 用于REST/APIs 的代理授权框架(delegated authorization framework)。 +- OAuth2 是基于令牌 Token 的授权,在无需暴露用户密码的情况下,让应用获取对用户数据有限访问权限。 +- OAuth2 解耦认证和授权。 + +## 什么是 OceanBase 开发者中心 +OceanBase 开发者中心(OceanBase Developer Center,ODC)是为 OceanBase 数据库量身打造的企业级数据库开发平台。ODC 支持连接 OceanBase 中 MySQL 和 Oracle 模式下的数据库,同时为数据库开发者提供了数据库日常开发操作、WebSQL、SQL 诊断、会话管理和数据导入导出等功能。ODC 采用成熟的浏览器-服务端架构,拥有跨平台、轻量化和易部署的特点。同时,ODC 还提供客户端版本,不仅能满足个人开发者快速上手使用 OceanBase 的需求,还可提升开发人员与 DBA 的协作效率。 +## 应用场景 +ODC 提供桌面版和 Web 版两种产品形态。 + +- 桌面版支持 Windows 和 Mac 操作系统。 +- Web 版支持 X86/ARM 架构。 + +ODC Web 版支持 OAuth2 集成,ODC Web 版内置账号体系,因此在集成时需配置外部账号服务。Web 版支持场景如下表所示: + +| 支持场景 | 说明 | +| --- | --- | +| 跳转到 ODC 首页 | 在 CAS OAuth2 上集成 ODC 且认证登录 ODC 后,通过授权页面登录到 ODC 首页。 | \ No newline at end of file diff --git a/zh-CN/10.system-integration/2.oauth2-account-integration-guide/2.oauth2-application-integration.md b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/2.oauth2-application-integration.md new file mode 100644 index 00000000..815adfe8 --- /dev/null +++ b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/2.oauth2-application-integration.md @@ -0,0 +1,29 @@ +# 应用集成 +## 跳转过程 +ODC 适配标准 OAuth2 认证中心,目前仅支持授权码(authorization-code)模式,即应用程序使用授权码来向授权服务器申请访问令牌/刷新令牌。 + +![1.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/1.png) + +如图所示,授权流程场景可以描述为如下几个步骤: + +1. 用户登录应用系统,请求跳转到认证服务器,并 302 返回登录认证页面。 +2. 用户输入账户+密码进行认证,认证服务器认证通过返回 code 给应用系统。 +3. 应用系统携带 code 向认证服务器换取访问令牌,认证服务器验证 Client ID,code 等信息,给应用系统发送访问令牌。 +4. 应用系统携带访问令牌查询用户登录信息,认证服务器返回用户信息,如用户名。 +5. 应用系统验证用户名正确,创建会话,并跳转到 redirect url。 + +上述图中的相关参数说明如下: + +| **步骤** | **参数说明** | +| --- | --- | +| 步骤 1 | Authorization Request
            - response_type:必选。值固定为 `code`。
            - client_id:必选:第三方应用标识 ID。
            - State:推荐。Client 提供的一个字符串,服务器会原样返回给 client。
            - redirect_uri:必选。授权成功后的重定向地址。
            - scope:可选。表示授权范围。 | +| 步骤 2 | 验证步骤 1 中传递的参数。
            显示登录页面,让用户认证。
            用户授权 client 可访问的资源。 | +| 步骤 3 | Authorization Response
            跳转到步骤 1 中指定的 redirect_url,并返回:
            - Code:授权码。
            - State:步骤 1 中客户端提供的 state 参数原样返回。 | +| 步骤 4 | Access Token Request
            - grant_type:必选。固定值 `authorization_code`。
            - code:必选。Authorization Response 中响应的 code。
            - redirect_uri:必选。必须和 Authorization Request 中提供的 redirect_uri 相同。
            - client_id:必选。必须和 Authorization Request 中提供的 client_id 相同。 | +| 步骤 5 | Access Token Response
            - access_token:访问令牌。
            - Refresh_token:刷新令牌。
            - Expires_in:过期时间。| + + +## 接入准备 +用户已部署授权服务。 +## 接入方式 +ODC V3.4.0 版本已开放 OAuth2 认证登录功能,用户更新 ODC 到 V3.4.0 版本后,更新必要的配置信息即可接入自有授权服务器,实现单点登录。 \ No newline at end of file diff --git a/zh-CN/10.system-integration/2.oauth2-account-integration-guide/3.oauth2-odc-system-configuration.md b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/3.oauth2-odc-system-configuration.md new file mode 100644 index 00000000..52f05fe1 --- /dev/null +++ b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/3.oauth2-odc-system-configuration.md @@ -0,0 +1,43 @@ +# ODC 系统配置 + +ODC 系统配置维护在 ODC 元数据库的 `config_system_configuration` 表,具体配置项及说明如下: +## OAuth2 启用配置 +| 参数 | 说明 | +| --- | --- | +| odc.iam.auth.type | 登录鉴权方式,使用 OAuth2 接入时,请填写:oauth2。 | +| odc.oauth2.loginRedirectUrl | 认证成功后重定向地址。 | +| odc.oauth2.logoutUrl | 退出登录后跳转地址。 | +| odc.oauth2.adminAccountNames | 管理员用户账户集合。 | + +## OAuth2 Registration 配置 +启动脚本会生成 registrationId=odc 的配置项,用户需要更新各配置,也允许自定义 registrationId,但需要保证与重定向地址匹配。 + +| 参数 | 说明 | +| --- | --- | +| spring.security.oauth2.client.registration.odc.provider | 认证中心配置的 providerId。 | +| spring.security.oauth2.client.registration.odc.clientId | 应用标识,与授权服务器注册时的配置保持一致。 | +| spring.security.oauth2.client.registration.odc.clientSecret | 应用密钥,与授权服务器注册时的配置保持一致。 | +| spring.security.oauth2.client.registration.odc.redirectUrl | 授权成功后的回调地址。 | +| spring.security.oauth2.client.registration.odc.authorizationGrantType | 授权类型,目前仅支持 code。 | +| spring.security.oauth2.client.registration.odc.scope | 应用授权作用域,多个用空格隔开,建议为 profile。 | +| spring.security.oauth2.client.registration.odc.clientAuthenticationMethod | 授权服务认证请求方式,支持 post/none/basic,默认为 post。 | + +## OAuth2 Provider 配置 +启动脚本会生成 providerId=cas 的配置项,用户也可自定义 provider。存在多个 provider时,只有 +security.oauth2.client.registration.odc.provider 配置指向的 provider 生效。 + +| 参数 | 说明 | +| --- | --- | +| spring.security.oauth2.client.provider.cas.authorizationUri | 授权服务器提供的获取 grant-code 地址。 | +| spring.security.oauth2.client.provider.cas.tokenUri | 授权服务器提供的获取 access-token 地址。 | +| spring.security.oauth2.client.provider.cas.userInfoUri | 授权服务器提供的获取 user-info 地址。 | +| spring.security.oauth2.client.provider.cas.userInfoAuthenticationMethod | 授权服务器获取支持的用户信息请求方法。 | + +## 用户信息字段绑定配置 +授权服务器鉴权成功后,响应给 ODC 的用户信息。如 CAS 提供的 /oauth2.0/profile 接口返回内容。需要配置以下字段名称: + +| 参数 | 说明 | +| --- | --- | +| odc.oauth2.userAccountNameField | 用户账户字段名。 | +| odc.oauth2.userNickNameField | 用户名称字段名。 | +| odc.auth2.organizationNameField | 组织机构字段名。 | \ No newline at end of file diff --git a/zh-CN/10.system-integration/2.oauth2-account-integration-guide/4.oauth2-integrated-verification.md b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/4.oauth2-integrated-verification.md new file mode 100644 index 00000000..35e82eea --- /dev/null +++ b/zh-CN/10.system-integration/2.oauth2-account-integration-guide/4.oauth2-integrated-verification.md @@ -0,0 +1,69 @@ +# OAuth2 集成验证(以 CAS 为例) +## ODC 集成 CAS OAuth2 +### 步骤 1:ODC 授权服务注册 +在授权服务器注册 ODC 应用。 +```json +{ + "@class" : "org.apereo.cas.support.oauth.services.OAuthRegisteredService", + "clientId": "your client id", + "clientSecret": "your secret", + "serviceId" : "^(https|http|imaps)://.*", + "name" : "testService", + "id" : 100000, + "jsonFormat" : true, + "attributeReleasePolicy": { + "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy" + } + +} +``` +### 步骤 2:ODC 准备环境 +配置授权服务域名证书到 ODC 运行环境。 + +```bash +keytool -import -keystore cacerts -file cas.crt -alias cas +``` +参数说明: + +| 参数 | 说明 | +| --- | --- | +| cacerts | JRE keystore,文件位于$JAVA_HOME/jre/lib/security | +| cas.crt | 需要导入的证书 | +| cas | 证书别名 | + +### 步骤 3:ODC 更新配置信息 +语法格式: +```sql +UPDATE config_system_configuration SET `value`='oauth2' where `key`='odc.iam.auth.type'; +UPDATE config_system_configuration SET `value`='https://cas.example.org:8443/cas/login' where `key`='odc.oauth2.logoutUrl'; +UPDATE config_system_configuration SET `value`='http://localhost:8989/oauth2/authorization/cas' where `key`='odc.oauth2.loginRedirectUrl'; +UPDATE config_system_configuration SET `value`='admin,admin1' where `key`='odc.oauth2.adminAccountNames'; + +UPDATE config_system_configuration SET `value`='userAccountNameField' where `key`='odc.oauth2.userAccountNameField'; +UPDATE config_system_configuration SET `value`='userNickNameField' where `key`='odc.oauth2.userNickNameField'; +UPDATE config_system_configuration SET `value`='organizationNameField' where `key`='odc.oauth2.organizationNameField'; + +UPDATE config_system_configuration SET `value`='cas' where `key`='spring.security.oauth2.client.registration.odc.provider'; +UPDATE config_system_configuration SET `value`='your client id' where `key`='spring.security.oauth2.client.registration.odc.client-id'; +UPDATE config_system_configuration SET `value`='your secret' where `key`='spring.security.oauth2.client.registration.odc.client-secret'; +UPDATE config_system_configuration SET `value`='http://localhost:8989/login/oauth2/code/{registrationId}' where `key`='spring.security.oauth2.client.registration.odc.redirect-uri'; +UPDATE config_system_configuration SET `value`='authorization_code' where `key`='spring.security.oauth2.client.registration.odc.authorization-grant-type'; +UPDATE config_system_configuration SET `value`='profile' where `key`='spring.security.oauth2.client.registration.odc.scope'; +UPDATE config_system_configuration SET `value`='post' where `key`='spring.security.oauth2.client.registration.odc.clientAuthenticationMethod'; + +UPDATE config_system_configuration SET `value`='https://cas.example.org:8443/cas/oauth2.0/authorize' where `key`='spring.security.oauth2.client.provider.cas.authorization-uri'; +UPDATE config_system_configuration SET `value`='https://cas.example.org:8443/cas/oauth2.0/accessToken' where `key`='spring.security.oauth2.client.provider.cas.token-uri'; +UPDATE config_system_configuration SET `value`='https://cas.example.org:8443/cas/oauth2.0/profile' where `key`='spring.security.oauth2.client.provider.cas.user-info-uri'; +UPDATE config_system_configuration SET `value`='header' where `key`='spring.security.oauth2.client.provider.cas.userInfoAuthenticationMethod'; +``` +## CAS OAuth2 单点登录 ODC +### 步骤 1:启动 ODC +部署 Web 版 ODC 请参见 [部署指南](https://www.oceanbase.com/docs/enterprise/odc-doc-cn/V3.3.3/10000000000515650) 。 +### 步骤 2:访问 ODC 首页 +![image2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/2.png) +### 步骤 3:自动跳转到 CAS +![image3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/3.png) +### 步骤 4:登录后进入授权页面 +![image4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/4.png) +### 步骤 5:单点授权后登录 ODC +![image5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/5.png) \ No newline at end of file diff --git a/zh-CN/11.faq.md b/zh-CN/11.faq.md new file mode 100644 index 00000000..1ae884e4 --- /dev/null +++ b/zh-CN/11.faq.md @@ -0,0 +1,256 @@ +常见问题 +========================= + + + +客户端版 ODC 安装问题 +---------------------------------- + +1. Q:客户端版 ODC 安装预检查时会检查哪些项目? + + A:客户端版 ODC 预检查项目如下所示:
            + - Windows 操作系统版本检查:仅支持 Windows 7 及以上版本。
            + - 端口检查:查看 8989 是否被占用。在 ODC V2.3.0 后采用动态端口将不再检查该项。
            + - Java 运行环境检查:建议安装 JDK 1.8.0_242 及以上版本。 +
            + +2. Q:客户端版 ODC 安装或启动失败时如何查看日志? + + A:在日志文件 main.log 中查看报错信息。日志的存放路径如下所示:
            + - Linux: ~/.config/odc/logs
            + - macOS: ~/Library/Application Support/Logs/odc/logs
            + - Windows: %USERPROFILE%\AppData\Roaming\odc\logs +
            + +3. Q:客户端版 ODC 安装或启动失败,提示端口冲突问题时该如何排查? + + A:查看占用了端口号 8989 的进程,关闭相关进程后重新安装或启动。ODC V2.3.0 及以上版本采用动态端口技术,不会出现该类问题。 + a. 使用以下命令在 MAC 系统下查看端口号占用情况: + ```javascript + lsof -i tcp:8989 + ``` + b. 使用以下语句在 Win 系统下查看端口号占用情况: + ```javascript + netstat -ano|findstr 8989 + ``` + + ODC V3.2.0 支持自定义端口设置: + + - MAC 系统下需设置环境变量后通过命令启动: + + ![faq 3.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%983-1.png) + + ![faq 3.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%983-2.png) + + - Windows 通过环境变量设置 ODC_PORT 指定端口生效: + + ![faq 3.3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%983-3.png) +
            + +4. Q:客户端版 ODC 安装或启动失败,提示 Java 版本问题时该如何解决? + + A:使用以下命令查看 Java 运行环境,ODC 需使用 JDK 1.8.0_242 及以上版本,若版本低于 1.8.0_242 请更新 JDK 并重启电脑后重新安装或启动: + + ```javascript + java -version + ``` + + +
            + +5. Q:客户端版 ODC 安装或启动失败,提示软件包损坏该如何解决? + + A:通过 `sudo spctl --master-disable` 后,选择任何来源。 + + ![常见问题-安装包损坏解决](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3600781361/p327743.png) +
            + +6. Q:在 macOS 系统中安装 ODC 时,提示如下信息。 + ![0630BE10-49E1-4E06-BB2B-F55CDEEDC31F](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0158920361/p313145.png) + A:macOS 暂不支持直接安装,您可以参照 Apple 的支持文档查看如何安全的打开非通过 Apple Store 下载的应用,详情请参见文章 [在 Mac 上安全地打开 App](https://support.apple.com/zh-cn/guide/mac-help/mchleab3a043/mac)。 + + + + +Web 版 ODC 启动问题 +----------------------------------- + +1. Q:从旧版本 ODC 升级至 V3.2.0 及以上版本时,出现用户名冲突 (如 admin),且启动失败,应如何解决? + + A: + + **报错示例:** + + ![用户名冲突启动失败](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3663745361/p345547.png) + + **解决方案** : + + (以用户名 admin 冲突为例) + + a. 在安装目录下的 ../odc/static/tmp/rename.properties 中编辑 rename.properties,格式为 + + ```unknow + admin=用户重命名 + ``` + + b. 用户名修改完成后保存,再次尝试启动 ODC。 + + + +连接信息相关问题 +----------------------------- + +1. Q:ODC 执行 SQL 时连接中断,应如何解决? + + A: + + 此问题因代理服务器超时导致,可通过浏览器调试模式检查 `sql-execute` 请求的 response 确认。 + + 可修改负载均衡配置,确保 proxy 超时配置时长充足。如 nginx 配置可修改如下: + + a. 增加以下 proxy 配置。 + + ```shell + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + ``` + + + > **说明**
            + > 建议 `proxy_connect_timeout` 参数不超过 75 秒,请参见 [proxy_connect_timeout](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout)。 + > 设置 `proxy_next_upstream off` 旨在禁止 nginx 将请求转发至下一个 ODC 节点,导致用户需重新登录,且某些功能不可用,如异步任务结果集下载等与文件上传下载相关的功能。 + + + b. 修改配置后重启 nginx 。 +
            + +2. Q:如何备份 ODC 中的连接信息? + + A: + + * 针对 Web 版 ODC,可直接迁移或备份部署 ODC 时创建的元数据库; + * 针对客户端版 ODC,可备份用户目录下的 `odc2.0.mv.db` 文件,需恢复连接时,拷贝或替换该文件至到原目录下即可。 +
            + +3. Q:执行 SQL 超时时,应如何解决? + + A:当执行 SQL 超时时,可手动设置查询超时时间。在连接信息编辑页面的高级配置中,加大 **SQL 查询超时** **时间** 项的值。该设置项从 ODC V2.2.0 版本开始支持,若您使用的是低版本应用,请升级至 ODC V2.2.0 及以上版本。 +
            + +4. Q:如出现 proxyro 用户不存在的报错时,应如何解决? + + A:如出现报错信息 proxyro 用户不存在时,可在连接信息编辑页面的高级配置中,配置 **查询 sys 租户视图** 项来设置拥有查询 sys 租户视图权限的用户。该设置项从 ODC V2.2.0 版本开始支持,若您使用的是低版本应用,请升级至 ODC V2.2.0 及以上版本。 + + + +命令行工具相关问题 +------------------------------ + +1. Q:Windows 系统下桌面版 ODC 使用命令行工具建立连接后,如下图所示出现连接卡住后并断开的问题,应如何解决? + ![Image 360](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9678376161/p255231.png) + + A:这是因为环境中缺少 Windows 下系统库文件 msvcp120.dll 和 msvcr120.dll,请安装官方 [Visual Studio 补丁](https://www.microsoft.com/en-us/download/details.aspx?id=40784)。 + + > **说明**
            + > Visual Studio 补丁安装后不用重启,建议更新 ODC 至最新版本,目前的 ODC 版本带有对应的 DLL 文件,无需再单独安装补丁。 + + + + + +编码相关问题 +--------------------------- + +1. Q:在使用 ODC 时出现查询结果集为乱码,应如何解决? + + A:出现此现象主要因客户端的编码和数据库认为的客户端编码不一致造成。ODC 客户端的编码分两种情况: + + + | 位置 | Linux | Mac | Windows | + |--------|-------|------|---------| + | SQL 窗口 | UTF8 | UTF8 | UTF8 | + | 命令行窗口 | UTF8 | UTF8 | GBK | + + + + 数据库认为的客户端编码可以通过数据库参数查看,查看方法: + + ```sql + show variables like '%character_set_c%'; + show variables like '%character_set_r%'; + ``` + + + + 具体参数如下: + + ![常见问题-乱码](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7963541361/p326073.png) + + 可通过如下命令进行数据库认为的客户端编码调整: + + ```sql + set names gbk; + ``` + + + + + | 场景 | 解决方案 | + |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | SQL 窗口执行 SQL 结果集中包含中文字符乱码
            - ODC 安装服务器:mac
            - OBserver的字符集编码:GBK | - 查看现象
            在数据库中执行如下命令:
            ```sql show variables like '%character%'; ``` 得到结果: ```sql character_set_client gbk character_set_connection gbk character_set_filesystem binary character_set_results gbk character_set_system gbk ```
            从现象可看出数据的字符集是 GBK,且数据库认为客户端使用的字符集也是 GBK。
            - 问题原因
            数据库认为客户端使用的字符集(GBK)与实际客户端的字符集(UTF8)不一致。
            - 解决方案
            调整数据库认为客户端使用的字符集,将其与实际客户端的字符集兼容。
            ```sql set names utf8mb4; ```
            调整完成后,在当前 session 内再执行 SQL ,查看结果集时即可避免中文乱码问题。 | + | 命令行窗口中执行 SQL 结果集中包含中文字符乱码
            - ODC 安装服务器:windows
            - OBserver的字符集编码:utf8mb4 | - 查看现象
            在数据库中执行如下命令:
            ```sql show variables like '%character%'; ```
            得到结果:
            ```sql character_set_client utf8mb4 character_set_connection utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_system utf8mb4 ```
            从现象可看出数据的字符集是 utf8mb4,且数据库认为客户端使用的字符集也是 utf8mb4。
            - 问题原因
            数据库认为客户端使用的字符集(utf8mb4)与实际客户端的字符集(GBK)不一致。
            - 解决方案
            调整数据库认为客户端使用的字符集,将其与实际客户端的字符集兼容。
            ```sql set names gbk; ```
            调整完成后,在当前 session 内再执行 SQL ,查看结果集时就可避免中文乱码问题。 | + | 导入文件至数据库中,中文内容乱码 - 文件编码:GBK
            - ODC 安装服务器:mac
            - OBserver的字符集编码:utf8mb4 | - 查看现象
            在数据库中执行如下命令:
            ```sql show variables like '%character%'; ```
            得到结果:
            ```sql character_set_client utf8mb4 character_set_connection utf8mb4 character_set_filesystem binary character_set_results utf8mb4 character_set_system utf8mb4 ```
            从现象可看出数据的字符集是 utf8mb4,且数据库认为客户端使用的字符集也是 utf8mb4。
            - 问题原因
            因为此时用户是通过导入往数据库中写入数据,与 ODC 自身的客户端编码无关,需保证导入文件编码和数据库认为客户端使用的字符集保持一致。
            - 解决方案
            将导入文件由 GBK 转码至 UTF8 后,再导入,乱码问题解决。 | + + + + + + +数据导出导入问题 +----------------------------- + +1. Q:导入或导出数据失败时,任务汇总信息中抛出异常: `javax.crypto.BadPaddingException: Given final block not properly padded` 时该如何处理? + + A:看到该异常的原因是 OBProxy 密码解密失败。可通过以下三种方法解决: + + + + + + + +DDL 语句展示问题 +------------------------------- + +1. Q:表结构 DDL 查看信息不全,应如何解决? + + A:获取索引和约束 DDL 本身就包含在 现有的 DDL 中,可通过 `DBMS_METADATA.get_ddl` 或 `show create table` 实现。 + + 示例: + + ```sql + -- 获取表索引DDL + SELECT dbms_metadata.get_ddl('INDEX', 'indexname', 'username') from dual; + -- 获取表注释 DDL + SELECT 'comment on table ' || table_name || ' is ' || '''' || comments || ''';' + FROM all_tab_comments where owner='USER1' AND table_name='T_1' ; + -- 获取表注释 DDL 样例 + comment on table T_1 is 'desc 2'; + + -- 获取列注释 DDL + SELECT 'comment on column ' || table_name || '.' || column_name || ' is ' || '''' || comments || ''';' + FROM all_col_comments where owner='USER1' AND table_name='T_1' ; + -- 获取列注释 DDL 样例 + comment on column T_1.ID is 'ID 3'; + ``` +
            + +2. Q:在视图或表管理页面查看视图或表的 DDL 语句时,所展示的语句不全被截断了。 + + A:数据库对象管理页面的 DDL 页签调用了系统表 `all_views` 中字段 `text` 的内容,在 OBServer V2.2.70 之前, `all_views` 表中字段 `text` 的内容太长时会被截断,这个问题的 OBServer V2.2.70 后被修复了。您也可以使用 `SHOW CREATE VIEW/TABLE` 语句直接查询目标视图或表的完整结构语句。 + + + + diff --git a/zh-CN/12.rn.md b/zh-CN/12.rn.md new file mode 100644 index 00000000..343f4960 --- /dev/null +++ b/zh-CN/12.rn.md @@ -0,0 +1,260 @@ +# 版本发布记录 + +本次 1 月发版的 OceanBase 开发者中心(OceanBase Developer Center,ODC)V4.1.0 主要新增 SQL 检查和自动运行,并对连接管理、权限管理、SQL 窗口、表对象管理、导入导出和交互界面等功能进行了优化。 + +## 版本信息 + +* **当前版本:** V4.1.0 + +* **前置版本:** V4.0.2 + +* **发版时间:** 2023 年 01 月 12 日 + +* **支持的升级路径:** 对于 ODC V2.0.0 及之后版本,均可直接升级至本版本。 + + + + +## 支持的 OceanBase 数据库版本 + +OceanBase 开发者中心 V4.1.0 版本支持下述版本的 OceanBase 数据库。 + +* ODC 通用功能支持 OceanBase 数据库版本 + + * OceanBase V1.4.x(主流版 V1.4.7) + + * OceanBase V2.0.x + + * OceanBase V2.1.x + + * OceanBase V2.2.x(主流版 V2.2.7) + + * OceanBase V3.1.x(主流版 V3.1.2) + + * OceanBase V3.2.x(主流版 V3.2.4) + + * OceanBase V4.0.0 + + * OceanBase 社区版 + + + + +* ODC PL 功能支持 OceanBase 数据库版本 + + * PL 对象(函数/存储过程/程序包)编译、PL 对象(函数/存储过程)调试和匿名块调试:支持 V2.2.7、V3.0.x 及之后版本,推荐 OceanBase V3.2.3 BP4 及之后版本体验更友好的调试能力。 + + * PL 对象(函数/存储过程/程序包)运行和匿名块运行:支持 V2.0.x 及之后版本。 + + + +## 功能变更 + + +* SQL 检查 + + * 新增 SQL 规范检查,SQL 窗口中编辑 SQL 语句、创建数据库变更任务和创建表时支持进行 SQL 规范检查。 + +* 自动运行 + + * 新增 SQL 计划任务,支持定时周期性执行用户创建的 SQL 脚本,以满足周期性执行用户所需的数据库开发和运维任务。 + +* 权限管理 + + * 新增自动授权规则,公共资源管控台管理员对满足某些条件的用户,例如姓名、组织部门、登录方式等信息符合某些判断条件,在初次登录或创建用户时自动授予特定的角色或权限,以避免大量冗余授权操作的一项功能。 + + * 支持在管控台对公共连接列表进行权限管理。 + + * 支持在管控台对角色进行资源管理、系统操作权限的配置。 + +* 管控台 + + * 支持用户直接关联权限,删除之前用户关联权限必须通过角色的限制。 + + * 新增直接管理公共连接权限的能力。 + + * 新增资源管理权限,系统操作权限的配置能力。 + + * 操作记录入口移动至安全审计菜单下。 + + +* 结果集编辑 + + * 支持使用 Shift 快捷键选择指定列中的多行数据。 + + * 增强结果集可编辑范围,多表关联查询时如果包含其中一张表的 ROWID ,则结果集也支持编辑。 + +* 导入导出 + + * 使用客户端版 ODC 进行导出时,支持将备份文件直接导出到本地目录。 + + * 导入导出支持 OceanBase V4.0.0 版本。 + + * 导入/导出时,支持勾选 **保留当前配置** 以保存当前配置作为默认配置。 + + * 导出表结构时去除部分 sys 账号依赖,大部分数据库对象的导入导出不再依赖 sys 账户。无 sys 账户存在的限制如下: + + * OceanBase MySQL 租户无法导出序列定义。 + + * OceanBase V2.2.70 之前的版本无法导出表组定义。 + + * OceanBase V2.2.30 及之前的版本的 Oracle 租户无法导出索引定义。 + + * OceanBase V2.2.70 之前的版本无法导出唯一索引的分区信息。 + + * OceanBase V2.2.70 ~ V4.0.0.0 版本的 Oracle 租户无法导出分区表的唯一索引定义。 + +* SQL 执行 + + * 支持通过会话变量 `ob_query_timeout` 设置查询超时时间,无超时限制。 + + * 手动提交模式下,ODC V4.0.0 及之后版本支持根据是否有未提交事务区分状态显示 **提交** 和 **回滚** 按钮。 + + * 优化执行记录中 DB 耗时中 Execute SQL 指标,提供准确的网络耗时统计。 + + * 支持展示姓名中常见的生僻字,非国标编码字通过显码字体展示。 + + * 对象拖拽生成语句交互支持记住选项不再提示选择语句类型。 + + * 支持使用 Shift 快捷键选择指定列中的多行数据。 + +* 连接管理 + + * 更改首页连接列表的数据组织形式。 + + * 支持 SSL 加密。 + + * 公共连接列表支持置顶连接,打标签操作。 + + * 历史连接入口调整为一级菜单。 + + * 新建连接时,不再设置查询超时时间,可以在 SQL 窗口动态修改查询超时。 + +* 数据库对象 + + * 增加对数据库表的记录数以及数据大小信息的展示。 + +* 安全加固 + + * 部分场景下可能出现敏感信息明文透出。 + + * 升级 Spring Cloud Config Server 版本到 V2.2.6.RELEASE。 + + * 升级 Jackson 相关组件版本到 V2.14.1。 + + * 升级 Jettison 版本到 V1.5.2。 + + * 阿里专有云接入 RASS 模块。 + + * 去除 Java JWT 依赖。 + + * 去除 javacsv 依赖。 + + * 升级 Hadoop Common 组件版本至 V3.3.3。 + + * 升级 netty-all 组件版本至 V4.1.44.Final。 + + * 升级 MINA Core 组件版本至 2.1.1。 + + * 剥离 Log4j 依赖库。 + + +## 问题修复 + +* 任务中心 + + * 公共只读连接关联流程执行策略显示错误。 + + * 公共只读连接相关流程详情页面打开缓慢。 + + * 存储的任务数据量过大导致任务列表刷新缓慢。 + +* 数据库变更 + + * 回滚数据库变更任务前后下载得到的查询结果不同。 + +* 导入导出 + + * 整库导出表组时报错。 + + * 无法使用 ISO8859-1 字符集导入/导出数据。 + + * 导出包含 Float 数据类型的表时存在 Float 精度损失。 + +* 管控台 + + * 无法验证已存在的公共连接的权限。 + +* SQL 执行 + + * 无法执行包含 emoji 表情等特殊字符的 SQL 语句。 + + * SELECT 语句的 WHERE 条件中如果包含 `*` 字符且指定投影字段会执行报错。 + + * 某些特定 PL 场景下,在 SQL 窗口中执行 SQL 语句时出现无法正常分句导致执行错误且无忽略方法。 + + * OceanBase MySQL 模式下,值为 0000-00-00 00:00:00 的 DATETIME 数据显示为 NULL。 + + * DML 语句执行成功后影响的行数为 0。 + +* 结果集 + + * 下载结果集时使用数据脱敏,查询结果集元数据出错。 + + * 结果集数据编辑过程中,修改某个数据后再取消修改,点击确认后将会报错。 + + * 编辑 CLOB 类型的列时,上传数据中存在 `;` 导致编辑报错。 + +* 数据库对象 + + * OceanBase V3.1.2 之前的版本,如果表注释为空,则查看表详情时报错`预期外异常`。 + + * 查看表数据和视图数据时,无法查看位于第 1000 行之后的记录。 + + * OceanBase Oracle 模式下查看表 DDL 时,如果包含唯一索引,DDL 中会重复输出一次。 + + * 访问无权限的 MySQL 数据库时,存储过程、函数等数据对象报错。 + + * OceanBase 1.4.79 之前的版本查看表对象报错。 + + * OceanBase 2.2.50 之前的版本查看表/视图数据时白屏。 + + * 查看大容量表/视图数据内容时加载缓慢,可能会导致连接的 OceanBase 租户 CPU 使用率过高。 + + * 已开启回收站但白屏删除的表对象无法进入回收站。 + + * 创建视图时如果关联表的表名中包含 `&`,则无法显示 `&` 后的表名。 + + * `information_schema` 数据库下,OceanBase MySQL 租户查看任意视图对象属性时,**基本信息** 显示为空。 + + * 左侧导航栏中的对象结构树无法显示程序包中名称包含中文的子程序。 + +* 影子表 + + * 新建影子表同步时,同步对象中取消/选择一个源表并单击下一步后一直处于加载状态。 + + * 全局唯一索引未包含所有一级分区键,导致生成的 SQL 不正确。 + +* PL 调试 + + * 程序包调试过程中,如果存在子程序互相调用,跳入后打断点将抛出异常。 + +* 用户管理 + + * ODC V4.0.2 版本用户无法修改自己的密码。 + + + +## 已知问题 + +* 客户端版 ODC 不支持安装在中文目录名中。 + +* 导出包含虚拟列的表时,导出的数据文件和内容显示异常。 + +* Web 版 ODC 中,结构或数据的导入量上限为 2GB,超限文件无法上传。 + +* Web 版 ODC 中,结构或数据的导出量上限为 2GB,超限会导致最终导出数据不完整。 + +* 导出任务详情中,导出对象的数据总记录数依赖 OceanBase 数据库视图,并非精准值。 + +* 需设置 `ob_enable_trace_log` 参数为 `on`,否则只显示首次执行的 SQL 的执行计划。 \ No newline at end of file diff --git a/zh-CN/2.what-s-new/1.product-updates.md b/zh-CN/2.what-s-new/1.product-updates.md new file mode 100644 index 00000000..83494178 --- /dev/null +++ b/zh-CN/2.what-s-new/1.product-updates.md @@ -0,0 +1,20 @@ +产品动态 +========================= + +本次 6 月发版的 OceanBase 开发者中心(OceanBase Developer Center,ODC)V3.3.2 主要新增外部集成能力产品化和版本降级判断,并对 PL 对象的管理、PL调试、以及 SQL 执行和导入导出等交互优化功能进行了更新。 + +更新列表 +------------------------- + + + +| 更新项|更新模块 |说明| +|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| SQL 执行 | [SQL 窗口](zh-CN/../../6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md) | SQL 窗口语句自动补全支持 oceanbase/information_schema 下视图。 | +| PL 对象 | [管理函数](zh-CN/../../6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md)
            [管理存储过程](zh-CN/../../6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md)
            [管理程序包](zh-CN/../../6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md) |
          • 函数、存储过程和程序包对象支持批量编译 PL 对象。
          • 按状态筛选 PL 对象(有效 / 无效)。
          • PL 对象 DDL 查看支持下载为本地文件。
          • | +| PL 调试 | [管理数据库对象](zh-CN/../../6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md) | 调试流程和逻辑完善,修复一系列不支持的场景。 | +| 交互优化 | [管理数据库对象](zh-CN/../../6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md) |
          • [浏览器 Tab](zh-CN/../../6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md) 和 [桌面版窗口](zh-CN/../../7.client-odc-user-guide/3.client-odc-connect-database/2.client-odc-manage-connections.md) 名称包含\`@{数据库名称}\`信息。
          • 导入任务日志中增加了执行出错的具体 SQL 语句。
          • 在 [会话管理](zh-CN/../../6.web-odc-user-guide/10.web-odc-session-management.md) 页面中,支持鼠标悬浮显示全部 SQL 内容。
          • SQL 窗口执行 SQL 超时会提示索引可能仍在创建。
          • 编辑角色权限时,公共资源权限需要至少配置 1 个。
          • | +| 系统集成 | 外部系统审批集成 | 新增 Web 版外部系统审批集成,本次版本支持移动 4A 审批集成。 | +| 系统集成 | [堡垒机集成](zh-CN/../../10.bastion-host-integration-guide/1.bastion-overview.md) | 新增 Web 版堡垒机集成,本次版本支持 Web 版堡垒机集成。 | + + diff --git a/zh-CN/3.odc-overview/1.what-is-oceanbase-developer-center.md b/zh-CN/3.odc-overview/1.what-is-oceanbase-developer-center.md new file mode 100644 index 00000000..e103aef0 --- /dev/null +++ b/zh-CN/3.odc-overview/1.what-is-oceanbase-developer-center.md @@ -0,0 +1,7 @@ +什么是 OceanBase 开发者中心 +======================================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)是为 OceanBase 数据库量身打造的企业级数据库开发平台。ODC 支持连接 OceanBase 中 MySQL 和 Oracle 模式下的数据库,同时为数据库开发者提供了数据库日常开发操作、WebSQL、SQL 诊断、会话管理和数据导入导出等功能。 + +ODC 采用成熟的浏览器-服务端架构,拥有跨平台、轻量化和易部署的特点。同时,ODC 还提供客户端版本,不仅能满足个人开发者快速上手使用 OceanBase 的需求,还可提升开发人员与 DBA 的协作效率。 + \ No newline at end of file diff --git a/zh-CN/3.odc-overview/2.benefits.md b/zh-CN/3.odc-overview/2.benefits.md new file mode 100644 index 00000000..7749ed31 --- /dev/null +++ b/zh-CN/3.odc-overview/2.benefits.md @@ -0,0 +1,100 @@ +产品特性 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)作为为 OceanBase 数据库量身打造的企业级数据库开发平台,拥有编辑和管理数据库对象与资源等特性。 + +数据库对象管理 +---------------- + +* 引导式创建和可视化修改各类数据库对象。 + + + +* 通过回收站机制快速恢复和清理已删除对象。 + + + + + + +企业级特性分区支持 +------------------ + +* 支持 OceanBase 版本 MySQL 和 Oracle 模式中完整的分区类型。 + + + +* 人性化引导式全流程设计,降低了使用分区功能的门槛。 + + + + + + +Web 控制台 +---------------- + +* 支持 DDL、DML 和数据的安全变更。 + + + +* 通过 WebSQL 帮助开发人员正确使用 OceanBase 的各种特性和功能。 + + + +* 提供贴合 OceanBase 版本 MySQL 和 Oracle 的语法高亮、格式化、智能提示等贴心特性。 + + + +* 提供类似Excel的可视化数据编辑能力。 + + + + + + +数据导入导出 +--------------- + +* 为 OceanBase 量身打造的高效的数据导入导出能力。 + + + +* 支持多种文件格式的导入导出。 + + + + + + +数据库变量编辑 +---------------- + +* 支持会话变量和系统全局变量的可视化修改。 + + + +* 降低用户对变量记忆的难度。 + + + +* 提升根据业务场景定制变量的效率。 + + + + + + +资源性能 +------------- + +* 实时进行数据库会话访问情况管控,且支持查看和终止会话。 + + + +* 支持 SQL 执行计划分析,指导 SQL 调优。 + + + + + diff --git a/zh-CN/3.odc-overview/3.product-architecture.md b/zh-CN/3.odc-overview/3.product-architecture.md new file mode 100644 index 00000000..25bdb19d --- /dev/null +++ b/zh-CN/3.odc-overview/3.product-architecture.md @@ -0,0 +1,64 @@ +产品架构 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)的整体架构由三部分能力组成: + +* **基础能力** + + + +* **核心能力** + + + +* **高阶能力** + + + + + + +下图为当前版本的架构图:![Image 248](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5165754161/p244171.png) + +基础能力 +------------- + +* 用户管理:用户管理提供用户注册账号、登录系统和修改账号密码等服务。 + + + +* 连接管理:连接管理提供 OceanBase MySQL 模式及 Oracle 模式的管理服务。支持用户创建数据库连接和保存创建的连接信息,同时提供一键复制和删除连接的能力。 + + + + + + +核心能力 +------------- + +* 对象管理:对象管理提供对数据库对象(如:表、视图、函数、存储过程、序列)做可视化创建引导的服务,这降低了用户的使用门槛。同时,对象管理还提供在查看表数据时对表数据进行在线编辑的服务。 + + + +* 控制台:控制台支持对 SQL 窗口内的内容进行保存及再修改,可帮助用户进行脚本的复用。同时支持一键格式化 SQL 脚本和结构化展示 SQL 内容。在编写 SQL 的过程中 SQL 编辑器能为用户提供智能提示以简化编写难度。 SQL 运行得到的结果集支持编辑和导出。2.2.0 版本及之后还提供了 PL 能力支持,提供了 PL 对象的格式化、编译、运行、调试等功能。 + + + + + + +高阶能力 +------------- + +* 工具集:工具集包含会话管理、回收站管理和导入导出工具。会话管理支持对数据库会话属性及全局属性做修改,同时也支持用户终止指定的数据库会话。回收站管理支持用户清除及还原数据库对象。导入导出支持用户进行多表或单表多种数据格式的导入导出。 + + + +* SQL 诊断:SQL 诊断能够方便用户进行 SQL 执行计划和 SQL 执行过程中资源消耗的查看。能够帮助用户定位 SQL 脚本中存在的问题。 + + + + + + diff --git a/zh-CN/3.odc-overview/4.product-features.md b/zh-CN/3.odc-overview/4.product-features.md new file mode 100644 index 00000000..12626ec5 --- /dev/null +++ b/zh-CN/3.odc-overview/4.product-features.md @@ -0,0 +1,96 @@ +产品功能 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)作为 OceanBase 数据库量身打造的企业级数据库开发平台,ODC 支持连接 OceanBase 中 MySQL 和 Oracle 模式下的数据库,同时为数据库开发者提供数据库日常开发操作、WebSQL、SQL 诊断、会话管理和数据导入导出等功能。 + +数据库连接管理 +---------------------------- + +ODC 支持用户连接至 OceanBase 中 MySQL 和 Oracle 模式下的数据库。在 ODC 创建连接页面输入要求的信息后,即可测试连接并保存连接信息,ODC 支持保存多个不同数据库的连接配置。 + +用户创建并保存的连接配置会直接展示在 ODC 首页,以供再次进入 ODC 时可在首页的连接列表中查看和进入目标数据库。已保存的数据库连接支持打开、编辑、复制和删除等操作。 + +![Image 173](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4276328361/p241285.png) + +工作台 +------------------------ + +基于 WebSQL,ODC 提供工作台的功能作为数据库开发者编辑和诊断 SQL 和 PL/SQL 的工作区。 + +* 在工作台的 SQL 窗口中,可对 SQL 脚本进行运行和保存等操作; + + + +* 在匿名块窗口中,可对匿名块脚本进行编辑、运行、调试和保存等操作; + + + +* 在工作台中会有对应页签,展示脚本的的各种执行详情和执行结果等诊断信息; + + + +* 同时可使用代码片段功能查找和保存常用的命令代码。![Image 174](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4276328361/p241286.png) + + + + + + +数据库对象创建和管理 +------------------------------- + +ODC 提供对数据库对象的创建和管理等数据库日常开发操作功能,可通过 ODC 创建和管理数据库中的表、视图、函数、存储过程、序列、触发器、类型和同义词等数据库对象。 + +除通过 SQL 语句创建和管理数据库对象,ODC 同时提供简明清晰的可视化界面,方便快速创建对象和管理对象的属性。 + +![Image 175](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5086373161/p241287.png) + +会话管理与属性 +---------------------------- + +应用与数据库的连接被称为一个会话,在会话管理页面可查看连接至当前数据库所有会话的详细信息。 + +同时在会话属性页面, ODC 提供可视化界面以清晰直观的查看和修改当前数据库支持的会话变量和全局变量。 + +![Image 176](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5086373161/p241289.png) + +数据导入与导出 +---------------------------- + +为使数据库开发者更方便的维护数据库内的数据, ODC 提供批量导入导出和单表导入导出功能(导出支持 SQL 格式和 CSV 格式,导入支持 SQL 格式、CSV 格式和 SQL 文件)。 + +* 通过批量导入导出,用户可批量选择数据库中的表以导入或导出其中的数据; + + + +* 单表导出和导入可导出或导入目标表中的数据。 + +![Image 622.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E4%BA%A7%E5%93%81%E7%AE%80%E4%BB%8B-%E4%BA%A7%E5%93%81%E5%8A%9F%E8%83%BD-%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA.png) + + + + + + + + +命令行窗口 +-------------------------- + +OBClient 是 OceanBase 推荐使用的黑屏客户端工具。 + +ODC 作为 OceanBase 专用的白屏开发工具,在本次迭代中集成了命令行工具 OBClient 至命令行窗口。无需再单独下载安装 OBClient,在 ODC 的命令行窗口中即可直接用命令行进行数据库开发管理工作。 + +可在命令行窗口中更直接灵活的执行 SQL/PL 语句并实时查看结果,同时可通过 `SOURCE` 命令运行上传在服务器中的文件。 + +![Image 177](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5086373161/p241291.png) + +模拟数据 +------------------------- + +模拟数据工具用于在测试数据库性能或者验证功能等需要大量模拟数据的场景下,能够快速根据表中的字段类型生成数据。 + +在模拟数据面板中,ODC 支持自定义规则生成数据,根据选中的表中的字段类型,可通过修改对应的规则和细则以生成所需的数据。 + +![Image 178](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5086373161/p241293.png) + diff --git a/zh-CN/3.odc-overview/5.product-limits.md b/zh-CN/3.odc-overview/5.product-limits.md new file mode 100644 index 00000000..ac7a72a9 --- /dev/null +++ b/zh-CN/3.odc-overview/5.product-limits.md @@ -0,0 +1,146 @@ +使用限制 +========================= + +本篇介绍 OceanBase 开发者中心(OceanBase Developer Center,ODC)中各功能模块所涉及的使用限制。 + +数据库版本要求 +---------------------------- + + + +| 数据库 | 支持版本 | +|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 当前版本 ODC 支持的 OceanBase 数据库版本 |
          • OceanBase V1.4.x
          • OceanBase V2.0.x
          • OceanBase V2.1.x
          • OceanBase V2.2.x
          • OceanBase V3.1.x
          • OceanBase V3.2.x
          • OceanBase 社区版(PL 相关能力不支持)
          • | + + + +ODC 支持 PL 能力的 OceanBase 数据库版本: + + +| 功能 | 支持版本 | +|-----------------------------------------------------------------------------|-----------------------| +| PL 对象(函数/存储过程/程序包)编译 PL 对象(函数/存储过程)调试 匿名块调试 | V2.2.7x、V3.0.0 及之后版本。 | +| PL 对象(函数/存储过程/程序包)运行 匿名块运行 | V2.0.x 及之后版本。 | + + + +浏览器版本要求 +---------------------------- + +当前 Web 版本 ODC 支持的浏览器版本: + + +| 浏览器 | 支持版本 | +|----------|-----------------------------------------------------------------------------------| +| 支持访问的浏览器 | Chrome 76 及以上版本。 Firefox 60 及以上版本。 Edge 79 及以上版本。 | + + + +推荐安装环境 +--------------------------- + +下述为安装客户端版 ODC 时的推荐环境: + + +| 环境 | 要求 | +|---------|---------------------------------------------------------| +| 系统版本 | Windows:Win 7/Win 10 Mac:10.13.6(17G65) | +| Java 环境 | JDK 1.8.0_242 及以上版本 | +| 端口号 | ODC V2.3.0 后采用动态侦测端口技术,无需再预留 8989 端口。 | +| CPU | X86 64 位处理器 2 核及以上配置 | +| 内存 | 4GB 及以上 | + + + +账号管理 +------------------------- + +登录 ODC,在首页顶部导航栏的右上角,会显示当前登录的用户名,单击用户名在弹出的下拉菜单中选择 **修改密码** 按钮,修改 ODC 账号密码。 + +数据库连接 +-------------------------- + +* Oracle 连接为共享 Session 设计,当您主动触发提交或回滚操作,或通过产品功能创建、修改、删除数据库对象和执行 DDL 语句被动触发提交操作后,事务在所有窗口生效。 + + + +* 事务手动提交模式下,需设置参数 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会被终止。同时需注意 `ob_trx_idle_timeout` 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。 + + + + + + +工作台 +------------------------ + +* 只有 Oracle 模式下支持创建匿名块窗口。 + + + +* 通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。 + + + +* 在调试前请确保连接的数据库中已安装 DBMS_DEBUG 和 DBMS_OUTPUT 等调试包。 + + + +* PL 对象调试仅支持连接 OBServer V2.2.70、V3.0.00 及之后版本(目前内核仅支持 x86 环境调试,arm 环境不支持调试)。 + + + +* ODC 中共享 Session,相同连接只有一个 Session。ODC V2.3.2 后在 Oracle 模式下自动提交默认设置为关,因此需手动提交事务。可在 **会话属性** 页面修改变量 autocommit 的值进行设置,详细操作请参见 [管理会话](../7.client-odc-user-guide/9.client-odc-session-management.md)。 + + + + + + +数据导出与导入 +---------------------------- + +* OceanBase V2.2.30 及之后版本支持字符编码 UTF8、GBK、GB18030 和 UTF16。OceanBase V2.2.30 版本之前仅支持字符编码 UTF8。 + + + +* 在 ODC V2.2.0 及之后版本中使用导入导出功能时必须通过 OBProxy 连接至目标实例,通过 OBProxy 连接和直连时 ODC 均支持导入导出功能。 + + + +* Web 版 ODC 对导出的数据大小有限制,最大支持导出 2 G 的数据(压缩前),超出部分无法导出。如需导出大量数据,请使用导数工具 OBDUMPER。 + + + +* Web 版 ODC 对导入上传的文件大小有限制,最大支持导入 2 G(压缩后)的文件,超出部分无法上传。如需导入大量数据,请使用导数工具 OBLOADER。 + + + +* 最大支持 3 个导入导出任务并行运行,后续任务在队列中等待运行。 + + + +* 在 ODC V2.4.1 之后版本,可选择配置 sys 租户账号以提升导出导入速度。同时,导出时如已勾选表和视图之外的其它对象,必须配置该项以使用 sys 租户账号进行导出。 + + + + + + +数据库对象 +-------------------------- + +* 目前暂不支持修改表中已经创建好的索引。 + + + +* 只有 Oracle 模式下支持创建序列和程序包对象。 + + + +* 分区信息查看依赖有读权限的 sys 账号,因此需在创建连接的高级配置中设置 sys 用户。 + + + + + diff --git a/zh-CN/4.quickstart/1.quickstart-overview.md b/zh-CN/4.quickstart/1.quickstart-overview.md new file mode 100644 index 00000000..e5cf2927 --- /dev/null +++ b/zh-CN/4.quickstart/1.quickstart-overview.md @@ -0,0 +1,23 @@ +入门概述 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)是为 OceanBase 数据库量身打造的企业级数据库开发平台。若您是 ODC 的新用户,本章将向您介绍 ODC 使用的入门操作以帮助您快速上手 ODC。​ + +以下使用流程可帮助您快速了解和使用 ODC: + +1. [安装 ODC](../7.client-odc-user-guide/1.client-odc-install-odc.md):除了部署 Web 版 ODC 以外,您可下载客户端版本的 ODC 进行数据库的管理。若您不需要使用客户端版 ODC 请直接查看步骤 2。 + + + +2. [登录 ODC](../6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md):获得 ODC 账号后,在登录界面输出账户信息以进行登录。 + + + +3. [创建连接](../6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md):进入 ODC 后,需要创建目标实例的连接配置以进入目标数据库管理页面。​ + + + + + + +完成上述步骤后,您可开始通过 ODC 开发和管理您的 OceanBase 数据库了。有关更多 ODC 的使用信息,请参见对应版本的《用户指南》。 diff --git a/zh-CN/4.quickstart/2.quickstart-install-odc.md b/zh-CN/4.quickstart/2.quickstart-install-odc.md new file mode 100644 index 00000000..9f22ec0a --- /dev/null +++ b/zh-CN/4.quickstart/2.quickstart-install-odc.md @@ -0,0 +1,53 @@ +安装 ODC +=========================== + +除在 OceanBase 中直接进入 Web 版 OceanBase 开发者中心(OceanBase Developer Center,ODC)以外,同时可下载客户端版本的 ODC 进行数据库的管理。与 Web 版 ODC 相比,客户端版 ODC 无登录入口,而是通过使用一个默认用户进行标识,因此只需安装客户端并 [创建连接](../6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md)。 + +推荐安装环境 +--------------- + + + +| 环境 | 要求 | +|---------|---------------------------------------------------------| +| 系统版本 | Windows:Win 7/Win 10 Mac:10.13.6(17G65) | +| Java 环境 | JDK 1.8.0_242 及以上版本。 | +| 端口号 | ODC V2.3.0 后采用动态侦测端口技术,无需再预留 8989 端口。 | +| CPU | X86 64 位处理器 2 核及以上配置。 | +| 内存 | 4GB 及以上 。 | + + + +安装步骤 +------------- + +1. 下载 [客户端版 ODC](https://help.aliyun.com/document_detail/212816.html)。 + + + +2. 下载完成后,双击安装文件开始安装。 + + + +3. 进入安装向导后,提示您选择安装路径。 + ![安装 ODC](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4762343061/p175972.png) + + + +4. 安装完成后,启动程序时会检查环境,当环境不符合要求时会弹出对应的错误信息并提示您继续启动应用或是关闭进程修复环境。若环境检查无误,应用将正常打开,您就可进入客户端版 ODC 并开始创建连接了。 + +
            +

            注意

            +
            • 自 ODC V3.2.0 版本起,客户端版 ODC V3.2.0 安装包中已附加 JRE 安装包(包含Mac 和 Win 64 位平台),可根据需求自行安装。
            • +
            • 如安装或启动失败,请参见 常见问题 > 客户端 ODC 安装问题。
            +
            + + + + + + + + + + diff --git a/zh-CN/4.quickstart/3.quickstart-log-on-to-odc.md b/zh-CN/4.quickstart/3.quickstart-log-on-to-odc.md new file mode 100644 index 00000000..696f2210 --- /dev/null +++ b/zh-CN/4.quickstart/3.quickstart-log-on-to-odc.md @@ -0,0 +1,19 @@ +登录账号 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)的登录操作,旨在通过登录账号对用户进行标识,后续对数据库的连接配置以及保存工作区的 SQL 脚本等功能,均依赖于用户标识。 + +进入 OceanBase 开发者中心,登录界面如下图所示,在登录界面输入账号、密码和验证码后,单击 **登录** 按钮进入 ODC 首页: + +![登录 ODC](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/ODC%20%E7%99%BB%E5%BD%95%E9%A1%B5.png) + +登录 ODC 并进入首页的连接管理页面后,在顶部导航栏的右上角会显示当前登录的账户名,单击账户名,在弹出的下拉菜单中单击 **退出登录** 按钮将返回 ODC 登录界面,可重新登录其它 ODC 账号。 +> **说明**
            +>
          • 用户首次登录的用户名和密码从管理员处获取。
          • +>
          • 管理员默认登录用户名:admin,默认密码:aaAA11__
          • +>
          • 如从 ODC 旧版本升级至 V3.2.0 及以上版本,出现 admin 等用户冲突,需手动修改原用户名称。具体方法,请参见 **常见问题** > Web 版 ODC 启动问题。
          • + + + + + diff --git a/zh-CN/4.quickstart/4.quickstart-create-a-personal-connection.md b/zh-CN/4.quickstart/4.quickstart-create-a-personal-connection.md new file mode 100644 index 00000000..638dbb71 --- /dev/null +++ b/zh-CN/4.quickstart/4.quickstart-create-a-personal-connection.md @@ -0,0 +1,67 @@ +创建个人连接 +=========================== + + + +概述 +----------------------- + +登录 OceanBase 开发者中心(OceanBase Developer Center,ODC)并进入 ODC 首页,可在 **个人连接** 页签的右上角单击 **新建连接** 按钮创建个人连接。 + +创建完成后,再次进入 ODC 时,可在连接列表中查看已保存的数据库连接。 + + +> **注意**
            +>
          • 自 ODC V2.3.0 版本起,导入导出功能需在创建连接的高级配置中设置 root@sys 用户,否则会提示无法使用导入导出功能,因自该版本起,导入导出功能查询视图信息时依赖 root@sys 账号。
          • +>
          • 分区信息查看同样依赖 root@sys 账号,因此如需展示表的分区信息须在创建连接的高级配置中设置 root@sys 用户。
          • +>
          • 自 ODC V3.3.0 版本起,ODC 支持独立 Session 模式和共享 Session 模式。独立 Session 模式下,每个 SQL 窗口对应一个数据库会话,所有的修改只会影响当前窗口;共享 Session 模式下,所有的 SQL 窗口共享同一个数据库会话,任意 SQL 窗口的修改均会影响到其它 SQL 窗口。
          • +>
          • 事务手动提交模式下,需设置 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会终止。同时需注意 `ob_trx_idle_timeout` 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。
          • + + + + + + +操作步骤 +------------------------- + +创建连接的操作步骤如下所示: + +![Image 801](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7804408461/p294940.png) + +1. 进入 ODC 后,单击 **个人连接** 页签右上角的 **新建连接** 按钮。 + + + +2. 在创建连接页签需填写或选择以下信息,如已拥有 OceanBase 数据库连接串,则以下信息均可从连接串中直接获取(mysql -h **主机名** -P **端口号** -u **数据库用户名@租户名** # **集群名** -D **默认数据库** -p ' **数据库密码** ')或直接使用页签中提供的智能解析工具进行填充: + + + + | 信息项 | 说明 | + |-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 数据库类型 | 选择 **物理库** 或 **逻辑库** 。
            • 物理库:普通数据库。
            • 逻辑库:ODP (Sharding)。
            | + | 所属区域 | 选择连接示例所在的区域 **独立部署/专有云** (在自己环境中搭建的数据库实例) 或 **公有云** (阿里云上的数据库实例)。 | + | 智能解析 | 在文本框中粘贴连接串信息,ODC 会自动识别连接串并在窗口中填充各项连接信息。 | + | 连接模式 | 选择 **MySQL** 或 **Oracle** (逻辑库仅支持 MySQL 模式)。 | + | 连接地址 | - **主机 IP** :连接的数据库所在服务器的 IP 信息。
            - **端口** :连接的数据库所在服务器的端口号信息。
            - **集群名** :连接的数据库所在集群的名称(逻辑库无需填写)。
            - **租户名** :连接的数据库所在租户的名称(逻辑库无需填写)。
            **说明**
            主机名和端口号可从连接的数据库所在租户信息页面获取,如在公有云或 OCP 上创建的租户。
            | + | 数据库账号 |
            • 数据库用户名:在租户中创建的账号(MySQL 模式下,该账户必须具有访问默认数据库的权限)。
            • 数据库密码:在租户中创建的账号的密码。单击数据库密码框后的 **测试连接** 按钮,测试是否能够连接到目标数据库。
            • 保存密码:关闭该项,连接信息中将不保存数据库密码信息,每次进入连接或测试连接时,需在弹出的密码弹窗中输入数据库密码以进入连接;开启该项,连接信息将保存数据库密码信息,每次进入连接无需输入数据库密码。
            **说明**
            • 如配置信息有误,会出现异常提示,例如用户或密码不对、网络异常等。
            • 用户只可连接本租户下的数据库,否则会报出测试失败的错误。
            • ODC V4.0.0 及之后版本支持不填账号密码即可保存连接。
            | + | 默认数据库/schema(可选) | 连接 MySQL 租户中的数据库时,需填写该连接使用的默认数据库(连接 Oracle 租户时无需填写该项)。
            **说明**
            MySQL 模式下,如不指定默认库,则默认连接 information_schema 库。 如 information_schema 库连接失败,请将默认数据库设置为该用户有权限的库。
            | + | SQL 查询超时时间 | 支持自定义 SQL 超时时间,SQL 查询超过指定的时间时查询自动终止(默认 60s)。 | + | sys 租户账号设置 | 选择是否 使用 sys 租户账号查询租户视图,勾选后输入 **账号** 和 **密码**。
            数据库类型为物理库时,请输入拥有查询 sys 租户视图权限的账号和密码,当 **连接地址** 中已指定 **租户** 为 sys 时,该项被自动填充。
            • **账户** :拥有 sys 租户视图查看权限的账号。
            • **密码** :账号对应的密码。
            输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。
            **说明**
            • 自 ODC V2.3.0 之后版本,导入导出功能需在创建连接的高级配置中设置 root@sys 用户。
            • 自 ODC V2.4.1 之后版本,导入导出功能查询视图信息时取消 root@sys 账号强依赖(如未配置 root@sys 账号,ODC 部分对象如存储过程和函数等不支持导出功能;如配置 root@sys 账号,通过访问 sys 租户下的视图信息得到最优的数据路由策略,可提升导出速度)。
            • **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入“@sys#集群”)。例如:账号为 root。
            | + + +3. 单击页面下方的 **保存** 按钮,在的弹窗中输入连接名后,单击 **确定** 按钮,即可将当前的配置信息持久保存在 ODC 连接列表中。再次登录 ODC 时,可在连接配置列表中直接选择该连接,保存连接配置时不要求测试连接一定成功。 + + + +4. 在页签下方,ODC 同时提供 **复制连接串** 按钮。单击该按钮,ODC 会将当前编辑的连接信息复制为连接串格式以方便获取当前配置的连接信息。 + + + +5. 如无需保存当前的连接配置,可单击页签下方的 **取消** 按钮,ODC 会弹出弹窗以确认是否退出当前新建连接窗口。 + + + + + + diff --git a/zh-CN/5.tutorials/1.tips-on-the-sql-console.md b/zh-CN/5.tutorials/1.tips-on-the-sql-console.md new file mode 100644 index 00000000..8f6a54d6 --- /dev/null +++ b/zh-CN/5.tutorials/1.tips-on-the-sql-console.md @@ -0,0 +1,109 @@ +SQL 控制台中隐藏的小技巧 +=================================== + +本教程介绍在 OceanBase 开发者中心(OceanBase Developer Center,ODC)SQL 控制台中隐藏的一些小技巧。 + +背景信息 +------------- + +基于 WebSQL,ODC 提供了 SQL 控制台作为数据库开发者编辑和诊断 SQL 的工作区。在 SQL 窗口中您可以对 SQL 及 PL 脚本进行运行和保存等操作,还会有对应页签展示脚本的各种执行详情和执行结果等诊断信息。在 SQL 窗口的编辑区域您可以体验到较多的细节,如窗口中会对数据库的关键字进行不同颜色的标识,其次还有输入自动提示、格式化等功能以提升您编辑 SQL 语句的效率。在编辑区域的下方是执行记录和结果两个展示页签,您可以在执行记录页签查看当前连接进程中每次执行语句的记录,并在结果页签中查看当前语句的执行结果。 + +本教程除了上述常见操作外,将向您介绍 SQL 控制台中一些容易被忽略的小技巧,这些操作将帮助您更便利在 SQL 控制台中进行开发管理任务。 + +切换事务提交模式 +----------------- + +ODC 在 V2.3.2 版本之后 Oracle 模式下自动提交默认设置为关(OFF),所以您需要手动提交当前事务(MySQL 模式下自动提交默认设置为开)。同时,在事务手动提交模式下,您还需要设置变量 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会被终止掉。 + +但是,您可以通过 ODC 切换事务提交的模式。 + +1. 进入连接后,单击导航栏中的 **会话** 按钮,在下拉列表中选择 **会话属性。** + + + +2. 进入 **会话属性** 页面后,在变量列表中选中变量 `autocommit` 后单击工具栏中的编辑按钮以进入变量编辑页面。 + + + +3. 在编辑页面的 **值** 选项中选择变量的值, **ON** (开)表示开启事务自动提交模式, **OFF** (关)表示开启事务手动提交模式。 + + + + + + +查看执行计划 +--------------- + +1. 在 SQL 窗口的编辑区中编辑好您要执行的命令,在运行脚本前,选中一条命令然后单击工具栏中 **计划** 按钮,在弹出的面板中会展示您选中的或当前光标所在的 SQL 语句在执行前系统预估的执行计划(`EXPLAIN PLAN` 操作的结果),展示的执行数据可能与实际执行语句后的数据略有不用,您可以使用该功能评估 SQL 语句。 + + + +2. 运行您在编辑区编写的语句,运行成功后,在结果集的工具栏中单击 **计划** 按钮查看当前 SQL 语句执行后的实际资源消耗及执行计划,可快速判断 SQL 语句的优劣。 + + + + + + +保存 SQL +--------------- + +1. 在 SQL 窗口的编辑区中编写您的脚本。 + + + +2. 单击 SQL 窗口工具栏中的 **保存 SQL** 按钮,在跳出的弹窗中为脚本指定名称,单击弹窗中的 **确认** 按钮完成脚本的保存。 + + + +3. 在上方导航栏中单击 **工作台** 按钮,在弹出的列表中将鼠标放置在 **已保存的脚本** 标签上,在二级列表中会显示您之前保存的所有脚本。 + + + +4. 在二级列表中,脚本名称的后面提供了 **编辑** 和 **删除** 操作。单击 **编辑** 按钮,在弹窗中会展示脚本名称和脚本内容,进行修改后单击 **确认** 按钮以保存修改。 + + + +5. 在二级列表中,单击脚本名称会生成对应的 SQL 窗口并在编辑区内展示脚本内容,您可以在窗口中继续对脚本进行编辑和运行等操作。 + + + + + + +设置界定符 +-------------- + +ODC 从 V2.2.0 版本后支持了 PL 能力并支持在 SQL 窗口中编辑 PL 语句,编辑时需要您首先自定义界定符。 + +1. 在 SQL 窗口的工具栏中单击 **设置** 按钮。 + + + +2. 在下拉列表的 **Delimiter** 框中选择您想要设置为界定符的符号。目前支持设置 **;** 、 **/** 、 **//** 、 **$** 和 **$$** 等 5 种形式的界定符。 + + + +3. 完成设置后,您可以在 SQL 窗口中开始编写 PL 语句,PL 语句编写完毕后使用选择的界定符作为结尾即可在 SQL 窗口中实现 PL 语句的编写与运行。 + + + + + + +ODC V2.4.1 版本后,您也可以在编辑区中使用 `DELIMITER` 语句直接定义界定符, **设置** 中的 **Delimiter** 项会回显您设置的界定符。 + +设置查询条数限制 +----------------- + +1. 在 SQL 窗口的工具栏中单击 **设置** 按钮。 + + + +2. 在下拉列表的 **查询结果限制** 框中指定结果集返回数据的行数。该项的默认值为 1000 行。 + + + + + diff --git a/zh-CN/5.tutorials/2.create-a-conection.md b/zh-CN/5.tutorials/2.create-a-conection.md new file mode 100644 index 00000000..d4c8752b --- /dev/null +++ b/zh-CN/5.tutorials/2.create-a-conection.md @@ -0,0 +1,136 @@ +如何创建连接 +=========================== + +本教程介绍在 OceanBase 开发者中心(OceanBase Developer Center,ODC)中创建数据库连接的详细步骤。 + +背景信息 +------------- + +ODC 作为 OceanBase 数据库量身打造的企业级数据库开发平台可以与您的 OceanBase 数据库建立连接,然后对其中的数据库对象和资源进行编辑和管理。当您安装客户端版 ODC 或部署 Web 版 ODC 后,创建连接将是您要进行的一步重要操作。ODC 支持连接专有云和公有云环境中的 OceanBase 数据库,并支持连接 OceanBase MySQL 模式和 Oracle 模式。 + +前提条件 +------------- + +* 安装客户端版 ODC 或部署 Web 版 ODC。Web 版 ODC 的部署请联系相关技术支持人员,客户端版 ODC 的安装,请参见 [安装 ODC](../7.client-odc-user-guide/1.client-odc-install-odc.md)。 + + + +* 若使用 Web 版 ODC,在部署后请登录 ODC 以进入连接管理页面。详情请参见 [登录 ODC](../6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md)。 + + + +* 获得连接实例的连接信息或连接串,本教程示例连接的连接串如下所示: + + ```unknow + -h100.0.0.0 -P8080 -uodc@oracle_tenant#odc_cluster -Dodc -p'Password01' + ``` + + + + + + +操作步骤 +------------- + +1. 在 ODC 首页 **连接管理** 页签中,单击 **新建连接** 按钮以弹出新建连接面板。 + + + +2. 选择 **所属区域** 。所属区域为被连接的实例所在的区域,有以下两种区域: + + * **公有云** :阿里云上的数据库实例。 + + * **独立部署/专有云** :在您自己的环境中搭建的数据库实例。本教程的示例实例在专有云环境中,所以选择专有云。 + + + + +3. 选择 **连接模式** 。 + + OceanBase 数据库支持 MySQL 模式和 Oracle 模式,选择被连接实例所属的模式(本教程的示例实例属于 Oracle 模式,因此选择 Oracle)。 + + +4. 指定 **连接名称** 。 + + 连接名称用来唯一标识一个连接,您需要自定义一个名称且不允许重复。本教程中指定名称为 Connection_Tutorial。 + + +5. 使用 **智能解析** 功能。 + + 若您拥有连接实例的连接串,可以直接将连接串粘贴进智能解析功能的文本框中,单击文本框中的 **智能解析** 按钮后,ODC 会根据连接串自动解析并填充 **连接地址** 、 **默认数据库** 、 **数据库用户名** 和 **数据库密码** 等信息。 + **说明** + + + + 如无连接串,可跳过本步骤,从步骤 6 开始手动填写上述信息。 + + +6. 填写 **连接地址** 。 + + 连接地址包含以下信息: + * **主机名** :连接实例所在服务器的 IP 信息。若您的实例在公有云上,可以在公有云控制台的租户信息页面获得主机名。本教程示例实例的 IP 信息为 100.0.0.0。 + + + + * **端口号** :连接实例所在服务器的端口号信息。若您的实例在公有云上,可以在公有云控制台的租户信息页面获得端口号信息。本教程示例实例的端口号为 8080。 + + + + * **集群** :连接实例所在集群的名称。本教程示例实例的集群名称为 odc_cluster。 + + + + * **租户** :连接实例所在租户的名称。本教程示例实例的集群名称为 oracle_tenant。 + + + + + + +7. 填写 **默认数据库** 。 + + 连接 MySQL 租户中的数据库时,可选填该连接要使用的默认数据库(连接 Oracle 租户中的数据库时则无需填写该项)。 + + 该项为选填项,不填写时默认连接到实例 information_schema。 + + +8. 填写 **数据库用户名** 。 + + 数据库用户名是在租户中创建的用户的名称,Oracle 模式下等同于填写 Schema 的名称,MySQL 模式下填写的数据库用户名必须有访问默认数据库的权限。本教程示例实例的数据库名称为 odc。 + + +9. 填写 **数据库密码** 。 + + 步骤 8 填写的数据库用户对应的密码。本教程示例实例的数据库名称为 Password01。 + + +10. 单击 **测试连接。** + + 单击 **数据库密码** 项后提供的 **测试连接** 按钮,查看 ODC 是否可以根据上述连接信息成功连接到目标实例。连接成功与否不影响连接信息的保存。 + + +11. 选择是否关闭 **保存数据库密码** 功能。 + + 关闭该项时,连接信息中将不保存数据库密码信息。每次进入连接或测试连接时,需要在弹出的密码弹窗中输入数据库密码以进入连接。开启该项时,连接信息将保存数据库密码信息,每次进入连接无需输入数据库密码。 + + +12. 指定 **SQL 查询超时时间** 。 + + ODC 支持自定义 SQL 超时时间,默认 60s,超过指定的时间时查询自动终止。 + + ODC V2.3.2 后事务默认需要手动提交(之前版本默认自动提交),在手动提交模式下需要设置变量 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会被终止。同时需要注意 `ob_trx_idle_timeout` 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。 + + +13. 指定 **查询 sys 租户视图** 。 + + 在该项中可指定拥有 sys 租户视图查看权限的账号和对应的密码。ODC V2.3.0 后使用数据导入导出功能和查看分区信息功能时需要在此项配置 root@sys 账号,即 sys 租户下的 root 账号。 本教程示例实例的 root@sys 账号的密码为默认空密码,所以只在 **账户** 项填写 root 即可。填写完成后可单击该项下的 **测试连接** 按钮测试 root@sys 账号是否可以成功连接。 + + +14. 单击 **保存** 以保存连接信息。 + + 填写和配置完上述所有的连接信息后,单击右下角的 **保存** 按钮,可将当前 **新建连接** 页面中填写的连接信息保存并显示在 ODC 的首页 **连接管理** 页签中。以方便直接在 **连接管理** 页签中找到目标连接并进入连接实例。 + + + + diff --git a/zh-CN/5.tutorials/3.tutorials-export.md b/zh-CN/5.tutorials/3.tutorials-export.md new file mode 100644 index 00000000..31f1568a --- /dev/null +++ b/zh-CN/5.tutorials/3.tutorials-export.md @@ -0,0 +1,136 @@ +如何导出数据 +=========================== + +本篇教程介绍在 OceanBase 开发者中心(OceanBase Developer Center,ODC)中进行数据批量导出操作的详细步骤。 + +背景信息 +------------------------- + +为使数据库开发者更方便的维护数据库内的数据,ODC 提供批量导入导出和单表导入导出功能。通过导入导出可选择数据库中的对象以导入或导出其中的数据或结构。目前 ODC 支持的导出数据格式有 CSV 格式和 SQL 格式,支持的导入文件格式有 ZIP 压缩文件、SQL 文件(批量导入)和 CSV 文件(单表导入)。 + +创建导入或导出任务后,可进入任务中心下载导出文件和查看任务详情和日志等信息。 + +本教程以批量导出为例,介绍如何在 ODC 中导出数据的详细步骤。 + +前提条件 +------------------------- + +* 确认字符集。OceanBase V2.2.30 及之后版本支持字符编码 UTF8、GBK、GB18030 和 UTF16 等。OceanBase V2.2.30 版本之前仅支持字符编码 UTF8(ODC 目前导出文件的编码为 UTF-8,暂不支持修改)。 + + + +* 确认连接方式。在 ODC V2.2.1 及之前的低版本中使用导入导出功能时必须通过 OBProxy 连接至目标实例,直连时 ODC 不支持导入导出功能。 + + + +* 配置 root@sys 账户。自 ODC V2.4.1 之后版本,可选择配置 sys 租户账号以提升导出导入速度。同时,导出时如已勾选表和视图之外的其它对象,必须配置该项以使用 sys 租户账号进行导出。 + + + + + + +操作步骤 +------------------------- + +1. 进入 **导出设置** 面板。 + + 进入连接后,单击上方导航栏中的 **工具** 按钮,在下拉列表中选择 **导出** 后,弹出 **导出设置** 面板。 + + +2. 指定 **任务名** 。 + + **导出设置** 面板中,ODC 会自动生成默认的任务名,格式为连接名_模式名_日期,可修改任务名自定义导出任务名称。 + + +3. 选择 **导出内容** 。 + + ODC 目前支持 **导出结构和内容** 、 **仅导出数据** 和 **仅导出结构** 三种方式 **。** + + 其中导出结构指是导出目标对象的定义语句,会生成 .sql 结尾的 SQL 文件。导出内容是导出对象中实际保存的数据,根据选择的 **导出格式** 不同生成的数据文件格式也不同。本教程选择导出内容为 **导出结构和内容** 。 + + +4. 选择 **数据格式** 。 + + ODC 目前支持将数据导出为 **CSV 格式** 和 **SQL 格式** 。当 **导出内容** 为 **仅导出结构** 时,无需选择数据格式。具体格式信息,请参见 [导出导入格式](../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。本教程选择导出数据为 **CSV 格式** 。 + + +5. 选择 **文件编码** 。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB1803** **0** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。您需要在 **文件编码** 下拉框中选择需要的编码格式。 + + +6. 选择 **导出对象** 。 + + 在 **导出对象** 标签下的表格中勾选需导出的对象。表格中会展示 **对象名称** 和 **对象类型** 信息,支持通过 **对象类型** 进行筛选和使用搜索框直接进行搜索。列表中支持批量选择和全选,您也可以对对象类型进行筛选。ODC 对导出的数据大小有限制,最大支持导出 2G 的数据(压缩前),超出部分无法导出。所以当您选择的对象中的数据累加超过 2G 时,最后生成的数据文件中数据将是不完整的。 + + +7. 进行 **导出数据设置。** + + 当 **导出内容** 为仅导出结构时无需进行导出数据设置,该项包含以下设置项: + * **使用全局快照** :勾选该项后 ODC 将导出全局中指定表的最新快照点中的数据,勾选该项可以保证全局数据的统一性。 + + + + * **批量提交数量** :单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。选择 **数据格式** 为 SQL 格式时,通过指定批量提交数量,可在导出文件中导出指定数量数据时添加一句 `COMMIT` 命令。 + + + + * **不导出的数据类型** :单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。您可以通过该项指定导出数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + + + + + + +8. 指定 CSV 格式信息。 + + 在步骤 4 中选择了 **数据格式** 为 CSV 格式,所以需要指定 CSV 格式信息。单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中指定以下信息: + * **包含列头** :该项默认勾选,选择导出数据为 CSV 格式时是否包含列头。 + + + + * **空字符串转为空值** :该项默认勾选,选择导出数据为 CSV 格式时是否将表中的空字符串转换为空值 \\N。 + + + + * **字段分隔符** :设置字段间的分隔符。支持选择 **,** (逗号)、 **;** (分号)和 **:** (冒号)作为字段分割符。同时支持自定义一个字符长度的字符作为分隔符。 + + + + * **文本识别符** :设置文本内容的识别符。支持选择 **'** (单引号)和 **"** (双引号)作为文本识别符。 + + + + * **换行符号** :设置换行符。支持选择 **\\n** 、 **\\r** 和 **\\r\\n** 作为换行符。 + + + + + + +9. 进行 **导出结构设置** 。 + + 在该项下选择是否 **添加删除对象语句** 。勾选后在导出对象结构文件时,在对象的 `CREATE` 语句前都会添加对应的 `DROP` 语句。 + + +10. 进行 **sys 租户账号配置** 。 + + 在该项下选择是否 **使用 sys 租户账号提升导出速度** 。勾选后在弹出的 **账户** 和 **密码** 文本框中填写 sys 账户和对应的密码。设置好该项后会使用 sys 租户的权限进行导出,可提升导出的速度。同时,导出时如果勾选了表和视图之外的其它对象,必须配置该项使用 sys 租户账号进行导出。 + + > **注意**
            + OceanBase V2.2.30 之前版本仅支持字符编码 UTF8。 + + ODC V2.2.1 及之前的低版本中使用导入导出功能时必须通过 OBProxy 连接至目标实例,直连时 ODC 不支持导入导出功能。 + ODC V2.4.1 之后版本,可选择配置 sys 租户账号以提升导出导入速度。同时,导出时如已勾选表和视图之外的其它对象,必须配置该项以使用 sys 租户账号进行导出。 + + +11. 生成导出任务。 + + 选择所有需导出的对象完成后,单击面板右下角的 **导出** 按钮以生成导出任务。 + + 任务成功生成后 ODC 会自动跳转至任务中心,在任务中心可查看导出任务的运行状况。任务完成可下载导出的数据文件并查看任务详情和日志等信息。 + + + + diff --git a/zh-CN/5.tutorials/4.tutorials-import.md b/zh-CN/5.tutorials/4.tutorials-import.md new file mode 100644 index 00000000..9082ca09 --- /dev/null +++ b/zh-CN/5.tutorials/4.tutorials-import.md @@ -0,0 +1,114 @@ +如何导入数据 +=========================== + +本篇教程介绍在 OceanBase 开发者中心(OceanBase Developer Center,ODC)中进行数据批量导入操作的详细步骤。 + +背景信息 +------------------------- + +为使数据库开发者更方便的维护数据库内的数据,ODC 提供批量导入导出和单表导入导出功能。通过批量导入导出您可以批量选择数据库中的对象以导入或导出其中的数据或结构,通过单表导入导出,您可以导出目标表中的数据。目前 ODC 支持的导出数据格式有 CSV 格式和 SQL 格式,支持的导入文件格式有 ZIP 压缩文件、SQL 文件(批量导入)和 CSV 文件(单表导入)。 + +创建导入或导出任务后,可进入任务中心下载导出文件和查看任务详情和日志等信息。 + +本教程以批量导入为例,介绍如何在 ODC 中导入数据的详细步骤。 + +前提条件 +------------------------- + +* 确认字符集。OceanBase V2.2.30 及之后版本支持字符编码 UTF8、GBK、GB18030 和 UTF16 等。OceanBase V2.2.30 版本之前仅支持字符编码 UTF8。ODC 目前导出文件的编码为 UTF-8,暂不支持修改。 + + + +* 确认连接方式。在 ODC V2.2.1 及之前的低版本中使用导入导出功能时必须通过 OBProxy 连接至目标实例,直连时 ODC 不支持导入导出功能。 + + + +* 配置 root@sys 账户。自 ODC V2.4.1 之后版本,可选择配置 sys 租户账号以提升导出导入速度。同时,导出时如已勾选表和视图之外的其它对象,必须配置该项以使用 sys 租户账号进行导出。 + + + + + + +操作步骤 +------------------------- + +1. 进入 **批量导入** 面板。 + + 进入连接后,单击上方导航栏中的 **工具** 按钮,在下拉列表中选择 **导入** 后,弹出 **批量导入** 面板。 + + +2. 指定 **任务名** 。 + + **导入设置** 面板中,ODC 会自动生成默认的任务名,格式为连接名_模式名_日期,同时可在文本框中修改自动生成的任务名。 + + +3. 选择 **导入格式** 。 + + 目前 ODC 支持的导入格式有 ZIP 压缩文件、SQL 文件(批量导入)和 CSV 文件(单表导入)。其中 SQL 格式和 CSV 格式是 OceanBase 导入导出工具特有的格式。具体格式信息,请参见本手册中的 **导出导入格式** (《用户指南》![符号](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5112176361/p351955.jpg) 使用工具![符号](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5112176361/p351957.jpg) 数据导出与导入)。本教程选择导入格式为 **ZIP 压缩文件** 。 + + +4. 上传 **导入文件** 。 + + 单击文件池进入文件资源管理器选择要导入的文件,或者直接将文件拖入文件池中以完成文件上传。上传的文件格式需与所选的导入文件格式相同,ZIP 压缩文件支持上传 .zip 结尾的文件。SQL 文件支持上传 .sql 文件。上传的文件的格式需与步骤 3 中选择的 **导入格式** 相同。 + + +5. 选择 **文件编码** 。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。需在 **文件编码** 下拉框中选择所需的编码格式。 + + +6. 选择 **导入内容** 。 + + ODC 目前支持 **导入结构和内容** 、 **仅导入数据** 和 **仅导入结构** 三种方式 **。** + + 当 **导入格式** 为 ZIP 压缩文件时需指定该项。导入结构是指运行导入文件中的对象定义语句,导入后会在数据库中创建新的对象,导入数据是向指定对象中导入数据文件中的数据。本教程选择导入内容为 **导入结构和内容** 。 + + +7. 选择 **数据格式** 。 + + 当 **导入格式** 为 ZIP 压缩文件时需指定该项。ODC 目前支持导入 **CSV 格式** 和 **SQL 格式** 的数据。具体格式信息,请参见本手册中的 **导出导入格式** (《用户指南》![符号](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5112176361/p351955.jpg) 使用工具![符号](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5112176361/p351957.jpg) 数据导出与导入)。本教程选择数据格式为 **CSV 格式** 。 + + +8. 进行 **导入数据设置。** + + 当 **导入格式** 为 ZIP 压缩文件且 **导入内容** 为仅导入结构时无需进行导入数据设置。该项包含以下设置项: + * **导入前清空数据** :勾选该项后,导入数据时将首先清空目标对象中原有的数据。 + + + + * **批量提交数量** :单击 **导入** **数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。通过指定批量提交数量,可在导入文件中导入指定数量数据时添加一句 `COMMIT` 命令。 + + + + * **跳过的数据类型** :单击 **导** **入** **数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。您可以通过该项指定导入数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + + + + + + +9. 进行 **导入结构设置** 。 + + 当 **导入内容** 为仅导入数据时,该项不可被指定。在该项下选择当对象结构已存在时的操作。选择 **跳过** 操作则在导入时跳过导入文件中的结构定义语句直接导入数据,该项会保留对象中的原数据。选择 **替换** 操作时则执行导入文件中的结构定义语句以重新创建并替换原对象,该项会清空对象中的原数据。 + + +10. 选择 **任务错误处理** 方式。 + + ODC 提供 **停止任务** 和 **忽略错误继续任务** 两种错误处理方式。需在 **任务错误处理** 标签下选择所需的处理方式。 + + +11. 进行 **sys 租户账号配置** 。 + + 在该项下选择是否 **使用 sys 租户账号提升导入速度** 。勾选后在弹出的 **账户** 和 **密码** 文本框中填写 sys 账户和对应的密码。设置好该项后会使用 sys 租户的权限进行导入,可提升导入的速度。 + + +12. 生成导入任务。 + + 单击面板右下角的 **导入** 按钮以生成导出任务。 + + 任务成功生成后 ODC 会自动跳转至任务中心,在任务中心可查看导入任务的运行状况,任务完成后可查看任务详情和日志等信息。 + + + + diff --git a/zh-CN/5.tutorials/5.tutorials-debug.md b/zh-CN/5.tutorials/5.tutorials-debug.md new file mode 100644 index 00000000..3cabd0da --- /dev/null +++ b/zh-CN/5.tutorials/5.tutorials-debug.md @@ -0,0 +1,147 @@ +如何调试存储过程 +============================= + +本篇教程介绍在 OceanBase 开发者中心(OceanBase Developer Center,ODC)中调试一个存储过程的详细步骤。 + +背景信息 +------------- + +PL 程序的开发工作是数据库服务开发人员重要的日常工作,与 SQL 语句的支持模块类似,PL 的调试模块同样为非常重要的功能。因此,在编程过程中,开发人员需要一个PL 开发区域和调试功能。 + +ODC V2.2.0 及之后版本支持 PL 对象和匿名块的创建、编译、运行和调试等功能。您可在匿名块窗口的编辑区域中编译 PL 语句,同时可对已创建的 PL 对象进行编辑和调试等操作。针对 PL 对象的调试,ODC 提供批量执行、单步执行、跳入、跳出、终止调试、重新调试和退出调试等功能,同时提供 **参数** 、 **堆栈和变量** 、 **DBMS 输出** 、 **断点** 、 **调试日志** 等页签查看调试产生的信息。 + +前提条件 +------------- + +* 调试功能只支持 V2.2.73 及之后版本的 OceanBase 数据库 Oracle 模式。 + + + +* ODC V3.2.2 之前版本,通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。 + + + +* 自 ODC V3.2.2 及之后版本,ODC 支持通过 OBProxy 连接 OBServer 情况下进行 PL 调试。 + + + +* 在调试前,请确保连接的数据库中已安装 DBMS_DEBUG 和 DBMS_OUTPUT 等调试包。 + + + +* 按下述示例脚本创建示例存储过程 procedure_test: + + ```javascript + CREATE OR REPLACE PROCEDURE procedure_test + ( + A IN NUMBER, + B IN NUMBER, + C OUT NUMBER + ) IS + BEGIN + C:= A + B; + dbms_output.put_line ( C / 2 ) ; + END procedure_test; + ``` + + + + + + +操作步骤 +------------- + +存储过程 procedure_test 的结果是输出参数 C 除以 2 后的值,参数 C 的值等于参数 A 加参数 B,因此在程序运行后通过输出结果无法直接看到参数 C 的值。通过调试存储过程 procedure_test 可查看和验证参数 C 在程序运行中实际的值。 + +1. 进入调试模式。 + + 进入连接后,在左侧的存储过程列表中查找目标存储过程 procedure_test 右键其名称,在弹出的列表中单击 **调试** 按钮开始调试(或可在列表中先单击 **编辑** 按钮进入对象编辑页面,在编辑页面的工具栏中单击调试图标![调试](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9338438361/p361384.jpg)开始调试)。 + + +2. 设置参数。 + + 存储过程 procedure_test 中包含三个参数,A 和 B 为输入参数,C 为输出参数。 + 1. 存在输入参数时,在调试时需首先设置参数的值。因此开始调试时,ODC 会首先弹出 **设置参数** 页面,请在该页面为输入参数赋值:指定参数 A 的值为 2,参数 B 的值为 4。 + + + + 2. 输入值后单击 **确定** ,完成参数设置。 + + ![Image 223](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4256904161/p242630.png) + + + + + +3. 进入调试页面。 + + 参数设置完成后,即可进入调试页面。 + + 调试页面编辑区下的 **参数** 页签显示该程序在运行前设置的所有的参数定义信息(参数名、模式和类型)及对应的值,其中对应的值会根据调试过程作出相应的变化。 + + 在调试页面的工具栏中 ODC 提供了以下功能键: + * **批量执行** :批量运行至最近断点,若无断点直接运行至结尾语句。 + + + + * **单步执行** :单步执行,不会进入子程序。 + + + + * **跳入** :单步执行,若当前行是调用已定义的存储程序或函数,则会进入被调用的子程序。 + + + + * **跳出** :在子程序内,执行跳出操作后,返回到上层调用位置的下一行;主程序内运行跳出,效果和 **自动调试** 相同。 + + + + * **终止调试** :继续运行直到结束,会跳过后续设置的断点。 + + + + + + +4. 设置断点。 + + 设置断点用于在程序运行时中断在所需位置,从而方便分析程序。在 ODC 中通过单击编辑区中的行号设置断点: + 1. 请在示例程序中,单击第 9 行语句 `dbms_output.put_line ( C / 2 );` 的行号,设置一个断点; + + + + 2. 在编辑区下的 **断点** 页签中,会展示在程序中所有设置的断点的 PL **对象名称** 和 **行号** 等信息,同时提供 **取消** 和 **查看** 断点操作。 + + > **说明** + > 内核不支持在注释行和 begin、end 等关键字行处设置断点。 + + + + + +5. 开始调试。 + + 设置完断点后,单击工具栏中的批量执行图标![调试-批量执行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9338438361/p361401.jpg),程序将按步骤开始执行并在断点处终止。或可单击单步执行图标![调试-单步执行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0438438361/p361403.jpg)(单击一次单步执行,程序向后执行一步)。 + + +6. 查看调试信息。 + + 程序此时终止在第 9 行,可在编辑区下的 **堆栈和变量** 页签查看当前栈上的变量与其对应的值。因设置断点,程序此时终止在了第 9 行,所以在 **堆栈和变量** 页签显示变量 C 的值为 6。在 **调试日志** 页签中可查看调试开始、调试结束、断点添加、断点取消等操作的记录和错误日志。 + + +7. 终止调试。 + + 单击工具栏中终止调试图标![调试-终止调试](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0438438361/p361412.jpg)后,程序将继续运行至结束并跳过后续设置的断点。 + + 因程序中包含 PL 输出语句 `dbms_output.put_line`,所以当程序运行结束后,在编辑区下的 **DBMS 输出** 页签中会显示输出结果参数 C 除以 2 的值。此时页签中显示值 3,说明程序执行无误。 + + +8. 重新调试。 + + 运行结束后,如需对当前对象再次发起新一轮的调试,可单击工具栏中的 **重新调试** 按钮。此时上一轮调试运行后的信息与断点将被清空,可再次进行设置并开始调试。 + + +9. 退出调试。 + + 当通过调试已完成程序的分析后,可单击工具栏中的 **退出调试** 按钮以退出调试页面。 \ No newline at end of file diff --git a/zh-CN/5.tutorials/6.tutorials-view-sql-performance.md b/zh-CN/5.tutorials/6.tutorials-view-sql-performance.md new file mode 100644 index 00000000..c3de1efc --- /dev/null +++ b/zh-CN/5.tutorials/6.tutorials-view-sql-performance.md @@ -0,0 +1,113 @@ +如何查看 SQL 性能 +================================ + +本篇教程介绍在 OceanBase 开发者中心(OceanBase Developer Center,ODC)中查看 SQL 性能的详细步骤。 + +背景信息 +------------- + +SQL (Structured Query Language) 是具有数据操纵和数据定义等多种功能的数据库语言,大多数数据库开发者依赖 SQL 语言对数据库内容进行管理与开发。所以 SQL 的性能一定程度上会影响数据库的性能,SQL 本身提供了执行计划命令(`EXPLAIN` 命令 )供用户查看语句在数据库中具体的执行步骤并以此作为判断 SQL 性能和改进 SQL 语句的依据。 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)作为一款强大的企业级数据库开发平台,提供了图形化查看 SQL 语句执行计划的功能。借助 ODC 您可以更直观便捷查看 SQL 语句的执行情况并分析 SQL 语句的性能。 + +前提条件 +------------- + +运行下述语句,创建示例表 employees: + +```javascript +CREATE TABLE employees( + emp_id INTEGER, + emp_name VARCHAR(20), + manager_id INTEGER +); + +INSERT INTO employees VALUES ( 1, 'Anna', 6 ) ; +INSERT INTO employees VALUES ( 2, 'Brain', 4 ) ; +INSERT INTO employees VALUES ( 3, 'Candy', 4 ) ; +INSERT INTO employees VALUES ( 4, 'David', 5 ) ; +INSERT INTO employees VALUES ( 5, 'Eva', NULL) ; +INSERT INTO employees VALUES ( 6, 'Frank', 5 ) ; +INSERT INTO employees VALUES ( 7, 'Gary', 6 ) ; +``` + + + +操作步骤 +------------- + +1. 进入连接后,在 SQL 窗口的编辑区中输入下述 ​`SELECT`​ 命令查看表 employees 中的数据。 + + ```javascript + SELECT * FROM employees; + ``` + + + +2. 单击编辑区工具栏右上角的 **计划** 按钮。 + + 在运行命令前,可以先通过编辑区中的 **计划** 按钮,查看当前编辑区选中的或当前光标所在的 SQL 语句在执行前系统预估的执行计划(`EXPLAIN PLAN` 操作的结果),展示的执行数据可能与实际执行语句后的数据略有不用,但是可以使用该功能预先评估 SQL 语句。 + + +3. 在弹出的 **计划详情** 面板中,查看 SQL 运行前预估的执行计划。 + + **计划详情** 面板中的 **计划统计** 页签会展示以下信息: + + + + + + + +4. 运行语句。 + + 单击工具栏中的 **运行** 按钮,执行 ​`SELECT`​ 语句。 + + +5. 在结果集的工具栏中单击 **计划** 按钮查看执行后的执行计划。 + + 此时在弹出的 **执行详情** 中,展示的是语句执行后实际的执行计划。 + + +6. 在 **执行详情** 面板查看语句的 **基本信息** 。 + + **基本信息** 模块主要展示了以下信息: + + + + + + + +7. 在 **执行详情** 面板查看语句的 **耗时统计** 。 + + **耗时统计** 模块通过条形图形象的展示了以下信息及它们之间的占比: + + + + + + + +8. 在 **执行详情** 面板查看语句的 **IO 统计** **。** + + **IO 统计** 模块主要展示了以下信息: + + + + + + + +9. 在 **执行详情** 面板查看语句的 **计划统计。** + + **计划统计** 页签结构化的展示了语句执行后的执行计划。它同 **计划详情** 页面中的结构一样,详情可查看步骤 3 中 **计划统计** 的信息。 + + +10. 在 **执行详情** 面板查看语句的 **大纲** 。 + + **大纲** 页签展示了执行计划返回的结果中 `OUTLINE DATA` 对应的内容。这部分内容是优化器为了完全复现某一计划而生成的一组 Hint 信息。 + + + + diff --git a/zh-CN/6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md b/zh-CN/6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md new file mode 100644 index 00000000..4b037343 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/1.log-on-to-odc/1.log-on-to-odc-account.md @@ -0,0 +1,15 @@ +登录账号 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)的登录操作,旨在通过登录账号对用户进行标识,后续对数据库的连接配置以及保存工作区的 SQL 脚本等功能,均依赖于用户标识。 + +[部署 WEB ODC](../../8.deployment-guide/1.deployment-overview.md) 后,进入 OceanBase 开发者中心,登录界面如下图所示,在登录界面输入账号、密码和验证码后,单击 **登录** 按钮进入 ODC 首页: + +![登录 ODC](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/ODC%20%E7%99%BB%E5%BD%95%E9%A1%B5.png) + +登录 ODC 并进入首页的连接管理页面后,在顶部导航栏的右上角会显示当前登录的账户名,单击账户名,在弹出的下拉菜单中单击 **退出登录** 按钮将返回 ODC 登录界面,可重新登录其它 ODC 账号。 + +> **说明** +>
          • OceanBase 开发者中心(OceanBase Developer Center,ODC)部署完成后,可以在浏览器中通过宿主机(高可用部署为 Nginx 代理所在宿主机)的 IP 和端口号(http://IP:PORT 或 http://DOMAIN:PORT)访问 Web 版 ODC。
          • +>
          • 用户首次登录的用户名和密码从管理员处获取。
          • +>
          • 如从 ODC 旧版本升级至 V3.2.0 及以上版本,出现 admin 等用户冲突,需手动修改原用户名称。具体方法请参见常见问题 > Web 版 ODC 启动问题。
          • \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/1.log-on-to-odc/2.change-password.md b/zh-CN/6.web-odc-user-guide/1.log-on-to-odc/2.change-password.md new file mode 100644 index 00000000..a464c0e9 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/1.log-on-to-odc/2.change-password.md @@ -0,0 +1,38 @@ +修改密码 +========================= + + + +1. 登录 Web 版 OceanBase 开发者中心(OceanBase Developer Center,ODC)后,在首页的顶部导航栏的右上角,单击当前登录账号,并选择 **修改密码** 。 + + ![修改密码](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6789528361/p360961.png) + + +2. 在弹出的 **修改密码** 窗口中,指定以下信息以修改密码: + + ![修改密码弹窗](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/1086823561/p360965.png) + + * **原密码** :该账号原密码。 + + + + * **新密码** :设置新密码。 + + + + * **确认密码** :再次输入新密码,确认设置无误。 + + + + + + +3. 上述信息设置完成后,单击 **确定** 按钮,完成修改密码。 + + + + + + + + diff --git a/zh-CN/6.web-odc-user-guide/10.web-odc-session-management.md b/zh-CN/6.web-odc-user-guide/10.web-odc-session-management.md new file mode 100644 index 00000000..40ee52eb --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/10.web-odc-session-management.md @@ -0,0 +1,80 @@ +会话管理 +========================= + +应用与数据库的连接被称为一个会话,在 OceanBase 开发者中心(OceanBase Developer Center,ODC)会话管理页面您可以查看连接到当前数据库所有会话的详细信息。同时在会话属性页面 ODC 提供了可视化界面使您可以清晰直观的查看和修改当前数据库支持的会话变量和全局变量。 + +进入 ODC 对应的数据库连接后,单击页面上方导航栏的 **会话** 按钮,可选择进入 **会话属性** 或 **会话管理** 页面。 + +![Image 186](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86-1.png) + +会话属性 +------------------------- + +![会话管理2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4639171361/p203464.png) + +会话属性即数据库变量,OceanBase 中有会话变量和全局变量: + +* **会话变量** :当客户端连接到数据库后,数据库会复制全局变量以自动生成会话变量。会话变量的修改只对当前会话生效。 + +* **全局变量** :数据库实例共享全局变量。这意味着不同用户共享这些全局变量,且数据库会保存您对全局变量做出的更改,断开连接并再次进入数据库时,更改依旧有效。 + + + +> **说明**
            +>
          • 当前版本的 ODC 中不支持编辑全局变量,可对会话变量进行修改。
          • +>
          • ODC 中共享 Session,相同连接只有一个 Session。ODC V2.3.2 后在 Oracle 模式下自动提交默认设置为关,所以您需要手动提交事务。您可以修改变量 autocommit 的值进行设置。
          • +>
          • 事务手动提交模式下,需要设置 ob_trx_idle_timeout 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 ob_trx_idle_timeout 设置的时间,连接会终止。同时需要注意 ob_trx_idle_timeout 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。
          • + + + + + + +ODC 提供了可视化界面使您可以清晰直观的查看与修改当前数据库支持的变量。对于变量值的修改: + +* 针对会话变量,当前版本 ODC 区分了查看态和编辑态,选中需修改的变量后,单击工具栏中的编辑按钮以进入编辑弹窗进行修改。编辑完成后单击 **确定** 按钮,在弹出的 **SQL 确认** 页面中单击 **执行** ,修改生效。 + + + +* 如变量的值为字符或数字类型,可在变量编辑页面中直接输入修改值。 + + + +* 如变量的值为枚举类型,ODC 会在变量值的编辑框中列举出该变量支持的值的集合,可在不使用准确记忆变量名和值的情况下通过可视化界面完成修改,此方式可降低用户记忆变量的成本并提高变量修改的效率。 + + + + + + +会话管理 +------------------------- + +与当前数据库的连接被称为一个会话,在会话管理页面您可以查看连接到当前数据库的所有会话和以下会话信息: + + +| 会话信息 | 说明 | +|---------|--------------------------------------------------| +| 会话 ID | 展示当前会话的 ID,是会话的唯一标识。 | +| 用户 | 会话登录使用的数据库用户名。 | +| 来源 | 发起会话的地址。 | +| 数据库名 | 当前会话访问的数据库名称。 | +| 状态 | 展示当期会话的状态,有 **SLEEP** (休眠)和 **ACTIVE** (活跃)两种状态。 | +| 命令 | 会话当前执行的命令类型。 | +| 执行时间(s) | 会话当前执行 SQL 所花的时间。 | +| SQL | 会话当前执行 SQL 的具体内容。 | +| OBProxy | 会话访问的代理地址。 | + + +![管理会话](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/1238140161/p203463.png) + +会话管理页面的导航栏中提供了以下功能键供您管理会话: + +* **刷新** :刷新会话列表。 + +* **关闭会话** :终止当前会话。 + +* **关闭会话当前查询** :终止当前会话正在进行的 SQL 执行进程。 + +> **说明**
            +> 在会话管理页面的列表中,鼠标悬浮在 SQL 内容上,可以显示全部 SQL 内容。 \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-table-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-table-objects-overview.md new file mode 100644 index 00000000..5739ec51 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/1.web-odc-table-objects-overview.md @@ -0,0 +1,42 @@ +概述 +======================= + +表由行(Row)和列(Column)组成的。每列称为一个字段,每列的标题称为字段名。行包括了若干列信息项,一行数据称为一个或一条记录。一张数据库表由一条或多条记录组成,没有记录的表称为空表。每个表中通常都有一个主关键字,用于唯一地确定一条记录。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击表标签可以查看表列表。在表列表中双击表名进入表管理页面,您可以在表管理页面的数据页签查看和修改表的数据,或在属性页签查看表的基本信息、列、分区、索引、约束和 DDL 等属性信息。 +**注意** + + + +分区信息查看依赖 root@sys 账号,所以您需要在创建连接的高级配置中设置 root@sys 用户。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V1.4.1 及以上。 | + + + +本章节将分篇介绍以下 ODC 中表对象的相关操作: + +* [新建表](../../../6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md) + + + +* [表列表](../../../6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/3.web-odc-table-list.md) + + + +* [表属性管理](../../../6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/4.web-odc-manage-table-attributes.md) + + + +* [表数据管理](../../../6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/5.web-odc-manage-table-data.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md new file mode 100644 index 00000000..d5efa805 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md @@ -0,0 +1,263 @@ +# 新建表 + + +## 概述 + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建表。本文介绍如何使用 ODC 创建表。 + +![新建表](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%A6%82%E8%BF%B0.png) + +如上图所示,创建表包含以下 7 个步骤: + +1. 指定基本信息。 + +2. 设置列。 + +3. 设置索引。 + +4. 设置约束。 + +5. 设置分区规则。 + +6. 确认 SQL。 + +7. 完成新建表。 + + + + + + +## 操作步骤 + + +以在 ODC 中创建员工表(employee)为例,员工表中包含员工工号(emp_no)、员工生日(birthdate)、员工姓名(name)和员工性别(gender)。具体操作步骤如下: + +### 步骤 1:指定基本信息 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左侧导航栏中单击 **表** 标签可查看表列表。在表列表的右上角,单击 **+** 创建表,或在顶部导航栏中单击 **新建** 以创建所需对象。 + +在 **基本信息** 中,输入 **表名称** 和表的 **描述** 。 + +![新建表-步骤1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A41.png) + +> **说明** +>
            • 在 MySQL 模式下,同时需要选择默认字符集和默认排序规则。
            • +>
            • 完成指定基本信息并切换至设置列步骤后,表示确认提交基本信息。
            + +### 步骤 2:设置列 + +如下图所示,添加一列时需指定以下信息: + + + +![step 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A42.png) + +| 信息项 | 说明 | +|---------------|--------------------------------------------------------------------| +| 名称 | 指定字段(列)的名称。 | +| 类型 | 指定字段(列)的数据类型。
            具体数据类型,请参考 [OceanBase 数据库的开发指南](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview)。 | +| 长度 | 指定类型长度。 | +| 小数点 | 设置类型精度。 | +| 非空 | 是否限制该字段(列)的值不能为空。 | +| 自增(MySQL 模式下) | 选择是否为自增列。
            **注意**
            每个表仅允许设置一个自增字段(列)。
            当一个字段(列)设置为自增后,其余字段(列)不可勾选,需取消勾选后,才可设置其它字段(列)为自增字段(列)。 | +| 虚拟列 | 选择是否创建虚拟列。
            **注意**
            如果已勾选虚拟列,则 **必须** 填写表达式。
            在创建虚拟列时需要定义虚拟列依赖的表达式,虚拟列包含 Virtual Column 和 Stored Column,仅在使用时会根据表达式计算出虚拟列的值,因此在向表中插入数据的时候,不能为虚拟列指定要插入的值。 | +| 缺省值/表达式 | 该字段(列)的默认值/表达式。 | +| 注释 | 对该字段(列)的说明。 | + + + +设置列页面提供 3 种功能操作: + +| 功能项 | 说明 | +|--------|-------------------------------------------------------------------------------------------------------------------------------------------| +| 工具栏操作 | 通过列页面顶部的工具栏可添加和删除列。 | +| 单击行序号 | - 单击行序号,选中整行,显示辅助菜单(新建、删除)。
            - 单击并选中行序号,可拖动整行参数以调整顺序。 | +| 鼠标右键操作 | 右键单击鼠标选中整行,进行复制行 / 向下移动一行。 | + + +> **说明** +>
            • 复制行后,可选中某行并通过快捷键 Command + V / Ctrl + V 对进行粘贴。
            • +>
            • 页面底部的辅助编辑区域会显示所选中列的相关提示信息。
            • +>
            • 基本信息和列为必填项,其它为选填项,填写基本信息和列后,可以直接提交并确认 SQL 新建表。
            + + +### 步骤 3:设置索引 + +当表中包含大量数据,可以使用索引更快速的查询数据。索引是表中对某一列或多个列的值进行预排序的数据结构。通过使用索引,可以直接定位到符合条件的记录。 + +如下图所示,需指定以下信息: + +![step 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A43.png) + +| 信息项 | 说明 | +|------|--------------------------------------------------------------------------------| +| 索引名称 | 为该索引指定的名称。 | +| 范围 | 默认值为 **GLOBAL** ,支持 **GLOBAL** (全局索引)/ **LOCAL** (局部索引)。 | +| 方法 | 默认值为 **BTREE** (全局索引),支持 **空/BTREE/HASH** 。
            - BTREEB 以 B+树结构存储数据,适用于在范围查找的SQL语句中。
            - HASH 索引基于 HASH 表实现,只有查询条件精确匹配 HASH 索引中的所有列才会用到 HASH 索引,仅能满足"=","IN"和"\<=\>"查询,HASH 索引无法用于排序,不适用于区分度小的列上,例如员工性别(gender)。 | +| 索引类型 | 默认值为 **NORMAL** ,支持 **NORMAL** **/UNIQUE/FULLTEXT** 。
            - NORMAL 表示普通索引。
            - UNIQUE 表示唯一的、不允许重复的索引,例如员工工号(emp_no)。
            - FULLTEXT 表示全文搜索的索引,用于搜索包含大量数据的表。 | +| 列 | 选择索引所在的列,需注意索引列的顺序。 | +| 不可见 | 选择设置的索引是否可见。 | + + + +设置索引页面提供以下功能键: + +| 功能项 | 说明 | +|-----|------------| +| +新建 | 添加一个新索引。 | +| 删除 | 删除当前选中的索引。 | + + + +### 步骤 4:设置约束 + +约束用于规定表中的数据规则。如果存在违反约束的数据行为,该行为会被约束终止。 + +![step 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A44.png) + +ODC 中支持设置的表级约束包括以下 4 种: + +* **主键约束** :定义一个主键来唯一标识表中的每一行数据。主键约束可为一个字段或是一组字段,一张表中只能设置一个主键约束,且设置完成后不支持编辑。 + +* **唯一约束** :保证在一个字段或者一组字段里的数据在表中是唯一的,一张表中可设置多个唯一约束。 + +* **外键约束** :在两个表的数据之间建立连接(可为一列或多列),旨在保持关联表之间数据的一致性、完整性。设置完成后不支持新增和编辑。 + +* **检查约束** :在编辑数据库数据时,按照设置的检查规则进行校验,校验通过才允许数据修改操作。 + + +由于 OceanBase 数据库中 MySQL 模式和 Oracle 模式支持的约束不同,而不同约束所需的信息也略有不同,因此请根据所选的约束方法按页面上的要求指定所需信息: + + +| 信息项 | 说明 | +|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 约束名称 | 指定约束的名称。 | +| 列信息 | 选择一个字段或者一组字段作为约束。 | +| 关联 Schema(Oracle 模式下) | 使用 **外键约束** 时需指定关联表(父表)所在的 Schema。 | +| 关联数据库(MySQL 模式下) | 使用 **外键约束** 时需指定关联表(父表)所在的数据库。 | +| 关联表 | 使用 **外键约束** 时需指定关联表(父表)。 | +| 关联字段 | 使用 **外键约束** 时需指定关联字段(父表)。 | +| 删除 | 指定删除关联表(父表)中的数据时,当前表(子表)对应的动作。
            可指定 **CASCADE** 、 **NO ACTION** **、** **RESTRICT** 和 **SET NULL** 等四种对应的动作。
            MySQL 和 Oracle 模式下所支持的外键动作不同:
            - MySQL 模式下,OceanBase 可指定 CASCADE、NO ACTION、RESTRICT 和 SET NULL;
            - Oracle 模式下,OceanBase 可指定 CASCADE、NO ACTION 和 SET NULL。
            **注意**
            OceanBase 暂不支持 **SET NULL** 动作。
            相关语法,请参考 [OceanBase](https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database/V3.2.1/create-table)或 MySQL/Oracle 官网文档。 | +| 更新 | 指定更新关联表(父表)中的数据时,当前表(子表)对应的动作。
            可指定 **CASCADE** 、 **NO ACTION** 、 **RESTRICT** 和 **SET NULL** 等四种对应的动作。
            MySQL 和 Oracle 模式下所支持的外键动作不同:
            - MySQL 模式下,OceanBase 可指定 CASCADE、NO ACTION、RESTRICT 和 SET NULL;
            - Oracle 模式下,OceanBase 可指定 NO ACTION。
            **注意**
            OceanBase 暂不支持 **SET NULL** 动作。
            相关语法,请参考 [OceanBase](https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database/V3.2.1/create-table)或 MySQL/Oracle 官网文档。 | +| 检查条件 | 指定执行 **检查约束** 时校验数据的检查规则。 | + +设置约束页面提供以下功能键: + + +| 功能项 | 说明 | +|-----|------------| +| +新建 | 添加一个新约束。 | +| 删除 | 删除当前选中的约束。 | + +### 步骤 5:设置分区规则 + +![step 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A45.png) + +当表中包含大量数据时,可以对表进行分区。表进行分区后,表中的数据会存放到多个表空间,每次查询数据时不会扫描整张表。 + +* OceanBase 中 MySQL 模式支持六种分区方法: **key** 、 **Hash** 、 **Range** 、 **Range Columns** 、 **List** 和 **List Columns** 。 + + + +* Oracle 模式支持三种分区方法: **List** 、 **Range** 和 **Hash** 。 + + 由于在 MySQL 模式和 Oracle 模式下分区的定义不同,因此以下信息在不同模式下的意义略有不同,请根据所选的分区方法按其定义指定以下信息: + + | 信息项 | 说明 | + |------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 分区方法 | 指定分区方法。 MySQL 模式和 Oracle 模式下支持的分区方法不同。
            - Range 分区:基于属于一个给定连续区间的列值,将多行分配给分区。范围必须是有序的、连续的和不重叠的。
            - List 分区:基于数据的枚举值进行分区。
            - Hash 分区:基于给定的分区个数进行分区。对于分布规则不明显的数据,并没有明显的范围查找等特征,可以使用HASH分区,将数据分区列的值按照HASH算法打散到不同的分区上,将数据随机分布到各个分区。
            -Key 分区:类似于按 HASH 分区,区别在于 KEY 分区只支持计算一列或多列,且 MySQL 服务器提供其自身的哈希函数。必须有一列或多列包含整数值。
            有关分区方法,请参见 [OceanBase 数据库分区表](https://www.oceanbase.com/docs/enterprise/oceanbase-database-cn/V3.2.3/10000000000357153)。 | + | 字段 | 选择作为分区键的字段。 | + | 表达式 | 根据表达式的返回值进行分区(Oracle 模式下不支持分区表达式)。 | + | 分区 | 根据所选的 **分区方法** ,可能需要指定 **分区名称** 、 **分区数量** 、 **区间上限值** 或 **值枚举** 等信息。 可添加多个分区,并拖动已选字段进行排序。 | + + + + + + +### 步骤 6:确认 SQL + +![新建表-步骤六](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/create%20table.png) + +单击 **提交** 后,在 SQL 确认页面查看语句,支持 **SQL 检查** 和 **格式化** 语句以方便查看。 + +语法格式如下: + +```sql +CREATE TABLE table_name (column_name column_type, column_name column_type,.......); +``` + + + +参数说明: + +| 参数 | 说明 | +|-------------------------|----------------------------------------| +| CREATE TABLE | 用于创建给定名称的表,必须拥有表 CREATE 的权限。 | +| table_name | 创建表的名称,表名称必须符合标识符命名规则。 | +| column_name column_type | 指定数据表中每个列(字段)的名称和数据类型,如果创建多个列,需要用逗号隔开。 | + + + +### 步骤 7:完成新建表 + +单击 **执行** ,完成新建表后,会在左侧导航栏的表列表中出现新建的 employee 表。 + +![新建表-步骤七-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A47.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击表列表中的表名,通过弹出的管理操作列表(包括 **查看表结构** 、 **查看 DDL** 、 **查看表数据** 、 **新建表** 、 **导入** 、 **导出** 、 **下载** 、 **模拟数据** 、 **打开 SQL 窗口** 、 **复制** 、 **重命名** 、 **删除** 和 **刷新** ),可快速管理和操作目标对象。 + +表对象具体操作,请参见 [表数据管理](../1.web-odc-table-objects/5.web-odc-manage-table-data.md)。 + +支持使用关键字 `SELECT` 查询新建的表数据。 + +语法格式: + +```sql +SELECT + column_name, + column_name +FROM + table_name [WHERE Clause] [LIMIT N] [ OFFSET M] +``` + + + +参数说明: + +| 参数 | 说明 | +|-------------|------------------------------------------------------| +| SELECT | SELECT 命令可以读取一条或者多条记录。 | +| column_name | 指定查列名称。 使用星号(\*)默认查询所有列信息。 | +| WHERE | 条件语句。 | +| LIMIT | 设定返回的记录数。 | +| OFFSET | 指定 SELECT 语句开始查询的数据偏移量。 默认情况下偏移量为 0。 | + + + +示例: + +```sql +SELECT `emp_no`, `birthdate`, `name`, `gender` FROM `employee`; +``` + + + +![新建表-步骤8](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A48.png) + + + +## 相关信息 + + +* [新建视图](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [新建函数](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [新建存储过程](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [新建序列](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [新建程序包](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [新建触发器](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [新建类型](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +* [新建同义词](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/3.web-odc-table-list.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/3.web-odc-table-list.md new file mode 100644 index 00000000..50a67736 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/3.web-odc-table-list.md @@ -0,0 +1,38 @@ +表列表 +======================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **表** 标签可查看表列表。表列表中展示当前连接的数据库中存在的表对象,可在表列表中查看该对象的结构树或右键目标对象以进行管理操作。 + +结构树 +------------------------ + +如下图所示,在表列表中单击目标表名前的下弹标志会在弹出的下拉列表中展示其结构树,对象表的结构树最深有三层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表**: + +![Image 188](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%88%97%E8%A1%A8-1.png) + +管理操作 +------------------------- + +在表列表中,表对象名称默认支持按头字符升序排序。 +鼠标右键单击架构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键以供快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|-----------|--------------------------------------------------------------------------------| +| 查看表结构 | 进入表属性页签,全量查看表的基本信息、列、索引、约束和 DDL 等信息。 | +| 查看 DDL | 进入表属性页签,查看定义当前表的 SQL 语句。 | +| 查看表数据 | 进入表数据页签,查看表中的数据。 | +| 新建表 | 进入新建表页面,根据步骤创建新的表对象。 | +| 导入 | 向当前表中导入数据,具体信息请参见 [单表导出与导入](../../6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md)。 | +| 导出 | 导出当前表中的数据,具体信息请参见 [单表导出与导入](../../6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md)。 | +| 下载 | 下载表对象的 SQL 文件。 | +| 模拟数据 | 进入 **模拟数据** 面板。 | +| 打开 SQL 窗口 | 新建一个 SQL 窗口。 | +| 复制 | 复制表名、Select 语句、Insert 语句、Update 语句或 Delete 语句。 | +| 重命名 | 重命名当前表对象。 | +| 删除 | 删除当前表对象。 | +| 刷新 | 对当前表对象进行一些管理操作后,刷新结构树以展示最新信息。 | +| 查看列/索引/约束 | 进入表属性页签的列/索引/约束信息部分,查看表对象中列/索引/约束的具体信息。 | +| 新建列/索引/约束 | 弹出新建列/索引/约束页面。 | + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/4.web-odc-manage-table-attributes.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/4.web-odc-manage-table-attributes.md new file mode 100644 index 00000000..0883a803 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/4.web-odc-manage-table-attributes.md @@ -0,0 +1,172 @@ +表属性管理 +========================== + + + +概述 +----------------------- + +![数据库对象-表对象-表属性管理-概述](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/table%20attribute-basic%20information.png) + +1. 在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页单击连接名,进入连接。 + +2. 在左侧导航栏中单击 **表** 标签可查看表列表。 + +3. 在表列表中双击表名进入表管理页面。 + +4. 在表管理页面,单击顶部导航栏中的 **属性** 按钮进入属性页签。在属性页签中,可查看当前表中 **基本信息**、**列**、**索引**、**约束**、**分区** 和 **DDL** 属性信息。 + + + +基本信息 +------------------------- + +![Image 699](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-2.png) + +在 **属性** 页签的左导航栏中单击 **基本信息** 标签查看当前表的基本信息: + + +| 信息项 | 说明 | +|--------|----------------------------| +| 表名称 | 显示当前表的名称,同时可在此修改表的名称。 | +| 默认字符集 | 当前表所用的字符集。 | +| 默认排序规则 | 当前表所用的排序规则。 | +| 描述 | 显示创建表时所添加的描述,同时可在此修改对表的描述。 | +| 所有者 | 表对象所在的数据库。 | +| 最近修改日期 | 显示最近修改表属性的日期。 | +|行数据量|显示行数。| +|大小|显示数据大小。| + + + +基本信息页面提供以下功能键: + + +| 功能项 | 说明 | +|-----|----------------------------------------------| +| 编辑 | 单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412792.jpg),修改基本信息。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新基本信息。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + + +列信息 +------------------------ + +![表信息_列.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-3.png) + +在属性页签的左导航栏中单击 **列** 标签查看当前表中所包含的列。在 **列** 标签中,支持修改 **名称** 、 **长度** 、 **非空** 和 **注释** 。 + +工具栏中提供以下功能键: + + + + +| 操作键 | 说明 | +|-----|-----------------------------------------------------------------| +| 新建 | 单击+,在表中新增一个字段(列)。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除当前选中的字段。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新字段信息。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg)(在 **字段名称** 和 **类型** 右侧),筛选或搜索字段。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + +> **说明** +>
            • Oracle 模式下不支持设置自增字段。
            • +>
            • 列为非空时允许设置为空,列为空时不允许设置为非空。
            • +>
            • 如果表中无自增字段,增加一个自增列,仅支持新建列为设置为自增列。
            • +>
            • 缺省值和自增互斥,仅允许设置其中一项;仅支持修改未勾选虚拟列的列缺省值,缺省值一经设置无法取消。
            • +>
            • 已设置的虚拟列不可修改,新建列可设置虚拟列。
            + + + + + + +索引信息 +------------------------- + +![表信息_索引.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-4.png) + +在属性页签的左导航栏中单击 **索引** 标签查看当前表中包含的索引。 + +在 **索引** 标签中,支持修改 **索引名称** 和 **不可见** 。 + +工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|----------------------------------------------------------------------------------| +| 新建 | 单击+,在表中新增一个索引。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除当前选中的索引。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新索引信息。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg)(在 **索引名** 、 **范围** 、 **方法** 和 **类型** 右侧),筛选或搜索字段。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入**。 | + + + +约束信息 +------------------------- + +![表信息_约束.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-5.png) + +在属性页签左导航栏单击的 **约束** 标签查看当前表中的约束信息. + +在 **约束** 标签中,支持新增/删除 **唯一约束** 和 **检查约束**,不可修改已有对象。 + +工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|----------------------------------------------| +| 新建 | 单击+,在表中新增一个约束。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除当前选中的约束。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新约束列表。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg),筛选或搜索字段。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入**。 | + + +> **说明** +>
            • 不同约束方法支持的功能键不同,当导航栏中功能键为灰色或不存在时,表明该约束方法暂不支持该操作。
            • +>
            • 外键约束:OceanBase Oracle 模式支持通过 `all_constraints` 查询外键;OceanBase MySQL 模式自 OBServer V2.2.6 版本起,支持通过 information_schema.key_column_usage 查询外键。
            • +>
            • 仅 OceanBase Oracle 模式支持检查约束功能。
            + + +分区信息 +------------------------- + +![表信息_分区.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-6.png) + +在属性页签的左导航栏中单击 **分区** 标签查看当前表中所包含的 **分区名称**、 **顺序**、 **分区方法**、 **表达式** (Oracle 模式下展示分区键)、 **区间上限值** 或 **枚举值** 等信息(展示新建表时设置的分区方法,不同分区方法展示的分区信息不同)。且工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|-------------------------------------------------------| +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除选中的分区,分区的数据也随之销毁。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新分区列表。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg),筛选或搜索分区名称、顺序或区间上限值等信息。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + +> **说明** +> 自 ODC V3.3.0 版本起,表对象分区查看去除 sys 租户依赖。 + + + +DDL 信息 +--------------------------- + +![Image 702](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-7.png) + +可在 **属性** 页签中单击左导航栏中的 **DDL** 标签,查看当前表的 DDL 语句(即查看定义当前表的 SQL 语句,不支持编辑)。工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|----------------------------------------------| +| 格式化 | 单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412792.jpg),格式化语句以方便查看。 | +| 下载 | 单击![下载](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E4%B8%8B%E8%BD%BD.jpg),下载 DDL 为本地文件。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新分区列表。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/5.web-odc-manage-table-data.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/5.web-odc-manage-table-data.md new file mode 100644 index 00000000..d2c8899b --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/1.web-odc-table-objects/5.web-odc-manage-table-data.md @@ -0,0 +1,128 @@ +表数据管理 +========================== + +在OceanBase开发者中心(OceanBase Developer Center,ODC)点击连接名进入连接后,在左导航栏中点击 **表** 标签可以查看表列表。在表列表中双击表名进入表管理页面,点击上方导航栏中的 **数据** 按钮进入数据页签,在该页签可对当前表中的数据进行查看、新增、修改和删除操作。 +> **注意**
            +> ODC 中共享 Session,相同连接只有一个 Session。ODC V2.3.2 后在 Oracle 模式下自动提交默认设置为关,所以您需要手动提交事务。您可以在 **会话属性** 页面修改变量 autocommit 的值进行设置,详细操作请参见 [管理会话](6.web-odc-user-guide/10.web-odc-session-management.md)。 + +![p1](https://intranetproxy.alipay.com/skylark/lark/0/2020/png/273361/1608089003460-8dfb5b87-b6a1-45ae-92c4-d5c541d46014.png) + +查看数据 +------------------------- + +进入数据页签后,ODC 以表格的形式展示表中的数据,并导航栏中提供了以下功能键供您查看和管理表中的数据: + +* **开启编辑** :进入编辑态,以供您直接修改表中的数据。 + + + +* **提交** :Oracle 模式下自动提交默认设置为关(OFF),所以您需要单击该按钮以手动提交当前事务。单击时会提示您当前连接采用共享 Session,提交操作会对所有窗口生效,单击 **确认** 后提交生效。MySQL 模式下自动提交默认设置为开(ON)将不展示该按钮。 + + + +* **回滚** :Oracle 模式下自动提交默认设置为关(OFF),单击该按钮以回滚当前事务。单击时会提示您当前连接采用共享 Session,回滚操作会对所有窗口生效,单击 **确认** 后回滚生效。MySQL 模式下自动提交默认设置为开(ON)将不展示该按钮。 + + + +* **刷新** :刷新表中数据。 + + + +* **列模式** :以表格的形式展示当前被选中行的数据。在 **列模式** 页面可以进行上一行、下一行的切换展示,在列数量比较多的场景下, **列模式** 比较方便查看单行数据。 + + + +* **列管理** :筛选在页面中展示的列。 + + + +* **回到开始** :跳转至第一页。 + + + +* **上一页** :向上翻页。 + + + +* **下一页** :向下翻页。 + + + +* **跳至底部** :跳转至最后一页。 + + + +* **展示数据量** :设置在页面中展示的行数。 + + + +* **导出** :将表中数据导出,可以选择导出的文件类型(CSV 或 SQL)、字符集(GBK 或 UTF8)和行数。结果集最多导出 10000 行数据。 + + + + + + +编辑数据 +------------------------- + +如下图所示,在数据页签导航栏中单击 **开启编辑** 可进入编辑态。ODC 中用颜色标识您对表中数据的操作,新增的数据用绿色标识,删除的数据用红色标识,修改后的数据用橙色标识。 + +![p2](https://intranetproxy.alipay.com/skylark/lark/0/2020/png/273361/1608089013698-25bffb62-e227-4283-8aa4-159ca82548ca.png) + +编辑态下,导航栏提供了以下操作键功能编辑表中的数据: + +* **添加行** :单击该功能键将在表中插入一个空行。双击单元格以插入数据,ODC 提供了校验和工具来帮助您更快捷方便的插入数据。例如,当前单元格在日期类型的列中,ODC 会为您提供一个日历窗口来帮助您直接选择要插入的日期值。 + + + +* **删除行** :在表中删除当前选中的行。 + + + +* **复制当前行** :在表中复制当前选中的行。 + + + +* **列模式** :以表格的形式展示当前被选中行的数据。在 **列模式** 页面可以进行上一行、下一行的切换展示,在列数量比较多的场景下, **列模式** 比较方便查看单行数据。 + + + +* **列管理** :筛选在页面中展示的列。 + + + +* **回到开始** :跳转至第一页。 + + + +* **上一页** :向上翻页。 + + + +* **下一页** :向下翻页。 + + + +* **跳至底部** :跳转至最后一页。 + + + +* **展示数据量** :限制在页面中展示的行数。 + + + +* **取消** :退出编辑态。 + + + +* **确认修改** :生成对应操作的 SQL 语句,确认语句无误后,单击 **执行** 使修改生效。当自动提交设置为开(ON)时,单击该按钮事务被自动提交。 + + + +* **修改并提交** :Oracle 模式下自动提交默认设置为关(OFF),所以您需要单击该按钮以手动提交当前事务。单击时会提示您当前连接采用共享 Session,提交操作会对所有窗口生效,单击 **确认** 后提交生效。MySQL 模式下自动提交默认设置为开(ON)将不展示该按钮。 + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/1.web-odc-view-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/1.web-odc-view-objects-overview.md new file mode 100644 index 00000000..b021da86 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/1.web-odc-view-objects-overview.md @@ -0,0 +1,29 @@ +概述 +======================= + +视图是基于一个或多个表(或视图)而创建的虚拟表,视图基于的表称为基表。视图本身不包含数据,通过它可以对基表里面的数据进行查询和修改。所以视图的定义存在数据字典中,但是与此定义相关的数据并没有再存一份于数据库中。视图看上去非常像数据库的物理表,对它的操作同任何其它的表一样。当通过视图修改数据时,实际上是在改变基表中的数据,相反地,基表数据的改变也会反映在由基表产生的视图中。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击视图标签可以查看视图列表。在视图列表中双击视图名进入视图管理页面,您可以在视图管理页面的数据页签查看视图的数据,或在属性页签查看视图的基本信息、列和 DDL 等属性信息。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V1.4.1 及以上。 | + + + +本章节将分篇介绍以下 ODC 中视图对象的相关操作: + +* [新建视图](6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md) + + + +* [管理视图](6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md new file mode 100644 index 00000000..67733433 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/2.web-odc-create-a-view.md @@ -0,0 +1,204 @@ +新建视图 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建视图。本文介绍如何使用 ODC 创建视图。 + +概述 +----------------------- + +视图是一个虚拟表,其结构和内容是由一张或多张表中的部分数据组成并通过 `SELECT` 查询语句获取,本身并不包含数据。 + +### 视图作用 + +* 简化数据查询操作:视图能够将数据库中不同表中所需的数据组合成一个单表,利用视图,将多表查询转换成视图的单表查询。 + + + +* 限制数据访问操作:使用视图仅向特定用户公开特定数据,用户仅能查看视图所显示的数据。 + + + +![概述](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%A6%82%E8%BF%B0.png) + +如上图所示,创建视图需要进行以下 5 个步骤: + +1. 指定基本信息。 + + + +2. 选择基表。 + + + +3. 选择字段。 + + + +4. 确认 SQL。 + + + +5. 完成新建视图。 + + + + + + +操作步骤 +------------------------- + +以在 ODC 中创建员工薪资视图(salary)为例,将 employee 表中的 name 和 consumer 表中的 budget、dept_name 数据组合到视图 salary 中。具体操作步骤如下: + +### 步骤 1:指定基本信息 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左侧导航栏中单击 **视图** 标签可查看视图列表。在视图列表的右上角,单击 **+** 创建视图,或在顶部导航栏中单击 **新建** 以创建所需对象。 + +在 **基本信息** 中,输入 **视图名称** 并选择 **检查项** 。 + +* **视图名称** :为视图指定一个名称。 + + + +* **检查项** :检查项是对写入数据的约束检查,OceanBase Oracle 模式下支持只读。默认值: **无** 。 + + + + + + +![步骤1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%80.png) + +完成基本信息的指定后,单击页签左下角的 **确定** 按钮,完成当前步骤。 + +设置基本信息完成后,可以直接单击页面下方的 **下一步:确认 SQL** 按钮进入第四步 **确认 SQL**,或可以按需进入第二步进行基表选择的操作。 + +### 步骤 2:选择基表 + +指定基本信息后,可按需继续进行第二步基表选择的操作,该步骤可跳过。 + +在 **基表选择** 页签中,左侧的列表按 Schema \> 库 \> 表 / 视图的层级关系展示了可被选择的基表,列表支持搜索。在基表列表中选中目标表或视图,单击列表旁的添加按钮 > 添加选中的表或视图到页签右侧的表操作区中。 + +![步骤2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%BA%8C.png) + +在表操作区中,可对选择的基表进行以下操作: + + +| 信息项 | 说明 | +|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 设置别名 | 为选中的基表设置一个别名,可选操作。在表操作区中单击表名后的 **\<别名\>** 标签在文本框中输入别名。 | +| 设置关联关系 | 表操作区中存在两个或两个以上的表时可通过下拉框选择表与表之间的关联关系,默认值为 **JOIN,** 最后一张表无需设置关联关系。单击别名标签后的下拉列表标签![下拉列表](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E4%B8%8B%E6%8B%89%E5%88%97%E8%A1%A8.jpg)进行选择,可选 **JOIN** 、 **INNER JOIN** 、 **LEFT JOIN** 、 **RIGHT JOIN** 、 **CROSS JOIN** 、 **FULL JOIN** 、 **UNION** 、 **UNION ALL** 、 **INTERSECT** 、 **MINUS** 、 **LEFT OUTER JOIN** 、 **RIGHT OUTER JOIN** 和 **FULL OUTER JOIN** 等关联关系。 | +| 调整关联顺序 | 可直接在表操作区中拖动选择的基表进行顺序的调整。每次调整,变更为最后一张表的关联关系将被清空。 | +| 删除基表 | 在表操作区中单击每张表后的删除按钮,可将该表从表操作区中删除。每次删除,变更为最后一张表的关联关系将被清空。 | + + + +完成基表的选择和设置后,单击页签左下角的 **确定** 按钮,完成当前步骤。 + +### 步骤 3:选择字段 + +完成基表选择后,可进行第三步字段选择的操作。如已跳过第二步基表选择将无法进行字段选择。 + +在 **字段选择** 页签中,左侧的列表按 Schema \> 库 \> 表 / 视图的层级关系展示了在第二步被选择的基表所包含的字段,支持搜索字段。在字段列表中选中目标字段,单击列表旁的添加按钮 > 添加选中的字段到页签右侧的字段操作区中。 + +![步骤3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%89.png) + +在字段操作区中,可对选择的字段进行以下操作: + + +| 信息项 | 说明 | +|--------|-----------------------------------------------------------| +| 设置别名 | 为选中的字段设置一个别名,可选操作。在字段操作区中单击字段名后的 **\<别名\>** 标签在文本框中输入别名。 | +| 调整关联顺序 | 可直接在字段操作区中拖动选择的字段进行顺序的调整。 | +| 删除字段 | 在字段操作区中单击每个字段后的删除按钮,可从字段操作区中删除该字段。 | +| 自定义字段 | 单击字段操作区右上角的 **+自定义** 标签会在字段操作区中添加一个字段,用户需要为新增的字段指定字段名称和别名。 | + + + +完成字段的选择和设置后,单击页签左下角的 **确定** 按钮,完成当前步骤。 + +### 步骤 4:确认 SQL + +完成上述所有信息的指定后,单击页面上 **下一步:确认 SQL** 按钮以进入语句编辑页面。 + +![步骤4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%204.png) + +在语句编辑页面中会根据 **基本信息** 、 **基表选择** 和 **字段选择** 页签中指定的信息生成对应的视图定义语句。当包含 2 个以上表时,需要根据表之间的关联关系和逻辑条件等补齐语句。补齐视图创建语句后,单击页面右上角的 **创建** 按钮,完成视图的创建。 + +用户可以在 SQL 创建确认页面编辑创建的视图语句。语法格式如下: + +```sql +CREATE VIEW view_name AS +SELECT + column1, + column2..... +FROM + table_name +WHERE + [condition]; +``` + + + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|--------------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,为脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,脚本中选中的语句转换为注释或转换为 SQL 语句。 | +|IN 值转化| 可以将如 A B 的格式转化为 ('A','B') 的格式。| +| 上一步 | 返回 **新建视图** 页面,用户可以继续编辑或修改 **基本信息** 、 **基表选择** 和 **字段选择** 页签中的指定的值。 | + + + +### 步骤 5:完成新建视图 + +单击 **创建** ,完成新建视图后,可以如同查询表对象一样,使用 `SELECT` 语句查询用户视图。 + +![步骤4.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%205.2.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击视图列表中的视图名,通过弹出的管理操作列表(包括 **查看视图属性** 、**查看视图数据**、 **新建视图** 、 **导出**、**下载** 、 **复制** 和 **删除** ),可快速管理和操作目标对象。 + +视图具体操作,请参见 [管理视图](../2.web-odc-view-objects/3.web-odc-manage-views.md)。 + +语法格式: + +```sql +SELECT +column1, +column2..... +FROM +table_name; +``` + + + +示例: + +```sql +SELECT `name`, `budget`, `department_name` FROM `salary`; +``` + + + +![步骤5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%205.2.png) + +相关信息 +------------------------- + +* [新建表](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [新建函数](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [新建存储过程](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [新建序列](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [新建程序包](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [新建触发器](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [新建类型](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +* [新建同义词](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md new file mode 100644 index 00000000..61f9b6d6 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/2.web-odc-view-objects/3.web-odc-manage-views.md @@ -0,0 +1,54 @@ +管理视图 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **视图** 标签可查看视图列表,在视图列表中展示了当前连接的数据库中存在的视图对象。 + +您可以在视图列表中查看该对象的 **结构树** 或右键目标对象以进行一些 **管理操作** 。或者在视图列表中双击目标视图名进入视图管理页面,您可以在视图管理页面的 **属性和数据页签**。 + +结构树 +------------ + +如下图所示,在视图列表中单击目标视图名前的下弹标志会在弹出的下拉列表中展示其结构树,对象视图的结构树最深有三层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表** : + +![Image 193](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-1.png) + +管理操作 +------------- + +在视图列表中,视图对象名称默认支持按头字符升序排序。 +右键结构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|--------|-------------------------------------------------------------| +| 查看视图属性 | 进入 **属性** 页签,全量查看视图的基本信息、列和代码等信息。 | +| 查看视图数据 | 进入 **数据** 页签,查看视图中的数据。 | +| 新建视图 | 进入新建视图页面,根据步骤创建新的视图对象。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载视图对象的 SQL 文件。 | +| 复制 | 选择对象名、Select 语句、Insert 语句、Update 语句或 Delete 语句。 | +| 删除 | 删除当前视图对象。 | + + + +属性和数据页签 +---------------- + + ![manage view2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-2.png) + +* 属性页签: + + * **基本信息** :查看 **视图名称** 、 **检查项** 和 **创建人** 等信息。 + + + + * **列** :查看视图对应基表的 **字段名称** 、 **数据类型** 和 **字段注释** 等信息。工具栏中单击刷新图标,刷新字段信息。 + + + + * **代码** :当前视图的定义脚本。工具栏中单击下载图标,下载 DDL 为本地文件;单击格式化图标,格式化语句以方便查看。 + + +* 数据页签:展示视图中包含的字段名(列)。 + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/1.web-odc-function-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/1.web-odc-function-objects-overview.md new file mode 100644 index 00000000..0fdfe915 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/1.web-odc-function-objects-overview.md @@ -0,0 +1,29 @@ +概述 +======================= + +函数即定义了一组 SQL 脚本的集合,可以在SQL语句中对函数进行调用以返回一个指定的结果。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击函数标签可以查看函数列表。在函数列表中双击函数名进入函数管理页面,您可以在函数管理页面查看函数的基本信息、参数和 DDL 等信息。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V2.0.0 及以上。 | + + + +本章节将分篇介绍以下 ODC 中函数对象的相关操作: + +* [新建函数](6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-functions/../../../2.web-odc-create-a-function.md) + + + +* [管理函数](6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-functions/../../../3.web-odc-manage-functions.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/2.web-odc-create-a-function.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/2.web-odc-create-a-function.md new file mode 100644 index 00000000..aec1d659 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/2.web-odc-create-a-function.md @@ -0,0 +1,191 @@ +新建函数 +========================= + + + +概述 +----------------------- + +函数是在数据库内定义的子程序,可以从内置 SQL 语句中调用函数。如果自带的函数不能满足业务需求,则可以通过 ODC 新建函数,添加自定义函数,以实现某些功能运算和完成各种特定操作,且自定义函数可以减少重复编码,提高程序可读性。 + +函数是一种与存储过程十分相似的过程式数据库对象。与存储过程一样,都是由 SQL 语句和过程式语句组成的代码片段,并且可以被应用程序和其他 SQL 语句调用。 + +自定义函数与存储过程的区别: + +* 函数有且仅有一个返回,适合做处理数据后返回一个结果;存储过程可有 0 个或多个返回,适合做批量插入、批量更新。 + +* 可以直接通过 select 语句调用函数,而存储过程的调用需要使用 call 语句。 + +![创建函数1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%9B%E5%BB%BA%E5%87%BD%E6%95%B01.png) + +如上图所示,创建函数包含以下 6 个步骤: + +1. 输入函数名称。 + +2. 选择函数返回值的数据类型。 + +3. 添加参数。 + +4. 确定新建函数信息。 + +5. 编辑函数信息。 + +6. 完成新建函数。 + +操作步骤 +------------------------- + +### 步骤一:输入函数名称。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **函数** 标签可以查看函数列表。在函数列表的右上角,单击 + 创建函数,或是在 ODC 上方导航栏中单击 **新建** 以创建您需要的对象。 + +![创建函数2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6422441361/p138325.png) + +### 步骤二:选择函数返回值的数据类型。 + +具体数据类型,请参考 [OceanBase 数据库的开发指南](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview)。 + +### 步骤三:添加参数。 + +1. 参数即调用函数时传入的信息,需指定参数信息: + + * Oracle 模式:需指定参数的 **名称** 、 **模式** 、 **类型** 和 **默认值** **。** + + + + * MySQL 模式: 需指定参数的 **名称** 、 **类型** 和 **长度** 。 + + + + + + +2. 添加函数提供三种功能操作: + + + + | 功能项 | 说明 | + |----------|-------------------------------------------------------------------------------------------------------------------------------------------------| + | 弹窗引导辅助菜单 | 通过弹窗引导辅助菜单,可添加、删除、上下移动参数。 | + | 单击表序号 | - 单击表序号,选中整行,显示辅助菜单(删除、上/下移动)。
            - 单击并选中表序号,可拖动整行参数以调整顺序。 | + | 右键操作 | - 拖动鼠标选中整行,右键单击鼠标,进行复制行 / 向下移动一行。
            - 选择单元格,右键单击鼠标,进行复制。 | + + + +3. **参数** 中需指定的 **模式** 指参数类型。 + + MySQL 模式下不支持设定参数模式,Oracle 模式下支持三种参数模式 **IN** (输入)、 **OUT** (输出)、 **INOUT** (输入输出): + + + | **参数** | **类型** | + |--------|-------------------------------------------------------------------| + | IN | 输入参数,调用函数时将参数的值传入函数供执行函数时使用。 | + | OUT | 输出参数,调用函数时,函数会忽略输出参数本身的值并传入一个空值,在函数体中可以修改输出参数并将修改结果返回给输出参数所代表的实参。 | + | INOUT | 输入输出参数,即同时具备输入参数和输出参数的功能。 | + + + > **说明**
            + > Oracle 模式下函数和存储过程均包含 IN/OUT/INOUT 参数;MySQL 模式下只包含 IN 参数,而存储过程包含 IN/OUT/INOUT 参数。 + + + + + +### 步骤四:单击确定,进入 SQL 创建确认页面。 + +### 步骤五:在 SQL 创建确认页面 ,编辑函数语句。 + +![创建函数3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%9B%E5%BB%BA%E5%87%BD%E6%95%B03.png) + +用户可以在 SQL 创建确认页面编辑创建的函数语句。语法格式如下: + +```sql +create function < 函数名 > ([ <参数1> <类型1> [ , <参数2> <类型2>] ] ...) +RETURNS < 类型 > +< 函数主体 > +``` + + + +参数说明: + + +| 参数 | 说明 | +|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| \<函数名\> | 指定自定义函数的名称。
            **注意**
            自定义函数不能与存储过程具有相同的名称。 | +| \<参数\>\<类型\> | 用于指定自定义函数的参数。 该参数只有名称和类型,不能指定关键字 IN、OUT 和 INOUT。 | +| RETURNS\<类型\> | 用于声明自定义函数返回值的数据类型。其中,`<类型>` 用于指定返回值的数据类型。
            **注意**
            在 RETURN VALUE 语句中包含 SELECT 语句时,SELECT 语句的返回结果只能是一行且只能有一列值。 | +| \<函数主体\> | 自定义函数的主体部分,亦称函数体。 函数体必须包含一个 `RETURN<值>` 语句,其中`<值>`用于指定自定义函数的返回值。 | + + + +示例: + +```sql +create function `function_test` ( + `p1` int(45) -- 申明参数 +) returns int(11) -- 申明返回值类型 + +-- 函数体开始 +begin + +-- 申明变量 +declare +v1 int; + +-- 变量赋值 +set v1 = p1 + 1; + +-- 返回值 +return v1; + +-- 函数体结束 +end +``` + + + +### 步骤六:完成新建函数。 + +单击 **创建** ,完成新建函数后,可以如同调用系统内置函数一样,使用关键字 select 调用用户自定义的函数。 + +> **说明**
            +> 在左侧导航栏中,右键鼠标单击函数列表中的函数名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **编辑** 、 **编译** 、 **调试** 、 **运行** 、 **下载** 、 **删除** 和 **刷新** ),可快速管理和操作目标对象。 +> 函数具体操作,请参见 [管理函数](6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-functions/../../../3.web-odc-manage-functions.md)。 + +语法格式: + +```sql +select <函数名> ([<参数> [,...]]) +``` + + + +示例: + +```sql +select function_test(2); +``` + + + +* MySQL 模式 + + ![创建函数4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%9B%E5%BB%BA%E5%87%BD%E6%95%B04.png) + + +* Oracle 模式 + + ![新建函数](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0.png) + + + > **注意**
            + >
          • Oracle 模式下如果包含 OUT 参数,则需通过 `call` 方式调用。
          • + >
          • 函数列表中如果出现黄色图标,表示目前有错误或者警告。
          • + + + +相关信息 +------------------------- + +[新建存储过程](6.web-odc-user-guide/11.web-odc-database-objects/../../../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md new file mode 100644 index 00000000..f1e9bf8c --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/3.web-odc-function-objects/3.web-odc-manage-functions.md @@ -0,0 +1,92 @@ +管理函数 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **函数** 标签可以查看函数列表,在函数列表中展示了当前连接的数据库中存在的函数对象。 + +可在函数列表中查看该对象的 **结构树** 或右键目标对象以进行一些 **管理操作**。或者,在函数列表中双击目标函数名进入 **函数管理页面**。 + +结构树 +------------ + +如下图所示,在函数列表中单击目标函数名前的下弹标志会在弹出的下拉列表中展示其结构树,对象函数的结构树最深有三层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表** : + +![Image 194](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-1.png) + +管理操作 +------------- + +在函数列表中,函数对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|--------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建函数。 | +| 筛选 | 单击筛选图标选择显示有效/无效函数。 | +| 批量编译 | 单击批量编译图标对函数对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
            ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png) | +| 刷新 | 对当前函数对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键鼠标单击结构树中的目标项,通过弹出的管理操作列表,可快速管理和操作目标对象。管理操作键表如下所示: + + +| 操作键 | 说明 | +|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 查看 | 进入 **函数管理页面**,全量查看当前函数的基本信息、参数和代码等信息。 | +| 新建 | 进入新建函数页面,根据步骤创建新的函数对象。 | +| 编辑 | 在 **函数管理页面** 中展示定义当前函数的语句,您可以在窗口中继续编辑该函数。 | +| 编译 | 编译目标函数。 | +| 调试 | 进入调试页面以对当前函数进行调试。
            **说明**
            • 推荐升级至 OBServer V2.2.77 及之后版本(因 OBServer 部分版本存在 PL 调试类已知问题,可能导致 OBServer 不稳定)。
            • ODC V3.2.2 之前版本,通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。
            • 自 ODC V3.2.2 及之后版本,支持通过 OBProxy 连接 OBServer 情况下进行 PL 调试。
            • ODC V4.0.0 及之后版本,支持设置参数值为 DEFAULT、NULL 或空字符串。
            | +| 运行 | 运行当前函数。| +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载函数对象的 SQL 文件。| +| 删除 | 删除当前函数。 | +| 刷新 | 对当前函数对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +函数管理页面 +--------------------------- + +![Image 817](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-2.png) + +在函数列表中双击目标函数名进入函数管理页面。可在函数管理页面查看以下信息: + + +| 功能 | 说明 | +|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 基本信息 | 显示 **函数名称** 、 **返回类型** 和 **创建人** 等信息。 | +| 参数 | 显示参数 **名称** 、 **顺序** 、 **模式** 、 **数据类型** 、 **默认值** 等信息。单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7659061361/p326053.jpg)图标,可刷新参数。 | +| DDL | 显示定义函数的脚本,同时提供 **编辑** 、**下载**、 **查找** 和 **刷新** 功能键。 **说明** 单击 **编辑** 图标,会跳转至 PL 对象编辑窗口。 | + + + +函数编辑页面 +--------------- + +在函数列表中右键目标项,在提供的操作键中单击 **编辑** 可进入函数编辑页面,在编辑页面的代码区会展示该函数的定义语句, 您可以继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 确认修改 | 单击以更新本次修改。 | +| 编译 | 编译当前页面中的语句。 | +| 运行 | 单击该按钮运行代码区中的语句。 | +| 终止 | 单击该按钮终止正在运行的语句。 | +| 调试 | 单击该按钮进入调试页面,并对代码区内的 PL 对象进行调试。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| IN 值转化 | 批量复制转化工具,适用于查询数据时对复制的行或列结果进行格式转化。 将批量数据粘贴在 SQL 编辑区后,选择复制的数据,单击 **IN 值转化** 按钮,即可转化成 in('A','B')格式。
          • 列值分隔符号为换行符。
          • 行值分隔符为空格或 TAB 值。
          • | +| 代码片段 | 提供内置语法片段和自定义语法片段供您查看和引用。详情请查看 **用户指南** > **使用工作台** > **代码片段**。 | +| 下载 | 下载函数对象的 SQL 文件。 | \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/1.web-odc-stored-procedure-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/1.web-odc-stored-procedure-objects-overview.md new file mode 100644 index 00000000..a035d143 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/1.web-odc-stored-procedure-objects-overview.md @@ -0,0 +1,46 @@ +概述 +======================= + +存储过程(Stored Procedure)是在数据库系统中,一组为了完成特定功能的 SQL 语句集,它存储在数据库中,一次编译后永久有效。 + +函数和存储过程的定义类似,都是 SQL 脚本的集合,但是二者主要区别如下: + +* 函数一般只返回一个变量,而存储过程没有返回值。 + + + +* 函数是可以嵌入在 SQL 语句中使用,比如,可以在 `SELECT` 语句中调用函数,但是存储过程一般是作为一个独立的部分被执行。 + + + +* 函数限制比较多,而存储过程的限制相对就比较少。一般来说,存储过程实现的功能要复杂一点,而函数的实现的功能针对性比较强。 + + + + + + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **存储过程** 标签可以查看存储过程列表。在存储过程列表中双击存储过程名进入存储过程管理页面,您可以在存储过程管理页面查看存储过程的基本信息、参数和 DDL 等信息。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V2.0.0 及以上。 | + + + +本章节将分篇介绍以下 ODC 中存储过程对象的相关操作: + +* [新建存储过程](../../../6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) + + + +* [管理存储过程](../../../6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md new file mode 100644 index 00000000..4c02d0cd --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md @@ -0,0 +1,229 @@ +# 新建存储过程 + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建存储过程。本文介绍如何使用 ODC 创建存储过程。 + + +## 概述 + +存储过程是一条或多条语句的集合,对数据库进行一系列复杂操作时,存储过程可以在数据库内将这类复杂操作封装成一个代码块,以便重复使用,从而减少数据库开发人员的工作量。 + +存储过程旨在完成特定功能的 SQL 语句集,经编译创建并保存在数据库中,用户可以通过指定存储过程名并指定所需参数来调用执行,利用存储过程可以加速 SQL 语句的执行。 + +新建存储过程,即由用户创建并能够完成某一特定功能的存储过程,存储过程可以包含参数和返回值。 + +### 存储过程与函数的区别 + +* 函数的返回值显示具体结果值,而存储过程的返回值仅指明执行是否成功。 + + + +* 可以直接通过 `SELECT` 语句调用函数,而存储过程的调用需要使用 `CALL` 语句。 + + + + + + +### 存储过程作用 + +* 提高应用程序的通用性和可移植性:新建存储过程完成后,可以在程序中被多次调用,无需重新编写该存储过程的 SQL 语句,且支持修改存储过程,对程序源代码无影响,从而提高程序的可移植性。 + + + +* 提高 SQL 执行速度:存储过程编译完成,如果某一个操作包含大量的 SQL 代码或者分别被执行多次,则使用存储过程比直接使用单条 SQL 语句执行速度更快速。 + + + +* 减轻服务器的负担:在进行数据库对象操作时,如果使用单条调用的方式,则网络上必须传输大量的 SQL 语句;如果使用存储过程,则可以直接发送过程的调用命令,从而降低网络负担。 + + + + +![概述](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%A6%82%E8%BF%B0.png) + + +如上图所示,创建存储过程包含以下 5 个步骤: + +1. 输入存储过程名称。 + +2. 添加参数。 + +3. 确定新建存储过程信息。 + +4. 编辑存储过程信息。 + +5. 完成新建存储过程。 + +## 操作步骤 + +以在 ODC 中创建部门预算存储过程(proc_total)为例,存储过程 proc_total 中包含 budget_r 和 budget_s 两个 INT 类型的输入参数,计算两个参数之和。具体操作步骤如下: + +### 步骤 1:指定存储过程名称 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **存储过程** 标签可以查看存储过程列表。在存储过程列表的右上角,单击 **+** 创建存储过程,或是在顶部导航栏中单击 **新建** \> **存储过程** 以创建所需的对象。 + +在 **新建存储过程** 中,输入存储过程名称。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A41.png) + +### 步骤 2:添加参数 + +1. 参数即调用函数时传入的信息,需指定参数信息: + + * Oracle 模式:需指定参数的 **名称** 、 **模式** 、 **类型** 和 **默认值** **。** + + + + * MySQL 模式: 需指定参数的 **名称** 、 **模式** 、 **类型** 和 **长度** 。 + + + + + + +2. 添加函数提供三种功能操作: + + + + | 功能项 | 说明 | + |----------|-------------------------------------------------------------------------------------------------------------------------------------------------| + | 弹窗引导辅助菜单 | 通过弹窗引导辅助菜单,可添加、删除、上下移动参数。 | + | 单击表序号 | - 单击表序号,选中整行,显示辅助菜单(删除、上/下移动)。
            - 单击并选中表序号,可拖动整行参数以调整顺序。 | + | 鼠标右键操作 | 右键单击鼠标选中整行,进行复制行 / 向下移动一行。 | | + + > **说明** + > + > 复制行后,可选中某行并通过快捷键 Command + V / Ctrl + V 进行粘贴。 + + + +3. **参数** 中需指定的 **模式** 指参数类型 + + MySQL 模式下不支持设定参数模式,Oracle 模式下支持三种参数模式 **IN** (输入)、 **OUT** (输出)、 **INOUT** (输入输出): + + ```sql + CREATE PROCEDURE proc_name ([[IN |OUT |INOUT ] parameter_name parameter_type...]) + ``` + + + * 参数说明 + + + + | **参数** | **类型** | + |--------|----------------------------------------------------------------------------------------------------------------------------------| + | IN | 输入参数。
            调用存储过程时将参数的值传入存储过程供执行存储过程时使用。 IN 类型参数一般只用于传入,在调用存储过程中一般不作修改和返回。 | + | OUT | 输出参数。
            调用存储过程时,存储过程会忽略输出参数本身的值并传入一个空值,执行结束后,输出参数会被赋予存储过程对其修改的值。一般用输出参数获取存储过程的执行结果数据。 OUT 类型参数可以用于调用存储过程中需要修改和返回值。 | + | INOUT | 输入输出参数。
            同时具备输入参数和输出参数的功能。 | + + + + * 参数设置 + + + + | 属性 | 是否必填 | 默认 | 模式 | + |-----|------|---------|--------------| + | 名称 | 必填 | 空 | Oracle/MySQL | + | 模式 | 必填 | IN | Oracle/MySQL | + | 类型 | 必填 | VARCHAR | Oracle/MySQL | + | 长度 | 必填 | 45 | MySQL | + | 默认值 | 非必填 | 空 | Oracle | + + + + + + + + + +### 步骤 3:确定新建存储过程 + +单击 **确定** ,进入 SQL 创建确认页面。 + +### 步骤 4:编辑存储过程 + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-4.png) + +在 SQL 创建确认页面 ,编辑存储过程语句。 + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,为脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,为脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| IN 值转化 | 可以将如 A B 的格式转化为 ('A','B') 的格式。 | + + +用户可以在 SQL 创建确认页面编辑创建的存储过程语句。语法格式如下: + +```sql +CREATE PROCEDURE proc_name ( + [proc_parameter[,...]]) +BEGIN +proc_body: +  Valid SQL routine statement +END [end_label] +``` + + + +参数说明: + + +| 参数 | 说明 | +|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| proc_name | 存储过程的名称,默认在当前数据库中创建。 如需在特定数据库中创建存储过程,需要在名称前加上数据库名称,即 db_name.sp_name。
            **注意**
            名称应当尽量避免选取与 MySQL 内置函数相同的名称,否则会发生错误。 | +| [proc_parameter[,…] ] | 存储过程的参数列表,包括 `[IN|OUT|INOUT] parameter_name parameter_type`。
            其中,`parameter_name` 为参数名,`parameter_type` 为参数的类型(可以是任何有效的 MySQL 数据类型)。当有多个参数时,参数列表中彼此间用逗号分隔。存储过程可以无参数(此时存储过程的名称后仍需加上一对括号),也可以有 1 个或多个参数。
            **注意**
            参数名避免与数据表的列名相同,否则存储过程的 SQL 语句会将参数名看作列名,从而可能出错。 | +| proc_body | 存储过程的主体部分,包含在过程调用的时候必须执行的 SQL 语句。
            此部分以 **BEGIN** 开始, **END** 结束。如存储过程体中只有一条 SQL 语句,则可以省略 BEGIN-END 标志。 | + + + +### 步骤 5:完成新建存储过程 + +单击 **创建** ,完成新建存储过程后,可以如同调用系统内置函数一样,使用 `CALL` 语句调用用户自定义的存储过程。 + +![5.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-5.1.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击存储过程列表中的存储过程名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **编辑** 、 **运行** 、 **下载** 、 **删除** 和 **刷新** 等),可快速管理和操作目标对象。 + +存储过程具体操作,请参见 [管理存储过程](../4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md)。 + +语法格式: + +```sql +CALL proc_name ([proc_parameter [,...]]); +``` + + + +示例: + +```sql +CALL proc_total (30000, 20000); +``` + + + +![5.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-5.2.png) + +## 相关信息 + +* [新建表](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [新建视图](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [新建函数](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [新建序列](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [新建程序包](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [新建触发器](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [新建类型](../8.web-odc-type-objects/2.web-odc-create-a-type.md) +* [新建同义词](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md new file mode 100644 index 00000000..8c4a3a03 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/4.web-odc-stored-procedure-objects/3.web-odc-manage-stored-procedures.md @@ -0,0 +1,113 @@ +管理存储过程 +=========================== + + + +概述 +----------------------- + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页单击连接名进入连接后,在左导航栏中单击 **存储过程** 标签可查看存储过程列表,在存储过程列表中显示当前连接的数据库中存在的存储过程对象。 + +在存储过程列表中,可查看该对象的 **结构树** 或右键目标对象以进行 **管理操作** 。或者,在存储过程列表中双击目标存储过程名进入 **存储过程管理页面** 。 + +结构树 +------------------------ + +如下图所示,在存储过程列表中,单击目标存储过程名左侧的下拉图标![下拉按钮2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2334377361/p354912.jpg),在弹出的下拉列表中会展示其结构树。 + +对象存储过程的结构树最深包含三层,右键单击结构树中不同层级中的项,提供对该项的操作键选项,具体操作请参见 **管理操作** 中的 **管理操作键表** : + +![Image 195](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-1.png) + +管理操作 +------------------------- + +在存储过程列表中,存储过程对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|----------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建存储过程。 | +| 筛选 | 单击筛选图标选择显示有效/无效存储过程。 | +| 批量编译 | 单击批量编译图标对存储过程对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
            ![数据库对象-批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png) | +| 刷新 | 对当前存储过程对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 +右键结构树中的目标项,在弹出的右键管理操作列表中,ODC 提供操作键选项以快速管理目标对象。 +下述为管理操作键表: + + +| 操作键 | 说明 | +|-----|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 查看 | 进入 **存储过程管理页面,** 全量查看当前存储过程的基本信息、参数和代码等信息。 | +| 新建 | 进入新建存储过程页面,根据步骤创建新的存储过程对象。 | +| 编辑 | 在 **存储过程编辑页面** 中展示定义当前存储过程的语句,可以窗口中继续编辑该存储过程。 | +| 编译 | 编译目标存储过程。 | +| 调试 | 进入 **调试页面** 以对当前存储过程进行调试。
            **说明**
            ODC V4.0.0 及之后版本,支持设置参数值为 DEFAULT、NULL 或空字符串。
            | +| 运行 | 运行当前存储过程。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载存储过程对象的 SQL 文件。 | +| 删除 | 删除当前存储过程。 | +| 刷新 | 对当前存储过程对象进行管理操作后,刷新结构树以显示最新信息。
            **说明**
          • 推荐升级至 OBServer V2.2.77 及之后版本(因 OBServer 部分版本存在 PL 调试类已知问题,可能导致 OBServer 不稳定)。
          • ODC V3.2.2 之前版本,通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。
          • 自 ODC V3.2.2 及之后版本,ODC 支持通过 OBProxy 连接 OBServer 情况下进行 PL 调试。
          • | + + + +存储过程管理页面 +----------------------------- + +![管理存储对象2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-2.png) + +在函数列表中,双击目标存储过程对象名进入存储过程管理页面。可在存储过程管理页面查看以下信息: + + +| 功能 | 说明 | +|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 基本信息 | 显示 **存储过程名称** 、 **创建人** 、 **创建时间** 和 **最近修改时间** 等信息。 | +| 参数 | 显示参数 **名称** 、 **模式** 、 **数据类型** 、 **长度** 和 **默认值** 等信息。单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7659061361/p326053.jpg)图标,可刷新参数。 | +| DDL | 显示定义存储过程的脚本,同时提供 **编辑** 、 **下载**、**查找** **、** **格式化** 和 **刷新** 功能键。 **说明** 单击 **编辑** 图标,会跳转至 PL 对象编辑窗口。 | + + + +存储过程编辑页面 +----------------------------- + +在存储过程列表中右键目标项,在提供的操作键中单击 **编辑** 可进入存储过程编辑页面,在编辑页面的代码区会显示该存储过程的定义语句, 可继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 确认修改 | 单击以更新本次修改。 | +| 编译 | 编译当前页面中的语句。
            **说明**
          • 编译过程中,如存在引用无效的外部对象时 对象名所在行高亮。
          • 编译完成后, **编译结果** 中会显示编译状态(如存在告警,会显示告警详情)。
          • | +| 运行 | 单击该按钮![运行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7267628361/p358390.jpg)运行代码区中的语句。 | +| 调试 | 单击该按钮![调试](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7267628361/p358392.jpg)进入调试模式,并对代码区内的 PL/SQL 对象进行调试。 调试完成后,可直接关闭调试窗口。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,旨在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,旨在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| IN 值转化 | 批量复制转化工具,适用于查询数据时对复制的行或列结果进行格式转化。 将批量数据粘贴在 SQL 编辑区后,选择复制的数据,单击 **IN 值转化** 按钮,即可转化成 in('A','B')格式。
          • 列值分隔符号为换行符。
          • 行值分隔符为空格或 TAB 值。
          • | + + + +储存过程运行结果页面 +------------------------------- + +![存储过程-运行结果](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2334377361/p350898.png) + +存储过程执行完毕后,可查看 **运行结果** 和 **DBMS 输出** 信息。 + + +| 功能 | 说明 | +|---------|----------------------------------------| +| 运行结果 | 在运行结果页签中,可查看存储过程运行状态、参数、类型、值、返回类型和返回值。 | +| DBMS 输出 | 在 DBMS 输出页签中,可查看存储过程 DBMS 输出信息。 | + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/1.web-odc-sequence-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/1.web-odc-sequence-objects-overview.md new file mode 100644 index 00000000..ea80e4d2 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/1.web-odc-sequence-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +序列(Sequence)是指在数据库中按照一定规则自增的一种数字序列。因为自增所以不会出现重复的值,所以通常用来做为表的主键或唯一键。 +> **注意**
            +> 连接 V2.1.0 及之后版本 OceanBase 数据库 Oracle 模式支持创建序列对象,MySQL 模式暂不支持。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击序列标签可以查看序列列表。在序列列表中双击序列名进入序列管理页面,您可以在序列管理页面查看序列的基本信息、参数和 DDL 等信息。 + +本章节将分篇介绍以下 ODC 中序列对象的相关操作: + +* [新建序列](../../../6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) + + + +* [管理序列](../../../6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md new file mode 100644 index 00000000..66c1648f --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md @@ -0,0 +1,43 @@ +新建序列 +========================= + +
            +

            说明

            +

            ODC V3.2.2 及之后版本支持连接 OceanBase 社区版。 因内核功能差异,ODC 序列功能不支持 OceanBase 社区版 (菜单入口会置灰)。

            +
            + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击 **序列** 标签可以查看序列列表。在序列列表的右上角,单击 **+** 创建序列,或是在 ODC 上方导航栏中单击 **新建 \> 序列** 以创建所需的对象。创建序列有以下两个步骤: + +![1](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4729171361/p138331.png) + +1. 设置 **基本信息** :需指定 **序列名称** 和 **当前用户** (根据当前连接账号自动填充)。 + + + +2. **设置列** (可选)。在该步骤需指定以下信息: + + + + | 信息项 | 说明 | + |------|-----------------------------------------------| + | 起始于 | 指定序列的起始值,要保证不小于属性 **最小值** 。 | + | 增量 | 指定序列值自增时的步长,可以为负数。 | + | 最小值 | 指定序列可获取的最小值,数据库支持的最小值为-1026。 | + | 最大值 | 指定序列可获取的最大值,数据库支持的最大值为 1027。 | + | 缓存设置 | 指定序列缓存的大小,合理设置缓存值可以提高序列取值的执行性能,也可设置 **无缓存** 。 | + | 是否排序 | 指定序列的取值是否有序,有序取值场景下,序列的取值性能不如无序。 | + | 是否循环 | 指定序列取值超过指定的 **最大值** 后,是否重新从最小值开始取值。 | + + + +3. 单击 **下一步:确认 SQL** 按钮后,进入SQL创建确认页面。 + + ![数据库对象-新建序列-确认创建](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4729171361/p326072.png) + + +4. 根据您指定的信息会预生成一个 SQL 脚本,检查 SQL 脚本无误后,单击页面右上角的 **创建** 按钮,开始执行脚本并生成序列。 + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md new file mode 100644 index 00000000..7ce8919e --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/5.web-odc-sequence-objects/3.web-odc-manage-sequence.md @@ -0,0 +1,40 @@ +管理序列 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击 **序列** 标签可以查看序列列表。 + +您可以在序列列表中右键目标对象以进行一些 **管理操作** 。或者,在序列列表中双击目标序列名进入 **序列管理页面**。 +![Image 196](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-1.png) + +管理操作 +------------- + +在序列列表中,序列对象名称默认支持按头字符升序排序。 +在序列列表中右键目标对象,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。 + +下述为管理操作键表: + + +| 操作键 | 说明 | +|------|--------------------------------------------------------------------------| +| 新建序列 | 进入新建序列页面,根据步骤创建新的序列对象。 | +| 查看序列 | 进入 **序列管理页面**,全量查看当前序列的基本信息、属性和 DDL 等信息。 | +| 修改 | 进入 **序列管理页面** 的属性部分修改当前序列的信息。 | +| 删除 | 删除当前序列。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载序列对象的 SQL 文件。 | +| 刷新 | 对当前序列对象进行一些管理操作后,刷新列表以展示最新信息。 | + + + +序列管理页面 +--------------- + +您可以在序列管理页面查看以下信息: + +* **基本信息** :展示 **序列名称** 和 **用户名** 等信息。 + +* **属性** :展示属性 **下一个缓冲值** 、 **增量** 、 **最小值** 、 **最大值** 、 **缓存设置** 、 **是否排序** 和 **是否循环** 等信息。其中 **下一个缓冲值** 展示的是序列视图中 `last_number` 的值,该值仅做展示不允许修改。 + +* **DDL** :展示定义序列的脚本。 + ![sequence2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-2.png) diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/1.web-odc-package-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/1.web-odc-package-objects-overview.md new file mode 100644 index 00000000..7e81f13e --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/1.web-odc-package-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +程序包(Package)是由一组相关的函数、过程、变量和游标等 PL 程序设计元素的组合。程序包类似于 Java 中的类,变量类似于类中的成员变量,函数和过程类似 Java 类中的方法。其主要作用是把相同或相似的东西归类,方便维护和管理,提高开发效率,提高性能。 +> **注意**
            +> 连接 V2.2.20 及之后版本的 OceanBase 数据库 Oracle 模式支持创建触发器对象,MySQL 模式暂不支持。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击程序包标签可以查看程序包列表。在程序包列表中双击程序包名进入程序包管理页面,您可以在程序包管理页面查看包头和包体的的基本信息和代码等信息。 + +本章节将分篇介绍以下 ODC 中程序包对象的相关操作: + +* [新建程序包](../../../6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md) + + + +* [管理程序包](../../../6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md new file mode 100644 index 00000000..fa17b19f --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/2.web-odc-create-a-program-package.md @@ -0,0 +1,29 @@ +新建程序包 +========================== + +
            +

            说明

            +

            ODC V3.2.2 及之后版本支持连接 OceanBase 社区版。 因内核功能差异,ODC 程序包功能不支持 OceanBase 社区版 (菜单入口会置灰)。

            +
            + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **程序包** 标签可以查看程序包列表。在程序包列表的右上角,单击 **+** 创建程序包,或是在上方导航栏中单击 **新建** 以创建您需要的对象。新建程序包需要分别创建包头和创建包体。 + +创建包头 +------------- + +在程序包列表单击右上角的 **+** 或是在 ODC 导航栏中单击 **新建** 以进入新建程序包页面指定包头。 + +![程序包对象-新建程序包](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4429171361/p326070.png) + +在新建程序包页面中指定程序包名称后,单击 **下一步:确认 SQL** 按钮进入包头定义页面。 + +如下图所示,ODC 会为您自动生成模板语句,在包头定义页面的导航栏中,ODC 提供了功能键 **格式化** 方便您规范语句格式。完成包头定义语句后单击页面右上角的 **创建** 按钮生成包头: + +![Image 197](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4429171361/p241381.png) + +创建包体 +------------- + +创建包头后,新建的程序包就会出现在程序包列表中,在列表中找到刚刚创建好的程序包,右键目标程序包名,单击 **新建包体** 以进入包体定义页面。如下图所示,和包头定义页面相似,ODC 会为您自动生成模板语句并在导航栏中提供功能键 **格式化** 方便您规范语句格式。完成包体定义语句后单击页面右上角的 **创建** 按钮生成包体: + +![Image 198](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4429171361/p241382.png) diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md new file mode 100644 index 00000000..71358ad2 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/6.web-odc-package-objects/3.web-odc-manage-program-packages.md @@ -0,0 +1,107 @@ +管理程序包 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **程序包** 标签可以查看程序包列表,在程序包列表中展示了当前连接的数据库中存在的程序包对象。 + +您可以在程序包列表中查看该对象的 **结构树** 或右键目标对象以进行一些 **管理操作**。或者,在程序包列表中双击目标程序包名进入程序包管理页面,程序包管理页面提供了 **包头页签** 和 **包体页签**。 + +结构树 +------------------------ + +如下图所示,在程序包列表中单击目标程序包名前的下弹标志会在弹出的下拉列表中展示其结构树,对象程序包的结构树最深有六层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表**: + +![Image 227](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-1.png) + +管理操作 +------------------------- + +在程序包列表中,程序包对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|---------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建程序包。 | +| 筛选 | 单击筛选图标选择显示有效/无效程序包。 | +| 批量编译 | 单击批量编译图标对程序包对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
            ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png) | +| 刷新 | 对当前程序包对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键结构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------| +| 新建程序包 | 进入新建程序包页面,根据步骤创建新的程序包包头。 | +| 新建包体 | 进入包体定义页面以新建包体。 | +| 编辑包头包体 | 同时打开 **包头/包体编辑页面**,您可以在窗口中继续编辑包头和包体。 | +| 删除 | 删除当前程序包。 | +| 刷新 | 对当前程序包对象进行一些管理操作后,刷新结构树以展示最新信息。 | +| 查看 | 进入 **包头页签** 或是 **包体页签** **,** 全量查看当前程序包的基本信息和代码等信息。 | +| 编辑 | 在 **包头/包体编辑页面** 中展示定义包头/包体的语句,您可以在窗口中继续编辑包头/包体。 | +| 编译 | 编译目标程序包。 | +| 调试 | 进入调试页面以对当前程序包进行调试。PL 对象调试仅支持连接 OBServer V2.2.70、V3.0.00 及以后版本。
            **说明**
            ODC V4.0.0 及之后版本,支持设置参数值为 DEFAULT、NULL 或空字符串。
            | +| 运行 | 运行程序包体子程序中的存储过程或函数。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载程序包对象的 SQL 文件。 | +| 删除 | 删除当前程序包包体。 | + + + +包头页签 +------------------------- + +在程序包管理页面,单击导航栏中的 **包头** 标签会展示以下信息: + +* **基本信息** :展示 **程序包名称** 、 **创建人** 、 **创建时间** 和 **最近修改时间** 等程序包信息。 + + + +* **代码** :展示包头的定义代码,还提供了 **编辑** (进入包头编辑页面)和 **查找** 两个功能键。 + + + + + + +包体页签 +------------------------- + +在程序包管理页面,单击导航栏中的 **包体** 标签会展示以下信息: + +* **基本信息** :和包头页签相同,展示 **程序包名称** 、 **创建人** 、 **创建时间** 和 **最近修改时间** 等程序包信息。 + +* **代码** :展示包体的定义代码,还提供了 **编辑** (进入包体编辑页面)和 **查找** 两个功能键。 + + + + +包头/包体编辑页面 +------------------------------ + +![programpackage2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-2.png) + +在程序包列表中右键目标项,在提供的操作键中单击 **编辑** 可进入程序包编辑页面,在编辑页面的代码区会展示该程序包的定义语句, 您可以继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 确认修改 | 单击以更新您本次修改。 | +| 编译 | 编译当前页面中的语句。只有包体编辑页面提供该功能键。 | +| 终止 | 单击该按钮终止正在运行的语句。 | +| 调试 | 进入调试页面以对当前程序包进行调试。PL 对象调试仅支持连接 OBServer V2.2.70、V3.0.00 及以后版本。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/1.web-odc-trigger-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/1.web-odc-trigger-objects-overview.md new file mode 100644 index 00000000..4a9c3f99 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/1.web-odc-trigger-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +触发器(Trigger)是一种特殊类型的存储过程,它不能被显式的调用,而是由事件来触发。所以,触发器用于监视某种情况并触发某种操作。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击触发器标签可以查看触发器列表。单击列表右上角的 **+** 按钮可进入触发器新建页面,在触发器列表中双击触发器名进入触发器管理页面,您可以在触发器管理页面查看触发器的基本信息和代码。 +> **注意**
            +> 连接 V2.2.20 及之后版本的 OceanBase 数据库 Oracle 模式支持创建触发器对象,MySQL 模式暂不支持。 + +本章节将分篇介绍以下 ODC 中触发器对象的相关操作: + +* [新建触发器](../../../6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) + + + +* [管理触发器](../../../6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md new file mode 100644 index 00000000..5c411e59 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md @@ -0,0 +1,119 @@ +新建触发器 +========================== + +
            +

            说明

            +

            ODC V3.2.2 及之后版本支持连接 OceanBase 社区版。 因内核功能差异,ODC 触发器功能不支持 OceanBase 社区版 (菜单入口会置灰)。

            +
            + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **触发器** 标签可以查看触发器列表。在触发器列表的右上角,单击 **+** 创建触发器,或是在上方导航栏中单击 **新建** 以创建您需要的对象。 + +创建触发器需要进行以下 3 步操作: + +1. 指定基本信息。 + + + +2. 设置高级设置信息。 + + + +3. 确认 SQL。 + + + + + + +![Image 228](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9951704161/p242686.png) + +指定基本信息 +--------------------------- + +在新建触发器页面,第一步需要指定基本信息。 **基本信息** 页签中包含以下信息项: + +* **触发器名称** :为触发器指定一个名称。 + + + +* **基准对象模式** :触发器作用的对象所在的 Schema。 + + + +* **基准对象类型** :触发器作用的对象的类型,当前版本只支持 **TABLE** 表对象。 + + + +* **基准对象名称** :触发器作用的对象的名称。 + + + +* **触发器状态** :指定当前触发器为 **启用** 或 **禁用** 。 + + + + + + +设置高级设置信息 +----------------------------- + +指定基本信息后,第二步需要指定一些高级设置信息。 **高级设置** 页签包含以下信息项: + +* **触发器类型** :选择触发器的类型,当前版本只支持创建 **SIMPLE** 简单触发器。 + + + +* **触发** :指定触发时间,即该触发器是在触发事件发生之前( **BEFORE** )或之后( **AFTER** )触发。 + + + +* **级别** :指定触发器的级别。当前版本只支持行级别触发器(Row-level)。 + + + +* **事件** :指定会触发此触发器的操作,支持选择 **INSERT** 、 **UPDATE** 和 **DELETE** 事件。 + + + +* **列(选填)** :指定 **事件** 作用的范围,在 **事件** 中选择 **SELECT** 事件后展示该项。当前版本只支持在表对象中创建行级触发器,所以这里要选择事件作用的列。 + + + +* **引用旧值** **(选填)** :为引用的对象指定一个别名,对应触发器创建语法中 `REFERENCEING OLD` 的值。 + + + +* **引用新值** **(选填)** :为引用的对象指定一个别名,对应触发器创建语法中 `REFERENCEING NEW` 的值。 + + + +* **子句条件** **(选填)** :指定一个逻辑表达式,只有当该表达式的值为 True 时,遇到触发事件才会自动执行触发器指定的操作。 + + + + + + +确认 SQL +--------------------------- + +完成 **基本信息** 和 **高级设置** 页签上所有信息的指定后,单击页面上 **下一步:确认 SQL** 按钮以进入语句编辑页面。 + +在语句编辑页面中会根据 **基本信息** 和 **高级设置** 中指定的信息生成对应的触发器定义语句,您需要补齐语句中触发器触发后需执行的操作,即触发体。补齐触发体语句后,单击页面右上角的 **创建** 按钮,完成触发器的创建。 + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|--------------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| 上一步 | 回到 **新建触** **发器** 页面,您可以继续编辑或修改 **基本信息** 和 **高级设** **置** 页签中的指定的值。 | + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md new file mode 100644 index 00000000..d692f9d4 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md @@ -0,0 +1,80 @@ +管理触发器 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **触发器** 标签可以查看触发器列表。在触发器列表中展示了当前连接的数据库中存在的触发器对象,您可以在触发器列表中右键目标对象以进行一些管理操作。或者,在触发器列表中双击目标触发器名进入触发器管理页面。 + +![Image 200](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-1.png) + +管理操作 +------------------------- + +在触发器列表中,触发器对象名称默认支持按头字符升序排序。 +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建触发器。 | +| 筛选 | 单击筛选图标选择显示有效/无效触发器。 | +| 刷新 | 对当前触发器对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键列表中的目标对象,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|-------|----------------------------------------------------------------------------------| +| 查看触发器 | 进入 **触发器管理页面**,查看当前触发器的基本信息、参数和代码等信息。 | +| 新建触发器 | 进入新建触发器页面,根据引导步骤创建新的触发器。 | +| 编辑 | 在 **触发器编辑页面** 中展示当前触发器的定义语句,您可以在窗口中继续编辑该触发器。 | +| 编译 | 编译当前触发器。 | +| 启用 | 启用当前触发器。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载触发器对象的 SQL 文件。 | +| 禁用 | 禁用当前触发器。 | +| 删除 | 删除当前触发器。 | +| 刷新 | 对当前触发器对象进行一些管理操作后,刷新以展示最新信息。 | + + + +触发器管理页面 +---------------------------- + +在触发器列表中双击目标触发器名进入触发器管理页面,页面中提供以下 3 个页签: + +* **基本信息** :展示触发器的 **名称** 、 **所有者** 和 **是否启用** 等信息。 + +* **基准对象** :展示该触发器基准对象的 **名称** 、 **所有者** 和 **类型** 等信息。 + +* **DDL** :展示定义触发器的脚本,还提供了 **编辑** (进入触发器页面)、 **查找** 和 **刷新** 等功能键。 + + + + + + +触发器编辑页面 +---------------------------- + +[trigger2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-2.png) + +在触发器列表中右键目标项,在提供的操作键中单击 **编辑** 可进入触发器编辑页面,或者在触发器管理页面的 DDL 页签中单击 **编辑** 按钮也可进入触发器编辑页面。在编辑页面的代码区会展示该触发器的定义语句, 您可以继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| 确认修改 | 单击以更新您本次修改。 | + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/1.web-odc-type-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/1.web-odc-type-objects-overview.md new file mode 100644 index 00000000..149e1bec --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/1.web-odc-type-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +在数据库中可以创建自定义的对象类型(Type)。数据库的对象类型和 Java 中的类相似,可以包含属性和方法(函数和存储过程)。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个连接后,在左导航栏中单击类型标签可以查看类型列表。单击列表右上角的 **+** 按钮可进入类型新建页面,在类型列表中双击类型名进入类型管理页面,您可以在类型管理页面查看类型的的基本信息和代码。 +> **注意**
            +> 连接 V2.2.20 及之后版本的 OceanBase 数据库 Oracle 模式支持创建类型对象,MySQL 模式暂不支持。 + +本章节将分篇介绍以下 ODC 中类型对象的相关操作: + +* [新建类型](../../../6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) + + + +* [管理类型](../../../6.web-odc-user-guide/11.web-odc-database-objects/7.web-odc-trigger-objects/3.web-odc-manage-triggers.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/2.web-odc-create-a-type.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/2.web-odc-create-a-type.md new file mode 100644 index 00000000..6ebda5c4 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/2.web-odc-create-a-type.md @@ -0,0 +1,167 @@ +新建类型 +========================= + +
            +

            说明

            +

            ODC V3.2.2 及之后版本支持连接 OceanBase 社区版。 因内核功能差异,ODC 类型功能不支持 OceanBase 社区版 (菜单入口会置灰)。

            +
            + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建类型。本文介绍如何使用 ODC 创建类型。 + +概述 +----------------------- + +数据库类型对象用于指定类型的名称及其属性、方法和其它属性。 + +ODC 类型对象支持创建三种类型:对象类型、数组类型和表类型。 + +* 对象类型:抽象数据类型(Abstract Data Type,ADT),是将数据库对象、数据库对象之间的关系和数据库对象的基本操作封装在一起的一种表达方式。 + + + +* 数组类型:可变数组与嵌套表相似,也是一种集合。一个可变数组是对象的一个集合,其中每个对象都具有相同的数据类型。可变数组的大小由创建时决定。允许表的列的数据类型是可变长度的多维数组。数组的类型可以是任何基本类型、枚举类型、复合类型或用户自定义类型。 + + + +* 表类型:独立嵌套表类型,用创建的数组直接定义到表的列上。 + + +![新建类型](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%A6%82%E8%BF%B0.png) + + +如上图所示,创建类型包含以下 4 个步骤: + +1. 指定类型名称。 +2. 选择类型对象。 +3. 编辑语句。 +4. 完成新建类型。 + +操作步骤 +------------------------- + +以在 ODC 中创建对象类型(ob_var)为例,类型中包含 var 和 var1 两个 varchar 类型的参数。具体操作步骤如下: + +### 步骤 1:指定类型名称 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **类型** 标签可以查看类型列表。在类型列表的右上角,单击 **+** 创建类型,或在顶部导航栏中单击 **新建** 以创建所需对象。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A41.png) + +### 步骤 2:选择新建的类型对象 + + + +| 类型 | 说明 | 示例 | +|------|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| 对象类型 | 抽象数据类型(ADT)。
            **说明**
            只有对象类型包含子程序。 | ``` CREATE OR REPLACE TYPE ob_var AS OBJECT( var varchar2(10), var1 varchar(10) ); ``` | +| 数组类型 | 独立可变数组(varray)类型。 | ``` CREATE OR REPLACE TYPE test AS VARRAY(20) of varchar2(20); ``` | +| 表类型 | 独立嵌套表类型。 | ``` CREATE OR REPLACE TYPE test AS TABLE OF varchar2(100 BYTE); ``` 通过 `AS TABLE OF` 创建一个数组 list\。 | + + + +### 步骤 3:编辑语句 + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A43.png) + +指定上述信息后,单击 **下一步** 按钮,进入语句编辑页面,在语句编辑页面中会根据在 **新建类型** 弹窗中指定的信息生成对应的类型定义语句,用户需要根据需求补齐语句。补齐语句后,单击页面右上角的 **创建** 按钮,完成类型的创建。 + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,为脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,为脚本中选中的语句转换为注释或转换为 SQL 语句。 | + + + +### 步骤 4:完成新建类型 + +单击 **创建** ,完成新建类型后,类型通常用于 PL 语句中,使用关键字 `INSERT` 调用用户自定义的类型。 + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A44.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击类型列表中的类型名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **下载** 、 **删除** 和 **刷新** ),可快速管理和操作目标对象。 +> 类型具体操作,请参见 [管理类型](../8.web-odc-type-objects/3.web-odc-manage-types.md)。 + +示例: + +```sql +-- 创建表 +create table data_type (id number(10),name varchar2(50),age int,address varchar2(50),salary float); + +-- 插入表数据 +insert into data_type values(1,'baba',20,'hangzhou',3000.00); + +-- 新建类型 +create or replace type ob_var as object( + var varchar2(10), + var1 varchar(10) +); + +delimiter / +-- 新建存储过程 +create or replace procedure p_datatype is +begin + declare + rec data_type%rowtype; + v_age rec.age%type; + var varchar2(50); + v_name var%type; + v_salary data_type.salary%type; + +-- 自定义类型 + type salary is table of number index by varchar2(20); + arr salary; + v_arr arr%type; + + CURSOR c2 IS SELECT name, age FROM data_type; + c_row c2%rowtype; + v_rec c_row%type; + + ob ob_var; + v_obj ob%type; + + begin + v_name := 'ali '; + v_age := 30; + v_salary := 2000; + dbms_output.put_line('被引用项:变量,记录,表列名称:' || v_name || ' * ' || v_age || ' * ' || v_salary); + + v_arr('James') := 78000; + dbms_output.put_line('被引用项:集合变量的名称:' || v_arr.FIRST); + + open c2; + fetch c2 into v_rec; + dbms_output.put_line('被引用项:游标变量名称:' || v_rec.name || ' * ' || v_rec.age); + close c2; + + v_obj:=ob_var('test','object'); + dbms_output.put_line('被引用项:对象实例的名称:' || v_obj.var || ' * ' || v_obj.var1); + end; +end; +/ + +begin + p_datatype; +end; +/ +``` + +相关信息 +------------------------- + +* [新建表](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [新建视图](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [新建函数](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [新建存储过程](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [新建序列](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [新建程序包](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [新建触发器](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [新建同义词](../9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/3.web-odc-manage-type.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/3.web-odc-manage-type.md new file mode 100644 index 00000000..caec313b --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/8.web-odc-type-objects/3.web-odc-manage-type.md @@ -0,0 +1,59 @@ +管理类型 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **类型** 标签可以查看类型列表。在类型列表中展示了当前连接的数据库中存在的类型对象,您可以在类型列表中右键目标对象以进行一些管理操作。或者,在类型列表中双击目标类型名进入类型管理页面。 + +结构树 +------------------------ + +如下图所示,在类型列表中单击目标类型名前的下弹标志会在弹出的下拉列表中展示其结构树,对象类型的结构树最深有五层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表**: + +![Image 201](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%B1%BB%E5%9E%8B-1.png) + +管理操作 +------------------------- + +在类型列表中,类型对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建类型。 | +| 筛选 | 单击筛选图标选择显示有效/无效类型。 | +| 批量编译 | 单击批量编译图标对类型对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
            ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png)
            **说明**
            类型对象如果支持调试功能,则同时支持批量编译;如果不支持调试功能,则同时不支持批量编译。 | +| 刷新 | 对当前类型对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键结构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + +下述为管理操作键表: + + +| 操作键 | 说明 | +|------|-------------------------------------------------------------------------------------------------| +| 查看类型 | 进入 **类型管理页面**,查看当前类型的基本信息和代码。 | +| 新建类型 | 进入新建类型页面,根据引导步骤创建新的类型。 | +| 编辑主体 | 若类型中包含子程序,该项可用。单击后在 **类型编辑页面** 中展示当前类型的定义语句,您可以在窗口中继续编辑该类型。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载类型对象的 SQL 文件。 | +| 删除 | 删除当前类型。 | +| 刷新 | 对当前类型对象进行一些管理操作后,刷新以展示最新信息。 | + + +类型管理页面 +--------------------------- + +![type2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%B1%BB%E5%9E%8B-2.png) + +在类型列表中双击目标类型名进入类型管理页面,页面中提供以下 2 个页签: + +* **基本信息** :展示类型的 **名称** 、 **所有者** 、 **类型** 、 **创建时间** 和 **修改时间** 等信息。 + +* **DDL** :展示定义类型的脚本,还提供了 **下载**、**查找**、**刷新** 和 **格式化** 等功能键。 \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/1.web-odc-synonym-objects-overview.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/1.web-odc-synonym-objects-overview.md new file mode 100644 index 00000000..d186c07d --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/1.web-odc-synonym-objects-overview.md @@ -0,0 +1,29 @@ +概述 +======================= + +同义词(synonyms)是数据库对象的一个别名,经常用于简化对象访问和提高对象访问的安全性。与视图类似,同义词并不占用实际存储空间,只有在数据字典中保存了同义词的定义。同义词有两种类型,分别是公用同义词和普通同义词。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个连接后,在左导航栏中单击同义词标签可以查看同义词列表。单击列表右上角的 **+** 按钮可进入同义词新建页面,在同义词列表中双击同义词名进入同义词管理页面,您可以在同义词管理页面查看同义词的的基本信息和代码。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.2.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V2.2.0 及以上。 | + + + +本章节将分篇介绍以下 ODC 中同义词对象的相关操作: + +* [新建同义词](../../../6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md) + + + +* [管理同义词](../../../6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md) + + + + + diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md new file mode 100644 index 00000000..67b19965 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/2.web-odc-create-a-synonym.md @@ -0,0 +1,146 @@ +新建同义词 +========================== + +
            +

            说明

            +

            ODC V3.2.2 及之后版本支持连接 OceanBase 社区版。 因内核功能差异,ODC 同义词功能不支持 OceanBase 社区版 (菜单入口会置灰)。

            +
            + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建同义词。本文介绍如何使用 ODC 创建同义词。 + +概述 +----------------------- + +同义词是数据库当前用户通过给另外一个用户的对象创建一个别名,然后可以通过对别名进行查询和操作,从而直接操作该数据库对象。 + +同义词类似于视图功能,支持对表进行增删改查。在 Oracle 数据库中的大部分数据库对象,如表、视图、物化视图、序列、函数、存储过程、包、同义词等等,数据库管理员都可以根据实际情况为它们定义同义词。 + +同义词扩展了数据库的使用范围,能够在不同的数据库用户之间实现无缝交互。经常用于简化对象访问和提高对象访问的安全性。 + +### 同义词类型 + +同义词类型包括普通同义词和公用同义词。 + +* 普通同义词:普通用户创建的同义词一般都是私有同义词,普通同义词只能当前用户可以访问,其他用户仅在授权后才可访问,当前用户具有创建同义词权限。 + + + +* 公用同义词:一般由具有 DBA 角色(如:system)的用户创建,所有用户都可以访问。 + + + +具体请参考 [OceanBase 数据库](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.2/synonyms)。 + +![新建同义词](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%A6%82%E8%BF%B0.png) + +如上图所示,创建同义词包含以下 8 个步骤: + +1. 指定同义词名称。 +2. 指定对象所有者。 +3. 指定对象类型。 +4. 指定对象名称。 +5. 指定同义词类型。 +6. 确定新建同义词信息。 +7. 编辑同义词信息。 +8. 完成新建同义词。 + +操作步骤 +------------------------- + +以在 ODC 中创建员工表同义词(syn_employee)为例,对 SYS 数据库中的 employee 表创建同义词 syn_employee。具体操作步骤如下: + +### 步骤 1:指定同义词名称 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **同义词** 标签可以查看同义词列表,同义词列表按类型分为普通同义词列表和公用同义词列表。在同义词列表的右上角,单击 **+** 创建同义词,或是在 ODC 上方导航栏中单击 **新建** \> **同义词** 以创建所需对象。 + +在 **新建同义词** 中,指定同义词名称。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-1.png) + +### 步骤 2:指定对象所有者 + +指定所属 Schema。 + +### 步骤 3:指定对象类型 + +指定对象类型:表或者视图。 + +### 步骤 4:指定对象名称 + +指定所创建同义词对应的对象名称。 + +### 步骤 5:指定同义词类型 + +指定同义词类型:普通同义词或者公用同义词。 + +### 步骤 6:确定新建同义词 + +单击 **下一步:确定 SQL** ,进入 SQL 创建确认页面。 + +### 步骤 7:编辑同义词 + +![7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%AD%A5%E9%AA%A47.png) + +在 SQL 创建确认页面,编辑同义词语句。 + +在语句编辑页面中会根据在 **新建同义词** 弹窗中指定的信息生成对应的同义词定义语句,用户需要直接修改语句。确认语句后,单击页面右上角的 **创建** 按钮,完成同义词的创建。同义词创建后不支持修改。 + +用户可以在 SQL 创建确认页面编辑创建的同义词语句。语法格式如下: + +```sql +CREATE OR REPLACE SYNONYM syn_name FOR schema_name.object_name; +``` + + + +参数说明: + + +| 参数 | 说明 | +|-------------|----------------------------------------------------| +| OR REPLACE | 创建同义词时,如同义词存在则更新。 | +| syn_name | 同义词的名称。 普通同义词名称在某个 Schema 下必须是唯一的。 | +| schema_name | 指定对象所属的数据库 Schema。 | +| object_name | 指定对象名称。 | + + + +### 步骤 8:完成新建同义词 + +单击 **创建** ,完成新建同义词后,可以如同调用系统内置同义词一样使用。 + +![8.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%AD%A5%E9%AA%A48.1.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击类型列表中的类型名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **删除** 、 **下载** 和 **刷新** ),可快速管理和操作目标对象。 +> 类型具体操作,请参见 [管理同义词](../9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md)。 + +语法格式: + +```sql +SELECT * FROM syn_name ([syn_parameter[,...]) +``` + + + +示例: + +```sql +SELECT * FROM syn_employee; +``` + + + +![8.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%AD%A5%E9%AA%A48.2.png) + +相关信息 +------------------------- + +* [新建表](../1.web-odc-table-objects/2.web-odc-create-a-table.md) +* [新建视图](../2.web-odc-view-objects/2.web-odc-create-a-view.md) +* [新建函数](../3.web-odc-function-objects/2.web-odc-create-a-function.md) +* [新建存储过程](../4.web-odc-stored-procedure-objects/2.web-odc-create-a-stored-procedure.md) +* [新建序列](../5.web-odc-sequence-objects/2.web-odc-create-a-sequence.md) +* [新建程序包](../6.web-odc-package-objects/2.web-odc-create-a-program-package.md) +* [新建触发器](../7.web-odc-trigger-objects/2.web-odc-create-a-trigger.md) +* [新建类型](../8.web-odc-type-objects/2.web-odc-create-a-type.md) diff --git a/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md new file mode 100644 index 00000000..f284c316 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/11.web-odc-database-objects/9.web-odc-synonym-objects/3.web-odc-manage-synonyms.md @@ -0,0 +1,37 @@ +管理同义词 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **同义词** 标签可以查看同义词列表,同义词列表按类型分为普通同义词列表和公用同义词列表。在同义词列表中展示了当前连接的数据库中存在的同义词对象,您可以在同义词列表中右键目标对象以进行一些管理操作。或者,在列表中双击目标同义词名进入同义词管理页面。 + + +管理操作 +------------------------- + +![同义词对象-同义词列表-右键操作](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%90%8C%E4%B9%89%E8%AF%8D-1.png) + +在同义词列表中,同义词对象名称默认支持按头字符升序排序。 + +右键列表中的目标对象,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|-------|---------------------------------------------------------------------------| +| 查看同义词 | 进入 **同义词管理页面**,查看当前同义词的基本信息和代码。 | +| 新建同义词 | 进入 **新建同义词** 页面,根据引导步骤创建新的同义词。 | +| 删除 | 删除当前同义词。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载同义词对象的 SQL 文件。 | +| 刷新 | 对当前同义词对象进行一些管理操作后,刷新以展示最新信息。 | + + + +同义词管理页面 +---------------------------- + +![synonym2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%90%8C%E4%B9%89%E8%AF%8D-2.png) + +在同义词列表中双击目标同义词名进入同义词管理页面,页面中提供以下 2 个页签: + +* **基本信息** :展示同义词的 **名称** 、 **对象所有者** 、 **对象名称** 、 **创建时间** 和 **修改时间** 等信息。 + +* **DDL** :展示定义同义词的脚本。同义词创建后不支持修改,可以 **下载** 和 **格式化** 脚本。 \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/12.web-odc-help-center.md b/zh-CN/6.web-odc-user-guide/12.web-odc-help-center.md new file mode 100644 index 00000000..956f0de5 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/12.web-odc-help-center.md @@ -0,0 +1,65 @@ +帮助中心 +========================= + + + +概述 +----------------------- + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页的顶部导航栏中,通过 **帮助** ,可查看 **新功能介绍** 和 **浏览帮助文档** 并在 **关于开发者中心** 和 **意见反馈** 页签获取产品信息与服务邮箱。 + +![Image 909](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6083197361/p313332.png) + +产品功能介绍 +--------------------------- + +首次访问 ODC 时,会自动弹出 **产品** **功能介绍** 弹窗,弹窗内容包括当前版本的特性和核心功能以快速了解 ODC。 + +关闭弹窗后,可单击 **帮助** 下拉列表中的 **产品** **功能介绍** 标签再次打开弹窗。 +**说明** + + + +同一版本内不同权限的用户查看产品功能介绍时,弹窗内的内容可能会有所不同。 + +浏览帮助文档 +--------------------------- + +在 **帮助** 下拉列表中,单击 **浏览帮助文档** 标签: + +* Web 版 ODC:在浏览器的新页签中展示对应版本的 HTML 格式文档; + + + +* 客户端版 ODC:弹出文档浏览窗。 + + + + + + +如需查看最新或历史版本的产品文档,请至 **[OceanBase 文档中心](https://www.oceanbase.com/docs/enterprise/oceanbase-developer-center/odc/V3.3.1/product-updates)** 浏览。 + +关于开发者中心 +---------------------------- + +在 **帮助** 下拉列表中,单击 **关于开发者中心** 标签,在弹出的窗口中可获得产品名称、版本号、发版日期、官网地址和版权等信息。 + +![Image 910](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0897962561/p313341.png) + +意见反馈 +------------------------- + +在 **帮助** 下拉列表中,单击 **意见反馈** 标签: + +* Web 版 ODC:获取 ODC 的支持邮箱(odcsupport@service.alipay.com),通过邮箱可与联系 ODC 技术支持并反馈意见。 + + + +* 客户端版 ODC:获取 ODC 的支持邮箱并提供一键下载反馈包功能(在弹窗中单击 **Generate information package** ,ODC 则会将前后端日志和系统环境等信息打包至反馈包中)。 + + ![Image 911](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9754197361/p313345.png) + + + + diff --git a/zh-CN/6.web-odc-user-guide/2.web-odc-homepage.md b/zh-CN/6.web-odc-user-guide/2.web-odc-homepage.md new file mode 100644 index 00000000..752ec210 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/2.web-odc-homepage.md @@ -0,0 +1,115 @@ +# ODC 首页 + +## 概述 + +登录 OceanBase 开发者中心(OceanBase Developer Center,ODC)后,进入 ODC 首页。 + +在 ODC 首页可查看历史会话、[任务](../6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md)、[操作记录](../6.web-odc-user-guide/8.web-odc-view-operation-records.md) 和 [帮助](../6.web-odc-user-guide/12.web-odc-help-center.md),并进行数据库连接管理、语言切换、个人设置、修改账户密码和退出登录等操作。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/1.png) + +## 数据库连接管理 + +首页中可查看 **全部连接**、**个人连接** 和 **公共连接** 页签,页签中以列表的形式展示所创建的个人连接和被授予访问的公共连接信息。 + +* 全部连接:全部连接页签中,可[新建个人连接](3.web-odc-connect-database/1.web-odc-create-private-connection.md)、[申请公共连接权限](9.web-odc-task-management/8.web-odc-apply-for-permissions-task.md)、搜索、筛选、排序和刷新连接。 + +* 个人连接:个人连接页签中,可[新建个人连接](3.web-odc-connect-database/1.web-odc-create-private-connection.md)、[申请公共连接权限](9.web-odc-task-management/8.web-odc-apply-for-permissions-task.md)、搜索、筛选、排序和刷新连接。更多详情,请参见 [管理个人连接](3.web-odc-connect-database/2.web-odc-manage-connections.md)。 + + + +* 公共连接:公共连接页签中,,可[新建个人连接](3.web-odc-connect-database/1.web-odc-create-private-connection.md)、[申请公共连接权限](9.web-odc-task-management/8.web-odc-apply-for-permissions-task.md)、搜索、筛选、排序和刷新连接。更多详情,请参见 [公共连接管理](4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md)。 + + +## 查看历史会话 + +在 ODC 首页的 **历史** 页签中可查看历史打开窗口。 + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/history-3.png) + +面板显示如下信息: + + +| 信息项 |说明| +|-----------|----------------------------------------------------| +| 连接名 | 显示已访问的连接名称。 | +| 库名/Schema | 显示访问连接后,进入的数据库或 Schema 名称。 | +| 最近打开时间 | 最近一次访问该连接的时间。 | +| SQL/PL 窗口 | 显示此次访问创建的工作台窗口,将数据放置在对应窗口名上,将显示在窗口中编辑过的脚本。 | +| 操作 | 提供 **打开** 操作键,单击该按钮在新窗口中恢复当前连接,同时恢复对应的工作台窗口和其中的内容。 | + + +> **说明** +> 面板中的历史记录信息默认保存 48 个小时,您可通过该入口快速恢复未保存的 SQL 窗口的内容。 + +## 任务管理 + +在 ODC 首页的 **任务** 页签中可新建和查看任务。更多详情,请参见 [任务管理](9.web-odc-task-management/1.web-odc-task-management-overview.md)。 + +公共资源管控台 +---------------------------- + +作为企业数据库开发平台,ODC 提供公共资源管控台的服务,方便 ODC 管理员进行用户的管理与权限和资源的分配。 +> **注意** +> 仅被授予管理员角色的 ODC 用户可在 ODC 首页查看 **公共资源管控台** 页签,非管理员用户首页不显示此页签。 + +在 ODC 首页单击 **管控台** 页签,进入公共资源管理页面。 + +管控台中提供用户管理、角色管理、公共连接管理、资源组管理、自动授权规则管理、任务流程、脱敏规则管理和系统设置等服务。 + +其中用户需通过角色授予公共资源和个人资源权限。同时使用资源组可以批量授予或回收一批公共连接的权限。详情请参见 [公共资源管理](4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md)。 + +主题切换 +------------------------- + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/theme-4.png) + +在 ODC 首页的左下角单击 **我的** > **主题**,支持切换应用模式为 **默认主题** 或者 **暗黑主题**。 + +语言切换 +------------------------- + +在 ODC 登录页面和 ODC 首页的左下角单击 **我的** > **语言** 会显示应用的显示语言,默认为 **简体中文** ,单击该标签可切换应用的显示语言。目前 ODC 支持 **English** (英文)、 **简体中文** 和 **繁体中文** 等三种显示语言。 + +个人设置 +------------------------- + + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/ODC%20homepage/setting-5.png) + +ODC 首页顶部导航栏的左下角单击 **我的** > **偏好设置** 弹出 **编辑个人设置** 面板。 + +在面板中可全局统一修改支持自定义的功能设置。同时可在每个连接中分别对这些功能进行独立设置,独立设置仅对当前连接生效。个人设置的优先级低于每个连接中的独立设置且持久保存。 + + +面板中支持进行以下全局设置: + + +| 设置 | 说明 | +|-------------------|----------------------------------------------------------------------------------------------------| +| SQL 窗口 Session 模式 | 设置 SQL 窗口的 Session 模式。 | +| 界定符设置 | 设置在 SQL 窗口内运行 PL 语句时默认使用的 Delimiter 符号。目前支持设置 **;** 、 **/** 、 **//** 、 **$** 和 **$$** 等 5 种形式的界定符。 | +| Oracle 事务提交模式 | 设置 Oracle 模式下事务的默认提交模式。可设置事务手动提交或自动提交。 | +| MySQL 事务提交模式 | 设置 MySQL 模式下事务的默认提交模式。可设置事务手动提交或自动提交。| +| 结果集查询条数限制 | 设置 SQL 窗口内执行 SQL 语句默认返回的结果行数。| +| 对象拖放生成语句类型 | 设置拖放表/视图对象时默认生成的语句类型。 | + + + +修改密码 +------------------------- + +在 ODC 首页的左下角单击 **我的** > **修改密码** 会弹出 **修改密码** 弹窗,具体操作请参见 [修改密码](1.log-on-to-odc/2.change-password.md)。 + +退出登录 +------------------------- + +在 ODC 首页的左下角单击 **我的** > **退出登录** 将退出首页返回 ODC 登录页面。 + +使用帮助 +------------------------- + +在 ODC 首页左下角的 **帮助** 页签中,可直接查看 ODC 常用操作的教程文档,以及当前版本的新增功能与常见问题等信息。 + +在页签中单击需查看的文档,在弹出的窗口中会展示文档的介绍信息与跳转链接,可选择查看帮助帮助文档。 + diff --git a/zh-CN/6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md b/zh-CN/6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md new file mode 100644 index 00000000..3ea6284c --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/3.web-odc-connect-database/1.web-odc-create-private-connection.md @@ -0,0 +1,63 @@ +# 创建个人连接 + + + +## 背景信息 + +登录 OceanBase 开发者中心(OceanBase Developer Center,ODC)并进入 ODC 首页,可在 **个人连接** 页签的右上角单击 **新建连接** 按钮创建个人连接。 + +创建完成后,再次进入 ODC 时,可在连接列表中查看已保存的数据库连接。 + + +> **注意**
            +>
          • 自 ODC V2.3.0 版本起,导入导出功能需在创建连接的高级配置中设置 root@sys 用户,否则会提示无法使用导入导出功能,因自该版本起,导入导出功能查询视图信息时依赖 root@sys 账号。
          • +>
          • 分区信息查看同样依赖 root@sys 账号,因此如需展示表的分区信息须在创建连接的高级配置中设置 root@sys 用户。
          • +>
          • 自 ODC V3.3.0 版本起,ODC 支持独立 Session 模式和共享 Session 模式。独立 Session 模式下,每个 SQL 窗口对应一个数据库会话,所有的修改只会影响当前窗口;共享 Session 模式下,所有的 SQL 窗口共享同一个数据库会话,任意 SQL 窗口的修改均会影响到其它 SQL 窗口。
          • +>
          • 事务手动提交模式下,需设置 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会终止。同时需注意 `ob_trx_idle_timeout` 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。
          • + + + + + + +## 操作步骤 + +创建个人连接的操作步骤如下所示: + + +1. 进入 ODC 后,在左侧导航栏的 **连接** 页签中单击 **个人连接** > **新建个人连接** 按钮。 + + ![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/private%20connection/1.png) + +2. 在创建连接页签需填写或选择以下信息,如已拥有 OceanBase 数据库连接串,则以下信息均可从连接串中直接获取(mysql -h **主机名** -P **端口号** -u **数据库用户名@租户名** # **集群名** -D **默认数据库** -p ' **数据库密码** ')或直接使用页签中提供的智能解析工具进行填充: + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/private%20connection/2.png) + + + + | 信息项 | 说明 | + |-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 智能解析 | 在文本框中粘贴连接串信息,ODC 会自动识别连接串并在窗口中填充各项连接信息。 | + | 连接类型 | 选择 **MySQL** 或 **Oracle** (逻辑库仅支持 MySQL 模式)。 | + | 连接地址 |
            • **主机 IP** :连接的数据库所在服务器的 IP 信息。
            • **端口** :连接的数据库所在服务器的端口号信息。
            • **集群名** :连接的数据库所在集群的名称(逻辑库无需填写)。
            • **租户名** :连接的数据库所在租户的名称(逻辑库无需填写)。
            **说明**
            主机名和端口号可从连接的数据库所在租户信息页面获取,如在公有云或 OCP 上创建的租户。
            | + | 数据库账号 |
            • 数据库用户名:在租户中创建的账号(MySQL 模式下,该账户必须具有访问默认数据库的权限)。
            • 数据库密码:在租户中创建的账号的密码。单击数据库密码框后的 **测试连接** 按钮,测试是否能够连接到目标数据库。
            • 保存密码:关闭该项,连接信息中将不保存数据库密码信息,每次进入连接或测试连接时,需在弹出的密码弹窗中输入数据库密码以进入连接;开启该项,连接信息将保存数据库密码信息,每次进入连接无需输入数据库密码。
            **说明**
            • 如配置信息有误,会出现异常提示,例如用户或密码不对、网络异常等。
            • 用户只可连接本租户下的数据库,否则会报出测试失败的错误。
            • ODC V4.0.0 及之后版本支持不填账号密码即可保存连接。
            | + | 默认数据库/schema(可选) | 连接 MySQL 租户中的数据库时,需填写该连接使用的默认数据库(连接 Oracle 租户时无需填写该项)。
            **说明**
            MySQL 模式下,如不指定默认库,则默认连接 information_schema 库。 如 information_schema 库连接失败,请将默认数据库设置为该用户有权限的库。
            | + | sys 租户账号设置 | 选择是否 **使用 sys 租户账号查询租户视图**,勾选后输入 **账号** 和 **密码**。
            数据库类型为物理库时,请输入拥有查询 sys 租户视图权限的账号和密码,当 **连接地址** 中已指定 **租户** 为 sys 时,该项被自动填充。
            • **账户** :拥有 sys 租户视图查看权限的账号。
            • **密码** :账号对应的密码。
            输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。
            **说明**
            • 自 ODC V2.3.0 之后版本,导入导出功能需在创建连接的高级配置中设置 root@sys 用户。
            • 自 ODC V2.4.1 之后版本,导入导出功能查询视图信息时取消 root@sys 账号强依赖(如未配置 root@sys 账号,ODC 部分对象如存储过程和函数等不支持导出功能;如配置 root@sys 账号,通过访问 sys 租户下的视图信息得到最优的数据路由策略,可提升导出速度)。
            • **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入“@sys#集群”)。例如:账号为 root。
            | + |启用 SSL|选择是否启用 SSL 加密 SSL 链路,以保证客户端和服务器之间数据的安全传输。
            **说明**
            • 通过非加密方式(require none)创建的用户(默认为 require none)可根据需求选择是否开启 SSL。如果勾选 **启用 SSL**,则会创建一个 SSL 连接;如不勾选,则创建的为普通连接。
            • 通过 SSL 连接方式(require ssl)创建的用户勾选 **启用 SSL** 后,即可创建 SSL 连接;如不勾选,则会连接失败。
              通过 require ssl 创建的用户可不上传证书但必须勾选 **启用 SSL**,否则连接失败。推荐上传证书以验证通信双方身份(非必须):
              • 上传 CA 证书,客户端会校验服务端的身份;
              • 上传客户端密钥和客户端证书,服务端会校验客户端的身份。
            • 通过 x509 加密方式(require x509)创建的用户必须 **启用 SSL** 且上传 CA 证书以及客户端密钥和客户端证书,客户端和服务端会校验对方身份;不勾选 **启用 SSL** 或不上传证书均无法成功创建连接。
            通过 ODC 启用 SSL 前,须确认 OBServer 端已开启 SSL;如通过 OBProxy 连接,同样需保证 OBProxy 已开启 SSL。如何在 Server 端开启 SSL,请参见 [OBServer 传输加密](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000944716) 和 [公有云 OceanBase SSL 链路加密](https://help.aliyun.com/document_detail/254643.html)。
            | + + +3. 指定上述信息后,单击面板右下角的 **保存** 按钮,在的弹窗中输入连接名后,单击 **确定** 按钮,即可将当前的配置信息持久保存在 ODC 连接列表中。再次登录 ODC 时,可在连接配置列表中直接选择该连接,保存连接配置时不要求测试连接一定成功。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/private%20connection/3.png) + + > **说明** + > + > 保存前,可以单击 **测试连接** 进行数据库连接测试,如果数据库用户名和密码正确,则会提示 **连接成功**。 + + + +4. 在页签下方,ODC 同时提供 **复制连接串** 按钮。单击该按钮,ODC 会将当前编辑的连接信息复制为连接串格式以方便获取当前配置的连接信息。 + + + +5. 如无需保存当前的连接配置,可单击页签下方的 **取消** 按钮,ODC 会弹出弹窗以确认是否退出当前新建连接窗口。 \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md b/zh-CN/6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md new file mode 100644 index 00000000..65c882f7 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/3.web-odc-connect-database/2.web-odc-manage-connections.md @@ -0,0 +1,144 @@ +管理个人连接 +=========================== + + + +概述 +----------------------- + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页中,可查看所创建的 **个人连接** 信息和被授权访问的 **公共连接** 信息。连接信息以列表的形式显示以供查看和管理所有连接信息。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/private%20connection/1.png) + +查看个人连接信息 +----------------------------- + +个人连接连接信息以列表的形式进行显示: + + + +* 通过列表上方的搜索图标![search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg)查找目标连接。 + +* 通过![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg)按照类型、权限和标签筛选连接。按钮通过刷新按钮可刷新列表信息。 + +* 通过![sort](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%8E%92%E5%BA%8F.png)排序连接。 + +* 通过![update](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%B7%E6%96%B0.jpg)刷新列表信息。 + +* 支持调整连接列表的列宽。 + + +个人连接列表中直接显示了以下连接信息: + + +| 信息项 | 说明 | +|------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 连接名 | 显示连接的名称、属性、类型、集群/租户、主机名/端口号和数据库用户名信息,单击连接名称可进入数据库连接。 其中连接名称前会通过图标显示该连接的状态,蓝色图标表示有效连接,红色图标表示失效连接,灰色图标表示连接未保存数据库密码信息。 | +| 集群 | 显示并筛选集群信息。 单击筛选图标,可筛选所属集群信息(勾选 **空** ,可筛选出无所属集群的连接) | +| 租户 | 显示并筛选租户信息。 单击筛选图标![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属租户信息(勾选 **空** ,可筛选出无所属租户的连接)。 | +|主机:端口|显示主机:端口号。| +|置顶|单击![upper](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E9%A1%B6%E7%BD%AE.png),置顶/取消置顶连接。
            连接列表默认按对连接的创建时间进行排序,最新创建的连接显示在列表最上方。列表无法进行自定义排序,但可将常用的连接进行置顶。| +| 标签 | 单击![label](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%A0%87%E7%AD%BE.png)自定义标签内容并将标签指派给目标连接,每个连接只能设置一个标签。| +| 操作 | 单击更多图标,显示 **编辑** 、 **复制** 和 **移除** 功能键以及更新时间。| + +设置标签 +------------------------- + +ODC 支持自定义标签并将标签指派给目标连接,每个连接只能设置一个标签。可也可在连接创建完成后在连接列表中将鼠标放置在目标连接的标签项上,单击浮现的 **设置标签** 按钮,在弹出的下拉列表中进行新建标签、设置标签和管理标签的操作。 + +* 新建标签:通过两种方式新建标签 + + * 新建连接面板新建:新建连接时,在 **新建连接** 面板单击 **连接名称** 文本框后的 **设置标签** 按钮进行设置。 + + * 连接列表中新建:将鼠标放置在目标连接的标签项上,单击浮现的 **设置标签** 按钮,在弹出的下拉列表中,单击 **新建标签** 按钮。在弹出的 **标签管理** 页面中指定标签的名称和颜色,完成指定后单击对勾图表完成新建。 + +* 设置标签:弹出的下拉列表会显示您所有创建过的标签,在下拉列表中选择目标标签完成设置。 + +* 管理标签:在弹出的下拉列表中,单击右上角的设置图标弹出 **标签管理** 窗口。在标签管理窗口可对创建好的标签进行编辑和删除操作。 + + + + + + + + + +置顶个人连接 +--------------------------- + +连接列表默认按对连接的创建时间进行排序,最新创建的连接显示在列表最上方。列表无法进行自定义排序,但可将常用的连接进行置顶。 + +在列表中找到目标连接,单击连接名称后的旗标![首页-顶置连接名](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5289084361/p342106.png)可将连接置顶,置顶后旗标将被点亮为黄色,再次单击旗标取消置顶。 + +编辑个人连接 +--------------------------- + +单击目标连接 **操作** 项下的 **编辑** 按钮弹出 **编辑连接** 面板,面板与 **新建连接** 面板的结构相同并显示当前连接的配置信息。可在 **编辑连接** 面板中直接对显示的信息进行修改。 + +修改 **数据库密码** 时,需先单击密码框后的 **修改密码** 按钮,密码才可被修改。修改过程中如想放弃本次修改,则继续单击密码框后的 **取消修改** 按钮,密码框的内容就会被重置回修改前的状态。 + +复制个人连接 +--------------------------- + +单击目标连接 **操作** 项下的 **复制** 按钮会弹出 **新建连接** 面板,且面板中会自动填充当前连接的配置信息,旨在已有的信息基础上,简单修改连接信息以快速新建连接。 + +使用复制功能可有助于快捷创建类似连接信息的数据库连接。 + +删除个人连接 +--------------------------- + +单击目标连接 **操作** 项下的 **删除** 按钮以删除当前的连接配置。 + +例如连接的数据库已不存在或后续不再继续访问该数据库时,可直接删除当前的连接配置。 + +其它操作 +------------------------- + +* 除 **个人连接** 页签中提供的上述管理操作,在进入数据库连接后,工作台顶部导航栏的主页菜单![主页菜单](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352089.jpg)按钮同时会提供以下与连接相关的操作: + + * **新窗口打开连接** :在弹出的连接列表中单击需进入的连接,ODC 会生成一个新窗口并进入目标连接。 + + + + * **连接管理** :生成新窗口并进入 ODC 首页以查看和管理所有的连接配置信息。 + + + + * **重新加载** :重新加载当前页面。 + + + + * **退出连接** :退出当前连接并跳转至 ODC 首页。 + + + + + + + ![Image 031](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8906118461/p232235.png) + +* 浏览器 Tab 名称包含`@{数据库名称}`信息。 + ![Image 032](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/web%20%E4%B8%AA%E4%BA%BA%E8%BF%9E%E6%8E%A5%E7%AE%A1%E7%90%86-%40%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%8D.png) + +* 在工作台顶部导航栏的左上方,会显示连接名称和 Schema(Oracle 模式)或数据库名称(MySQL 模式)等信息。 + + * 将鼠标放置在上方导航栏的连接名称上,弹出的信息框会显示 **连接模式** 、 **主机名/端口** 、 **集群/租户** 和 **数据库用户名** 等信息。 + ![管理个人连接-其它操作](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4986712561/p358120.png) + + + + * 单击显示 Schema 名称或数据库名称的下拉弹窗,在弹出的列表中会显示当前数据库用户可进入的 Schema 或数据库,在列表中单击 Schema 或数据库的名称,可切换至目标 Schema 或数据库中。 + ![管理个人连接-连接内切换连接名](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2799808461/p413596.png) + + + + + + +相关信息 +------------------------- + +在 ODC 首页的公共连接页签中,可查看被授权访问的公共连接。 + +关于公共连接的创建与管理,请参见 [公共连接管理](../4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md)。 diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md new file mode 100644 index 00000000..88c064d2 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/1.web-odc-public-resource-overview.md @@ -0,0 +1,53 @@ +概述 +======================= + +作为企业数据库开发平台,OceanBase 开发者中心(OceanBase Developer Center,ODC)提供公共资源管控台的服务方便 ODC 管理员进行用户的管理与权限和资源的分配。 + +被授予管理员角色的 ODC 用户在 ODC 首页右侧可以看到 **公共资源管控台** 页签,非管理员无法看到该页签。管控台中提供公共连接管理、资源组管理和系统设置等服务。 + +被授予管理员角色的 ODC 用户在 ODC 首页右侧可以看到 **公共资源管控台** 页签,非管理员无法看到该页签。管控台中提供用户管理、角色管理、公共连接管理、资源组管理和系统设置等服务。 + +除内置的管理员角色 **system_admin** 外,管理员需首先在角色管理中创建所需角色并为角色分配合适的权限。然后,在用户管理中管理员可以为组织中的用户批量创建新的 ODC 账户并进行角色的分配以实现权限的分配和管控。 + +ODC 用户获得数据库连接信息后可在 ODC 中创建个人连接,个人连接只有用户自己可以访问。在企业的实际应用场景中出于安全考虑并不能分享数据库连接信息给所有用户,管理员可在 ODC 中创建公共连接,创建完成后还可以将多个公共连接组合起来建为资源组,然后您可以将公共连接或资源组授权给指定角色,公共连接将直接分享给所属角色的所有用户,而无需直接分享连接信息给所有用户。 + +在系统设置中,管理员可进行全局的功能设置。 + +本章将分篇介绍公共资源管控台提供的功能: + +* [快速入门](../4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md) + + + +* [用户管理](3.web-odc-public-resource-permission/4.web-odc-manage-users.md) + + + +* [角色管理](3.web-odc-public-resource-permission/3.web-odc-manage-roles.md) + + + +* [公共连接管理](3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md) + + + +* [资源组管理](3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md) + + + +* [任务流程](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + + + +* [操作记录](../4.web-odc-public-resource-management/5.web-odc-operating-records.md) + + +* [数据脱敏管理](../4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md) + +* [系统设置](../4.web-odc-public-resource-management/6.web-odc-system-settings.md) + + + + + + diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md new file mode 100644 index 00000000..4564876c --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/2.web-odc-public-resource-quickstart.md @@ -0,0 +1,55 @@ +快速入门 +========================= + +本文档旨在帮助用户快速了解和使用公共资源管控台。 + +概述 +----------------------- + +通过 ODC 首页的 **公共资源管控台** 页签,可 **立即进入公共** **资源管控台** 页面(默认进入 **快速入门** 页面)。![公共资源管控台-快速入门](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6996078461/p411751.png) + +公共资源管控台功能 +------------------------------ + +ODC 公共资源管控台用于管理用户资源权限,规范配置风险任务流程,保障数据资源的安全管控。 + +* [资源权限管理](3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md):为不同角色的用户分配公共连接、资源组的读写权限,实现数据库资源权限的分配和管控。 + + + +* [任务流程管理](../4.web-odc-public-resource-management/4.web-odc-task-process.md):根据任务类型限制用户发起的变更内容、定制不同的审批流程,达到数据库变更安全的目的。 + + + +* [安全审计管理](../4.web-odc-public-resource-management/5.web-odc-operating-records.md):支持个人设置、密码管理、连接管理和数据库操作等 14 类审计事件类型,确保安全合规,重要事件可追踪,审计报告可下载。 + + + + + + +管理资源权限 +--------------------------- + +1. 添加公共连接资源。 + + 管理员可创建或编辑由多个用户共享的[公共连接资源](3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md)。 + + +2. 设置资源组。 + + 包含多个公共连接,适用于将多个公共连接资源[批量授权](3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md)给角色。 + + +3. 管理角色权限。 + + 为[角色](3.web-odc-public-resource-permission/3.web-odc-manage-roles.md)赋予多个公共连接资源权限和个人资源权限。 + + +4. 创建用户。 + + 设置[用户](3.web-odc-public-resource-permission/4.web-odc-manage-users.md)账号密码,并通过角色授予相关连接资源权限。 + + + + diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md new file mode 100644 index 00000000..0848e3f7 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/1.web-odc-manage-public-connection.md @@ -0,0 +1,100 @@ +# 公共连接管理 + + + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持创建个人连接和公共连接。个人连接是用户获得数据库连接信息后在 ODC 中自己创建的连接,但在企业的实际应用场景中出于安全考虑并不能分享数据库连接信息给所有用户,因此管理员可在 ODC 中创建公共连接,并将公共连接添加到指定资源组,从而用户能够访问资源组下的公共连接。 + +登录 OceanBase 开发者中心(OceanBase Developer Center,ODC)并进入 ODC 首页,可单击 **管控台** 页签进入管控台页面创建公共连接。 + +创建完成后,可在公共连接管理列表中查看已保存的公共连接。 + + + +## 新建公共连接 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20connection/1.png) + +1. 在 **公共连接管理** 页面右上角,单击 **新建公共连接** 按钮,以弹出 **新建公共连接** 面板。 + +2. 在 **新建公共连接** 面板中需指定以下信息以创建新的公共连接。 + + + | 信息项 | 说明 | + |-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 连接名称 | 指定该连接的名称。 | + | 所属资源组 | 单击文本框,在弹出的下拉列表中选择已创建好的资源组,更多关于资源组的详细信息,请参见 [资源组管理](../3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md)。 | + | 连接状态 | 连接状态默认是 **启用** ,可以手动更改为 **停用** 。被停用的连接将不能被访问。 | + | 智能解析 | 在文本框中粘贴连接串信息,ODC 会自动识别连接串并在窗口中填充各项连接信息。 | + | 连接类型 | 选择 **MySQL** 或 **Oracle** (逻辑库仅支持 MySQL 模式)。 | + | 连接地址 |
            • **主机 IP** :连接的数据库所在服务器的 IP 信息。
            • **端口** :连接的数据库所在服务器的端口号信息。
            • **集群名** :连接的数据库所在集群的名称(逻辑库无需填写)。
            • **租户名** :连接的数据库所在租户的名称(逻辑库无需填写)。
            **说明**
            主机名和端口号可从连接的数据库所在租户信息页面获取,如在公有云或 OCP 上创建的租户。
            | + | 读写账号 | 指定拥有数据库读写权限的 **账号** 和 **密码** 信息。指定后,拥有读写权限的 ODC 账户将使用该数据库账号访问数据库。 单击数据库密码框后的 **测试连接** 按钮,测试账户信息是否正确。 | + | 只读账号 | 指定拥有数据库只读权限的 **账号** 和 **密码** 信息。指定后,拥有只读权限的 ODC 账户将使用该数据库账号登录数据库。 单击数据库密码框后的 **测试连接** 按钮,测试账户信息是否正确。 | + | 默认数据库 | 连接 MySQL 租户中的数据库时,需填写该连接使用的默认数据库(连接 Oracle 租户中的数据库时则无需填写该项)。 | + | sys 租户账号设置 | 选择是否 **使用 sys 租户账号查询租户视图**,勾选后输入 **账号** 和 **密码**。
            数据库类型为物理库时,请输入拥有查询 sys 租户视图权限的账号和密码,当 **连接地址** 中已指定 **租户** 为 sys 时,该项被自动填充。
            • **账户** :拥有 sys 租户视图查看权限的账号。
            • **密码** :账号对应的密码。
            输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。
            **说明**
            • 自 ODC V2.3.0 之后版本,导入导出功能需在创建连接的高级配置中设置 root@sys 用户。
            • 自 ODC V2.4.1 之后版本,导入导出功能查询视图信息时取消 root@sys 账号强依赖(如未配置 root@sys 账号,ODC 部分对象如存储过程和函数等不支持导出功能;如配置 root@sys 账号,通过访问 sys 租户下的视图信息得到最优的数据路由策略,可提升导出速度)。
            • **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入“@sys#集群”)。例如:账号为 root。
            | + |启用 SSL|选择是否启用 SSL 加密 SSL 链路,以保证客户端和服务器之间数据的安全传输。
            **说明**
            • 通过非加密方式(require none)创建的用户(默认为 require none)可根据需求选择是否开启 SSL。如果勾选 **启用 SSL**,则会创建一个 SSL 连接;如不勾选,则创建的为普通连接。
            • 通过 SSL 连接方式(require ssl)创建的用户勾选 **启用 SSL** 后,即可创建 SSL 连接;如不勾选,则会连接失败。
              通过 require ssl 创建的用户可不上传证书但必须勾选 **启用 SSL**,否则连接失败。推荐上传证书以验证通信双方身份(非必须):
              • 上传 CA 证书,客户端会校验服务端的身份;
              • 上传客户端密钥和客户端证书,服务端会校验客户端的身份。
            • 通过 x509 加密方式(require x509)创建的用户必须 **启用 SSL** 且上传 CA 证书以及客户端密钥和客户端证书,客户端和服务端会校验对方身份;不勾选 **启用 SSL** 或不上传证书均无法成功创建连接。
            通过 ODC 启用 SSL 前,须确认 OBServer 端已开启 SSL;如通过 OBProxy 连接,同样需保证 OBProxy 已开启 SSL。如何在 Server 端开启 SSL,请参见 [OBServer 传输加密](https://www.oceanbase.com/docs/enterprise-oceanbase-database-cn-10000000000944716) 和 [公有云 OceanBase SSL 链路加密](https://help.aliyun.com/document_detail/254643.html)。
            | + +3. 指定上述信息后,单击面板右下角的 **新建** 按钮完成创建公共连接。 + + > **注意**
            + > 单击 **新建** 按钮,如出现以下情况会弹出风险提示对话框: + >
            • 读写账号不连通。
            • 读写账号权限不足。
            • 只读账号不连通。
            • 只读账号超出权限。
            + + + + +## 管理公共连接 + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20connection/2.png) + +进入 **公共连接管理** 页面后,连接信息以列表的形式进行显示: + +* 通过列表上方的搜索图标![search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg)查找目标连接。 + +* 通过![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg)按照类型、权限和标签筛选连接。按钮通过刷新按钮可刷新列表信息。 + +* 通过![sort](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%8E%92%E5%BA%8F.png)排序连接。 + +* 通过![update](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%B7%E6%96%B0.jpg)刷新列表信息。 + +* 支持调整连接列表的列宽。 + +### 公共连接列表 + +公共连接列表中的基本信息如下所示,且列表中的每一列均提供筛选器以供按列筛选连接。 + + +| 信息项 | 说明 | +|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 连接 ID | 公共连接序号。 单击 **连接 ID** ,可根据 ID 号进行升序或降序。 | +| 连接名 | 显示连接的名称、主机名/端口号信息,单击连接名称可进入数据库连接。 其中连接名称前会通过图标显示该连接的状态:绿色图标表示有效连接;红色图标表示失效连接;灰色图标表示连接未保存数据库密码信息。 单击 **连接名** ,可升序或降序。| +| 集群 | 显示并筛选集群信息。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属集群信息(勾选 **空** ,可筛选出无所属集群的连接)。| +| 租户 | 显示并筛选租户信息。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属租户信息(勾选 **空** ,可筛选出无所属资源组的连接)。 | +| 所属资源组 | 显示并筛选连接所属的资源组的名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属资源组的连接(勾选 **空** ,可筛选出无所属资源组的连接)。 | +| 状态 | 显示当前连接状态( **启用/停用** )。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选状态。 | +| 操作时间 | 显示上一次对公共连接进行 **编辑** 操作的时间,如未对公共连接进行过 **编辑** 操作则显示的时间为公共连接的创建时间。| +| 操作 | 显示 **查看** 、**管理权限**、**编辑**、**复制** 和 **停用/启用** 功能键。
            • 查看:查看当前连接的配置信息。
            • 管理权限:添加/删除可访问连接的用户。
            • 编辑:修改当前连接的配置信息。
            • 复制:根据当前连接的配置信息,快速修改和新建连接。
            • 停用/启用:直接修改连接的状态。
            | + +### 查看公共连接 + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20connection/3.png) + +单击公共连接信息 **操作** 项下的 **查看** 按钮,以弹出 **公共连接信息** 面板。面板中包括 **连接详情**、**相关用户** 和 **相关流程** 三个页签。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 连接详情 |
            • 连接信息:显示 **所属区域**、 **连接模式**、 **连接名称**、 **所属资源组**、 **连接地址**、 **数据库读写用户名**、**数据库只读用户名** 和 **查询 sys 租户账号** 等创建连接时您指定的信息。
            • 操作信息:显示 **创建人** 、 **创建时间** 和 **更新时间** 等信息。
            • 删除用户:单击页签中的 **删除公共连接** 按钮将删除当前连接,删除连接后,被赋予该连接的用户将无法访问当前连接。 | +| 相关用户 | 显示了可访问当前公共连接的用户 **姓名** 、 **角色** 和 **权限** 等信息。
            | +| 相关流程|显示可管理的任务信息。| +| 编辑 | 在 **公共连接信息** 面板中,单击右下角的 **编辑** 按钮可进入 **编辑公共连接** 面板。 | + +### 编辑公共连接 + +1. 单击公共连接信息列表 **操作** 项下的 **编辑** 按钮,以弹出 **编辑公共连接** 面板。 + +2. **编辑公共连接** 面板中会显示在新建公共连接时所指定的所有信息项(其中 **数据库类型** 、 **所属区域** 和 **连接模式** 项在连接被创建后不可修改)。 + +3. 编辑信息完成后,单击 **保存** 按钮。 + diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md new file mode 100644 index 00000000..92d83c3e --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/2.web-odc-manage-resource-groups.md @@ -0,0 +1,109 @@ +资源组管理 +========================== + + + +概述 +----------------------- + +![资源组管理](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3052208461/p341986.png) + +资源组是集合多个公共连接的一种对象,使用资源组可将公共连接按组批量授权给角色。 + +1. 进入 **公共资源管控台** 页面后,在左侧导航栏中单击 **资源权限** ; + + + +2. 在弹出列表中单击 **资源组** 以进入 **资源组管理** 页面。 + + + + + + +新建资源组 +-------------------------- + +![新建资源组](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3052208461/p361028.png) + +1. 在 **资源组管理** 页面的右上角单击 **新建资源组** 按钮,以弹出 **新建资源组** 面板。 + + + +2. 在 **新建资源组** 面板中需指定以下信息以创建新的资源组。 + + + + | 信息项 | 说明 | + |----------|--------------------------------------------------------| + | 资源组名称 | 指定该资源组的名称。 | + | 资源组状态 | 资源组状态默认为 **启用** ,可手动更改为 **停用** 。被停用的资源组将不能被访问。 | + | 公共连接(可选) | 单击 **添加连接** 按钮,在弹出的文本框中选择已创建的公共资源组,以赋予资源组访问此类公共资源组的权限。 | + | 备注(可选) | 为资源组添加备注信息,非必填项。 | + + + +3. 指定上述信息后,单击面板右下角的 **新建** 按钮以完成资源组的创建。 + + + + + + +管理资源组 +-------------------------- + +进入 **资源组管理** 页面后,资源组信息以列表的形式进行显示: + +* 通过刷新按钮可刷新列表信息。 + + + +* 通过列表右上角的搜索栏搜索目标资源组。 + + + + + + +### 资源组列表 + +资源组列表中显示并提供了以下基本信息,且列表中的每一列均提供筛选器以供按列筛选资源组。 + + +| 信息项 | 说明 | +|--------|------------------------------------------------------------------------------------------------------------------------------------------------------| +| 资源组 ID | 资源组序号。 单击 **资源组 ID** ,可根据 ID 号进行升序或降序。 | +| 资源组名称 | 显示资源组的名称信息。 | +| 连接数量 | 显示当前资源组可访问的公共连接的数量。 | +| 状态 | 显示资源组当前状态: **启用** 或 **停用** 。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选状态。 | +| 更新时间 | 显示对资源组进行 **编辑** 的最新历史操作时间。 如首次 **编辑** 资源组,则显示时间为资源组的创建时间。 单击 **更新时间** ,可升序或降序。 | +| 操作 | 显示 **查看** 、 **编辑** 和 **停用/启用** 功能键。 可单击 **停用/启用** 按钮直接修改资源组状态 **。** | + + + +### 查看资源组 + +1. 单击资源组信息 **操作** 栏中的 **查看** 按钮,以弹出 **资源组信息** 面板。面板中包括 **资源组详情** 和 **相关用户** 两个页签。 + + + + | 信息项 | 说明 | + |-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 资源组详情 | - 资源组信息:显示 **资源组名称、备注、公共连接** ( **连接名称** 和 **状态** )等创建资源组时您指定的信息。
            - 操作信息:显示 **创建人、创建时间** 和 **更新时间** 等信息。
            - 删除用户:单击页签中的 **删除资源组** 按钮以删除当前资源组;删除资源组后,被赋予该资源组的用户将无法访问当前资源组。 | + | 相关用户 | 显示可访问当前资源组的用户 **姓名** 、 **角色** 和 **权限** 等信息。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选角色和权限。 | + + + +2. 指定上述信息后,单击面板右下角的 **编辑** 按钮可进入 **编辑资源组** 面板。 + + + + + + +### 编辑资源组 + +单击资源组信息列表 **操作** 栏中的 **编辑** 按钮,以弹出 **编辑资源组** 面板。 + +**编辑资源组** 面板中显示新建资源组时所指定的所有信息项,可修改此类信息项以编辑资源组。 diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/3.web-odc-manage-roles.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/3.web-odc-manage-roles.md new file mode 100644 index 00000000..d1cd2ad5 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/3.web-odc-manage-roles.md @@ -0,0 +1,175 @@ +角色管理 +========================= + +角色是为用户赋予各种权限的一种对象,为多种权限的集合,使用角色可将一组具有相同权限的用户组织在一起。为便于用户赋予并管理其在 OceanBase 开发者中心(OceanBase Developer Center,ODC)所拥有的权限,可自定义角色并将角色赋予用户。 + +进入 **公共资源管控台** 页面后,在左导航栏中单击 **资源权限** \> **角色** ,进入 **角色管理** 页面。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/1.png) + +内置角色 +------------------------- + +ODC 中内置了管理员角色 **system_admin** ,该角色被自动赋予给管理员用户 **admin** ,该角色可进行系统有关的所有操作且默认可访问所有的公共资源和个人资源 *,* 该角色不支持被编辑、删除和停用 *。* + +新建角色 +------------------------- + +在 **角色管理** 页面的右上角单击 **新建角色** 按钮,弹出 **新建角色** 面板。 + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/2.png) + +新建角色的操作步骤如下: + +1. 指定 **角色名称**。 + + 指定新建角色的名称,角色名称为必填项,长度不超过 48 位字符。 + + +2. 指定 **角色状态** 。 + + 新创建的角色默认是 **启用** 状态,您可以手动选择 **停用** ,被停用的角色其权限将不生效。 + + +3. 选择 **权限类型** 。 + + 选择要为当前角色指定的权限类型。 + + 当前 ODC 支持指定 **公共资源权限** 和 **个人资源权限** ,勾选需要设置的权限后,下方会出现 **权限设置** 项 **。** 创建角色时,必须为该角色指定至少一种权限类型并进行设置。 + + +4. 进行 **权限设置** 操作 **。** + + 选择了 **权限类型** 后 **,权限设置** 项下会出现对应类型的设置页签。 + + + | 权限类型 | 功能描述 | + |--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 公共资源权限 | 资源类型:包括连接访问权限、资源管理权限和系统操作权限。
            • 单击第一个文本框,在下拉列表中选择想要添加的资源。
            • 资源名称:根据所选的资源类型,单击第二个文本框,下拉列表中会显示当前系统中已创建的对应资源名称,在列表中选择需授权的资源(支持多选)。
            • 资源权限:单击第三个文本框,在下拉列表中选择您想要授权的公共资源权限。
              公共资源包含 **只读** 和 **读写** 两种权限,关于权限的详细说明,请参见本篇 **权限说明**。 单击 **添加资源** 按钮,可同时为该角色设置多个公共资源权限。
            | + | 资源管理权限 | 支持配置公共连接、资源组、角色和用户的权限。 | + | 系统操作权限 | 支持配置个人连接、任务流程、脱敏规则、操作记录和系统配置的权限。 | + + + +5. 指定 **备注(可选)** 。 + + 在文本框中输入备注信息,非必填项,长度不超过 140 位字符。 + + +6. 完成角色新建。 + + 单击面板右下角的 **新建** 按钮以完成角色的新建。 + + + + + +权限说明 +------------------------- + +当前 ODC 支持设置 **公共资源权限** 和 **个人资源权限** ,公共资源分为 **公共连接** 和 **资源组** 两种,它们的权限范围和对权限的支持说明如下表所示: + + +| 权限范围 | 只读 | 读写 | +|------------------|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| +| SQL 窗口 | 支持 SQL 窗口查询语句 | 支持 SQL 窗口控制语句 支持 SQL 窗口查询语句 支持 SQL 窗口数据变更语句 支持 SQL 窗口结构变更语句 | +| 结果集 | 查看结果集 导出结果集 | 查看结果集 导出结果集 修改结果集 | +| 匿名块窗口 | 支持除写入外的其他操作 | 全部匿名块窗口权限 | +| 命令行窗口 | 支持除写入外的其他操作 | 全部命令行窗口权限 | +| 模拟数据 | 不支持 | 全部模拟数据权限 | +| 异步执行 | 支持除写入外的其他操作 | 全部异步执行权限 | +| 导入导出 | 导出 | 导入 导出 | +| 会话 | 查看会话属性 查看会话列表 | 查看会话属性 修改会话属性 查看会话列表 修改会话列表 | +| 回收站 | 查看回收站 | 查看回收站 修改回收站 | +| 表(非 SQL 语句操作) | 查看表定义 查看表数据 | 查看表定义 查看表数据 修改表定义 修改表数据 新建表 删除表 | +| 视图(非 SQL 语句操作) | 查看视图定义 查看视图数据 | 查看视图定义 查看视图数据 新建视图 删除视图 | +| 函数(非 SQL 语句操作) | 查看函数定义 | 查看函数定义 修改函数定义 运行函数 编译函数 调试函数 新建函数 删除函数 | +| 存储过程(非 SQL 语句操作) | 查看存储过程定义 | 查看存储过程定义 修改存储过程定义 运行存储过程 编译存储过程 调试存储过程 新建存储过程 删除存储过程 | +| 程序包(非 SQL 语句操作) | 查看程序包定义 | 查看程序包定义 修改程序包定义 运行程序包 编译程序包 调试程序包 新建程序包 删除程序包 | +| 触发器(非 SQL 语句操作) | 查看触发器定义 | 查看触发器定义 修改触发器定义 新建触发器 删除触发器 编译触发器 | +| 类型(非 SQL 语句操作) | 查看类型定义 | 查看类型定义 修改类型定义 新建类型 删除类型 编译类型 | +| 同义词(非 SQL 语句操作) | 查看同义词定义 | 查看同义词定义 新建同义词 删除同义词 | +| 序列(非 SQL 语句操作) | 查看序列定义 | 查看序列定义 修改序列定义 新建序列 删除序列 | + + + +管理角色 +------------------------- + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/3.png) + +进入 **角色管理** 页面后,角色信息以列表形式显示: + +* 通过刷新按钮可刷新列表信息。 + + + +* 通过列表右上角的搜索栏搜索角色。 + + + +* 同时,可通过角色管理页面提供的功能键查看和管理已创建的角色。 + + + + + + +### 角色列表 + +角色列表基本信息如下所示,且列表中的每一列均提供筛选器以供按列筛选角色。 + + +| 信息项 | 说明 | +|------|--------------------------------------------------------------------------------| +| 角色名称 | 显示为角色的名称。 | +| 权限类型 | 显示为角色指定了哪些类型的权限。 | +| 状态 | 显示角色状态为 **启用** 或 **停用** 。 | +| 更新时间 | 显示角色信息最近一次被更新的时间。 | +| 操作 | 显示 **查看** 、 **编辑** 和 **停用** / **启用** 功能键。可单击 **停用** / **启用** 按钮直接修改角色的状态 **。** | + + + +### 查看角色 + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/public%20resource/role/4.png) + +1. 单击角色信息 **操作** 栏中的 **查看** 按钮,以弹出 **角色信息** 面板。面板中有 **角色详情** 和 **相关用户** 两个页签。 + + + + | 信息项 | 说明 | + |------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 角色详情 |
            • 创建信息:显示 **角色名称** 、 **权限类型** 和 **备注** 等创建角色时所指定的信息。
            • 操作信息:显示 **创建人** 、 **创建时间** 和 **更新时间** 等信息。
            • 删除角色:单击页签中的 **删除角色** 按钮将删除当前角色,删除角色后无法恢复其相关的数据,且引用该角色的用户权限被同步回收,但不影响用户登录。
            | + | 相关用户 | **相关用户** 页签中显示被授予当前角色的用户列表,列表中会显示用户的 **姓名** 、 **角色** 和 **状态** 等信息。 | + + + +2. 在 **角色信息** 面板中,单击右下角的 **编辑** 按钮会进入 **编辑角色** 面板。 + + + +3. 单击 **复制角色** 按钮会进入 **新建角色** 面板,面板中均会自动填充当前角色的信息。 + + + + + + + + +### 编辑角色 + + +1. 单击角色信息列表 **操作** 栏中的 **编辑** 按钮,以弹出 **编辑角色** 面板。 + + + + | 信息项 | 说明 | + |------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 角色详情 | 操作信息:显示 **角色名称** 、 **角色状态** 、 **权限类型** 、 **权限设置** 和 **备注** 等信息。 | + | 相关用户 | **相关用户** 页签中显示被授予当前角色的用户列表,列表中会显示用户的 **姓名** 、 **角色** 和 **状态** 等信息。
            - 单击 **移除** ,移除当前角色的用户。
            - 在 **添加用户** 文本框中选择新的用户进行角色授权。 | + + + +2. 在 **编辑角色** 面板中,单击右下角的 **保存** 按钮保存编辑。 diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/4.web-odc-manage-users.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/4.web-odc-manage-users.md new file mode 100644 index 00000000..2aa41f64 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/4.web-odc-manage-users.md @@ -0,0 +1,127 @@ +用户管理 +========================= + + + +概述 +----------------------- + +![Image 867](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9942208461/p308934.png) + +可在用户管理页面创建 OceanBase 开发者中心(OceanBase Developer Center,ODC)用户并管理其权限。 + +进入 **公共资源管控台** 页面后,在左导航栏中单击 **资源权限** \> **用户** ,进入 **用户管理** 页面。 + +内置用户 +------------------------- + +ODC 中已内置一个管理员账户 **admin** ,该账户被自动设置为了管理员角色 **system_admin** ,所以该账户可进行系统有关的所有操作且默认可访问所有的公共资源,该账户不支持被编辑、删除和停用。 + +新建用户 +------------------------- + +在 **用户管理** 页面的右上角单击 **新建用户** 按钮以弹出 **新建用户** 面板。 + +![Image 868](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9942208461/p308936.png) + +新建用户的操作步骤如下: + +1. 指定 **用户信息** 。 + + a. 用户信息包含以下三部分的信息: + + * **账号** :指定用于登录 ODC 的账户信息。账号是必填项且不能重复,支持英文、数字、下划线和特殊字符的组合(即:._+@#$%),长度为 4\~48 位字符。 + * **姓名** :指定登录后在 ODC 中用于显示的姓名信息。姓名是必填项,长度不超过 110 位字符。 + * **密码** :指定用于登录 ODC 的密码信息。密码是必填项,其中至少包含 2 位数字、2 位大写字母、2 位小写字母和 2 位特殊字(即:._+@#$%),长度为 8\~32 位字符。单击文本框后的 **随机密码** 按钮 ODC 将为您自动生成一串随机密码。 + + > **说明**
            + > 管理员新建用户或修改用户密码后,用户首次登录时,会提示修改用户密码,以加固密码并预防密码泄露。 + + b. ODC 支持批量创建用户,可单击 **添加用户** 按钮,指定多个用户信息。 + +2. 指定 **账号状态** 。 + + 新创建的账户默认为 **启用** 状态,可手动选择 **停用** ,停用的账户将不能进行登录操作。 + + +3. 为新建用户指定 **角色** 。 + + 角色是选填项,可以为用户赋予多个角色。单击文本框,弹出的下拉列表中会显示组织中已创建的角色,在列表中选择需为当前创建的所有用户赋予的角色。若无已创建的角色,请先至角色管理创建角色。 + + +4. 指定 **备注** 信息(可选)。 + + 在文本框中输入备注信息,非必填项,长度不超过 140 位字符。 + + +5. 提交新建信息。 + + 单击面板右下角的 **新建** 按钮,提交新建信息。 + + +6. 保存用户信息。 + + 新建用户成功后,在弹出的 **用户创建成功** 弹窗中会显示本次新建的所有用户信息。可通过单击弹窗中的 **复制用户信息** 和 **下载用户信息** 按钮将新建的用户信息保存至本地。 + + 在批量创建用户的场景中,此操作有助于快速保存所有新建用户信息。 + + + + + +管理用户 +------------------------- + +进入 **用户管理** 页面后,用户信息以列表的形式进行显示,在列表右上角的搜索栏可直接进行用户搜索。同时,用户管理页面提供的功能键可查看和管理已创建的用户。 + +### 用户列表 + +用户列表中显示并提供基本信息如下所示,且列表中的每一列均提供筛选器以按列筛选用户。 + + +| 信息项 | 说明 | +|------|---------------------------------------------------------------------------------------------------------------------------------------------------| +| 姓名 | 显示为用户执行的姓名信息。 | +| 账号 | 显示为用户指定的账号信息。 | +| 角色 | 显示角色信息。 | +| 状态 | 显示用户状态为 **启用** 或 **停用** 。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选状态。 | +| 更新时间 | 显示用户信息最近一次被更新的时间。 单击 **更新时间** ,可升序或降序。 | +| 登录时间 | 显示用户最近一次登录 ODC 的时间。 单击 **登录时间** ,可升序或降序。 | +| 操作 | 显示 **查看** 、 **编辑** 和 **停用/启用** 功能键。可单击 **停用/启用** 按钮直接修改用户的状态 **。**
            **说明**
            当前登录用户不可编辑和停用自己的账号。 | + + + +### 查看用户 + +![公共资源管控台-用户管理-查看](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7112812561/p421887.png) + +单击用户信息 **操作** 项下的 **查看** 按钮,以弹出 **用户信息** 面板。面板中包括 **用户详情** 和 **相关资源** 两个页签。 + + +| 信息项 | 说明 | +|------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 用户详情 | - 创建信息:显示 **账号** 、 **姓名** 、 **密码** 、 **角色** 和 **备注** 等创建用户时您指定的信息。其中密码是加密显示,并提供 **重置密码** 按钮以供修改用户的登录密码。
            - 操作信息:显示 **创建人** 、 **创建时间** 、 **更新时间** 和 **登录时间** 等信息。
            - 删除用户:单击页签中的 **删除用户** 按钮将删除当前用户,删除用户后,该账号将无法登录 ODC 且无法恢复其相关的数据。 | +| 相关资源 | 显示当前用户可访问的公共连接的名称,公共连接所属的资源组和资源组拥有的访问权限等信息。 | +| 编辑 | 在 **用户信息** 面板中,单击右下角的 **编辑** 按钮可进入 **编辑用户** 面板。 | + + +### 编辑用户 + +![公共资源管控台-用户管理-编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4186823561/p421888.png) + +单击用户信息列表 **操作** 项下的 **编辑** 按钮,以弹出 **编辑用户** 面板。 + +**编辑用户** 面板中会显示您在新建用户时指定的所有信息项。其中在用户被创建后不可修改 **账户** ,可修改 **姓名** 、 **账号状态** 、 **角色** 和 **备注** 等信息,可在查看用户详情页面时修改 **密码** 。 + +### 停用用户 + +单击用户信息列表 **操作** 项下的 **停用** 按钮,以弹出确定是否停用对话框,单击 **确定** ,停用用户。 + +> **说明** +>
          • 被停用的用户将无法进行登录。
          • +>
          • 被停用的用户账号信息仍保留,支持启用。
          • + + + + + diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/5.web-odc-manage-automatic-authorization-rules.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/5.web-odc-manage-automatic-authorization-rules.md new file mode 100644 index 00000000..5fae718e --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/3.web-odc-public-resource-permission/5.web-odc-manage-automatic-authorization-rules.md @@ -0,0 +1,117 @@ +# 自动授权规则 + + + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持拥有特殊权限的用户(系统管理员)定义自动授权规则。拥有该特殊权限的用户可在公共资源管控台内创建/修改/查看/停用自动授权规则。 + +自动授权是指对满足某些条件的用户,例如姓名、组织部门、登录方式等信息符合某些判断条件,在初次登录或创建用户时自动授予特定的角色或权限,以避免大量冗余授权操作的一项功能。 + +本文档介绍如何在公共资源管控台上新建和管理自动授权规则。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/1.png) + +## 新建自动授权规则 + +### 操作步骤 + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/2.1.png) + +1. 在 **自动授权规则** 页面的右上角单击 **新建规则** 按钮以弹出 **新建规则** 面板。 + + +2. 在 **新建规则** 面板中需指定以下信息以创建新的规则。 + + | 信息项 | 说明| + |--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 规则名称 | 指定该规则的名称,不可重名。 | + | 状态 | 选择 **启用** / **停用** 该授权规则。
            规则状态默认为 **启用**,可手动更改为 **停用** 。被停用的规则将不能被访问。 | + | 触发事件 | 当前只能选择系统内置的事件,不同事件对应不同的触发时机。| + | 匹配条件(可选) | 单击 **添加条件** 按钮并指定以下四个字段创建匹配条件。
            • **对象**:存储了触发条件和执行行为所需的信息,可以为复杂嵌套对象,包括 array、list 和 map;也可以为字符串和数字等简单对象。
            • **表达式**:目标在对象中所处的索引,不同类型对象的索引方式有区别。
            • **操作**:支持包含、匹配和等于操作。
            • **值**:目标值。
              **说明**
              如未选择添加匹配条件,表示触发选择的事件则会无条件执行动作。
              | + | 执行动作(可选) | 选择 **授予角色** / **授予连接访问权限** 并配置对应的角色名称/公共连接名称。
              **说明**
              如未选择执行动作,表示无论是否满足匹配条件均不执行任何动作。
              | + | 备注(可选) | 为规则添加备注信息,非必填项。| + +3. 指定上述信息后,单击面板右下角的 **新建** 按钮以完成创建规则。 + +### 应用示例 + +用户[在 OAuth2 上集成 ODC 且认证登录 ODC 后](https://www.oceanbase.com/docs/enterprise-odc-doc-cn-10000000001031888),假设 OAuth2 授权系统返回的数据结构如下: + +```json +{ + "id": 1, + "name": "username", + "mail": "example@email.com", + "memberOf": { + "department": [ + { + "name": "deptA", + "description": "this is a department" + }, + { + "name": "deptB", + "description": "this is a department" + } + ], + "extra": "some other info" + } +} +``` + + +对于该数据,可以使用不同表达式获取对应的值,示例如下: + +| **expression** | **result** | +|--------------------------------|----------------------| +| id | 1 | +| memberOf.department\[0\].name | deptA | +| memberOf.department\[\*\].name | \["deptA", "deptB"\] | + + +当该新用户首次从 OAuth2 登录到 ODC 时,管理员可为其配置自动授权规则。以创建 Grant system_admin for deptB 授权规则为例,memberOf.department 包含任一 name 为 deptB 的元素时,为其授予 system_admin 角色。 具体操作如下图所示: + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/6.png) + +## 管理自动授权规则B + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/4.png) + +进入自动授权规则页面后,信息以列表的形式进行显示: + +* 通过刷新按钮可刷新列表信息。 + +* 通过列表右上角的搜索栏搜索目标规则。 + +* 支持调整规则列表的列宽。 + + +### 规则列表 + +规则列表中显示并提供了以下基本信息,且列表中的每一列均提供筛选器以供按列筛选规则。 + +| 信息项 | 说明| +|------|----------------------------------------------------------------------------------------| +| 规则名称 | 显示规则的名称信息。 | +| 创建人 | 显示创建发起人。
              单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 状态 | 显示规则当前状态: **启用** 或 **停用** 。
              单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选状态。 | +| 创建时间 | 显示对规则进行 **编辑** 的最新历史操作时间。
              支持以升序或降序方式显示创建时间。 | +| 操作 | 显示 **查看** 、 **编辑** 、 **停用/启用** 和 **删除** 功能键。 | + + +### 查看规则 + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/Automatic%20Authorization%20Rules/5.png) + +单击自动授权规则信息 **操作** 栏中的 **查看** 按钮,以弹出 **规则信息** 面板。面板中包括以下信息。 + +| 信息项 | 说明 | +|------|------------------------------------------------| +| 规则信息 | 显示 **规则名称、触发事件、匹配条件、执行动作、角色、备注** 等创建规则时您指定的信息。 | +| 操作信息 | 显示 **创建人** 和 **创建时间** 等信息。 | + +### 编辑规则 + +单击规则信息列表 **操作** 栏中的 **编辑** 按钮,以弹出 **编辑规则** 面板。 + +**编辑规则** 面板中显示新建规则时所指定的所有信息项,可修改此类信息项以编辑规则。 diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md new file mode 100644 index 00000000..d9d96bad --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md @@ -0,0 +1,146 @@ +# 任务流程管理 + + + +背景信息 +------------------------- + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持拥有特殊权限的用户(拥有公共资源管控台权限的管理员)定义变更任务流程,其他只读权限的用户可根据所定义的任务流程发起 [变更任务](../../6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md)。 + +拥有该特殊权限的用户可在公共资源管控台内修改/查看/停用变更任务流程,支持的任务流程包括导入、导出、模拟数据、数据库变更和申请连接权限。 + +![任务流程图](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0008191561/p416627.png) + +## **新建任务流程** + +以在 ODC 中新建申请连接权限为例。具体操作步骤如下: + +1. 进入 **公共资源管控台** 页面后,在左侧导航栏中单击 **任务流程** 以进入任务流程管理页面。 + +2. 在 **任务流程管理** 页面右上角,选择需要创建的任务流程类型后单击 **新建流程** 按钮,以弹出 **新建任务流程** 面板。 + + ![任务流程管理-新建任务流程1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%96%B0%E5%BB%BA%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B1.png) + +3. 在 **新建任务流程** 面板中需指定以下设置流程信息。 + ![任务流程管理-新建任务流程2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%96%B0%E5%BB%BA%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B2.png) + + | **信息项** | **说明** | + |---------|---------------------------------| + | 任务流程名称 | 指定该任务流程的名称。 | + | 任务类型 | 选择任务类型,包括导入、导出、模拟数据、数据库变更和权限申请。 | + | 风险等级数 | 选择风险等级数。 | + | 任务审批流程 | 设置审批节点。 | + | 流程有效期 | 指定审批和执行有效期。执行超时,任务将过期。 | + | 任务流程状态 | 选择启用/停用任务流程。 | + | 备注(可选) | 填写相关说明信息。 | + +4. 单击 **下一步:关联连接** 选择关联的公共连接。 + +5. 选择 **关联连接**。 + + ![任务流程管理-新建任务流程3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%96%B0%E5%BB%BA%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B3.png) + + | **信息项** | **说明** | + |---------|-------------------------------| + | 部分公共连接 | 选择部分公共连接时,需要添加公共连接/资源组中的公共连接。 | + | 全部公共连接 | 关联全部公共连接。 | + +6. 指定上述信息后,单击面板右下角的 **新建** 按钮完成创建任务流程。 + +管理任务流程 +--------------------------- + +![公共资源管控台-任务流程](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E7%AE%A1%E7%90%86%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B1.png) + +进入 **公共资源管控台** 页面后,在左导航栏中单击 **任务流程** ,进入 **任务流程管理** 页面。 + +在 **任务流程管理** 页面中,任务流程信息以列表的形式进行显示: + +* 通过刷新按钮可刷新列表信息。 +* 通过列表右上角的 **设置优先级** 选择目标任务流程执行顺序,创建任务时会关联优先级最高的任务流程。 +* 勾选任务流程名称复选框![复选框](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416674.jpg),支持批量删除。 + +### 任务流程管理列表 + +任务流程管理列表中的基本信息如下所示,且列表中的每一列均提供筛选器以供按列筛选任务流程。 + + +| 信息项 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务流程名称 | 显示任务流程名称。 | +| 任务类型 | 显示任务类型。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选任务类型(导入/导出/模拟数据/数据库变更)。 | +| 风险等级数 | 显示设置的风险等级数。 默认风险等级数为 1,可自定义,最大值为 10。只有数据库变更才能设置风险等级,其它类型的任务只能有一个风险等级。 | +| 创建人 | 显示任务发起人。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 状态 | 显示任务流程状态。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属任务状态(启用/停用)。 | +| 创建时间 | 显示上一次对任务流程操作的时间。 | +| 操作 | 显示 **查看** 、 **编辑** 和 **停用** / **启用** 功能键。
              - 查看:查看当前任务流程详情。
              - 编辑:修改当前任务流程详情。
              - 停用:直接修改任务流程的状态。 | + + + +### 查看任务流程 + +![任务流程-查看](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E6%9F%A5%E7%9C%8B%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B2.png) + +在 **任务流程管理** 页面中,单击对应任务流程列表 **操作** 项下的 **查看** 按钮,以弹出 **任务流程详情** 面板。 + + +#### 查看流程信息 + + +| 信息项 | 说明 | +|----------|-------------------------------------------------------------------------------------------| +| 任务流程基本信息 | 显示 **任务流程名称** 、 **任务类型** 、 **风险等级数** 、 **审批有效期** 、 **执行等待有效期** 、 **执行有效期** 和 **备注** 信息。 | +| 等级 | 显示任务等级,包括审批节点、审批角色和可审批人。 | +| 创建人 | 显示任务发起人。 | +| 创建时间 | 显示创建任务流程的操作时间。 | + + + +#### 查看相关连接 + +| 信息项 | 说明 | +|--------|--------------| +| 关联连接 | 显示关联的公共连接信息。 | +| 任务流程状态 | 显示任务流程状态。 | + + + +### 编辑任务流程 + +![任务流程-编辑](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E7%BC%96%E8%BE%91%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B3.png) + +在 **任务流程管理** 页面中,单击对应任务流程列表 **操作** 项下的 **编辑** 按钮,以弹出 **编辑任务流程** 面板。 + + +| 信息项 | 说明 | +|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务流程名称 | 同组织架构下任务流程名称不可重复,由数字、中文、英文字母组成,最大不超过 110 个字符。 | +| 任务类型 | 数据库变更的任务子类包括:Update/Delete/Insert/Select/Create/Drop/Alter/其它。 | +| 风险等级数 | 默认风险等级数为 1,可自定义,最大值为 10(推荐设置为 3)。 只有数据库变更才能设置风险等级,其它类型的任务只能有一个风险等级。 | +| 任务审批流程 | - 此项仅针对数据库变更流程,默认风险等级数为 1,只有一个等级,该等级包含用户选择的所有任务子类, 不对变更的数据量做限制,默认需管理员审批,可自定义该等级的审批节点(节点数和审批角色)。
              - 按如果风险等级数不为1,各等级可分别定义,定义项包括: **任务子类** 、 **变更的 SQL 数量范围** 和 **设置审批节点** 。 | +| 流程有效期 | 定义审批有效时间,如超过定义的时间长度,审批自动终止; 默认 24h(1天),可自定义,最大值 240h(10天)。
              - 审批有效期:审批超时,任务将过期。
              - 执行等待有效期:手动执行前等待超时,任务将过期。
              - 执行有效期:执行超时,任务将过期。 | +| 任务流程状态 | 选择 **启用** 或 **停用** 任务流程状态(已停用的变更流程不可再发起任务)。 | +| 备注 | 填写对该流程的说明,最大不超过 200 个字符。 | + +### 设置任务流程优先级 + +1. 在任务流程管理页面,单击 **设置优先级** ,进入设置优先级面板。 + + ![任务流程管理-设置任务流程优先级1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E8%AE%BE%E7%BD%AE%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E4%BC%98%E5%85%88%E7%BA%A71.png) + +2. 在 **设置优先级** 面板中,选择任务类型后,在流程优先级列表中单击和拖拽 **排序** 项下的图标以调整任务流程名称排序。 + + > **说明** + > 任务将按管理员在公共资源管控台的 设置优先级 中设置的优先级排序匹配执行。 + > 同一连接关联多个流程时,连接内的任务将按排序的优先级匹配流程。 + + ![任务流程管理-设置任务流程优先级2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E7%AE%A1%E7%90%86-%E8%AE%BE%E7%BD%AE%E4%BB%BB%E5%8A%A1%E6%B5%81%E7%A8%8B%E4%BC%98%E5%85%88%E7%BA%A72.png) + +3. 调整完成后,单击面板右下角的 **保存** 按钮完成优先级设置。 + +### 停用任务流程 + +单击目标连接 **操作** 项下的 **停用** 按钮会弹出是否停用任务流程对话框,单击 **确定**,停用任务流程。 + +> **说明** +> 被停用的自定义任务流程,在任务发起页面不会再显示该任务流程(即不可再发起关于该任务流程的任务)。 \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/5.web-odc-operating-records.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/5.web-odc-operating-records.md new file mode 100644 index 00000000..80ff8838 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/5.web-odc-operating-records.md @@ -0,0 +1,71 @@ +操作记录管理 +=========================== + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)的公共资源管控台上管理操作事件的历史记录。 + +操作记录列表 +--------------------------- + +> **说明**
              +> 拥有系统角色(system_admin)的用户可管理操作记录。 +> 操作记录当前永久保留。 + +进入 **公共资源管控台** 页面后,在左导航栏中单击 **操作记录** ,进入 **操作记录** 页面。 + +![公共资源管控台-操作记录](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%85%AC%E5%85%B1%E8%B5%84%E6%BA%90%E7%AE%A1%E6%8E%A7%E5%8F%B0-%E6%93%8D%E4%BD%9C%E8%AE%B0%E5%BD%95%E7%AE%A1%E7%90%86-1.png) + +* 通过列表上方的刷新按钮![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p420125.jpg),可刷新列表信息。 + + + +* 通过 **执行时间** 筛选时间,可支持查看最近 7 天/最近 15 天/最近 30 天/最近半年以及自定义时间段查看。 + + + + + + +操作记录列表中显示并提供基本信息如下所示。 + + +| 信息项 | 说明 | +|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 序号 | 操作记录序号。 | +| 事件类型 | 操作事件类型,包括个人设置、密码管理、连接管理、脚本管理、数据库操作、组织配置、成员管理、资源组管理、模拟数据、数据库变更、导入、导出和任务流程等。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选事件类型。 | +| 事件操作 | 显示操作事件信息。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选事件操作。 | +| IP 来源 | 显示 IP 来源。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p417135.jpg),可搜索 IP。 | +| 执行人 | 显示操作执行人。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p417135.jpg),可搜索执行人。 | +| 执行时间 | 显示操作执行的时间。 默认操作记录列表按执行时间排序,最新的执行记录显示在最前。 单击图标![升序降序](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p420143.jpg),可升序或降序。 | +| 执行结果 | 显示执行结果,包括 **成功** 或 **失败** 。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选执行结果。 | +| 操作 | 显示 **查看** 功能键。 | + + + +查看操作记录 +--------------------------- + +在操作记录列表中,单击 **操作** 项下的 **查看** 按钮,以弹出 **记录详情** 面板。 + +![公共资源管控台-操作记录-查看](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%85%AC%E5%85%B1%E8%B5%84%E6%BA%90%E7%AE%A1%E6%8E%A7%E5%8F%B0-%E6%93%8D%E4%BD%9C%E8%AE%B0%E5%BD%95%E7%AE%A1%E7%90%86-2.png) + +记录详情中可查看 **事件类型** 、 **事件操作** 、 **所属连接** 、 **IP 来源** 、 **执行细则** 、 **执行人** 、 **执行时间** 和 **执行结果** 信息。 + +导出操作记录 +--------------------------- + +在操作记录列表右上角,单击导出图标![导出](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p417273.jpg),弹出 **导出操作记录** 面板。 + +导出操作记录列表中显示并提供基本信息如下所示。 +![公共资源管控台-导出操作记录](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%85%AC%E5%85%B1%E8%B5%84%E6%BA%90%E7%AE%A1%E6%8E%A7%E5%8F%B0-%E6%93%8D%E4%BD%9C%E8%AE%B0%E5%BD%95%E7%AE%A1%E7%90%86-3.png) + + +| 信息项 | 说明 | +|--------|-------------------------------------------| +| 执行时间范围 | 选择开始日期和结束日期。 | +| 事件操作 | 筛选需查看的事件操作。 | +| 所属连接 | 操作所属的连接名。 筛选所属连接(默认选择全部)。 | +| 执行人 | 筛选操作执行人。 | +| 执行结果 | 筛选执行结果。 | +| 导出格式 | 选择导出格式:Excel 格式 或 CSV 格式。 | + + diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md new file mode 100644 index 00000000..999c6f42 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md @@ -0,0 +1,115 @@ +# 数据脱敏管理 + +## **前提条件** + +用户角色为拥有特殊权限的用户(公共资源管控台管理员)。 + +## **概述** + +数据脱敏是指对某些敏感信息,例如姓名、身份证号码、手机号、固定电话、银行卡号、邮箱等个人信息,通过脱敏规则进行数据变形,以保护敏感隐私数据的可靠保护。 + +为了更好地识别数据库中的敏感列,ODC 支持配置 AI 敏感列识别功能(可选功能,需用户自行部署 AI 模型)。该功能可以智能识别表中可能包含敏感信息的列,为数据脱敏规则的制定提供参考。推荐使用魔搭社区的 fylfy111/SensitiveColumn 模型(基于 qwen2.5 7B Instruct),部署时建议配置 --max-model-len=4096,至少需要单卡 RTX 3090 服务器。 + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)的公共资源管控台上新建和管理数据脱敏规则,以及在 ODC 中的应用场景,例如在数据导出和结果集导出等场景支持开启数据脱敏策略。 + +![数据脱敏管理-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-1.png) + +## **新建脱敏规则** + +![数据脱敏管理-2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-2.png) + +1. 进入 **公共资源管控台** 页面后,在左侧导航栏中单击 **安全审计** > **脱敏规则** 以进入数据脱敏管理页面。 + +2. 在 **脱敏规则** 页面右上角,单击 **新建脱敏规则** 按钮,以弹出 **新建脱敏规则** 面板。 + +3. 在 **新建脱敏规则** 面板中需指定以下信息以创建新的脱敏规则。 + + | **信息项** | **说明** | + | ---------- | ------------------------------------------------------------------------ | + | 规则名称 | 指定该脱敏规则的名称。规则名称不超过 48 个字符且不可重名。 | + | 规则状态 | 选择 **启用** / **停用** 脱敏规则。 | + | 规则详情 | 选择脱敏方式,将对应敏感字符替换成选择的脱敏方式。 | + | 脱敏效果 | 在 **测试数据** 中输入需要脱敏的数据后,单击 **脱敏验证** 查看脱敏结果。 | + +4. 指定上述信息后,单击面板右下角的 **新建** 按钮完成创建脱敏规则。 + +## **管理脱敏规则** + +进入 **脱敏规则管理** 页面后,脱敏规则信息以列表的形式进行显示: + +- 通过刷新按钮可刷新列表信息。 +- 通过列表右上角的搜索栏搜索目标规则名称。 + +### **脱敏规则列表** + +脱敏规则列表中的基本信息如下所示: + +| **信息项** | **说明** | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 规则名称 | 显示脱敏规则名称。 | +| 脱敏方式 | 显示创建脱敏规则时选择的脱敏方式。单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选脱敏方式。 | +| 状态 | 显示任务流程状态。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属任务状态(启用/停用)。 | +| 更新时间 | 显示编辑当前脱敏规则的最新操作时间。 | +| 操作 | 显示 **查看** 、 **编辑** 、 **停用** / **启用** 和 **删除** 功能键。
              - 查看:查看当前脱敏规则详情。
              - 编辑:修改当前脱敏规则详情。
              - 停用:停用当前脱敏规则。
              - 删除:删除当前脱敏规则。 | + +### **查看脱敏规则** + +在 **脱敏规则** 页面中,单击脱敏规则列表 **操作** 项下的 **查看** 按钮,以弹出 **脱敏规则详情** 面板。 + +![数据脱敏管理-3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-3.png) + +| **信息项** | **说明** | +| ---------- | ------------------------------------------------------------------------ | +| 规则名称 | 显示脱敏规则名称。 | +| 脱敏详情 | 显示脱敏方式和分段选择。 | +| 脱敏效果 | 在 **测试数据** 中输入需要脱敏的数据后,单击 **脱敏验证** 查看脱敏结果。 | +| 创建人 | 显示任务发起人。 | +| 创建时间 | 显示创建当前脱敏规则的操作时间。 | +| 更新时间 | 显示编辑当前脱敏规则的最新操作时间。 | + +### **编辑脱敏规则** + +![数据脱敏管理-4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-4.png) + +1. 在 **脱敏规则** 页面中,单击脱敏规则列表 **操作** 项下的 **编辑** 按钮,以弹出 **编辑脱敏规则** 面板。 + +2. 编辑脱敏规则面板中会显示在新建脱敏规则时所指定的所有信息项。 + +3. 编辑信息完成后,单击 **保存** 按钮。 + +## **应用场景** + +在导出数据和导出结果集等场景支持开启数据脱敏策略。 + +### **场景 1:导出数据时开启数据脱敏** + +以在 ODC 中导出部门表(department)时开启数据脱敏策略为例,具体操作步骤如下: + +1. 在表列表中,鼠标右键单击 department 表,在弹出的操作列表中选择 **导出** 。 + + ![数据脱敏管理-5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-5.png) + +2. 在弹出的 **单表导出** 面板中,单击 **数据脱敏** 并选择数据脱敏策略名称。 + + ![数据脱敏管理-6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-6.png) + +3. 在 **单表导出** 面板的 **数据脱敏** 下拉列表中,单击 **管理脱敏策略** ,支持添加脱敏策略、添加/排序/编辑/移除脱敏规则。 + + ![数据脱敏管理-7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-7.png) + +### **场景 2:导出结果集时开启数据脱敏** + +导出数据场景请参考[批量导出与导入](../6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md),以在 ODC 中下载部门表(department)结果集时开启数据脱敏策略为例,具体操作步骤如下: + +1. 在 department 结果集中,单击下载数据图标,在弹出的 **下载数据** 面板中,单击 **数据脱敏** 并选择数据脱敏策略名称。 + + ![数据脱敏管理-8](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-8.png) + +2. 在 **下载数据** 面板的 **数据脱敏** 下拉列表中,单击 **管理脱敏策略** ,支持添加脱敏策略、添加/排序/编辑/移除脱敏规则。 + + ![数据脱敏管理-7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%95%B0%E6%8D%AE%E8%84%B1%E6%95%8F%E7%AE%A1%E7%90%86-7.png) + +## **相关信息** + +- [结果页签](../5.web-odc-use-workspace/2.web-odc-sql-window.md) +- [批量导出与导入](../6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md) diff --git a/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/7.web-odc-system-settings.md b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/7.web-odc-system-settings.md new file mode 100644 index 00000000..096c9ca6 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/4.web-odc-public-resource-management/7.web-odc-system-settings.md @@ -0,0 +1,22 @@ +系统设置 +========================= + +在系统设置中,管理员可设置全局的功能。其他用户可在在个人设置页面中进行相同的功能设置,个人设置的优先级高于管理员操作的系统设置。 + +进入 **公共资源管控台** 页面后,在左导航栏中单击 **系统设置** 以进入 **系统设置** 页面。 + +![Image 874](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0096712561/p312560.png) + +单击页面右上角的 **编辑** 按钮以进入编辑状态,系统设置中支持进行以下设置: + + +| 设置 | 说明 | +|-------------------|----------------------------------------------------------------------------------------------------| +| SQL 窗口 Session 模式 | 设置 SQL 窗口的 Session 模式。 | +| 界定符设置 | 设置在 SQL 窗口内运行 PL 语句时默认使用的 Delimiter 符号。目前支持设置 **;** 、 **/** 、 **//** 、 **$** 和 **$$** 等 5 种形式的界定符。 | +| Oracle 事务提交模式 | 设置 Oracle 模式下事务的默认提交模式。可设置事务手动提交或自动提交。 | +| MySQL 事务提交模式 | 设置 MySQL 模式下事务的默认提交模式。可设置事务手动提交或自动提交。 | +| 结果集查询条数限制 | 设置 SQL 窗口内执行 SQL 语句默认返回的结果行数。 | +| 对象拖放生成语句类型 | 设置拖放表/视图对象时默认生成的语句类型。 | + + diff --git a/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md new file mode 100644 index 00000000..590fe62e --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/1.web-odc-use-workspace-overview.md @@ -0,0 +1,51 @@ +概述 +======================= + +工作台是 OceanBase 开发者中心(OceanBase Developer Center,ODC)为您提供的进行数据库开发工作的主要功能模块。 + +进入对应的数据库连接后,在上方导航栏中单击 **工作台** 标签在弹出的列表中工作台模块提供了以下功能: + +* **SQL 窗口** :数据库开发者编辑 SQL 和 PL 语句的工作区,在 SQL 窗口中 ODC 同时提供 **代码片段** 功能。 + + + +* **匿名块窗口** :数据库开发者编辑匿名块脚本的工作区。 + + + +* **命令行窗口** :集成了 OceanBase 客户端(OBClient)到命令行窗口,可在命令行窗口中更直接灵活的执行 SQL 或 PL 语句并实时查看结果。 + + + +* **已保存的脚本** :数据库开发者可打开之前在 ODC 中保存的脚本。 + + + +* **代码片段** :提供内置语法片段和自定义语法片段供您查看和引用。 + + + + + +> **注意**
              +> 仅 Oracle 模式下支持创建匿名块窗口。 + +本章节将分篇介绍工作台提供的功能: + +* [SQL 窗口](../../6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md) + + + +* [匿名块窗口](../../6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md) + + + +* [命令行窗口](../../6.web-odc-user-guide/5.web-odc-use-workspace/4.web-odc-command-line-window.md) + + + +* [已保存的脚本](../../6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md) + + + +* [代码片段](../../6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md) diff --git a/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md new file mode 100644 index 00000000..48049a7f --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/2.web-odc-sql-window.md @@ -0,0 +1,156 @@ +SQL 窗口 +=========================== + + + +概述 +----------------------- + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,在顶部导航栏单击 **工作台** 标签,在弹出下拉菜单中单击 **SQL 窗口** 以完成新建。 + +SQL 窗口中提供可编辑脚本的 SQL 编辑区域,显示运行结果的执行记录页签与结果页签,同时 SQL 窗口也支持运行 PL 语句。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/1.png) + +SQL 编辑区域 +----------------------------- + +在 SQL 窗口的编辑区域可体验更多细节: + +| 操作 | 说明 | +|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 提供输入自动提示功能 | 在 SQL 编辑区编写脚本时提供输入自动提示功能以提升编辑 SQL 语句效率。 例如:权限账户进行 SQL 语句编辑时,支持自动补全表名功能(跨库查询支持补全表名)。| +| 标识关键字和智能识别代码 | 窗口中会对数据库的关键字进行不同颜色的标识并可智能识别代码。 | +| 右键单击编辑区 `SELECT` 语句中的表、视图和函数名称 | 右键单击编辑区 `SELECT` 语句中的表、视图和函数名称时将提供常见操作键,同时将鼠标放置在表的名称上会显示字段信息。 | +| 拖拽对象列表至 SQL 编辑区 | 在对象列表中可将目标对象直接拖放至 SQL 编辑区中,以方便在语句中填充对象名。
              • 如为表 / 视图对象,拖放对象名 SQL 编辑区时,在 **快速生成** 弹窗中,可选择快速生成的 SQL 语句(在登录账号的 **个人设置** \> **对象拖放生成语句类型** 中,可设置拖放表 / 视图对象时默认生成的语句类型)。
              • 除表/视图外的其它对象,拖拽对象名直接将对象名拖拽至 SQL/PL 窗口。
              ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/2editing%20area-drag%20and%20drop.png) | +| 支持共享/独立 Session | ODC SQL 窗口支持 **共享 Session** 和 **独立 Session** 模式。
              • 共享 Session:支持在同一个连接内打开多个窗口,但不允许多窗口并行执行 SQL 。
              • 独立 Session:支持在同一个连接内打开多个窗口,允许并行执行 SQL。 在 SQL 窗口标签右侧单击 +,即可打开多个 SQL 窗口。SQL 窗口默认为共享 Session 模式,可以在顶部导航栏的右上角登录账号的 **个人设置** 中设置为 **独立 Session 模式**。
              ![SQL 窗口-SQL 编辑区域2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F2.png) | +| 支持特殊符号异常识别 | SQL 窗口的编辑区支持特殊符号异常识别,异常符号会被黄色波浪下划线进行标识。| +| 查看执行状态 | 鼠标悬停在 SQL 窗口标签上,会显示窗口名称和执行状态。
              ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/3editing%20area-Viewing%20the%20execution%20status.png) | + + +> **说明** +> Oracle 模式下 ODC 自动提交默认设置为关,如需手动提交事务,可在 SQL 窗口中的设置 > 设置会话变量或在顶部导航栏中的会话 > 会话属性页面修改变量 `autocommit` 的值进行设置,但 SQL 窗口中的设置操作仅对当前 SQL 窗口有效。详情请参见 [会话管理](../10.web-odc-session-management.md)。
              +> 事务手动提交模式下,需设置变量 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会终止。同时需注意 `ob_trx_idle_timeout` 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。 + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/4editing%20area-SQL%20Check.png) + +除编辑 SQL 语句时可体验上述细节,编辑区的工具栏中同时提供以下功能键: + +| 功能 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 运行 | 单击该按钮运行当前 SQL 窗口中所有的 SQL 语句。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。 | +| 运行当前语句 | 单击该按钮运行当前您选中的所有 SQL 语句或当前光标所在行的 SQL 语句。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。 | +| 终止 | 单击该按钮终止正在运行的语句。 | +|SQL 检查|单击该按钮检查 SQL 语法。| +| 执行计划 | 查看选中的或当前光标所在的 SQL 语句在执行前系统预估的执行计划(`EXPLAINPLAN`操作的结果),展示的执行数据可能与实际执行语句后的数据略有不同,您可以使用该功能评估 SQL 语句。
              单击 **执行计划** 按钮,在 **计划详情** 页签中,单击 **查看格式化信息** 切换至格式化展示页面。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| IN 值转化 | 批量复制转化工具,适用于查询数据时对复制的行或列结果进行格式转化。
              将批量数据粘贴在 SQL 编辑区后,选择复制的数据,单击 **IN 值转化** 按钮,即可转化成 in('A','B')格式。
              • 列值分隔符号为换行符。
              • 行值分隔符为空格或 TAB 值。
              | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| 保存脚本 | 单击该按钮/使用快捷键 Ctrl+S 保存当前窗口中的脚本。保存后再次进入工作台可以直接打开已保存的脚本。每个用户只能查看自己保存的 SQL 脚本,且脚本名不允许重复。打开已保存的脚本后,可编辑该脚本。
              **说明**
              使用快捷键 Ctrl+D 支持保存脚本至本地。
              | +| 设置 |
              • **Delimiter** :在下拉列表中选择您想要的符号以完成界定符的设置。目前支持设置 **;** 、 **/** 、 **//** 、 **$** 和 **$$** 等 5 种形式的界定符。
              • **查询结果限制** :设置查询结果返回的条数,默认值为 1000 行。
              • **会话变量** :可编辑、刷新和搜索变量。
              | +| 代码片段 | 提供内置语法片段和自定义语法片段供您查看和引用。详情请查看 [代码片段](../../6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md)。 | +| 提交 |
              • Oracle 模式下自动提交(autocommit)默认设置为关(OFF),因此需单击该按钮以手动提交当前事务。单击提交时会提示当前连接采用共享 Session,提交操作会对所有窗口生效,单击 **确认** 后提交生效。
              • MySQL 模式下自动提交(autocommit)默认设置为开(ON)将不展示该按钮。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。
              **说明**
              可通过 SQL 窗口中的设置 > **会话变量** 或顶部导航栏中的 **工具** > **会话属性** ,修改自动提交(autocommit)属性。
              | +| 回滚 |
              • Oracle 模式下, **会话变量** 中的自动提交(autocommit)为关(OFF)时,单击该按钮以回滚当前事务。单击时会提示您当前连接采用共享 Session,回滚操作会对所有窗口生效,单击 **确认** 后回滚生效。
              • MySQL 模式下, **会话变量** 中的自动提交(autocommit)为开(ON)将不展示该按钮。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。
              | + + + +运行 PL 语句 +----------------------------- + +SQL 窗口中支持编辑 PL 语句,在编辑区中编写 PL 语句完毕后使用选择的界定符作为结尾。 + +ODC 目前支持通过以下方式完成界定符的设置: + +* 在 SQL 编辑区的工具栏中单击 **设置** 按钮,在弹窗中的 **Delimiter** 选择框中选择所需设定的界定符。 + + + +* 在 **个人设置** 页面中的 **界定符设置** 选择框中选择所需的界定符。 + + + +* 显示 PL 行号和错误位置的编译错误信息。 + +* 在左侧导航栏中鼠标右键单击 PL 对象并选择 **运行**,支持设置参数值为 DEFAULT、NULL 或空字符串。 + + > **注意** + >
              • 自 ODC V2.4.1 之后版本,可在编辑区中使用 `DELIMITER` 语句直接定义界定符, 设置中的 Delimiter 项会回显所设置的界定符。
              • + >
              • 可直接使用 / 分隔 PL 语句。
              + +在 SQL 中运行 PL 语句后,结果页签支持 DBMS 输出。 + +![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/5Execute%20a%20PL%20statement.png) + +执行记录页签 +--------------------------- + +![6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/6Record.png) + +在执行记录页签中您可以查看当前连接进程中每次执行 SQL 语句的记录,包括 **状态** 、 **时间** 、 **SQL 语句** 、 **结果** 、 **TRACE ID** **、** **耗时** 和 **执行详情** (即执行计划)等信息。 + +| 功能 | 说明 | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 复选框 | 勾选列表前的复选框后单击 **删除** ,可批量选中并清理多条执行记录。 | +|状态|执行状态。| +|时间|执行时间。| +|SQL 语句|执行的 SQL 语句。| +|结果|执行结果。| +| TRACE ID | 执行记录 ID。
              **注意**
              如 TRACE ID 为空,请确保该语句运行时 enable_sql_audit 系统参数及 ob_enable_trace_log 变量值均为 **ON** 。具体步骤:
              1. 单击 **会话** > **会话属性** > **会话变量**,分别搜索 enable_sql_audit 和 ob_enable_trace_log 参数;
              2. 单击 **会话变量** 页签中的 **编辑** 图标,在弹出的 **编辑变量** 中,将 **OFF** 值改为 **ON** 后确定。
              3. 打开系统参数: ```sql obclient> alter system set enable_sql_audit='True'; Query OK, 0 rows affected (0.06 sec) ```
              | +| DB 耗时 | 可将鼠标箭头放置在 **DB 耗时** 信息后的提示图标上,弹出的提示信息中可查看对 SQL 执行的全链路耗时信息,以验证各个阶段的耗时与实际是否相符。 | +| 执行详情 | 默认展示文本计划。 在 **执行详情** 项下,单击 **查看** ,可在 **执行详情** 页面查看 **基本信息** 、 **耗时统计** 、 **I/O 统计、执行的 SQL 语句** 、 **计划统计和 大纲** 。 | + + + +日志页签 +------------------------- + +在该页签可查看当前 SQL 窗口的执行记录。 + +> **说明** +> 日志页签中,仅 INSERT、DELETE 和 UPDATE 语句的执行结果显示影响的行数,SELECT 和 TRUNCATE 等语句的执行结果不显示影响的行数。 + +![7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/7Results%20tab-DB%20Time.png) + +结果页签 +------------------------- + +![8](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/8Logs%20tab.png) + +在该页签可查看当前 SQL 语句的执行结果。结果页签中显示的结果集支持进行以下交互操作以方便日常开发工作: + +| 操作 | 说明 | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 鼠标选中目标范围 | 返回的结果集支持通过鼠标选中目标范围后直接通过快捷键复制至外部文件,可单击字段名称或行号直接选中整行或整列。 亦可通过工具栏中的 **导出** 工具将结果集中的数据导出到本地文件。 | +| 选择多行/多列 |
              • 按 Shift 键,可选择连续多行/多列;
              • 按 Ctrl/Command 键,可选择不连续的多行/多列。
              | +| 右键单击单元格 | 提供 **复制** / **输出到剪切板** 功能键以直接将数据复制到外部文件中。 | +| 右键单击行序号 | 提供 **复制行** / **冻结此行** / **解除全部冻结行** 功能。
              • 复制行:复制选中的行;
              • 冻结此行:将选中行置顶并冻结,冻结行和表头固定下方内容可垂直滚动;支持冻结多行;
              • 解除全部冻结行:将所有冻结行恢复。
              | +| 放大图标 | 当单元格中的数据过长导致无法全部显示时,可通过放大图标查看单元格中的全部数据:
              1. 将鼠标箭头放置在目标单元格上;
              2. 单击单元格右侧出现的放大图标![放大按钮](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8892277361/p353161.jpg),在弹出的大字段展示弹窗中可查看单元格中的全部数据。
              **说明**
              如为大字段,默认按文本展示大字段内容,可切换至十六进制查看同时支持下载打字段内容至本地。
              | +| BLOB 大对象 | 结果页签中:
              • Oracle 模式下,CLOB,BLOB,RAW 支持直接编辑文本内容、编辑十六进制数据和上传文件(限制在 200 KB 内)。
              • MySQL 模式下,BLOB,MEDIUMBLOB,TINYBLOB 等 XLOB 支持直接编辑文本内容、编辑十六进制数据和上传文件。
              | +| 右键单击结果页签的标签名(如 **结果1** ) | 在弹出的列表中单击 **固定** 可使当前结果页签保持展示状态,当执行一条新的查询时当前结果不会被覆盖而是生成一个新的结果展示页签,以方便对比不同的查询结果。 单击 **解除固定** 以取消目标结果页签的固定状态。 | +| 筛选、排序和搜索按钮 | 结果集中每个字段名称后提供筛选、排序和搜索按钮,可对单列的数据直接进行筛选、排序和搜索。 | +| 拖动列名 | 支持在结果集中直接拖动列名以调整各字段的顺序。| +| 调整列宽 | 支持拖动调整列宽。 | + + + +同时,结果页签的导航栏中提供以下工具: + +![9](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/9Results%20tab-modify.png) + +| 工具 | 说明 | +|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 列模式 | 以表格的形式展示一行选中的数据。在 **列模式** 页面可以进行上一行、下一行的切换展示,对于列数量比较多场景, **列模式** 比较方便行数据的查看。参考步骤如下:
              1. 选中需查看的数据后,单击 **列模式** ![列模式按钮](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326038.jpg)按钮;
              2. 在弹出的 **列模式** 页面中,可单击左右按钮查看上下行列值;
              3. 鼠标移动至某值字段,单击 放大按钮![放大按钮](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326047.jpg),可查看该列字段详情;
              4. 在 **列模式** 列表中,可通过 **备注** 查看表中对应的列注释信息。修改备注信息步骤如下:
              a. 在左侧导航栏的表列表中,右键单击目标表,选择 **查看表结构** ,进入表属性管理页签;
              b. 在属性页签的左导航栏中单击 **列** 标签;
              c. 选择字段名,单击编辑图标,弹出 **编辑字段** 弹窗;
              d. 在 **字段注释** 中,填写字段注释后,单击 **确定**;
              e. 在 **SQL 确认** 弹窗,单击 **执行** ,完成修改备注信息;
              f. 在 **列模式** 中即会显示修改的备注信息。 | +| 列管理 | 筛选在页面中展示的列。| +| 回到开始 | 跳转至第 1 页。 | +| 上一页 | 向上翻页。 | +| 下一页 | 向下翻页。| +| 跳至底部 | 跳转至最后一页。 | +| 搜索 | 在搜索框中输入关键字查询所需结果。 | +| 编辑 | 单击 **编辑** 按钮开启对当前展示的结果集的编辑状态,编辑态中提供 **添加一行** 、 **删除** 、 **复制当前行** 、 **取消** 、 **确认修改** (当自动提交设置为开时,单击该按钮事务被自动提交) 和 **修改并提交** (自动提交设置为关时显示该按钮) 等编辑操作。同时可在编辑态下双击目标数据直接进行修改,或是通过上述操作按钮进行快捷操作。 在编辑态中右键单元格,弹出的菜单中提供 **复制** 和 **设置为 Null** 两个操作键。
              **说明**
              通过结果集是否支持编辑预判断功能,在 SQL 执行时获取到 ResultMetaData 信息,可在 SQL 执行结果出来时同步判断结果集是否可编辑:
              • 如当前结果集不支持编辑,编辑按钮隐藏,且提示当前结果集不可编辑。
              • 如当前结果集支持编辑,编辑按钮呈可点击态,可点击进入结果集编辑页面(支持编辑场景:单表/单视图查询)。
              • 目前不支持包含 SET 类型和 ENUM 类型的结果集编辑。
              | +| 下载数据 | 将查询结果导出为 CSV、SQL 或 EXCEL 文件:
              • 导出 SQL 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、** **文件格式** (SQL) **、** **文件编码** 、 **数据脱敏** 和 **SQL 文件设置** ( **表名** );
              • 导出 CSV 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、** **文件格式** **、** **文件编码** 、 **数据脱敏** 和 **CSV 设置** ( **包含列头** 、 **空字符串转为空值** 、 **字段分隔符** 、 **文本识别符** 和 **换行符号** );
              • 导出 EXCEL 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、** **文件格式** **、** **文件编码** 、 **数据脱敏** 和 **Excel 文件设置** ( **包含列头** 和 **导出 SQL 到另一个 Sheet** )。
              **说明**
              • 支持对导出数据进行脱敏处理。
              • 导出数据条数不再受查询窗口的条数限制,可自定义导出条数。
              • 导出 CSV 格式时,默认导出的是 CSV 文件可以直接用 EXCEL 软件打开。
              • 导出 EXCEL 格式时可自定义是否包含列头,可选择是否导出查询的 SQL 语句。
              ![10](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20Window/10Results%20tab-download.png) | +| 计划 | 查看当前 SQL 语句执行后的实际资源消耗及执行计划,可快速判断 SQL 语句的优劣。 | \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md new file mode 100644 index 00000000..e1448e72 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/3.web-odc-anonymous-block-window.md @@ -0,0 +1,123 @@ +匿名块窗口 +========================== + + + +概述 +----------------------- + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,单击顶部导航栏中的 **工作台** 标签,在弹出下拉菜单中选择 **匿名块窗口** 以新建窗口。 + +匿名块窗口中提供 **PL 编辑区域**、**PL 运行结果和 DBMS 输出** 页签以及 **调试页面**。 + +![Image 460](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7838838161/p263569.png) + +PL 编辑区域 +---------------------------- + +在匿名块窗口的编辑区域,可体验到较多的细节功能,如当新建一个匿名块窗口时: + +* 会自动生成引导代码方便编写脚本; + + + +* 窗口中会对数据库的关键字进行不同颜色的标识; + + + +* 支持格式化等功能以提升编辑 PL 语句的效率。 + + 除编辑 PL 语句时可体验到上述细节功能外,编辑区域的工具栏中同时提供以下功能键: + + + | 功能 | 说明 | + |-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 运行 | 单击该按钮运行代码区中的语句。 | + | 终止 | 单击该按钮终止正在运行的语句。 | + | 调试 | 单击该按钮进入调试页面,并对代码区内的匿名块对象进行调试。 | + | 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | + | 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | + | 撤销 | 将脚本回退到上一步操作执行的结果。 | + | 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | + | 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | + | 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | + | 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | + | 保存 | 单击该按钮保存当前窗口中的脚本。 保存后,再次进入工作台可直接打开已保存的脚本。
              **说明**
              - 每个用户只能查看自己保存的 SQL 脚本,且脚本名不允许重复。
              - 打开已保存的脚本后,可继续对该脚本进行编辑。 | + + + + + + +PL 运行结果和 DBMS 输出页签 +--------------------------------------- + +在匿名块编辑区域的工具栏单击运行图标![运行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9861058361/p361443.jpg)后,会运行编辑区域中的匿名块脚本,可在编辑区域下方查看 **运行结果** 和 **DBMS 输出** 页签: + +* **运行结果** :展示脚本运行的结果,如运行无误则显示 **运行成功** ,如运行有误则展示错误提示信息。 + +* **DBMS 输出** :如子程序中包含 PL 输出语句则展示其调用后的输出结果(例如 `dbms_output.put_line`)。 + + + + +调试页面 +------------------------- + +在匿名块的编辑区域,单击 **调试** 按钮后可进入调试页面。 + +进入调试页面后可对当前窗口中的匿名块进行调试。 +**注意** + + + +* 推荐升级至 OBServer V2.2.77 及之后版本(因 OBServer 部分版本存在 PL 调试类已知问题,可能导致 OBServer 不稳定)。 + + + +* ODC V3.2.2 之前版本,通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。 + + + +* 自 ODC V3.2.2 及之后版本,ODC 支持通过 OBProxy 连接 OBServer 情况下进行 PL 调试。 + + + +* 在调试前请确保连接的数据库中已安装 DBMS_DEBUG 和 DBMS_OUTPUT 等调试包。 + + + + + + +![调试](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/1136530161/p203467.png) + +在调试模式下,编辑区的工具栏中提供以下功能键: + + +| 功能 | 说明 | +|------|-------------------------------------------------------| +| 批量执行 | 批量运行至最近断点,如果无断点直接运行至结尾语句。 | +| 单步执行 | 单步执行,不会进入子程序。 | +| 跳入 | 单步执行,如当前行是调用已定义的存储过程或函数,则会进入被调用的子程序。 | +| 跳出 | 在子程序内,执行跳出操作后,返回到上层调用位置的下一行;主程序内运行跳出,效果与 **自动调试** 相同。 | +| 终止调试 | 继续运行直到结束,会跳过设置的断点。 | +| 重新调试 | 对当前调试对象发起新一轮的调试,与 **调试** 的区别在于:无需新建调试连接。 | +| 退出调试 | 关闭调试连接,并退出调试交互窗口。 | + + + +在调试模式下,除编辑区外,同时提供以下页签: + +* **参数** :参数页签展示该调试对象所有的参数定义信息(参数名、模式和类型)及对应的值,其中对应的值会根据调试过程作出相应的变化。 + +* **堆栈和变量** :展示当前栈上的变量与其对应的值。 + +* **DBMS 输出** :如子程序中包含 PL 输出语句则展示其调用后的输出结果(例如 `dbms_output.put_line`)。 + +* **断点** :在编辑区单击行号设置断点(再次单击取消断点)。在断点页签可查看设置的所有断点,列表默认按照断点执行顺序进行排序,在列表中选中多个断点后可批量取消。每一行断点信息的操作栏中同时提供 **取消** (取消该断点)和 **查看** (在编辑区光标会跳转至该断点所处的位置)两个操作。 + +* **调试日志** :展示调试开始、调试结束、断点添加、断点取消等信息和错误日志。 + + + diff --git a/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/4.web-odc-command-line-window.md b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/4.web-odc-command-line-window.md new file mode 100644 index 00000000..eb59971f --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/4.web-odc-command-line-window.md @@ -0,0 +1,47 @@ +命令行窗口 +========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)集成了命令行工具 OceanBase 客户端(OBClient) 到命令行窗口,OBClient 是推荐的 OceanBase 数据库黑屏客户端工具。现在您无需再单独下载安装 OBClient,使用命令行窗口就可更直接灵活的执行 SQL 或 PL 语句并实时查看结果,还可以通过 `SOURCE` 命令运行上传在服务器中的文件。 + +新建命令行窗口 +---------------------------- + +登录 ODC 单击目标连接进入对应的数据库连接后,单击上方导航栏中的 **工作台** 标签,在弹出的下拉菜单中选择 **命令行窗口** 以新建一个命令行窗口。打开的窗口会自动连接到当前实例并显示一段默认代码展示连接的 ID、版本信息和帮助信息。 +> **注意**
              +> 最多可同时新建 3 个命令行窗口,以保持其连接状态。 + +当连接提示断开时,命令行窗口的右上角会出现 **重新连接** 按钮,单击该按钮重建连接。 + +![Image 510](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2700619161/p267479.png) + +脚本管理 +------------------------- + +如果您在开发过程中需要引用脚本,可使用 **命令行窗口** 提供的 **脚本管理** 功能导入脚本后引用。 + +引用脚本的操作步骤如下: + +1. 进入脚本管理面板。 + + 在命令行窗口的右上角单击 **脚本管理** 标签以弹出 **脚本管理** 面板。 + + +2. 导入被引用的脚本。 + + 单击 **导入脚本** 标签下的文件池进入文件资源管理器选择要引用的脚本或者直接将脚本文件拖入文件池中完成上传。导入的文件最大不能超过 250 MB。 + + +3. 获取文件路径。 + + 脚本上传成功后,可以在面板的 **脚本列表** 中查看被上传脚本的 **脚本路径** 、 **脚本名称** 、 **文件大小** 和 **上传时间** 等信息。可单击操作列中的 **复制路径** 按钮,然后在命令行窗口中的语句中粘贴路径信息以引用脚本。 + + +4. 删除脚本文件。 + + 上传的脚本文件只有上传者可以查看,文件上传 30 分钟后会被自动清理以防止占用过多空间,您也可以通过单击操作栏中的 **删除** 按钮清除文件。 + + + + + +![Image 161](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3130004161/p239418.png) diff --git a/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md new file mode 100644 index 00000000..92dff743 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/5.web-odc-stored-scripts.md @@ -0,0 +1,113 @@ +已保存的脚本 +=========================== + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,单击顶部导航栏中的 **工作台** 标签,在弹出的下拉菜单中选择并单击 **已保存的脚本** 以进入之前在 SQL 窗口和匿名块窗口中保存的脚本。 + +概述 +----------------------- + +![Image 560](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7092168461/p269155.png) + +在下拉菜单展示的脚本列表中单击脚本名以继续编辑或运行该脚本,如脚本为 SQL 脚本则自动生成 SQL 窗口以展示脚本,若是匿名块脚本则自动生成匿名块窗口以展示脚本。在脚本列表中,脚本名后还提供了以下功能键: + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------------------------------------------| +| 编辑 | 单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424761.jpg),修改脚本的名称和脚本内容。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424762.jpg),删除该脚本。 | +| 脚本管理 | 单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424763.jpg)脚本管理,编辑/导入/下载/删除脚本。 | + + + +管理脚本 +------------------------- + +### 编辑脚本 + +![已保存的脚本-管理脚本-编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424769.png) + +1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面后,单击 **工作台** \> **已保存的脚本** 。 + + + +2. 在 **已保存的脚本** 的下拉列表中,选择脚本并单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424782.jpg)进入编辑脚本面板(或单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424763.jpg)脚本管理,在脚本管理面板中,选择脚本并单击编辑)。 + + + +3. 在 **编辑脚本** 面板中,编辑 **脚本名称** 和 **脚本内容** 后,单击 **保存** 。 + + + + + + +### 删除脚本 + +1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面后,单击 **工作台** \> **已保存的脚本** 。 + + + +2. 在 **已保存的脚本** 的下拉列表中,选择脚本并单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424762.jpg),删除脚本。 + + + + + + +### 脚本管理 + +![已保存的脚本-管理脚本](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3679168461/p424794.png) + +1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面后,单击 **工作台** \> **已保存的脚本** 。 + + + +2. 在 **已保存的脚本** 的下拉列表中,单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424763.jpg)脚本管理,进入脚本管理面板。 + + + +3. 在导入脚本上传框中,通过单击或拖拽文件可导入多个脚本。 + + > **说明**
              + > - 单个上传文件大小限制:250M。
              + > - 支持上传 .sql/.pl/.txt 后缀的文件。 + + + + + + + +4. 在脚本列表中,支持如下功能。 + + * 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3679168461/p424801.jpg),可刷新脚本列表。 + + + + * 通过搜索框直接查找脚本名称。 + + + + * 单击复选框![复选框](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424802.jpg),支持选择多个脚本,可批量下载/批量删除。 + + + + * 单击 **复制路径** ,复制脚本路径。 + + + + * 单击 **编辑** ,编辑脚本。 + + * 单击 **下载** ,下载脚本。 + + + + * 单击 **删除** ,删除脚本。 + + + + + + + + diff --git a/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md new file mode 100644 index 00000000..a2de02a5 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/5.web-odc-use-workspace/6.web-odc-snippet.md @@ -0,0 +1,74 @@ +代码片段 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)作为企业级数据库开发平台,为您提供代码片段模块以供在 ODC 中进行数据库开发工作。如在开发过程中遗忘某些语句的具体用法,可直接在 ODC 提供的代码片段模块中进行查询。代码片段模块会根据当前连接的数据库模式(Oracle 或 MySQL)提供对应的代码片段。除内置的代码片段外,同时可自定义代码片段以记录常用代码方便下次使用,仅创建者可查看自定义代码片段。 + +在 SQL 窗口、匿名块窗口和 PL 对象编辑页面的工具栏中,单击 **代码片段** 按钮弹出代码片段面板。 +![Image 225](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8764861361/p242639.png) + +查看代码片段 +--------------------------- + +在代码片段面板中以卡片列表的形式展示代码片段,每个卡片上直接展示了代码片段名称、代码片段描述和代码片段类型等信息。将鼠标放置在卡片代码片段名称后的提示图标![代码片段提示标](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8764861361/p325006.png)上,会浮现提示窗展示目标代码片段的全部代码信息。 + +在卡片列表的上方 ODC 提供了搜索框,可借助搜索功能直接查找具体的代码片段。在搜索框的下方提供按类型进行筛选的筛选器。筛选器中默认选中全部类型,可单击筛选器选择筛选出 **常规** 、 **DML** 、 **DDL** 、 **流程控制语句** 和 **全部类型** 的代码片段。 + +新建代码片段 +--------------------------- + +在代码片段列表的右上角,单击 **+新建** 按钮弹出 **新建代码片段** 面板。在面板中需指定以下信息: + +* **代码片段名称**:指定代码片段的名称。名称可由英文字母、数字和下划线组成,长度不超过 60 字符,必填项。 + + + +* **代码片段类型**:选择代码的类型。支持选择 **常规** 、 **DML** 、 **DDL** 和 **流程控制语句** 等类型,默认为 **常规** 类型。 + + + +* **代码片段**:在 **代码片段** 标签下的编辑框中输入代码片段的具体代码内容,长度不能超过 2000 字符,必填项。与 SQL 窗口类似,编辑区的工具栏中还提供了格式化、查找/替换、撤销、重做、大小写、缩进和注释等工具,且提供代码高亮和联想等功能。 + + + +* **代码片段描述**:对代码片段内容的补充说明,长度不能超过 200 个字符,非必填项。 + + > **说明**
              + > 代码片段描述中,如有描述则展示描述的内容,如无内容则会展示代码片段中具体内容的前 30 个字符。 + + ![Image 224](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8764861361/p242637.png) + +引用代码片段 +--------------------------- + +创建好的代码片段除了供您在编辑脚本的时候查看代码的具体内容外,还支持直接将内容直接引用进脚本。引用代码片段有以下三种方法: + +* 方法一:您可以直接将列表中的卡片拖拽进编辑区中,该代码片段指定的代码内容将被粘贴进编辑区。 + + + +* 方法二:在目标代码片段的卡片上,单击卡片右下角的复制图标以复制代码内容,在编辑区中通过快捷键 Ctrl+V 或 Cmd + V 将代码内容粘贴进编辑区。 + + + +* 方法三:SQL 窗口的编辑区支持代码联想功能,当您在编辑区中编辑脚本时,创建好的代码片段会出现在代码联想的提示窗中,您可以通过代码联想的提示查看和引用代码片段。 + + + + + + +管理代码片段 +--------------------------- + +自定义的代码片段提供 **编辑** 和 **删除** 两个管理操作,您无法对内置的代码片段进行管理。 + +* **编辑** :单击目标代码卡片右上角的管理图标(···)在弹出的列表中单击 **编辑** 按钮进入 **编辑代码片段** 面板。面板中展示新建代码片段时指定的 **代码片段名称** 、 **代码片段类型** 、 **代码片段** 和 **代码片段描述** 等信息,可按需进行修改。 + + + +* **删除** :单击目标代码卡片右上角的管理图标(···)在弹出的列表中单击 **删除** 按钮以删除当前代码片段。 + + + + + diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md new file mode 100644 index 00000000..07cf819d --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md @@ -0,0 +1,19 @@ +概述 +======================= + +为了让数据库开发者更方便的维护数据库内的数据,OceanBase 开发者中心(OceanBase Developer Center,ODC)提供整库导入导出和单表导入导出功能。通过整库导入导出用户可以批量选择数据库中的表以导入或导出其中的数据,通过单表导入导出,用户可以导入导出目标表中的数据和结构。 + +创建导入或导出任务后,ODC 提供导入导出任务页签功能。页签中会显示当前的导入或导出任务列表,您还可以查看目标任务的任务详情和日志等信息。 +> **注意**
              +>
            • OceanBase V2.2.30 版本之前仅支持字符编码 UTF8。
            • +>
            • 在 ODC V2.2.1 及之前的低版本中使用导入导出功能时必须通过 OBProxy 连接至目标实例,直连时 ODC 不支持导入导出功能。
            • +>
            • ODC V2.4.1 版本后,您可以选择配置 sys 租户账号以提升导出导入速度。同时,导出时如果勾选了表和视图之外的其它对象,必须配置该项以使用 sys 租户账号进行导出。
            • + + +本章节将分篇介绍以下导入导出的相关功能: + +* [导出导入格式](../../../6.web-odc-user-guide/1.web-odc-data-export-and-import/1.web-odc-data-export-and-import-overview.md) + +* [批量导出与导入](../1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md) + +* [单表导出与导入](6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-single-table-export-and-import.md) diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md new file mode 100644 index 00000000..cef464ae --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md @@ -0,0 +1,26 @@ +导出导入格式 +=========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)数据导出与导入支持导出的内容有导出结构和数据、仅导出数据和仅导出结构等三种模式。其中结构是指被导出对象的结构定义(DDL)文件,数据是对象中实际保存的数据文件。根据您选择的导出导入格式不同,其中结构和数据文件的类型也不同。 + +目前 ODC 支持的数据导出格式有 SQL 格式和 CSV 格式,支持的导入文件格式有 ZIP 压缩文件、SQL 文件(批量导入)和 CSV 文件(单表导入)。 + +导出文件格式 +--------------------------- + +ODC 导出工具会将导出数据到以 .zip 结尾的压缩文件包中,压缩包中包含元数据文件 MANIFEST.bin 和 Schema 下导入导出对象的结构定义文件和数据文件。 + +创建导出任务时,如果您指定 **数据格式** 为 **SQL 格式** ,那文件包中的结构定义文件是以 `对象名-schema.sql` 命名的 SQL 文本,数据文件是以 `对象名.sql` 命名的 SQL 文本,其中对象名与数据库实际对象名保持一致。![Image 445](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2671938161/p263147.png) + +如果您指定 **数据格式** 为 **CSV 格式** ,那文件包中的结构定义文件是以 `对象名-schema.sql` 命名的 SQL 文本,数据文件是以 `对象名.csv` 命名的 CSV 文本,其中对象名与数据库实际对象名保持一致。![Image 444](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3671938161/p263148.png) + +导入文件格式 +--------------------------- + +ODC 导入工具支持导入 ZIP 压缩文件(批量导入和单表导入)、SQL 文件(批量导入)和 CSV 文件(单表导入)。 + +其中,ZIP 压缩文件是以 .zip 结尾的压缩包。创建导入任务时在面板中的 **导入内容** 项中选择了 **ZIP 压缩文件** 后还需在 **数据格式** 项中选择压缩包中的数据格式是 **CSV 格式** 或 **SQL 格式** 。对应数据格式的导入压缩文件内容可参考 **使用工具** > **数据导出和导入** > **导出文件格式** 中导出 CSV 格式和 SQL 格式数据所产生的压缩包内容。 + +批量导入时支持导入 SQL 文件,SQL 文件是以 .sql 结尾包含可直接在数据库中执行的 `SELECT`、`INSERT`、`UPDATE`、`DELETE`、`CREATE` 和 `DROP` 语句的文件。 + +单表导入时支持导入 CSV 文件,CSV 文件是 .csv 或 .txt 结尾的支持自定义分割符的数据文件。 diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md new file mode 100644 index 00000000..8c515bb9 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md @@ -0,0 +1,265 @@ +# 批量导出与导入 + + + + +## 概述 + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持批量导出和导入数据库对象的结构和数据。 + +进入数据库连接后,单击顶部导航栏中的 **工具** 标签,在弹出的下拉菜单中单击 **导出** 或 **导入** 标签进入导出设置与导入设置面板。 + +OceanBase 开发者中心(ODC)对导出与导入数据大小和保留时间的要求如下: + +| 要求 | 说明 | +|------------------------|------------| +| Web ODC 对导入与导出的数据大小有限制 |
            • 对导入上传的文件,最大支持导出 2GB 的数据(压缩后),超出部分无法上传。如需导入大量数据,请使用导数工具 [OBLOADER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610772)。
            • 对导出的数据,最大支持导出 2GB 的数据(压缩前),超出部分无法导出。如需导出大量数据,请使用导数工具 [OBDUMPER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610778)。
            • | +| 服务器上文件保留时间 |
            • 任务的状态(成功,失败,取消等)不影响文件的生命周期。
            • 任务永久保留,任务相关的文件默认保留 14 天。
            • | + + + +## 批量导出 + + +在 **新建导出** 面板中,可以选择同时导出多个对象到指定格式的文件中。 + +![export1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export1.png) + + + +以在 ODC 中批量导出员工表(employee)和视图(salary)为例。具体操作步骤如下: + +### 步骤 1:选择 **导出内容** + +如上图所示,ODC 目前支持 **导出结构和数据** 、 **仅导出数据** 和 **仅导出结构** 三种方式。其中导出结构是指导出目标对象的定义语句。可在 **导出内容** 标签下的选择框中选择导出的内容。 + +### 步骤 2:选择所属库 + +选择导出对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 3:选择导出范围 + +支持选择 **部分导出** 和 **整库导出** 。 + +* 部分导出:在 **导出对象** 的 **选择对象** 窗口中勾选需要导出的对象。支持使用搜索框直接进行搜索对象。 + + + +* 整库导出:导出当前库中的所有对象。 + + + + + + +### 步骤 4:进入导出设置面板 + +单击 **下一步:导出设置** 对导出的文件和 sys 租户账号进行设置。 + +### 步骤 5:设置数据文件 + +![export2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export2.png) + +1. 选择 **数据格式** 。 + + ODC 目前支持将数据导出为 **CSV 格式** 和 **SQL 格式**。当 **导出内容** 为 **仅导出结构** 时,只支持导出数据为 SQL 格式。具体格式信息,请参见 [导出导入格式](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md)。 + + +2. 选择 **文件编码** 。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + + +3. 选择 **数据脱敏** 。 + + 默认不脱敏,支持选择和管理脱敏策略名称。 **管理脱敏策略** 中,支持添加/编辑/删除策略名称。具体请参见 [数据脱敏管理](../../4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md)。 + + +4. 进行 **数据文件设置。** + + 当 **导出内容** 为仅导出结构时无需进行导出数据设置,该项包含以下设置项: + + * **使用全局快照** :勾选该项后 ODC 将导出全局中指定表的最新快照点中的数据,勾选该项可以保证全局数据的一致性。 + + + + * **批量提交数量** (SQL 格式):单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。选择 **数据格式** 为 SQL 格式时,通过指定批量提交数量,可在导出文件中导出指定数量数据时添加一句 `COMMIT` 命令。 + + + + * 指定 CSV 格式信息。当 **数据格式** 为 CSV 格式且 **导出内容** 为导出结构和数据时,可指定以下信息: + + * **包含列头** :该项默认勾选,选择导出数据为 CSV 格式时是否包含列头。 + + + + * **空字符串转为空值** :该项默认勾选,选择导出数据为 CSV 格式时是否将表中的空字符串转换为空值 \\N。 + + + + * **字段分隔符** :设置字段间的分隔符。支持选择 **,** (逗号)、 **;** (分号)和 **:** (冒号)作为字段分割符。同时支持自定义一个字符长度的字符作为分隔符。 + + + + * **文本识别符** :设置文本内容的识别符。支持选择 **'** (单引号)和 **"** (双引号)作为文本识别符。 + + + + * **换行符号** :设置换行符。支持选择 **\\n** 、 **\\r** 和 **\\r\\n** 作为换行符。 + + + + + + + + + + + + +### 步骤 6: **设置结构** 文件 + +在该项下选择是否在 **Create 语句前添加 Drop 语句** 。勾选该项后,在导出对象结构文件时,在对象的 `CREATE` 语句前均会添加对应的 `DROP` 语句。 + +### 步骤 7:设置任务执行方式 + +在该项下选择 **立即执行** / **定时执行** 。 + +### 步骤 8:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + +**注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
              + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + + - 如未配置 **sys** 租户账号,会导致导入导出缺少索引。 + + + + + +### 步骤 9:保留当前配置 + +勾选 **保留当前配置**,保留当前部分数据文件和结构文件配置。 + +### 步骤 10:生成导出任务 + +指定所有信息后,单击面板右下角的 **导出** 按钮以生成导出任务。 + +### 步骤 11:查看导出任务 + +![export3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export3.png) + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。详情请参见 [导出任务](../../../6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md)。 + +## 批量导入 + + +在 **新建导入** 面板中,可以选择同时导入结构和数据到多个数据库对象中。 + +![import1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import1.png) + + + +以在 ODC 中批量导入 ZIP 压缩文件(6000219_import_file)为例,其中包含员工表(employee)和视图(salary)。具体操作步骤如下: + +### 步骤 1:选择导入文件格式 + +如上图所示,ODC 目前支持批量导入 **CSV 文件** 、 **SQL 文件** 和 **ZIP 压缩文件** 。可在 **导入文件格式** 标签下的下拉框中选择需要的文件格式。具体格式信息,请参见 [导出导入格式](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md)。 + +### 步骤 2:上传导入文件 + +单击文件池进入文件资源管理器以选择需要导入的文件,或者直接将文件拖入文件池中以完成文件上传。上传的文件格式需要与所选择的导入文件格式相同,ZIP 压缩文件支持上传 .zip 结尾的文件、SQL 文件支持上传 .sql 文件以及 CSV 文件支持上传 .csv 文件。 + +### 步骤 3:选择文件编码 + +ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + +### 步骤 4:进入导入设置面板 + +单击 **下一步:导入设置** 对导入的文件和 sys 租户账号进行设置。 + +### 步骤 5:选择导入内容 + +![import2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import2.png) + +当 **导入格式** 为 ZIP 压缩文件时需指定该项。ODC 目前支持 **仅导入数据** 、 **仅导入结构** 和 **导入数据和结构** 三种方式 **。** 其中导入结构指是否要导入对象的定义语句。可在 **导入内容** 标签下的选择框中选择需要导入的内容。 + +### 步骤 6:选择所属库 + +选择导入对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 7: 设置导入数据 + +当 **导入格式** 为 ZIP 压缩文件且 **导入内容** 不为仅导入结构时需设置导入数据。该项包含以下设置项: + +* **导入前清空数据** :勾选该项后,导入数据时将首先清空目标对象中原有的数据。 + + + +* **批量提交数量** :单击 **导入数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。通过指定批量提交数量,可在导入文件中导入指定数量数据时添加一句 `COMMIT` 命令。 + + + +* **不导入的数据类型** (可选):可以通过该项指定导入数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + + + + + + +### 步骤 8: **设置导入结构** + +当 **导入内容** 为仅导入数据时,该项不可被指定。在该项下选择当对象结构已存在时的操作。选择 **跳过** 操作则在导入时跳过导入文件中的结构定义语句直接导入数据,该项会保留对象中的原数据。选择 **替换** 操作时则执行导入文件中的结构定义语句以重新创建并替换原对象,该项会清空对象中的原数据。 + +### 步骤 9:设置 **任务错误处理** 和执行方式 + +* ODC 提供 **停止任务** 和 **忽略错误继续任务** 两种错误处理方式。需要在 **任务错误处理** 标签下选择需要的处理方式。 + + + +* 支持选择 **立即执行** / **定时执行** 。 + + + + + + +### 步骤 10:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + **注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
              + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + + - 如未配置 **sys** 租户账号,会导致导入导出缺注释和索引。 + + + + +### 步骤 11:保留当前配置 + +勾选 **保留当前配置**,保留当前部分数据文件和结构文件配置。 + +### 步骤 12:生成导入任务 + +指定所有信息后,单击面板右下角的 **提交** 按钮以生成导入任务。 + +### 步骤 13:查看导入任务 + +![import3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import3.png) + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息,详情请参见 [导入任务](../../../6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md)。 + diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md new file mode 100644 index 00000000..a0419820 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md @@ -0,0 +1,221 @@ +# 单表导出与导入 + + + + +## 概述 + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持对指定表导出和导入结构和数据。 + +进入数据库连接后,左导航栏中单击对象标签查看对象列表,在对象列表中右键目标对象名或者在顶部导航栏中单击 **工具** ,在弹出的列表中您可以选择使用 **导出** 或 **导入** 功能以导出或导入当前表中的数据和结构。 + +OceanBase 开发者中心(ODC)对导出与导入数据大小和保留时间的要求如下: + + +| 要求 | 说明 | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Web ODC 对导入与导出的数据大小有限制 |
            • 对导入上传的文件,最大支持导出 2GB 的数据(压缩后),超出部分无法上传。如需导入大量数据,请使用导数工具 [OBLOADER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610772)。
            • 对导出的数据,最大支持导出 2GB 的数据(压缩前),超出部分无法导出。如需导出大量数据,请使用导数工具 [OBDUMPER](https://www.oceanbase.com/docs/enterprise/oceanbase-dumper-loader-cn/V3.2.0/10000000000610778)。
            • | +| 服务器上文件保留时间 |
            • 任务的状态(成功,失败,取消等)不影响文件的生命周期。
            • 任务永久保留,任务相关的文件默认保留 14 天。
            • | + + + +## 单表导出 + + +![export1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/export1.png) + + + +单表导出的操作与 [批量导出](../1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md) 的操作基本一致。以在 ODC 中导出员工表(employee)为例。具体操作步骤如下: + +### 步骤 1:选择导出内容 + +如上图所示,ODC 目前支持 **导出结构和数据** 、 **仅导出数据** 和 **仅导出结构** 三种方式 **。** 其中导出结构是指导出目标对象的定义语句。可在 **导出内容** 标签下的选择框中选择导出的内容。 + +### 步骤 2:选择所属库 + +选择导出对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 3:选择导出范围 + +默认导出当前表,支持选择 **部分导出** 和 **整库导出** 。 + +* 部分导出:在 **导出对象** 的 **选择对象** 窗口中勾选需要导出的对象。支持使用搜索框直接进行搜索对象。 +* 整库导出:导出当前库中的所有对象。 + +### 步骤 4:进入导出设置面板 + +单击 **下一步:导出设置** 对导出的文件和 sys 租户账号进行设置。 + +### 步骤 5:设置数据文件 + +![export2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/export2.png) + +1. 选择 **数据格式** 。 + + ODC 目前支持将数据导出为 **CSV 格式** 和 **SQL 格式** 。当 **导出内容** 为 **仅导出结构** 时,只支持导出数据为 SQL 格式。具体格式信息,请参见 [导出导入格式](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md)。 + + +2. 选择 **文件编码** 。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + + +3. 选择 **数据脱敏** 。 + + 默认不脱敏,支持选择和管理脱敏策略名称。 **管理脱敏策略** 中,支持添加/编辑/删除策略名称。具体请参见 [数据脱敏管理](../../4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md)。 + + +4. 进行 **数据文件设置。** + + 当 **导出内容** 为仅导出结构时无需进行导出数据设置,该项包含以下设置项: + * **使用全局快照** :勾选该项后 ODC 将导出全局中指定表的最新快照点中的数据,勾选该项可以保证全局数据的一致性。 + * **批量提交数量** (SQL 格式):单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。选择 **数据格式** 为 SQL 格式时,通过指定批量提交数量,可在导出文件中导出指定数量数据时添加一句 `COMMIT` 命令。 + * 指定 CSV 格式信息。当 **数据格式** 为 CSV 格式且 **导出内容** 为导出结构和数据时,可指定以下信息: + + * **包含列头** :该项默认勾选,选择导出数据为 CSV 格式时是否包含列头。 + * **空字符串转为空值** :该项默认勾选,选择导出数据为 CSV 格式时是否将表中的空字符串转换为空值 \\N。 + * **字段分隔符** :设置字段间的分隔符。支持选择 **,** (逗号)、 **;** (分号)和 **:** (冒号)作为字段分割符。同时支持自定义一个字符长度的字符作为分隔符。 + * **文本识别符** :设置文本内容的识别符。支持选择 **'** (单引号)和 **"** (双引号)作为文本识别符。 + * **换行符号** :设置换行符。支持选择 **\\n** 、 **\\r** 和 **\\r\\n** 作为换行符。 + +### 步骤 6:设置结构文件 + +在该项下选择是否在 **Create 语句前添加 Drop 语句** 。勾选该项后,在导出对象结构文件时,在对象的 `CREATE` 语句前均会添加对应的 `DROP` 语句。 + +### 步骤 7:设置任务执行方式 + +在该项下选择 **立即执行** / **定时执行** 。 + +### 步骤 8:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + **注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
              + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + + - 如未配置 **sys** 租户账号,会导致导入导出缺少索引。 + +### 步骤 9:保留当前配置 + +勾选 **保留当前配置**,保留当前部分数据文件和结构文件配置。 + + +### 步骤 10:生成导出任务 + +指定所有信息后,单击面板右下角的 **导出** 按钮以生成导出任务。 + +### 步骤 11:查看导出任务 + +![export3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/export3.png) + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。详情请参见 [导出任务](../../../6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md)。 + +## 单表导入 + + +![import1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/import1.png) + + + +以在 ODC 中导入 ZIP 压缩文件(6000219_import_file)为例,其中包含员工表(employee)。具体操作步骤如下: + +### 步骤 1:选择导入文件格式 + +如上图所示,ODC 目前支持导入 **CSV 文件** 和 **ZIP 压缩文件** 。可在 **导入文件格式** 标签下的下拉框中选择需要的文件格式。具体格式信息,请参见 [导出导入格式](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/2.web-odc-export-and-import-formats.md)。 + +### 步骤 2:上传导入文件 + +单击文件池进入文件资源管理器以选择需要导入的文件,或者直接将文件拖入文件池中以完成文件上传。上传的文件格式需要与所选择的导入文件格式相同,ZIP 压缩文件支持上传 .zip 结尾的文件、CSV 文件支持上传 .csv 文件。 + +> **说明** +> 支持上传单表或者多表。 + +### 步骤 3:选择文件编码 + +ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + +### 步骤 4:进入导入设置面板 + +单击 **下一步:导入设置** 对导入的文件和 sys 租户账号进行设置。 + +### 步骤 5:选择导入内容 + +![import2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/import2.png) + +当 **导入格式** 为 ZIP 压缩文件时需指定该项。ODC 目前支持 **仅导入数据** 、 **仅导入结构** 和 **导入数据和结构** 三种方式 **。** 其中导入结构指是否要导入对象的定义语句。可在 **导入内容** 标签下的选择框中选择需要导入的内容。 + +### 步骤 6:选择所属库 + +选择导入对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 7:导入目标表 + +默认导入当前表,如果导入多表,支持选择需要导入的表。 + +### 步骤 8:设置导入数据 + +当 **导入格式** 为 ZIP 压缩文件且 **导入内容** 不为仅导入结构时需设置导入数据。该项包含以下设置项: + +* **导入前清空数据** :勾选该项后,导入数据时将首先清空目标对象中原有的数据。 + + + +* **批量提交数量** :单击 **导入数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。通过指定批量提交数量,可在导入文件中导入指定数量数据时添加一句 `COMMIT` 命令。 + + + +* **不导入的数据类型** (可选):可以通过该项指定导入数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + + + + + + +### 步骤 9: 设置导入结构 + +当 **导入内容** 为仅导入数据时,该项不可被指定。在该项下选择当对象结构已存在时的操作。选择 **跳过** 操作则在导入时跳过导入文件中的结构定义语句直接导入数据,该项会保留对象中的原数据。选择 **替换** 操作时则执行导入文件中的结构定义语句以重新创建并替换原对象,该项会清空对象中的原数据。 + +### 步骤 10:设置任务错误处理和执行方式 + +* ODC 提供 **停止任务** 和 **忽略错误继续任务** 两种错误处理方式。需要在 **任务错误处理** 标签下选择需要的处理方式。 +* 支持选择 **立即执行** / **定时执行** 。 + + + + + + +### 步骤 11:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + **注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
              + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + + - 如未配置 **sys** 租户账号,会导致导入导出缺注释和索引。 + +### 步骤 12:保留当前配置 + +勾选 **保留当前配置**,保留当前部分数据文件和结构文件配置。 + +### 步骤 13:生成导入任务 + +指定所有信息后,单击面板右下角的 **提交** 按钮以生成导入任务。 + +### 步骤 14:查看导入任务 + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息,详情请参见 [导入任务](../../../6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md)。 + +![import3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/single%20export%20and%20import/import3.png) diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/2.web-odc-data-mocking.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/2.web-odc-data-mocking.md new file mode 100644 index 00000000..1e0db4c0 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/2.web-odc-data-mocking.md @@ -0,0 +1,75 @@ +模拟数据 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)提供模拟数据功能供您在测试数据库性能或者验证功能等需要大量模拟数据的场景下,能够快速根据表中的字段类型生成数据。 + +![Image 171](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/1175437461/p240476.png) + +使用模拟数据功能生成数据的步骤如下: + +1. 进入 **模拟数据** 面板。 + + 进入 ODC 单击目标连接进入对应的数据库对象管理页面后,单击上方导航栏中的 **工具** 标签,在弹出的下拉菜单中选择 **模拟数据** 以弹出 **模拟数据** 面板。 + + +2. 查看 **所属连接** 。 + + 显示目标任务所在的数据库连接名称。 + + +3. 指定 **所属库** 。 + + 选择需变更的数据库。 + + +4. 指定生成数据的表。 + + 在模拟数据面板的 **表** 标签下的下拉列表中选择要在其中生成数据的表。下拉列表中会展示当前实例中所有存在的表。 + + +5. 指定生成的数据量。 + + 在模拟数据面板的 **模拟生成数据量** 标签下的文本框中输入您需要生成的数据量。默认会生成 1000 条数据,最多生成不超过 1000000 行数据,所以您可以在文本框中输入 1\~1000000 间的任意正整数。 + + +6. 指定批量处理数据的大小。 + + 在模拟数据面板的 **批处理大小** 标签下的文本框中指定每生成多少条数据进行一次提交(`COMMIT` 命令)操作。默认每生成 200 条数据进行一次提交,最大不超过 500 条,所以您可以在文本框中输入 1\~500 间的任意正整数。 + + +7. 选择在表中插入模拟数据时是否清空表。 + + 在模拟数据面板的 **插入模拟数据清空表** 标签下的单选列表中选择当在表中插入模拟数据时是否清空表中原有的数据。 + + +8. 选择数据冲突处理方式。 + + 在模拟数据面板的 **数据冲突处理方式** 标签下的单选列表中选择当生成的数据有冲突时处理的方式。ODC 提供以下处理方式: + * **忽略** :默认为忽略,若数据有冲突则冲突数据不被插入。 + + + + * **覆盖** :若数据有冲突则删除原数据插入新数据。 + + + + * **终止** :若数据有冲突则停止生成数据终止整个模拟数据任务。 + + + + + + +9. 设置数据生成规则。 + + 在模拟数据面板的 **规则设置** 标签下的表格会根据您在第 2 步选择的表展示表的 **字段名称** 和 **字段类型** 信息。您可以在 **规则** 和 **细则** 列中针对目标字段设置模拟数据生成的规则。 其中 **规则** 列中会根据字段类型提供一些内置的对应规则,您可以按需进行选择。 **细则** 列会根据您选择的规则展示具体的规则信息,您可以单击细则信息后的编辑图标对细则信息进行修改。 + + +10. 提交信息,生成模拟数据任务。 + + 单击模拟数据面板右下角的 **提交** 按钮生成模拟数据任务。您可以在 **任务中心** 面板查看任务详情,详情请参见 [模拟数据任务](../../6.web-odc-user-guide/9.web-odc-task-management/4.web-odc-data-mocking-tasks.md)。 + + + + + diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md new file mode 100644 index 00000000..108b1068 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md @@ -0,0 +1,43 @@ +# 分区计划 + +## 背景信息 + +- **RANGE 分区**:基于属于一个给定连续区间的列值,将多行分配给分区。范围必须是有序的、连续的和不重叠的。详情请参见 [设置分区规则](../11.web-odc-database-objects/1.web-odc-table-objects/2.web-odc-create-a-table.md)。 + +- **分区计划**:在 RANGE 分区表中插入数据时,如果插入的数据超出当前分区的区间上限值,将无法插入数据并且会返回错误。分区计划是专门针对 Range 分区的扩展功能,ODC 支持依据用户设置的分区策略对 Range 分区表进行自动管理,用户无需手动创建新分区,以方便维护 RANGE 分区表。 + + 本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上使用分区计划,包括对新建和删除的表分区进行自动管理。 + +## 新建分区计划 + +1. 登录 ODC 后,单击目标连接进入对应的数据库对象管理页面。 + +2. 在顶部导航栏中,选择 **工具** > **分区计划**, 以弹出 **新建分区计划** 面板。 + + + ![分区计划1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-1.png) + +3. 在 **新建分区计划** 面板中指定以下信息。 + + ![分区计划2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-2.png) + + | **信息项** | **说明** | + |---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属连接 | 选择创建分区计划所属连接。默认为当前连接。 | + | 分区策略 | 搜索和勾选所属库中的 Range 分区表,并编辑对应的分区策略。
              • 勾选 **分区策略** 右侧的 **仅显示未设置的表** 时,支持过滤未设置的表。
              • 勾选 Range 分区表时,支持批量设置分区策略。
              • 在 **分区策略** 项下,单击编辑图标,支持编辑预创建分区数量、分区间隔、保留时长和命名规则等。
                • **预创建分区数量**:设置将要创建的分区数量。
                • **分区间隔**:支持根据所设置的分区时间间隔创建分区,单位:日/月/年。
                • **保留时长**:超过保留时长后,创建的分区将被自动清理,单位:日/月/年。
                  示例:预创建分区数量 1,分区间隔 1 月,保留时长 1 月,表示对当前表预创建 1 个分区,每隔 1 个月会创建 1 个分区,且超过 1 个月后所创建的分区会被自动清理。
                  ![edit](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-edit-3.png)
              | + | 备注 | 描述项目的业务背景信息,例如变更目的、预期目标等。 | + +4. 指定上述信息后,单击面板右下角的 **提交** 按钮完成创建分区计划任务。 + +5. 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务状态和任务信息。详情请参见 [分区计划任务](../9.web-odc-task-management/9.web-odc-sql-plan-task.md)。 + + ![分区计划3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-3.png) + + +**相关信息** +------------------------- + +* [任务流程管理](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md) + + +* [分区计划任务](../9.web-odc-task-management/9.web-odc-sql-plan-task.md) \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/4.web-odc-database-change.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/4.web-odc-database-change.md new file mode 100644 index 00000000..52061e0d --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/4.web-odc-database-change.md @@ -0,0 +1,108 @@ +数据库变更 +========================== + + + +概述 +----------------------- + +OceanBase 开发者中心(OceanBase Developer Center,ODC)SQL 窗口中的语句是同步执行的,当语句运行时间过长时可能会出现执行超时的问题。可使用数据库变更工具来运行耗时较高的 SQL 语句以避免语句执行超时。 + +![Image 441](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8492996461/p293273.png) + +操作步骤 +------------------------- + +新建数据库变更的步骤如下: + +1. 进入 **数据库变更** 面板。 + + 1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面; + + + + 2. 单击顶部导航栏中的 **工具** 标签; + + + + 3. 在弹出的下拉菜单中选择 **数据库变更** 以弹出 **新建数据库变更** 面板。 + + + + + + +2. 查看 **所属连接** (当前连接,不可切换)。 + + + +3. 选择 **所属库** (默认显示当前库)。 + + + +4. 指定 **SQL 内容** 。 + + 数据库变更支持两种指定 SQL 内容的方式: + * **SQL 录入** :SQL 录入为默认方式,可在编辑区中直接录入 SQL 脚本。 + + > **说明**
              + > 单击 **IN 值转化** 按钮,可将批量复制的数据转化成 in('A','B')格式。
              + > 列值分隔符号为换行符;行值分隔符为空格或 TAB 值。 + + * **上传附件** :选择上传附件方式后,单击文件池进入文件资源管理器选择要导入的文件或者直接将导入文件拖入文件池中以完成文件上传。 + + > **说明**
              + > - 最多支持上传 500 个文件,总文件大小不超过不超过 256 MB。
              + > - 默认附件按上传的先后排序,可拖拽改变顺序,任务执行时按文件顺序执行。
              + > - 当前只支持上传 .sql 后缀的 SQL 文件。 + + + +5. 指定 **回滚方案** 。 + + 回滚方案支持 SQL 文本录入及上传附件方式,具体参见"指定 SQL 内容"步骤。 + + +6. **分隔符** :支持 delimiter 分隔符号。 + + + +7. **查询结果限制** :支持设置查询结果限制 (1-100w)。 + + + +8. 指定 **任务错误处理** 方式。 + + 异步执行工具提供两种任务错误处理方式: + * **停止任务** :停止任务为默认方式,运行脚本的过程中出现错误时会停止运行。 + + + + * **忽略错误继续任务** :选择忽略错误继续任务方式,在运行脚本出现错后将跳过错误语句继续执行。 + + + + + + +9. 指定 **执行超时时间** 。 + + 在 **执行超时时间** 文本框中输入数字指定语句执行超时时间,单位为小时(默认超时时间为 48 小时,最大不超过 480 小时)。 + + +10. 指定 **任务描述** (选填)。 + + 可在 **任务描述** 文本框中输入不超过 200 个字符的描述信息,该项为选填项。 + + +11. 生成数据库变更任务。 + + 在面板中完成上述信息的指定后,单击右下角的 **新建** 按钮以提交信息生成数据库变更任务。 + + +12. 新建完成后,会自动转入 **任务中心** ![符号](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8089948361/p363595.jpg) **数据库变更** 页面,可单击 **查看** 按钮,在任务详情页面查看 **任务信息** 、 **执行结果** 和 **任务日志** 。 + + + + + diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/5.web-odc-shadow-table-synchronization.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/5.web-odc-shadow-table-synchronization.md new file mode 100644 index 00000000..87df55f2 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/5.web-odc-shadow-table-synchronization.md @@ -0,0 +1,64 @@ +# 影子表同步 + +## 背景信息 + +ODC 的影子表同步功能支持根据源表的表结构自动在当前库中创建影子表(表名是在源表名上增加前缀或后缀的方式生成),适用于全链路压测等场景。 + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上新建影子表同步。 +> **说明** +>
            • ODC V4.0.0 版本的影子表同步功能仅支持 MySQL 模式,且如果源表中包含二级分区,仅支持 HASH/KEY 的二级模板分区。
            • +>
            • 影子表创建完成后,可以在表对象列表中查看创建的影子表。
            • +>
            • 创建影子表时,如果表名已存在但表结构不同,则会生成同步 SQL 语句,更新影子表结构。
            • + + +## 新建影子表同步 + +1. 登录 ODC 后,单击目标连接进入对应的数据库对象管理页面。 + + +2. 在顶部导航栏中,选择 **工具** > **影子表同步**, 以弹出 **新建影子表同步** 面板。 + + ![影子表同步-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5-1.png) + +3. 在 **新建影子表同步** 面板中指定以下信息。 + + 1. 选择对象。 + + ![影子表同步-新建1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5-%E6%96%B0%E5%BB%BA2.png) + + + | **信息项** | **说明** | + |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属库 | 选择创建影子表的所属库并可查看当前连接名。 | + | 同步范围 | 选择需要同步的表:
              • **部分表** :选定的表在当前库中创建影子表。
              • **全部表**:来源库中所有的表都会在当前库中创建影子表。
              | + | 影子表名 | 支持以" **前缀** +源表名"或"源表名+ **后缀** "的格式创建影子表名,并且支持自定义前、后缀。 | + | 同步对象 | 同步部分表时,需在 **同步对象** 中选择源表以同步为影子表。 | + + + 2. 同步影子表结构分析。 + + ![影子表同步-新建2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5-%E6%96%B0%E5%BB%BA3.png) + + + | **信息项** | **说明** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 同步的表 | **同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **查看** 支持查看源表结构、影子表结构和结构变更 SQL 语句,单击 **跳过** 支持不同步该影子表。 | + | 不同步的表 | **不同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **取消跳过** 支持同步该影子表。
              **说明**
              选择跳过同步的表,会显示在 **不同步的表** 页签中。
              如果影子表名已存在且结构与源表一致,则会自动跳过同步表结构。
              | + | SQL 预览 | 显示同步表结构的 SQL 语句。 | + | 任务设置 | 选择审批完成后的 **执行方式** 。
              • **立即同步** :立即执行同步任务。
              • **定时同步** :定时执行同步任务。
              | + | 任务设置 | 选择 **任务错误处理** 方式。
              • **停止任务** :在执行过程中,遇到出错则中断后面的 SQL 脚本,不再执行。
              • **忽略错误继续执行** :在执行过程中,跳过当前出错的 SQL 脚本继续执行,并执行完所有 SQL 脚本。
              | + | 备注 | 描述项目的业务背景信息,例如变更目的、预期目标等。 | + +4. 指定上述信息后,单击面板右下角的 **提交** 按钮完成创建影子表同步任务。 + + +5. 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务状态和任务信息。详情请参见 [影子表同步任务](../../6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization.md)。 + + ![影子表同步-审批任务3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5-4.png) + + +## 相关信息 + +* [任务流程管理](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md) + +* [影子表同步任务](../../6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-shadow-table-synchronization-task.md) diff --git a/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-sql-plan.md b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-sql-plan.md new file mode 100644 index 00000000..51732523 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-sql-plan.md @@ -0,0 +1,43 @@ +# SQL 计划 + + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持定时周期性执行用户创建的 SQL 脚本,以满足周期性执行用户所需的数据库开发和运维任务,例如周期性执行存储过程、备份和做库表结构同步等。 + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上使用 SQL 计划,以根据设置的时间周期执行创建的 SQL 脚本。 + +## 新建 SQL 计划任务 + +1. 登录 ODC 后,单击目标连接进入对应的数据库对象管理页面。 + +2. 在顶部导航栏中,单击 **工具** > **SQL 计划** 。 + + +3. 在弹出的 **新建 SQL 计划** 面板中,输入以下信息。 + + ![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/sql%20plan/1.png) + +| **信息项** | **说明** | + |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | SQL 内容 | 支持两种指定 SQL 内容的方式:
              • **SQL 录入** :SQL 录入为默认方式,可在编辑区中直接录入 SQL 脚本。
              • 在 SQL 录入中,默认最大允许输入 10MB 个字符,如超限可上传附件。
              • 单击 **IN 值转化** 按钮,可将批量复制的数据转化成 in('A','B')格式。
              • 列值分隔符号为换行符。
              • 行值分隔符为空格或 TAB 值。
              • **上传附件** :选择上传附件方式后,单击文件池进入文件资源管理器选择要导入的文件或者直接将导入文件拖入文件池中以完成文件上传。
              • 最多支持上传 500 个文件,总文件大小不超过不超过 256 MB。
              • 默认附件按上传的先后排序,可拖拽改变顺序,任务执行时按文件顺序执行。
              • 当前只支持上传 .sql 后缀的 SQL 文件。
              | + | 分隔符 | 支持 Delimiter 分隔符号。 | + | 查询结果限制 | 支持设置查询结果限制 (1-100w)。 | + | 执行超时时间 | 在 **执行超时时间** 文本框中输入数字指定语句执行超时时间,单位为小时(默认超时时间为 48 小时,最大不超过 480 小时)。 | + | 定时周期 |
              • 可直接选择每小时/每天晚上/每周五快捷设置方式。
              • 支持两种设置定时周期的模式:
                • 默认模式:可选择每天/每周/每月,设置所需的执行周期时间。
                  ![SQL 计划-定时周期默认模式4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/4.png)
                • 自定义模式:可选择秒/分/时/日/月/周,设置所需的执行周期时间。
                  ![SQL 计划-定时周期自定义模式5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/5.png)
                | + | 任务设置 |
                • 选择任务错误处理方式:
                  • 停止任务:停止任务为默认方式,运行脚本的过程中出现错误时会停止运行。
                  • 忽略错误继续任务:选择忽略错误继续任务方式,在运行脚本出现错后将跳过错误语句继续执行。
                • 选择任务执行时长超周期处理方式:
                  • 待当前任务执行完毕在新周期发起任务。
                  • 忽略当前任务状态,定期发起新任务。
                | + | 备注(可选) | 可输入不超过 200 个字符的描述信息,该项为选填项。 | +4. 指定上述信息后,单击面板右下角的 **新建** 按钮完成创建 SQL 计划任务。 + + +5. 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务状态和任务信息。详情请参见 [SQL 计划任务](../9.web-odc-task-management/9.web-odc-sql-plan-task.md) + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/sql%20plan/2.png) + + + +## 相关信息 + +* [任务流程管理](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + +* [SQL 计划任务](../9.web-odc-task-management/9.web-odc-sql-plan-task.md) diff --git a/zh-CN/6.web-odc-user-guide/7.web-odc-recycle-bin.md b/zh-CN/6.web-odc-user-guide/7.web-odc-recycle-bin.md new file mode 100644 index 00000000..9b9b2cd5 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/7.web-odc-recycle-bin.md @@ -0,0 +1,41 @@ +使用回收站 +========================== + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击目标连接名后,进入对应的数据库对象管理页面后,单击右上角的 **回收站** 标签即可进入回收站页面。 + + + +回收站旨在短暂保存被删除的数据库对象,可帮助您轻松查询和还原被删除的数据库对象。 + +原理上,回收站是一个数据字典表,用于放置已删除的数据库对象信息。此处删除系指 `DROP` 操作,`DELETE` 操作删除的数据不会进入回收站。因此被 `DROP` 操作删除的对象并没有被数据库彻底删除,此类对象仍会占用空间,您可进行 `PURGE` 操作或在 ODC 中清空回收站以彻底释放空间。 + +如图所示,回收站页面展示以下信息: +![回收站](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6479168461/p203469.png) + + +| 信息 | 说明 | +|---------|---------------------------------------------------------------------| +| 原名称 | 显示被删除的对象的名称(用户创建对象时自定义的名称)。 单击 原名称,可升序或降序。 | +| 对象名称 | 系统中为该对象命名的名称。 与原名称不同,对象名称由系统指定不会出现重复名称,可以作为对象的唯一标识。 | +| 对象类型 | 显示被删除的对象的类型。 | +| 进入回收站时间 | 显示该对象被删除的时间戳,以方便更具体的回溯被删除的对象。 | + + + +回收站页面的导航栏中同时提供以下功能键: + + +| 操作键 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 清空 | 单击![清空](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p412872.jpg),清空回收站中当前所有的被删除对象并释放空间。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新回收站中被删除对象的列表。 | +| 清除 | 单击![清除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6479168461/p412873.jpg),将当前选中的对象从回收站中立即删除并释放存储空间。 | +| 还原 | 单击![还原](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p412874.jpg),将当前选中的对象从回收站中恢复到原来的位置。 | +| 搜索 | 在搜索框中输入对象名称,搜索被删除的对象。 | +| 设置 | 单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p413502.jpg),选择是否启用回收站以及是否启用 Truncate Table。 * 启用回收站:删除的对象会送入回收站。 * 启用 Truncate Table:支持保留对象数据。 | +| 选择所有对象 | 单击复选框图标![复选框](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6479168461/p422119.jpg),选择所有对象或取消所有对象。
                ![回收站-选择所有对象](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p422121.png) | + + + + + diff --git a/zh-CN/6.web-odc-user-guide/8.web-odc-view-operation-records.md b/zh-CN/6.web-odc-user-guide/8.web-odc-view-operation-records.md new file mode 100644 index 00000000..5b9aa0d6 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/8.web-odc-view-operation-records.md @@ -0,0 +1,79 @@ +查看操作记录 +=========================== + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上查看操作事件的历史记录。 + +背景信息 +------------------------- + +通过 ODC 查看操作记录,可满足以下需求: + +* 安全合规:数据库操作记录支持的多项功能协助用户完成安全合规建设,帮助用户满足安全合规要求。 + + + +* 实时监测:数据库操作记录提供公共连接相关的业务操作记录功能。 + + + +* 事件追溯:数据库操作记录可对数据库行为进行周期性对比,帮助用户快速定位异常点和异常行为,并提供风险检索能力,帮助用户追溯风险来源,并且可根据访问来源实现数据库的关联查询和关联分析,使数据库的访问行为有效定位到具体业务工作人员。 + + + + + + +操作记录列表 +--------------------------- + +> **说明**
                +> 所有用户均支持通过此入口查看自己的操作记录。 +> 操作记录当前永久保留。 + +1. 进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,在顶部导航栏单击 **操作记录** 标签。 + + ![操作记录1](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3785078461/p411756.png) + + +2. 弹出 **操作记录** 标签。 + + ![操作记录](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3785078461/p411758.png) + * 可通过列表上方的刷新按钮![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7205818461/p420126.jpg)可刷新列表信息。 + * 通过 **执行时间** 筛选时间,可支持查看最近7天/最近15天/最近30天/最近半年以及自定义时间段查看。 + + 操作记录列表中展示并提供基本信息如下所示。 + + + | 信息项 | 说明 | + |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 事件类型 | 显示操作事件类型,包括个人设置、密码管理、连接管理、脚本管理、数据库操作、组织配置、成员管理、资源组管理、模拟数据、数据库变更、导入、导出和任务流程等。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选事件类型。 | + | 事件操作 | 显示操作事件信息。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选事件操作。 | + | 所属连接 | 显示操作所属的连接名。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p417135.jpg),可搜索所属连接。 | + | IP 来源 | 显示 IP 来源。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p417135.jpg),可搜索 IP。 | + | 执行时间 | 显示操作执行的时间。 默认操作记录列表按执行时间排序,最新的执行记录显示在最前。 单击图标![升序降序](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p420143.jpg),可升序或降序。 | + | 执行结果 | 显示执行结果,包括 **成功** 或 **失败** 。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选执行结果。 | + | 操作 | 显示 **查看** 功能键。 | + + + + + + + + + + + +查看操作记录 +--------------------------- + +在操作记录列表中,单击 **操作** 项下的 **查看** 按钮,以弹出 **记录详情** 面板。 + +![前台-操作记录-查看](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2679533561/p420132.png) + +记录详情中可查看 **事件类型** 、 **事件操作** 、 **IP 来源** 、 **执行细则** 、 **执行人** 、 **执行时间** 和 **执行结果** 信息。 + +相关信息 +------------------------- + +有关管理操作记录,请参见公共资源管控台 [操作记录管理](4.web-odc-public-resource-management/5.web-odc-operating-records.md)。 diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md new file mode 100644 index 00000000..d0b2686b --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/1.web-odc-task-management-overview.md @@ -0,0 +1,65 @@ +概述 +======================= + +使用 OceanBase 开发者中心(OceanBase Developer Center,ODC)提供的 **工具** 功能会生成对应的任务,可在 **任务中心** 新建和查看任务。 + +查看任务 +------------------------- + +可通过 ODC 首页或连接页面进入任务中心查看任务。 + +* 通过 ODC 首页查看:在 ODC 首页的顶部导航栏,单击 **任务** **中心** 。 + + ![任务-概述](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9229808461/p415557.png) + + > **说明**
                + >
              • 从 ODC 首页进入的任务中心,不支持新建任务。
              • + >
              • 图标![消息](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9229808461/p420517.jpg)表示待处理的任务数量。
              • + + + + + + + +* 通过连接页面查看:登录 ODC 进入目标连接后,单击顶部导航栏中的 **任务中心** 按钮会弹出 **任务中心** 面板,在面板中可查看对应任务的详细信息。 + + ![任务-概述2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8608448461/p415558.png) + + ![任务入口-连接内2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8608448461/p423438.png) + + + + + +支持功能 +------------------------- + +ODC 任务管理支持如下功能: + +* [导入任务](../9.web-odc-task-management/2.web-odc-import-tasks.md) + + + +* [导出任务](../9.web-odc-task-management/3.web-odc-export-tasks.md) + + + +* [模拟数据任务](../9.web-odc-task-management/4.web-odc-data-mocking-tasks.md) + + + +* [数据库变更任务](../9.web-odc-task-management/5.web-odc-database-change-task.md) + + +* [权限申请](../9.web-odc-task-management/6.web-odc-apply-for-permissions-task.md) + + + + + + +相关信息 +------------------------- + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持拥有特殊权限的用户定义变更任务流程,具体请参见 [任务流程](../4.web-odc-public-resource-management/4.web-odc-task-process.md)。 diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md new file mode 100644 index 00000000..86b8dd66 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/2.web-odc-import-tasks.md @@ -0,0 +1,150 @@ +导入任务 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建批量导入和单表导入任务后,可在 **任务中心** 面板的 **导入** 页签新建和查看任务。 + +任务列表 +------------------------- + +> **说明**
                +> 任务列表会显示最近 48 小时内的任务。 +> 最大支持 3 个导入任务并行运行,后续任务在队列中等待运行。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击 **导入** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/1.png) + +进入导入任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| 信息项 | 说明 | +|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务编号 | 导入任务编号。| +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建导入任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。| +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 和 **下载** 等任务管理操作。
              • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务信息** 和 **任务日志**。
              • 通过/拒绝:单击该按钮审批执行中的任务。
              • 终止:任务运行中时,单击该按钮终止任务。
              • 下载:任务成功时,单击该按钮下载导出文件至本地。
              • | + + + +新建导入任务 +--------------------------- + + + +1. 在弹出的任务中心面板中,单击 **导入** 右侧 **+** ,弹出新建导入任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/2.png) + +2. 在弹出的任务面板中,选择导入文件格式。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/3.png) + + 如上图所示,ODC 目前支持批量导入 **CSV 文件** 、 **SQL 文件** 和 **ZIP 压缩文件** 。可在 **导入文件格式** 标签下的下拉框中选择需要的文件格式。具体格式信息,请参见 [导出导入格式](../../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + + +3. 上传导入文件。 + + 单击文件池进入文件资源管理器以选择需要导入的文件,或者直接将文件拖入文件池中以完成文件上传。上传的文件格式需要与所选择的导入文件格式相同,ZIP 压缩文件支持上传 .zip 结尾的文件、SQL 文件支持上传 .sql 文件以及 CSV 文件支持上传 .csv 文件。 + +4. 选择文件编码。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + +5. 进入导入设置面板。 + + 单击 **下一步:导入设置** 对导入的文件和 sys 租户账号进行设置。 + +6. 选择导入内容。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/4.png) + + + + 当 **导入格式** 为 ZIP 压缩文件时需指定该项。ODC 目前支持 **仅导入数据** 、 **仅导入结构** 和 **导入数据和结构** 三种方式 **。** 其中导入结构指是否要导入对象的定义语句。可在 **导入内容** 标签下的选择框中选择需要导入的内容。 + +7. 选择所属库。 + + 选择导入对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +8. 设置导入数据。 + + 当 **导入格式** 为 ZIP 压缩文件且 **导入内容** 不为仅导入结构时需设置导入数据。该项包含以下设置项: + + * **导入前清空数据** :勾选该项后,导入数据时将首先清空目标对象中原有的数据。 + + * **批量提交数量** :单击 **导入数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。通过指定批量提交数量,可在导入文件中导入指定数量数据时添加一句 `COMMIT` 命令。 + + * **不导入的数据类型** (可选):可以通过该项指定导入数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + +9. 设置导入结构。 + + 当 **导入内容** 为仅导入数据时,该项不可被指定。在该项下选择当对象结构已存在时的操作。选择 **跳过** 操作则在导入时跳过导入文件中的结构定义语句直接导入数据,该项会保留对象中的原数据。选择 **替换** 操作时则执行导入文件中的结构定义语句以重新创建并替换原对象,该项会清空对象中的原数据。 + +10. 设置任务错误处理和执行方式。 + + * ODC 提供 **停止任务** 和 **忽略错误继续任务** 两种错误处理方式。需要在 **任务错误处理** 标签下选择需要的处理方式。 + + * 支持选择 **立即执行** / **定时执行** 。 + +11. 设置 sys 租户账号。 + + a. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + b. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + > **注意** + >
                • **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
                  ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png)
                • 导出时如勾选表和视图之外的其它对象,须配置该项使用 sys 租户账号进行导入。
                • 如未配置 sys租户账号,会导致导入导出缺注释和索引。
                + + +12. 保留当前配置。 + + 指定所有信息后,勾选面板左下角的 **保留当前配置** 以保留当前部分数据文件和结构文件配置。 + +13. 生成导入任务。 + + 指定所有信息后,单击面板右下角的 **提交** 按钮以生成导入任务。 + +14. 查看导入任务。 + + 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息。 + + ![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/5.png) + + +查看导入任务 +--------------------------- + +### 任务信息 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务信息** 标签查看任务基本信息、导入文件信息和导入对象信息。 + + +| 信息项 | 说明 | +|--------|---------------------------------------------------------------------------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务编号** 、 **所属连接** 、 **所属数据库** 和 **任务类型** 等信息。 | +| 导入文件信息 | 显示创建导入导出任务时您选择的 **导入文件格式**、 **导入文件**、 **文件编码**、 **导入内容**、 **数据格式**、 **导入数据设置**、**任务错误处理**、**sys 租户账号配置** 和 **CSV 设置** 等信息。 | +| 导入对象信息 | 显示该任务中您选择的对象在导出或导入数据时的完成情况,包括 **对象名称**、 **对象类型**、**计划处理数量**、**实际处理数量** 和 **数据处理状态** 等信息。 | + + + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------| +| 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 | +| 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。当任务失败时,可通过告警日志查看错误信息。 | + +同时,工具栏提供了以下功能键: + +| 功能 | 说明 | +|------|-----------------------------------------------------------| +| 查找 | 单击该按钮查找日志信息。 | +| 下载 | 单击该按钮下载日志信息。 | +| 复制 | 单击该按钮复制日志信息。 | \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md new file mode 100644 index 00000000..69a01886 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/3.web-odc-export-tasks.md @@ -0,0 +1,168 @@ +导出任务 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建批量导出和单表导出任务后,可在 **任务中心** 面板的 **导出** 页签新建和查看任务。 + + + +任务列表 +------------------------- + +> **说明**
                +> 任务列表会显示最近 48 小时内的任务。 +> 最大支持 3 个导出任务并行运行,后续任务在队列中等待运行。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击 **导出** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/export/1.png) + +进入导出任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| **信息项** | **说明** | +|-------|-----------------------------------------------------------------| +| 任务编号 | 导出任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建导出任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 和 **下载** 等任务管理操作。
              • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务详情** 和 **任务日志**。
              • 通过/拒绝:单击该按钮审批执行中的任务。
              • 终止:任务运行中时,单击该按钮终止任务。
              • 下载:任务成功时,单击该按钮下载导出文件至本地。
              • | + + + +新建导出任务 +--------------------------- + +1. 在弹出的任务中心面板中,单击 **导出** 右侧 **+** ,弹出新建导出任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/export/2.png) + +2. 在弹出的任务面板中,选择导出内容。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/export/3.png) + + 如上图所示,ODC 目前支持 **导出结构和数据** 、 **仅导出数据** 和 **仅导出结构** 三种方式 **。** 其中导出结构是指导出目标对象的定义语句。可在 **导出内容** 标签下的选择框中选择导出的内容。 + +3. 选择所属库。 + + 选择导出对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +4. 选择导出范围。 + + 支持选择 **部分导出** 和 **整库导出**。 + * 部分导出:在 **导出对象** 的 **选择对象** 窗口中勾选需要导出的对象。支持使用搜索框直接进行搜索对象。 + + * 整库导出:导出当前库中的所有对象。 + +5. 进入导出设置面板。 + + 单击 **下一步:导出设置** 对导出的文件和 sys 租户账号进行设置。 + +6. 设置数据文件。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/export/4.png) + + + a. 选择 **数据格式** 。 + + ODC 目前支持将数据导出为 **CSV 格式** 和 **SQL 格式** 。当 **导出内容** 为 **仅导出结构** 时,只支持导出数据为 SQL 格式。具体格式信息,请参见 [导出导入格式](../../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + + b. 选择 **文件编码**。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + + c. 选择 **数据脱敏**。 + + 默认不脱敏,支持选择和管理脱敏策略名称。 **管理脱敏策略** 中,支持添加/编辑/删除策略名称。具体请参见 [数据脱敏管理](../4.web-odc-public-resource-management/6.web-odc-desensitization-rules.md)。 + + d. 进行 **数据文件设置**。 + + 当 **导出内容** 为仅导出结构时无需进行导出数据设置,该项包含以下设置项: + * **使用全局快照** :勾选该项后 ODC 将导出全局中指定表的最新快照点中的数据,勾选该项可以保证全局数据的一致性。 + + * **批量提交数量** (SQL 格式):单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。选择 **数据格式** 为 SQL 格式时,通过指定批量提交数量,可在导出文件中导出指定数量数据时添加一句 `COMMIT` 命令。 + + * 指定 CSV 格式信息。当 **数据格式** 为 CSV 格式且 **导出内容** 为导出结构和数据时,可指定以下信息: + + * **包含列头** :该项默认勾选,选择导出数据为 CSV 格式时是否包含列头。 + + * **空字符串转为空值** :该项默认勾选,选择导出数据为 CSV 格式时是否将表中的空字符串转换为空值 \\N。 + + * **字段分隔符** :设置字段间的分隔符。支持选择 **,** (逗号)、 **;** (分号)和 **:** (冒号)作为字段分割符。同时支持自定义一个字符长度的字符作为分隔符。 + + * **文本识别符** :设置文本内容的识别符。支持选择 **'** (单引号)和 **"** (双引号)作为文本识别符。 + + * **换行符号** :设置换行符。支持选择 **\\n** 、 **\\r** 和 **\\r\\n** 作为换行符。 + +7. 设置结构文件。 + + 在该项下选择是否在 **Create 语句前添加 Drop 语句** 。勾选该项后,在导出对象结构文件时,在对象的 `CREATE` 语句前均会添加对应的 `DROP` 语句。 + +8. 设置任务执行方式。 + + 在该项下选择 **立即执行** / **定时执行** 。 + +9. 设置 sys 租户账号。 + + 1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + 2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + > **重要** + > **sys 租户账号和密码** 为集群租户下用户的账号和密码(账号请勿填入"@sys#集群")。如图所示:
                ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png)
                • 导出时如勾选表和视图之外的其它对象,须配置该项使用 sys 租户账号进行导出。
                • 如未配置 sys租户账号,会导致导入导出缺注释和索引。
                + +10. 保留当前配置。 + + 指定所有信息后,勾选面板左下角的 **保留当前配置** 以保留当前部分数据文件和结构文件配置。 + +11. 生成导出任务。 + + 指定所有信息后,单击面板右下角的 **导出** 按钮以生成导出任务。 + +12. 查看导出任务。 + + 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。 + + ![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/export/5.png) + + + +查看导出任务 +--------------------------- + +### 任务详情 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务信息** 标签查看任务基本信息、导出文件信息和导出对象信息。 + + +| 信息项 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务编号** 、 **连接名** 、 **模式名** 、 **任务类型** 、 **创建时间** 、 **重试次数** 和 **重试时间** 等信息。 | +| 导出文件信息 | 显示创建导出任务时您选择的 **导出内容** 、 **数据格式** 、 **文件编码** 、 **导出数据设置** 、 **导出结构设置** **、** **任务错误处理** 和 **sys 租户账号配置** 等信息。 | +| 导出对象信息 | 显示该任务中您选择的对象在导出或导出数据时的完成情况,包括 **对象名称** 、 **对象类型** 、 **结构处理状态** 、 **数据总记录数** 、 **数据已处理数** 和 **数据处理状态** 等信息。 | + + + +### 任务流程 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务流程** 标签查看 **发起任务** 、 **审批** 和 **执行** 状态等信息。 + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------| +| 全部日志 | 显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 | +| 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。 当任务失败时,可查看告警日志以获得错误信息。 | + +同时,工具栏提供了以下功能键: + +| 功能 | 说明 | +|------|-----------------------------------------------------------| +| 查找 | 单击该按钮查找日志信息。 | +| 下载 | 单击该按钮下载日志信息。 | +| 复制 | 单击该按钮复制日志信息。 | diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/4.web-odc-data-mocking-tasks.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/4.web-odc-data-mocking-tasks.md new file mode 100644 index 00000000..c1c26c89 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/4.web-odc-data-mocking-tasks.md @@ -0,0 +1,95 @@ +模拟数据任务 +=========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建模拟数据任务后,可在 **任务中心** 面板的 **模拟数据** 页签新建和查看任务。 + +任务列表 +------------------------- + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击 **模拟数据** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Mock%20Data/1.png) + +进入模拟数据任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| 信息项 |说明 | +|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务编号 | 模拟数据任务编号。| +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建模拟数据任务任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。| +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。| +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 和 **下载** 等任务管理操作。
              • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务信息**、执行结果和 **任务日志**。
              • 通过/拒绝:单击该按钮审批执行中的任务。
              • 终止:任务运行中时,单击该按钮终止任务。
              • 下载:任务成功时,单击该按钮下载模拟数据对应的 SQL 文件至本地。
              • | + + + +新建模拟数据任务 +----------------------------- + +1. 在弹出的任务中心面板中,单击 模拟数据 右侧 +,弹出新建模拟数据任务面板。 + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Mock%20Data/2.png) + + + +2. 在 **新建模拟数据** 面板中,输入以下信息。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Mock%20Data/3.png) + + + | 信息项 | 说明 | + |-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属连接 | 显示目标任务所在的数据库连接名称。 | + | 所属库 | 选择需变更的数据库。 | + | 表 | 指定生成数据的表。 在模拟数据面板的 **表** 标签下的下拉列表中选择要在其中生成数据的表。下拉列表中会显示当前实例中所有存在的表。 | + | 模拟生成数据量 | 指定生成的数据量。 在模拟数据面板的 **模拟生成数据量** 标签下的文本框中输入您需要生成的数据量。默认会生成 1000 条数据,最多生成不超过 1000000 行数据,所以您可以在文本框中输入 1\~1000000 间的任意正整数。 | + | 批处理大小 | 指定批量处理数据的大小。 在模拟数据面板的 **批处理大小** 标签下的文本框中指定每生成多少条数据进行一次提交(`COMMIT` 命令)操作。默认每生成 200 条数据进行一次提交,最大不超过 500 条,所以您可以在文本框中输入 1\~500 间的任意正整数。 | + | 插入模拟数据清空表 | 选择在表中插入模拟数据时是否清空表。 在模拟数据面板的 **插入模拟数据清空表** 标签下的单选列表中选择当在表中插入模拟数据时是否清空表中原有的数据。 | + | 数据冲突处理方式 | 选择数据冲突处理方式。
                在模拟数据面板的 **数据冲突处理方式** 标签下的单选列表中选择当生成的数据有冲突时处理的方式。ODC 提供以下处理方式:
                - **忽略** :默认为忽略,若数据有冲突则冲突数据不被插入。
                - **覆盖** :若数据有冲突则删除原数据插入新数据。
                - **终止** :若数据有冲突则停止生成数据终止整个模拟数据任务。 | + | 规则设置 | 设置数据生成规则。
                在模拟数据面板的 **规则设置** 标签下的表格会根据您在第 2 步选择的表显示表的 **字段名称** 和 **字段类型** 信息。您可在 **规则** 和 **细则** 列中针对目标字段设置模拟数据生成的规则。 其中 **规则** 列中会根据字段类型提供一些内置的对应规则,您可以按需进行选择。 **细则** 列会根据您选择的规则显示具体的规则信息,您可以单击细则信息后的编辑图标对细则信息进行修改。 | + + + +3. 单击 **提交** ,完成新建模拟数据任务。 + +4. 任务生成后会自动弹出 任务中心 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Mock%20Data/4.png) + + + + +查看模拟数据任务 +----------------------------- + +### 任务信息 + +1. 单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务信息** 标签查看任务基本信息和模拟数据设置信息。 + + +| 信息项 | 说明 | +|----------|---------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务编号**、**所属连接**、**所属数据库**、**任务类型**、**执行方式**、**创建人** 和 **创建时间** 等信息。| +| 模拟数据设置信息 | 显示创建模拟数据任务时您选择的 **目标表**、 **模拟生成数据量**、 **批处理大小**、 **插入模拟数据前清空表**、 **数据冲突处理方式**、 **实际插入记录**、 **冲突记录**、 **忽略插入**、 **清除记录** 和 **规则设置展示** 等信息。 | + +2. 在任务信息面板右下角,单击 **再次发起** 和 **下载**,可以重新发起任务和下载导出文件至本地。 + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------| +| 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 | +| 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。 当任务失败时,可查看告警日志以获得错误信息。 | + +同时,工具栏提供了以下功能键: + +| 功能 | 说明 | +|------|-----------------------------------------------------------| +| 查找 | 单击该按钮查找日志信息。 | +| 下载 | 单击该按钮下载日志信息。 | +| 复制 | 单击该按钮复制日志信息。 | \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/5.web-odc-database-change-task.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/5.web-odc-database-change-task.md new file mode 100644 index 00000000..bb2805f1 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/5.web-odc-database-change-task.md @@ -0,0 +1,109 @@ +数据库变更任务 +============================ + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建数据库变更任务后,可在 **任务中心** 面板的 **数据库变更** 页签新建和查看任务。 + +任务列表 +------------------------- + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击数据库变更页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Database%20Change/1.png) + +进入数据库变更任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| 信息项 | 说明 | +|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务编号 | 数据库变更任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。| +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建数据库变更任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。| +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 、 **回滚** 和 **下载** 等任务管理操作。
              • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务信息**、执行结果和 **任务日志**。
              • 通过/拒绝:单击该按钮审批执行中的任务。
              • 终止:任务运行中时,单击该按钮终止任务。
              • 回滚:任务成功时,单击该按钮回滚任务。
              • 下载:任务成功时,单击该按钮下载导出文件至本地。
              • | + + + +新建数据库变更 +---------------------------- + + + +1. 在弹出的任务中心面板中,单击 **数据库变更** 右侧 **+**,弹出新建数据库变更任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Database%20Change/2.png) + +2. 在 **新建数据库变更** 面板中,输入以下信息。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Database%20Change/3.png) + + | 信息项 |说明| + |--------|-------| + | 所属连接 | 显示目标任务所在的数据库连接名称。| + | 所属库 | 选择需变更的数据库。| + | SQL 内容 | 选择 **SQL 录入** 或 **上传附件** :
                a. **SQL 录入** :SQL 录入为默认方式,可在编辑区中直接录入 SQL 脚本。
                **说明**
                - 在 SQL 录入中,最大允许输入 500000 个字符,如超限可上传附件。
                - 单击 **IN 值转化** 按钮,可将批量复制的数据转化成 in('A','B')格式。
                - 列值分隔符号为换行符。
                - 行值分隔符为空格或 TAB 值。
                b. **上传附件** :选择上传附件方式后,单击文件池进入文件资源管理器选择要导入的文件或者直接将导入文件拖入文件池中以完成文件上传。
                **说明**
                - 最多支持上传 500 个文件,总文件大小不超过不超过 256 MB。
                - 默认附件按上传的先后排序,可拖拽改变顺序,任务执行时按文件顺序执行。
                - 当前只支持上传 .sql 后缀的 SQL 文件。 | + | 回滚方案 | 指定 **回滚方案** 。 回滚方案支持 SQL 文本录入及上传附件方式,参见"SQL 内容"信息。| + | 分隔符 | 支持 delimiter 分隔符号。| + | 查询结果限制 | 支持设置查询结果限制 (1-100w)。 | + |任务设置|
                • 数据库变更工具提供两种任务错误处理方式:
                  • **停止任务** :停止任务为默认方式,运行脚本的过程中出现错误时会停止运行。
                  • **忽略错误继续任务** :选择忽略错误继续任务方式,在运行脚本出现错后将跳过错误语句继续执行。
                • 选择 **立即执行** / **定时执行** 设置任务执行方式。
                | + | 执行超时时间 | 在 **执行超时时间** 文本框中输入数字指定语句执行超时时间,单位为小时(默认超时时间为 48 小时,最大不超过 480 小时)。| + | 任务描述 | 可在 **任务描述** 文本框中输入不超过 200 个字符的描述信息,该项为选填项。| +3. 单击 **新建**,完成新建数据库变更。 + +4. 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Database%20Change/4.png) + + + + + +查看数据库变更任务 +------------------------------ + +### 任务信息 + + +1. 单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板中单击 **任务信息** 标签查看 **所属连接** 、 **所属数据库** 、 **SQL 内容** 和 **回滚内容** 等信息。 + + + +2. 单击 **再次发起** ,可重新发起数据库变更任务。 + + +### 任务流程 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板中单击 **任务流程** 标签查看 **发起任务状态** 、 **审批状态** 、 **执行状态** 和 **完成** 结果 等信息。 + + + + + + +### 执行结果 + + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板中单击 **执行结果** 标签查看 执行成功和执行失败记录。 + + + + + + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + + + | 信息项 | 说明 | + |------|-----------------------------------------------------------------------------------------------------------------------------| + | 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制全部日志信息。 | + | 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。当任务失败时,可通过告警日志查看错误信息。 单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制告警日志信息。 | + + + + + diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/6.web-odc-shadow-table-synchronization-task.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/6.web-odc-shadow-table-synchronization-task.md new file mode 100644 index 00000000..280641c8 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/6.web-odc-shadow-table-synchronization-task.md @@ -0,0 +1,113 @@ +# 影子表同步任务 + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持用户向公共资源管控台管理员申请创建影子表同步的权限。 + +用户在 **任务中心** 创建影子表同步任务后,管理员会在任务中心的任务列表中审批任务,申请权限的用户可以在任务中心的任务列表中查看任务信息和审批状态。 + +## 任务列表 + +> **说明** +> 任务列表会显示最近 48 小时内的任务。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 页签弹出任务中心面板,在面板中单击 **影子表同步** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Synchronize%20Shadow%20Table/1.png) + +进入影子表同步任务页签后,列表中会显示以下信息并且支持筛选和排序: + +| **信息项** | **说明** | +|---------|----------------------------------------------------------------------------------------------------| +| 任务编号 | 显示任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建任务的用户。单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 和 **终止** 等任务管理操作。
                • 查看:单击该按钮进入任务详情页面以查看目标任务信息。
                • 通过/拒绝:单击该按钮审批任务。
                • 终止:任务运行中时,单击该按钮终止任务。
                | + + +## 新建影子表同步任务 + +1. 在弹出的任务中心面板中,单击 **影子表同步** 右侧 **+**,弹出新建影子表同步任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Synchronize%20Shadow%20Table/2.png) + + +2. 在 **新建影子表同步** 面板中,输入以下信息。 + + a. 选择对象。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Synchronize%20Shadow%20Table/3.png) + + + | **信息项** | **说明** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属库 | 选择创建影子表的所属库并可查看当前连接名。 | + | 同步范围 | 选择需要同步的表:
                • **部分表** :选定的表在当前库中创建影子表。
                • **全部表** :来源库中所有的表都会在当前库中创建影子表。
                | + | 影子表名 | 支持以" **前缀** +源表名"或"源表名+ **后缀** "的格式创建影子表名,并且支持自定义前、后缀。 | + | 同步对象 | 同步部分表时,需在 **同步对象** 中选择源表以同步为影子表。 | + + b. 同步影子表结构分析。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Synchronize%20Shadow%20Table/4.png) + + | **信息项** | **说明** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 同步的表 | **同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **查看** 支持查看源表结构、影子表结构和结构变更 SQL 语句,单击 **跳过** 支持不同步该影子表。 | + | 不同步的表 | **不同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **取消跳过** 支持同步该影子表。
                **说明**
                选择跳过同步的表,会显示在 **不同步的表** 页签中。 如果影子表名已存在且结构与源表一致,则会自动跳过同步表结构。
                | + | SQL 预览 | 显示同步表结构的 SQL 语句。 | + | 任务设置 |
                • 选择审批完成后的 **执行方式** 。
                  • **立即同步** :立即执行同步任务。
                  • **定时同步** :定时执行同步任务。
                • 选择 **任务错误处理** 方式。
                  • **停止任务** :在执行过程中,遇到出错则中断后面的 SQL 脚本,不再执行。
                  • **忽略错误继续执行** :在执行过程中,跳过当前出错的 SQL 脚本继续执行,并执行完所有 SQL 脚本。
                | + | 任务设置 | | + | 备注 | 描述项目的业务背景信息,例如变更目的、预期目标等。 | + +3. 单击 **提交** ,完成任务申请。 + + > **说明** + > 任务申请创建完成后,任务会自动匹配管理员在公共资源管控台中创建的申请影子表同步任务流程。 + > 任务将按管理员在公共资源管控台的 **设置优先级** 中设置的优先级排序匹配执行。 + > 有关任务流程更多详情,请参见 [任务流程管理](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md)。 + +## 查看影子表同步任务 + +### 任务信息 + +1. 在 **任务中心** > **影子表同步** 的任务列表页签中,单击任务列表操作列中的 **查看** 按钮弹出目标任务的任务详情面板。 + +2. 在 **任务详情** 面板中,单击 **任务信息** 页签查看任务基本信息和设置信息。 + + | **信息项** | **说明** | + |---------|---------------------------------------------------------------------------------------------------------| + | 任务基本信息 | 显示 **任务状态** 、 **任务编号** 、 **任务类型** 、 **所属连接** 、 **所属数据库** 、 **执行方式** 、 **任务错误处理、备注、创建人** 和 **创建时间** 等信息。 | + | 任务设置信息 | 显示创建影子表同步任务时所选择的 **同步表/不同步表/** 待执行的 **SQL 脚本** 信息。| + + +3. 在任务信息面板右下角,单击 **再次发起** ,可以重新发起任务。 + +### **任务流程** + +1. 在 **任务详情面板** 中,单击 **任务流程** 页签查看 **发起任务状态** 、 **审批状态** 、 **执行状态** 和 **完成结果** 等信息。 + + +2. 在面板右下角,单击 **再次发起** ,可重新发起任务。 + +### 任务日志 + +1. 在 **任务详情** 面板中,单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + | 信息项 | 说明 | + |------|-----------------------------------------------------------------------------------------------------------------------------| + | 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。
                单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制全部日志信息。 | + | 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。当任务失败时,可通过告警日志查看错误信息。
                单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制告警日志信息。 | + + +2. 单击 **再次发起** ,可重新发起任务。 + + + +## 相关信息 + +* [任务流程管理](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md) +* [新建影子表同步](../../6.web-odc-user-guide/6.web-odc-use-tools/6.web-odc-shadow-table-synchronization.md) \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/7.web-odc-partition-scheme-task.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/7.web-odc-partition-scheme-task.md new file mode 100644 index 00000000..02c98de7 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/7.web-odc-partition-scheme-task.md @@ -0,0 +1,106 @@ +# 分区计划任务 + + + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持用户向公共资源管控台管理员申请分区计划的权限。 + +用户在 **任务中心** 创建分区计划任务后,管理员会在任务中心的任务列表中审批任务,申请权限的用户可以在任务中心的任务列表中查看任务信息和审批状态。 + +## 任务列表 + +> **说明** +> 任务列表会显示最近 48 小时内的任务。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 页签弹出任务中心面板,在面板中单击 **分区计划** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Partitioning%20Plan/1.png) + +进入分区计划任务页签后,列表中会显示以下信息并且支持筛选和排序: + +| 信息项 | 说明 | +|---------|----------------| +| 任务编号 | 显示任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 和 **终止** 等任务管理操作。
                • 查看:单击该按钮进入任务详情页面以查看目标任务信息。
                • 通过/拒绝:单击该按钮审批任务。
                • 终止:任务运行中时,单击该按钮终止任务。
                | + +## 新建分区计划任务 + + + +1. 在弹出的任务中心面板中,单击 **分区计划** 右侧 **+**,弹出新建分区计划任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Partitioning%20Plan/2.png) + +2. 在 **新建分区计划** 面板中,输入以下信息。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Partitioning%20Plan/3.png) + + | 信息项 | 说明 | + |---------|--------------------| + | 所属连接 | 选择创建分区计划所属连接。默认为当前连接。 | + | 分区策略 | 搜索和勾选所属库中的 Range 分区表,并编辑对应的分区策略。
                • 勾选 **设置分区计划** 右侧的 仅显示未设置的表时,支持过滤未设置的表。
                • 勾选 Range 分区表时,支持批量设置分区策略。
                • 在 **分区策略** 项下,单击编辑图标,支持编辑预创建分区数量、分区间隔、保留时长和命名规则等。
                | + | 备注(可选) | 输入申请原因。 | + +3. 单击 **提交** ,完成任务申请。 + + > **说明** + > 任务申请创建完成后,任务会自动匹配公共资源管控台中默认的申请分区计划任务流程。 + > 有关任务流程更多详情,请参见 [任务流程管理](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md)。 + + + +## 查看分区计划任务 + +### **任务信息** + +1. 在 **任务中心** > **分区计划** 的任务列表页签中,单击任务列表操作列中的 **查看** 按钮弹出目标任务的任务详情面板。 + + +2. 在 **任务详情** 面板中,单击 **任务信息** 页签查看任务基本信息和设置信息。 + + | 信息项 | 说明 | + |---------|---------------------------------------------------| + | 任务基本信息 | 显示 **任务状态** 、 **任务编号** 、 **任务类型、所属连接**、 **备注、创建人** 和 **创建时间** 等信息。 | + | 任务设置信息 | 显示创建分区计划任务时所选择的 Range 分区表的分区策略信息。| + +3. 在任务信息面板右下角,单击 **再次发起** ,可以重新发起任务。 + +### **任务流程** + +1. 在 **任务详情面板** 中,单击 **任务流程** 页签查看 **发起任务状态** 、 **审批状态** 、 **执行状态** 和 **完成结果** 等信息。 + + +2. 在面板右下角,单击 **再次发起** ,可重新发起任务。 + +### 关联记录 + +1. 在 **任务详情面板** 中,单击 **关联记录** 页签查看 **任务编号** 、 **所属库** 、 **创建时间** 、 **任务状态** 和 **查看** 操作等信息。 + +2. 在面板右下角,单击 **再次发起** ,可重新发起任务。 + +### 任务日志 + + +1. 在 **任务详情面板** 中,单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + + | 信息项 | 说明 | + |------|-----------------------------| + | 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制全部日志信息。 | + | 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。当任务失败时,可通过告警日志查看错误信息。 单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制告警日志信息。 | + +2. 单击 **再次发起** ,可重新发起任务。 + + +## 相关信息 + +* [任务流程管理](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md) + +* [新建分区计划](../../6.web-odc-user-guide/6.web-odc-use-tools/3.web-odc-partition-scheme.md) \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-apply-for-permissions-task.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-apply-for-permissions-task.md new file mode 100644 index 00000000..572f44d9 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/8.web-odc-apply-for-permissions-task.md @@ -0,0 +1,79 @@ +# 权限申请任务 + + +## **背景信息** + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持用户向公共资源管控台管理员申请使用公共连接的权限。 + +用户在 **任务中心** 创建权限申请任务后,管理员会在任务中心的任务列表中审批任务,申请权限的用户可以在任务中心的任务列表中查看任务信息和审批状态。 + +## **任务列表** + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 页签弹出任务中心面板,在面板中单击 **权限申请** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Permission%20Applications/1.png) + + +进入权限申请任务页签后,列表中会显示以下信息并且支持筛选和排序: + +| **信息项** | **说明** | +|---------|------------------------------------------| +| 任务编号 | 显示任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。
                单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。
                **说明**
                由于权限申请任务可能涉及多个数据库连接因此不做详细展示,显示为 **-**。 | +| 所属数据库 | 显示目标任务所在的数据库。
                单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。
                **说明**
                由于权限申请任务可能涉及多个数据库连接因此不做详细展示,显示为 **-** 。 | +| 创建人 | 创建任务的用户。
                单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 和 **通过/拒绝** 等任务管理操作。
                - 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务信息** 和 **任务流程**。
                - 通过/拒绝:单击该按钮审批任务。 | + + +## **新建权限申请任务** + + +1. 在弹出的任务中心面板中,单击 **权限申请** 右侧 **+**,弹出新建权限申请任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Permission%20Applications/2.png) + +2. 在 **申请连接权限** 面板中,输入以下信息。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Permission%20Applications/3.png) + + | **信息项** | **说明** | + |----------|------------------------------| + | 选择公共连接 | 勾选需要申请的目标公共连接。
                - 选择连接窗口:支持批量选择多个公共资源进行权限申请。
                - 已选项窗口:支持清空/删除已选的公共连接。
                - 支持通过连接/主机/集群/租户名称搜索公共连接。 | + | 申请权限类型 | 选择申请的目标公共资源的权限类型:只读/读写。 | + | 申请原因(可选) | 输入申请原因。 | + + +3. 单击 **提交** ,完成申请连接权限。 + + > **说明** + > 申请连接权限创建完成后,任务会自动匹配管理员在公共资源管控台中创建的申请连接权限任务流程。 + > 任务将按管理员在公共资源管控台的 **设置优先级** 中设置的优先级排序匹配执行。 + > 有关任务流程更多详情,请参见 [任务流程管理](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + +## **查看权限申请任务** + +### **任务信息** + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/Permission%20Applications/4.png) + +1. 在 **任务中心** > **权限申请** 的任务列表页签中,单击任务列表操作列中的 **查看** 按钮弹出目标任务的任务详情面板。 + + +2. 在 **任务详情** 面板中,单击 **任务信息** 页签查看任务基本信息和设置信息,包括 **任务状态** 、 **任务编号** 、 **任务类型** 、 **风险等级** 、 **申请公共连接** 。 + +| **信息项** | **说明** | +|----------|--------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务状态** 、 **任务编号** 、 **任务类型** 、 **风险等级** 、 **创建人** 和 **创建时间** 等信息。 | +| 任务设置信息 | 显示创建权限申请任务时所选择的 **连接名称** 、 **申请权限类型** 和 **状态** 等信息。 | + + + +### **任务流程** + +1. 在 **任务详情面板** 中,单击 **任务流程** 页签查看 **发起任务状态** 、 **审批状态** 、 **执行状态** 和 **完成结果** 等信息。 + + +2. 在面板右下角,单击 **再次发起** ,可重新发起权限申请任务。 \ No newline at end of file diff --git a/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/9.web-odc-sql-plan-task.md b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/9.web-odc-sql-plan-task.md new file mode 100644 index 00000000..56bcdf40 --- /dev/null +++ b/zh-CN/6.web-odc-user-guide/9.web-odc-task-management/9.web-odc-sql-plan-task.md @@ -0,0 +1,92 @@ +# SQL 计划任务 + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持定时周期性执行用户创建的 SQL 脚本,以满足周期性执行用户所需的数据库开发和运维任务,例如周期性执行存储过程、备份和做库表结构同步等。 + +用户在 **任务中心** 创建 SQL 计划任务后,管理员会在任务中心的任务列表中审批任务,申请权限的用户可以在任务中心的任务列表中查看任务信息和审批状态。 + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上使用 SQL 计划任务,以申请创建和管理 SQL 计划任务。 + +## 任务列表 + +> **说明** +> 任务列表会显示最近 336 小时内的任务。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 页签弹出任务中心面板,在面板中单击 **SQL 计划** 页签显示任务列表。 + +![SQL 计划1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1-1.png) + +进入 SQL 计划任务页签后,列表中会显示以下信息并且支持筛选和排序: + +| **信息项** | **说明** | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 编号 | 显示任务编号。
                单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选任务编号。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。
                单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 执行周期 | - | +| 下一次执行时间 | 显示下一次执行 SQL 计划任务的时间。 | +| 创建人 | 创建任务的用户。
                单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 更新时间 | 显示该任务生成的具体日期和时间。 | +| 状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝、编辑** 和 **启用/禁用** 等任务管理操作。
                • 查看:单击该按钮进入任务详情页面以查看目标任务信息。
                • 通过/拒绝:单击该按钮审批任务。
                • 启用/禁用:任务运行中时,单击该按钮启用/禁用任务。
                | + + +## 新建 SQL 计划任务 + +1. 在弹出的任务中心面板中,单击 **SQL 计划** 右侧 **+** ,创建 SQL 计划任务。 + + ![SQL 计划-新建 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/2.png) + +2. 在 **新建 SQL 计划** 面板中,输入以下信息。 + + ![SQL 计划-新建 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92-%E6%96%B0%E5%BB%BA%203.png) + + | **信息项** | **说明** | + |---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | SQL 内容 | 支持两种指定 SQL 内容的方式:
                • **SQL 录入** :SQL 录入为默认方式,可在编辑区中直接录入 SQL 脚本。
                • 在 SQL 录入中,默认最大允许输入 10MB 个字符,如超限可上传附件。
                • 单击 **IN 值转化** 按钮,可将批量复制的数据转化成 in('A','B')格式。
                • 列值分隔符号为换行符。
                • 行值分隔符为空格或 TAB 值。
                • **上传附件** :选择上传附件方式后,单击文件池进入文件资源管理器选择要导入的文件或者直接将导入文件拖入文件池中以完成文件上传。
                • 最多支持上传 500 个文件,总文件大小不超过不超过 256 MB。
                • 默认附件按上传的先后排序,可拖拽改变顺序,任务执行时按文件顺序执行。
                • 当前只支持上传 .sql 后缀的 SQL 文件。
                | + | 分隔符 | 支持 Delimiter 分隔符号。 | + | 查询结果限制 | 支持设置查询结果限制 (1-100w)。 | + | 执行超时时间 | 在 **执行超时时间** 文本框中输入数字指定语句执行超时时间,单位为小时(默认超时时间为 48 小时,最大不超过 480 小时)。 | + | 定时周期 |
                • 可直接选择每小时/每天晚上/每周五快捷设置方式。
                • 支持两种设置定时周期的模式:
                  • 默认模式:可选择每天/每周/每月,设置所需的执行周期时间。
                    ![SQL 计划-定时周期默认模式4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/4.png)
                  • 自定义模式:可选择秒/分/时/日/月/周,设置所需的执行周期时间。
                    ![SQL 计划-定时周期自定义模式5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/5.png)
                  | + | 任务设置 |
                  • 选择任务错误处理方式:
                    • 停止任务:停止任务为默认方式,运行脚本的过程中出现错误时会停止运行。
                    • 忽略错误继续任务:选择忽略错误继续任务方式,在运行脚本出现错后将跳过错误语句继续执行。
                  • 选择任务执行时长超周期处理方式:
                    • 待当前任务执行完毕在新周期发起任务。
                    • 忽略当前任务状态,定期发起新任务。
                  | + | 备注(可选) | 可输入不超过 200 个字符的描述信息,该项为选填项。 | + +3. 单击 **新建** ,完成任务申请。 + + > **说明** + > 任务申请创建完成后,任务会自动匹配公共资源管控台中默认的申请 SQL 计划任务流程。 + > 有关任务流程更多详情,请参见 [任务流程管理](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + +## **查看** SQL 计划 **任务** + +### 任务信息 + +![SQL 计划-查看 SQL 计划任务-任务信息8](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/6.png) + +1. 在 **任务中心** > **SQL 计划** 的任务列表页签中,单击任务列表操作列中的 **查看** 按钮弹出目标任务的任务详情面板。 + + +2. 在 **任务详情** 面板中,单击 **任务信息** 页签查看任务基本信息和设置信息。 + + | **信息项** | **说明** | + |---------|-------------------------------------------------------------------------------------------------------| + | 任务基本信息 | 显示 **任务状态** 、 **任务编号** 、 **任务类型、所属连接** 、 **备注、创建人** 和 **创建时间** 等信息。 | + | 任务设置信息 | 显示创建分区计划任务时的 **SQL 内容** 、 **定时周期** 、 **下一次执行时间** 、 **分隔符** 、 **查询结果限制** 、 **任务错误处理** 和 **执行超时时间** 信息。 | + + +### 执行记录 + +在 **任务详情面板** 中,单击 **执行记录** 页签查看 **任务编号** 、 **所属库** 、 **创建时间** 、 **任务状态** 和 **操作** 等信息。 + +### 操作记录 + +![SQL 计划-查看 SQL 计划任务-操作记录9](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/SQL%20%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1/7.png) + +在 **任务详情面板** 中,单击 **操作记录** 页签查看 **事件操作** 、 **操作时间** 、 **审批状态** 和 **操作** 等信息。 + +## 相关信息 + +* [任务流程管理](../4.web-odc-public-resource-management/4.web-odc-task-process.md) + + +* [SQL 计划](../6.web-odc-use-tools/6.web-odc-sql-plan.md) diff --git a/zh-CN/7.client-odc-user-guide/1.client-odc-install-odc.md b/zh-CN/7.client-odc-user-guide/1.client-odc-install-odc.md new file mode 100644 index 00000000..0f06512f --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/1.client-odc-install-odc.md @@ -0,0 +1,52 @@ +安装 ODC +=========================== + +除在 OceanBase 中直接进入 Web 版 OceanBase 开发者中心(OceanBase Developer Center,ODC)以外,同时可下载客户端版本的 ODC 进行数据库的管理。与 Web 版 ODC 相比,客户端版 ODC 无登录入口,而是通过使用一个默认用户进行标识,因此只需安装客户端并 [创建连接](3.client-odc-connect-database/1.client-odc-create-connection.md)。 + +推荐安装环境 +--------------- + + + +| 环境 | 要求 | +|---------|---------------------------------------------------------| +| 系统版本 | Windows:Win 7/Win 10 Mac:10.13.6(17G65) | +| Java 环境 | JDK 1.8.0_242 及以上版本。 | +| 端口号 | ODC V2.3.0 后采用动态侦测端口技术,无需再预留 8989 端口。 | +| CPU | X86 64 位处理器 2 核及以上配置。 | +| 内存 | 4GB 及以上 。 | + + + +安装步骤 +------------- + +1. 下载 [客户端版 ODC](https://help.aliyun.com/document_detail/212816.html)。 + + + +2. 下载完成后,双击安装文件开始安装。 + + + +3. 进入安装向导后,提示您选择安装路径。 + + ![安装 ODC](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4762343061/p175972.png) + + + +4. 安装完成后,启动程序时会检查环境,当环境不符合要求时会弹出对应的错误信息并提示您继续启动应用或是关闭进程修复环境。若环境检查无误,应用将正常打开,您就可进入客户端版 ODC 并开始创建连接了。 + + > **注意**
                  + >
                • 自 ODC V3.2.0 版本起,客户端版 ODC V3.2.0 安装包中已附加 JRE 安装包(包含Mac 和 Win 64 位平台),可根据需求自行安装。
                • + >
                • 如安装或启动失败,请参见常见问题 > 客户端 ODC 安装问题。
                • + + + + + + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/1.client-odc-database-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/1.client-odc-database-objects-overview.md new file mode 100644 index 00000000..fce5264a --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/1.client-odc-database-objects-overview.md @@ -0,0 +1,39 @@ +概述 +======================= + +表由行(Row)和列(Column)组成的。每列称为一个字段,每列的标题称为字段名。行包括了若干列信息项,一行数据称为一个或一条记录。一张数据库表由一条或多条记录组成,没有记录的表称为空表。每个表中通常都有一个主关键字,用于唯一地确定一条记录。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击表标签可以查看表列表。在表列表中双击表名进入表管理页面,您可以在表管理页面的数据页签查看和修改表的数据,或在属性页签查看表的基本信息、列、分区、索引、约束和 DDL 等属性信息。 +> **注意**
                  +> 分区信息查看依赖 root@sys 账号,所以您需要在创建连接的高级配置中设置 root@sys 用户。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V1.4.1 及以上。 | + + + +本章节将分篇介绍以下 ODC 中表对象的相关操作: + +* [新建表](../1.client-odc-table-objects/2.client-odc-create-a-table.md) + + + +* [表列表](../1.client-odc-table-objects/3.client-odc-table-list.md) + + + +* [表属性管理](../1.client-odc-table-objects/4.client-odc-manage-table-attributes.md) + + + +* [表数据管理](../1.client-odc-table-objects/5.client-odc-manage-table-data.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md new file mode 100644 index 00000000..67ec85da --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md @@ -0,0 +1,269 @@ +# 新建表 + + + + +## 概述 + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建表。本文介绍如何使用 ODC 创建表。 + +![新建表](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%A6%82%E8%BF%B0.png) + +如上图所示,创建表包含以下 7 个步骤: + +1. 指定基本信息。 + +2. 设置列。 + +3. 设置索引。 + +4. 设置约束。 + +5. 设置分区规则。 + +6. 确认 SQL。 + +7. 完成新建表。 + + + + + + +## 操作步骤 + + +以在 ODC 中创建员工表(employee)为例,员工表中包含员工工号(emp_no)、员工生日(birthdate)、员工姓名(name)和员工性别(gender)。具体操作步骤如下: + +### 步骤 1:指定基本信息 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左侧导航栏中单击 **表** 标签可查看表列表。在表列表的右上角,单击 **+** 创建表,或在顶部导航栏中单击 **新建** 以创建所需对象。 + +在 **基本信息** 中,输入 **表名称** 和表的 **描述** 。 + +![新建表-步骤1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A41.png) + +> **说明** +>
                  • 在 MySQL 模式下,同时需要选择 默认字符集 和 默认排序规则。
                  • +>
                  • 完成指定基本信息并切换至设置列步骤后,表示确认提交基本信息。
                  + +### 步骤 2:设置列 + +如下图所示,添加一列时需指定以下信息: + + + +![step 2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A42.png) + + +|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 信息项 | 说明 | +| 名称 | 指定字段(列)的名称。 | +| 类型 | 指定字段(列)的数据类型。
                  具体数据类型,请参考 [OceanBase 数据库的开发指南](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview)。 | +| 长度 | 指定类型长度。 | +| 小数点 | 设置类型精度。 | +| 非空 | 是否限制该字段(列)的值不能为空。 | +| 自增(MySQL 模式下) | 选择是否为自增列。
                  **注意**
                  每个表仅允许设置一个自增字段(列)。
                  当一个字段(列)设置为自增后,其余字段(列)不可勾选,需取消勾选后,才可设置其它字段(列)为自增字段(列)。 | +| 虚拟列 | 选择是否创建虚拟列。
                  **注意**
                  如果已勾选虚拟列,则 **必须** 填写表达式。
                  在创建虚拟列时需要定义虚拟列依赖的表达式,虚拟列包含 Virtual Column 和 Stored Column,仅在使用时会根据表达式计算出虚拟列的值,因此在向表中插入数据的时候,不能为虚拟列指定要插入的值。 | +| 缺省值/表达式 | 该字段(列)的默认值/表达式。 | +| 注释 | 对该字段(列)的说明。 | + + + +设置列页面提供 3 种功能操作: + +|--------|-------------------------------------------------------------------------------------------------------------------------------------------| +| 功能项 | 说明 | +| 工具栏操作 | 通过列页面顶部的工具栏可添加和删除列。 | +| 单击行序号 | - 单击行序号,选中整行,显示辅助菜单(新建、删除)。
                  - 单击并选中行序号,可拖动整行参数以调整顺序。 | +| 鼠标右键操作 | 右键单击鼠标选中整行,进行复制行 / 向下移动一行。 | + + +> **说明** +>
                  • 复制行后,可选中某行并通过快捷键 Command + V / Ctrl + V 对进行粘贴。
                  • +>
                  • 页面底部的辅助编辑区域会显示所选中列的相关提示信息。
                  • +>
                  • 基本信息和列为必填项,其它为选填项,填写基本信息和列后,可以直接提交并确认 SQL 新建表。
                  + + +### 步骤 3:设置索引 + +当表中包含大量数据,可以使用索引更快速的查询数据。索引是表中对某一列或多个列的值进行预排序的数据结构。通过使用索引,可以直接定位到符合条件的记录。 + +如下图所示,需指定以下信息: + +![step 3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A43.png) + + +|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 信息项 | 说明 | +| 索引名称 | 为该索引指定的名称。 | +| 范围 | 默认值为 **GLOBAL** ,支持 **GLOBAL** (全局索引)/ **LOCAL** (局部索引)。 | +| 方法 | 默认值为 **BTREE** (全局索引),支持 **空/BTREE/HASH** 。
                  - BTREEB 以 B+树结构存储数据,适用于在范围查找的SQL语句中。
                  - HASH 索引基于 HASH 表实现,只有查询条件精确匹配 HASH 索引中的所有列才会用到 HASH 索引,仅能满足"=","IN"和"\<=\>"查询,HASH 索引无法用于排序,不适用于区分度小的列上,例如员工性别(gender)。 | +| 索引类型 | 默认值为 **NORMAL** ,支持 **NORMAL** **/UNIQUE/FULLTEXT** 。
                  - NORMAL 表示普通索引。
                  - UNIQUE 表示唯一的、不允许重复的索引,例如员工工号(emp_no)。
                  - FULLTEXT 表示全文搜索的索引,用于搜索包含大量数据的表。 | +| 列 | 选择索引所在的列,需注意索引列的顺序。 | +| 不可见 | 选择设置的索引是否可见。 | + + + +设置索引页面提供以下功能键: + +|-----|------------| +| 功能项 | 说明 | +| +新建 | 添加一个新索引。 | +| 删除 | 删除当前选中的索引。 | + + + +### 步骤 4:设置约束 + +约束用于规定表中的数据规则。如果存在违反约束的数据行为,该行为会被约束终止。 + +![step 4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A44.png) + +ODC 中支持设置的表级约束包括以下 4 种: + +* **主键约束** :定义一个主键来唯一标识表中的每一行数据。主键约束可为一个字段或是一组字段,一张表中只能设置一个主键约束,且设置完成后不支持编辑。 + +* **唯一约束** :保证在一个字段或者一组字段里的数据在表中是唯一的,一张表中可设置多个唯一约束。 + +* **外键约束** :在两个表的数据之间建立连接(可为一列或多列),旨在保持关联表之间数据的一致性、完整性。设置完成后不支持新增和编辑。 + +* **检查约束** :在编辑数据库数据时,按照设置的检查规则进行校验,校验通过才允许数据修改操作。 + + +由于 OceanBase 数据库中 MySQL 模式和 Oracle 模式支持的约束不同,而不同约束所需的信息也略有不同,因此请根据所选的约束方法按页面上的要求指定所需信息: + +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 信息项 | 说明 | +| 约束名称 | 指定约束的名称。 | +| 列信息 | 选择一个字段或者一组字段作为约束。 | +| 关联 Schema(Oracle 模式下) | 使用 **外键约束** 时需指定关联表(父表)所在的 Schema。 | +| 关联数据库(MySQL 模式下) | 使用 **外键约束** 时需指定关联表(父表)所在的数据库。 | +| 关联表 | 使用 **外键约束** 时需指定关联表(父表)。 | +| 关联字段 | 使用 **外键约束** 时需指定关联字段(父表)。 | +| 删除 | 指定删除关联表(父表)中的数据时,当前表(子表)对应的动作。
                  可指定 **CASCADE** 、 **NO ACTION** **、** **RESTRICT** 和 **SET NULL** 等四种对应的动作。
                  MySQL 和 Oracle 模式下所支持的外键动作不同:
                  - MySQL 模式下,OceanBase 可指定 CASCADE、NO ACTION、RESTRICT 和 SET NULL;
                  - Oracle 模式下,OceanBase 可指定 CASCADE、NO ACTION 和 SET NULL。
                  **注意**
                  OceanBase 暂不支持 **SET NULL** 动作。
                  相关语法,请参考 [OceanBase](https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database/V3.2.1/create-table)或 MySQL/Oracle 官网文档。 | +| 更新 | 指定更新关联表(父表)中的数据时,当前表(子表)对应的动作。
                  可指定 **CASCADE** 、 **NO ACTION** 、 **RESTRICT** 和 **SET NULL** 等四种对应的动作。
                  MySQL 和 Oracle 模式下所支持的外键动作不同:
                  - MySQL 模式下,OceanBase 可指定 CASCADE、NO ACTION、RESTRICT 和 SET NULL;
                  - Oracle 模式下,OceanBase 可指定 NO ACTION。
                  **注意**
                  OceanBase 暂不支持 **SET NULL** 动作。
                  相关语法,请参考 [OceanBase](https://www.oceanbase.com/docs/oceanbase-database/oceanbase-database/V3.2.1/create-table)或 MySQL/Oracle 官网文档。 | +| 检查条件 | 指定执行 **检查约束** 时校验数据的检查规则。 | + +设置约束页面提供以下功能键: + +|-----|------------| +| 功能项 | 说明 | +| +新建 | 添加一个新约束。 | +| 删除 | 删除当前选中的约束。 | + +### 步骤 5:设置分区规则 + +![step 5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A45.png) + +当表中包含大量数据时,可以对表进行分区。表进行分区后,表中的数据会存放到多个表空间,每次查询数据时不会扫描整张表。 + +* OceanBase 中 MySQL 模式支持六种分区方法: **key** 、 **Hash** 、 **Range** 、 **Range Columns** 、 **List** 和 **List Columns** 。 + + + +* Oracle 模式支持三种分区方法: **List** 、 **Range** 和 **Hash** 。 + + 由于在 MySQL 模式和 Oracle 模式下分区的定义不同,因此以下信息在不同模式下的意义略有不同,请根据所选的分区方法按其定义指定以下信息: + + + |------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 信息项 | 说明 | + | 分区方法 | 指定分区方法。 MySQL 模式和 Oracle 模式下支持的分区方法不同。
                  - Range 分区:基于属于一个给定连续区间的列值,将多行分配给分区。范围必须是有序的、连续的和不重叠的。
                  - List 分区:基于数据的枚举值进行分区。
                  - Hash 分区:基于给定的分区个数进行分区。对于分布规则不明显的数据,并没有明显的范围查找等特征,可以使用HASH分区,将数据分区列的值按照HASH算法打散到不同的分区上,将数据随机分布到各个分区。
                  -Key 分区:类似于按 HASH 分区,区别在于 KEY 分区只支持计算一列或多列,且 MySQL 服务器提供其自身的哈希函数。必须有一列或多列包含整数值。
                  有关分区方法,请参见 [OceanBase 数据库分区表](https://www.oceanbase.com/docs/enterprise/oceanbase-database-cn/V3.2.3/10000000000357153)。 | + | 字段 | 选择作为分区键的字段。 | + | 表达式 | 根据表达式的返回值进行分区(Oracle 模式下不支持分区表达式)。 | + | 分区 | 根据所选的 **分区方法** ,可能需要指定 **分区名称** 、 **分区数量** 、 **区间上限值** 或 **值枚举** 等信息。 可添加多个分区,并拖动已选字段进行排序。 | + + + + + + +### 步骤 6:确认 SQL + +![新建表-步骤六](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/create%20table.png) + +单击 **提交** 后,在 SQL 确认页面查看语句,支持 **SQL 检查** 和 **格式化** 语句以方便查看。 + +语法格式如下: + +```sql +CREATE TABLE table_name (column_name column_type, column_name column_type,.......); +``` + + + +参数说明: + + +|-------------------------|----------------------------------------| +| 参数 | 说明 | +| CREATE TABLE | 用于创建给定名称的表,必须拥有表 CREATE 的权限。 | +| table_name | 创建表的名称,表名称必须符合标识符命名规则。 | +| column_name column_type | 指定数据表中每个列(字段)的名称和数据类型,如果创建多个列,需要用逗号隔开。 | + + + +### 步骤 7:完成新建表 + +单击 **执行** ,完成新建表后,会在左侧导航栏的表列表中出现新建的 employee 表。 + +![新建表-步骤七-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A47.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击表列表中的表名,通过弹出的管理操作列表(包括 **查看表结构** 、 **查看 DDL** 、 **查看表数据** 、 **新建表** 、 **导入** 、 **导出** 、 **下载** 、 **模拟数据** 、 **打开 SQL 窗口** 、 **复制** 、 **重命名** 、 **删除** 和 **刷新** ),可快速管理和操作目标对象。 + +表对象具体操作,请参见 [表数据管理](../1.client-odc-table-objects/5.client-odc-manage-table-data.md)。 + +支持使用关键字 `SELECT` 查询新建的表数据。 + +语法格式: + +```sql +SELECT + column_name, + column_name +FROM + table_name [WHERE Clause] [LIMIT N] [ OFFSET M] +``` + + + +参数说明: + + +|-------------|------------------------------------------------------| +| 参数 | 说明 | +| SELECT | SELECT 命令可以读取一条或者多条记录。 | +| column_name | 指定查列名称。 使用星号(\*)默认查询所有列信息。 | +| WHERE | 条件语句。 | +| LIMIT | 设定返回的记录数。 | +| OFFSET | 指定 SELECT 语句开始查询的数据偏移量。 默认情况下偏移量为 0。 | + + + +示例: + +```sql +SELECT `emp_no`, `birthdate`, `name`, `gender` FROM `employee`; +``` + + + +![新建表-步骤8](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A1%A8-%E6%AD%A5%E9%AA%A48.png) + + + +## 相关信息 + + +* [新建视图](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [新建函数](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [新建存储过程](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [新建序列](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [新建程序包](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [新建触发器](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [新建类型](../8.client-odc-type-objects/2.client-odc-create-a-type.md) +* [新建同义词](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/3.client-odc-table-list.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/3.client-odc-table-list.md new file mode 100644 index 00000000..51f032bb --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/3.client-odc-table-list.md @@ -0,0 +1,38 @@ +表列表 +======================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **表** 标签可查看表列表。表列表中展示当前连接的数据库中存在的表对象,可在表列表中查看该对象的结构树或右键目标对象以进行管理操作。 + +结构树 +------------------------ + +如下图所示,在表列表中单击目标表名前的下弹标志会在弹出的下拉列表中展示其结构树,对象表的结构树最深有三层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表**: + +![Image 188](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%88%97%E8%A1%A8-1.png) + +管理操作 +------------------------- + +在表列表中,表对象名称默认支持按头字符升序排序。 +鼠标右键单击架构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键以供快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|-----------|--------------------------------------------------------------------------------| +| 查看表结构 | 进入表属性页签,全量查看表的基本信息、列、索引、约束和 DDL 等信息。 | +| 查看 DDL | 进入表属性页签,查看定义当前表的 SQL 语句。 | +| 查看表数据 | 进入表数据页签,查看表中的数据。 | +| 新建表 | 进入新建表页面,根据步骤创建新的表对象。 | +| 导入 | 向当前表中导入数据,具体信息请参见 [单表导出与导入](../../5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md)。 | +| 导出 | 导出当前表中的数据,具体信息请参见 [单表导出与导入](../../5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md)。 | +| 下载 | 下载表对象的 SQL 文件。 | +| 模拟数据 | 进入 **模拟数据** 面板。 | +| 打开 SQL 窗口 | 新建一个 SQL 窗口。 | +| 复制 | 复制表名、Select 语句、Insert 语句、Update 语句或 Delete 语句。 | +| 重命名 | 重命名当前表对象。 | +| 删除 | 删除当前表对象。 | +| 刷新 | 对当前表对象进行一些管理操作后,刷新结构树以展示最新信息。 | +| 查看列/索引/约束 | 进入表属性页签的列/索引/约束信息部分,查看表对象中列/索引/约束的具体信息。 | +| 新建列/索引/约束 | 弹出新建列/索引/约束页面。 | + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/4.client-odc-manage-table-attributes.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/4.client-odc-manage-table-attributes.md new file mode 100644 index 00000000..5de419c3 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/4.client-odc-manage-table-attributes.md @@ -0,0 +1,171 @@ +表属性管理 +========================== + + + +概述 +----------------------- + +![数据库对象-表对象-表属性管理-概述](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/table/table%20attribute-basic%20information.png) + +1. 在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页单击连接名,进入连接。 + +2. 在左侧导航栏中单击 **表** 标签可查看表列表。 + +3. 在表列表中双击表名进入表管理页面。 + +4. 在表管理页面,单击顶部导航栏中的 **属性** 按钮进入属性页签。在属性页签中,可查看当前表中 **基本信息**、**列**、**索引**、**约束**、**分区** 和 **DDL** 属性信息。 + + + +基本信息 +------------------------- + + +在 **属性** 页签的左导航栏中单击 **基本信息** 标签查看当前表的基本信息: + + +| 信息项 | 说明 | +|--------|----------------------------| +| 表名称 | 显示当前表的名称,同时可在此修改表的名称。 | +| 默认字符集 | 当前表所用的字符集。 | +| 默认排序规则 | 当前表所用的排序规则。 | +| 描述 | 显示创建表时所添加的描述,同时可在此修改对表的描述。 | +| 所有者 | 表对象所在的数据库。 | +| 最近修改日期 | 显示最近修改表属性的日期。 | +|行数据量|显示行数。| +|大小|显示数据大小。| + + + +基本信息页面提供以下功能键: + + +| 功能项 | 说明 | +|-----|----------------------------------------------| +| 编辑 | 单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412792.jpg),修改基本信息。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新基本信息。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + + +列信息 +------------------------ + +![表信息_列.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-3.png) + +在属性页签的左导航栏中单击 **列** 标签查看当前表中所包含的列。在 **列** 标签中,支持修改 **名称** 、 **长度** 、 **非空** 和 **注释** 。 + + + +工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|-----------------------------------------------------------------| +| 新建 | 单击+,在表中新增一个字段(列)。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除当前选中的字段。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新字段信息。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg)(在 **字段名称** 和 **类型** 右侧),筛选或搜索字段。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + +> **说明** +>
                  • Oracle 模式下不支持设置自增字段。
                  • +>
                  • 列为非空时允许设置为空,列为空时不允许设置为非空。
                  • +>
                  • 如果表中无自增字段,增加一个自增列,仅支持新建列为设置为自增列。
                  • +>
                  • 缺省值和自增互斥,仅允许设置其中一项;仅支持修改未勾选虚拟列的列缺省值,缺省值一经设置无法取消。
                  • +>
                  • 已设置的虚拟列不可修改,新建列可设置虚拟列。
                  + + + + + + +索引信息 +------------------------- + +![表信息_索引.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-4.png) + +在属性页签的左导航栏中单击 **索引** 标签查看当前表中包含的索引。 + +在 **索引** 标签中,支持修改 **索引名称** 和 **不可见** 。 + +工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|----------------------------------------------------------------------------------| +| 新建 | 单击+,在表中新增一个索引。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除当前选中的索引。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新索引信息。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg)(在 **索引名** 、 **范围** 、 **方法** 和 **类型** 右侧),筛选或搜索字段。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入**。 | + + + +约束信息 +------------------------- + +![表信息_约束.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-5.png) + +在属性页签左导航栏单击的 **约束** 标签查看当前表中的约束信息. + +在 **约束** 标签中,支持新增/删除 **唯一约束** 和 **检查约束**,不可修改已有对象。 + +工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|----------------------------------------------| +| 新建 | 单击+,在表中新增一个约束。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除当前选中的约束。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新约束列表。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg),筛选或搜索字段。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入**。 | + + +> **说明** +>
                  • 不同约束方法支持的功能键不同,当导航栏中功能键为灰色或不存在时,表明该约束方法暂不支持该操作。
                  • +>
                  • 外键约束:OceanBase Oracle 模式支持通过 `all_constraints` 查询外键;OceanBase MySQL 模式自 OBServer V2.2.6 版本起,支持通过 information_schema.key_column_usage 查询外键。
                  • +>
                  • 仅 OceanBase Oracle 模式支持检查约束功能。
                  + + +分区信息 +------------------------- + +![表信息_分区.png](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-6.png) + +在属性页签的左导航栏中单击 **分区** 标签查看当前表中所包含的 **分区名称**、 **顺序**、 **分区方法**、 **表达式** (Oracle 模式下展示分区键)、 **区间上限值** 或 **枚举值** 等信息(展示新建表时设置的分区方法,不同分区方法展示的分区信息不同)。且工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|-------------------------------------------------------| +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412794.jpg),删除选中的分区,分区的数据也随之销毁。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新分区列表。 | +| 筛选 | 单击![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412788.jpg),筛选或搜索分区名称、顺序或区间上限值等信息。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + +> **说明** +> 自 ODC V3.3.0 版本起,表对象分区查看去除 sys 租户依赖。 + + + +DDL 信息 +--------------------------- + +![Image 702](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E5%B1%9E%E6%80%A7%E7%AE%A1%E7%90%86-7.png) + +可在 **属性** 页签中单击左导航栏中的 **DDL** 标签,查看当前表的 DDL 语句(即查看定义当前表的 SQL 语句,不支持编辑)。工具栏中提供以下功能键: + + +| 操作键 | 说明 | +|-----|----------------------------------------------| +| 格式化 | 单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412792.jpg),格式化语句以方便查看。 | +| 下载 | 单击![下载](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E4%B8%8B%E8%BD%BD.jpg),下载 DDL 为本地文件。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新分区列表。 | +| 导出 | 单击右上角的导出图标,导出单表数据,具体信息请查看本手册文档 **单表导出与导入** 。 | + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/5.client-odc-manage-table-data.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/5.client-odc-manage-table-data.md new file mode 100644 index 00000000..9bc66727 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/1.client-odc-table-objects/5.client-odc-manage-table-data.md @@ -0,0 +1,64 @@ +表数据管理 +========================== + +在OceanBase开发者中心(OceanBase Developer Center,ODC)点击连接名进入连接后,在左导航栏中点击 **表** 标签可以查看表列表。在表列表中双击表名进入表管理页面,点击上方导航栏中的 **数据** 按钮进入数据页签,在该页签可对当前表中的数据进行查看、新增、修改和删除操作。 + +> **注意** +> ODC 中共享 Session,相同连接只有一个 Session。在 Oracle 模式下,ODC V2.3.2 之后版本自动提交默认设置为关,所以您需要手动提交事务。可以在 **会话属性** 页面修改变量 autocommit 的值进行设置,具体操作请参见 [管理会话](../../9.client-odc-session-management.md)。 + +![表数据管理-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E6%95%B0%E6%8D%AE%E7%AE%A1%E7%90%86-1.png) + +查看数据 +------------------------- + +进入数据页签后,ODC 以表格的形式展示表中的数据,并导航栏中提供了以下功能键查看和管理表中的数据: + + +| 功能 | 说明 | +|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 编辑 | 单击编辑图标进入编辑态,以修改表中的数据。 | +| 提交(Oracle 模式) | Oracle 模式下自动提交默认设置为关(OFF),所以您需要单击该按钮以手动提交当前事务。单击时会提示您当前连接采用共享 Session,提交操作会对所有窗口生效,单击 **确认** 后提交生效。MySQL 模式下自动提交默认设置为开(ON)将不展示该按钮。 | +| 回滚(Oracle 模式) | Oracle 模式下自动提交默认设置为关(OFF),单击该按钮以回滚当前事务。单击时会提示您当前连接采用共享 Session,回滚操作会对所有窗口生效,单击 **确认** 后回滚生效。MySQL 模式下自动提交默认设置为开(ON)将不展示该按钮。 | +| 下载数据 | 单击下载数据图标,下载结果集数据。 将查询结果导出为 CSV、SQL 或 Excel 文件:
                  - 导出 SQL 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称**、** **文件格式** (SQL) **、** **文件编码** 、 **数据脱敏** 和 **SQL 文件设置** ( **表名** );
                  - 导出 CSV 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、**文件格式**、**文件编码** 、 **数据脱敏** 和 **CSV 设置** ( **包含列头** 、 **空字符串转为空值** 、 **字段分隔符** 、 **文本识别符** 和 **换行符号** );
                  - 导出 EXCEL 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、**文件格式**、**文件编码** 、 **数据脱敏** 和 **Excel 文件设置** ( **包含列头** 和 **导出 SQL 到另一个 Sheet** )。
                  **注意**
                  导出数据条数不再受查询窗口的条数限制,可自定义导出条数。 | +| 模拟数据 | 创建模拟数据。 具体操作步骤,请参见 [模拟数据](../../5.client-odc-use-tools/2.client-odc-data-mocking.md)。 | +| 回到开始 | 跳转至第一页。 | +| 上一页 | 向上翻页。 | +| 下一页 | 向下翻页。 | +| 跳至底部 | 跳转至最后一页。 | +| 展示数据量 | 设置在页面中展示的行数。 | +| 搜索 | 通过关键字搜索表数据。 | +| 列管理 | 筛选在页面中展示的列。 | +| 列模式 | 以表格的形式展示当前被选中行的数据。在 **列模式** 页面可以进行上一行、下一行的切换展示,在列数量比较多的场景下, **列模式** 比较方便查看单行数据。 | +| 刷新 | 刷新表中数据。 | +| 导出 | 导出单表数据,默认导出当前表,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入** 。 | + + + +编辑数据 +------------------------- + +如下图所示,在数据页签导航栏中单击 **开启编辑** 可进入编辑态。ODC 中用颜色标识您对表中数据的操作,新增的数据用绿色标识,删除的数据用红色标识,修改后的数据用橙色标识。 + +![表数据管理-2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E8%A1%A8%E6%95%B0%E6%8D%AE%E7%AE%A1%E7%90%86-2.png) + +编辑态下,导航栏提供了以下操作键功能编辑表中的数据: + + +| 功能 | 说明 | +|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------| +| 添加行 | 单击该功能键将在表中指定位置插入一个空行。双击单元格以插入数据,ODC 提供了校验和工具来帮助您更快捷方便的插入数据。例如,当前单元格在日期类型的列中,ODC 会为您提供一个日历窗口来帮助您直接选择要插入的日期值。 | +| 删除行 | 在表中删除当前选中的行。 | +| 复制当前行 | 以表格的形式展示当前被选中行的数据。在 **列模式** 页面可以进行上一行、下一行的切换展示,在列数量比较多的场景下, **列模式** 比较方便查看单行数据。 | +| 回到开始 | 跳转至第一页。 | +| 上一页 | 向上翻页。 | +| 下一页 | 向下翻页。 | +| 跳至底部 | 跳转至最后一页。 | +| 展示数据量 | 设置在页面中展示的行数。 | +| 搜索 | 通过关键字搜索表数据。 | +| 列管理 | 筛选在页面中展示的列。 | +| 列模式 | 以表格的形式展示当前被选中行的数据。在 **列模式** 页面可以进行上一行、下一行的切换展示,在列数量比较多的场景下, **列模式** 比较方便查看单行数据。 | +| 取消 | 退出编辑态。 | +| 确认修改 | 生成对应操作的 SQL 语句,确认语句无误后,单击 **执行** 使修改生效。当自动提交设置为开(ON)时,单击该按钮事务被自动提交。 | +| 修改并提交 | Oracle 模式下自动提交默认设置为关(OFF),所以您需要单击该按钮以手动提交当前事务。单击时会提示您当前连接采用共享 Session,提交操作会对所有窗口生效,单击 **确认** 后提交生效。 MySQL 模式下自动提交默认设置为开(ON)将不展示该按钮。 | + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/1.client-odc-view-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/1.client-odc-view-objects-overview.md new file mode 100644 index 00000000..6d32ac45 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/1.client-odc-view-objects-overview.md @@ -0,0 +1,29 @@ +概述 +======================= + +视图是基于一个或多个表(或视图)而创建的虚拟表,视图基于的表称为基表。视图本身不包含数据,通过它可以对基表里面的数据进行查询和修改。所以视图的定义存在数据字典中,但是与此定义相关的数据并没有再存一份于数据库中。视图看上去非常像数据库的物理表,对它的操作同任何其它的表一样。当通过视图修改数据时,实际上是在改变基表中的数据,相反地,基表数据的改变也会反映在由基表产生的视图中。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击视图标签可以查看视图列表。在视图列表中双击视图名进入视图管理页面,您可以在视图管理页面的数据页签查看视图的数据,或在属性页签查看视图的基本信息、列和 DDL 等属性信息。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V1.4.1 及以上。 | + + + +本章节将分篇介绍以下 ODC 中视图对象的相关操作: + +* [新建视图](../2.client-odc-view-objects/2.client-odc-create-a-view.md) + + + +* [管理视图](../2.client-odc-view-objects/3.client-odc-manage-views.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/2.client-odc-create-a-view.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/2.client-odc-create-a-view.md new file mode 100644 index 00000000..3ffd02df --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/2.client-odc-create-a-view.md @@ -0,0 +1,203 @@ +新建视图 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建视图。本文介绍如何使用 ODC 创建视图。 + +概述 +----------------------- + +视图是一个虚拟表,其结构和内容是由一张或多张表中的部分数据组成并通过 `SELECT` 查询语句获取,本身并不包含数据。 + +### 视图作用 + +* 简化数据查询操作:视图能够将数据库不同表中所需的数据组合成一个单表,利用视图,将多表查询转换成视图的单表查询。 + + + +* 限制数据访问操作:使用视图仅向特定用户公开特定数据,用户仅能查看视图所显示的数据。 + + + +![概述](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%A6%82%E8%BF%B0.png) + +如上图所示,创建视图需要进行以下 5 个步骤: + +1. 指定基本信息。 + + + +2. 选择基表。 + + + +3. 选择字段。 + + + +4. 确认 SQL。 + + + +5. 完成新建视图。 + + + + + + +操作步骤 +------------------------- + +以在 ODC 中创建员工薪资视图(salary)为例,将 employee 表中的 name 和 consumer 表中的 budget、dept_name 数据组合到视图 salary 中。具体操作步骤如下: + +### 步骤 1:指定基本信息 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左侧导航栏中单击 **视图** 标签可查看视图列表。在视图列表的右上角,单击 **+** 创建视图,或在顶部导航栏中单击 **新建** 以创建所需对象。 + +在 **基本信息** 中,输入 **视图名称** 并选择 **检查项** 。 + +* **视图名称** :为视图指定一个名称。 + + + +* **检查项** :检查项是对写入数据的约束检查,OceanBase Oracle 模式下支持只读。默认值: **无** 。 + + + + + + +![步骤1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%80.png) + +完成基本信息的指定后,单击页签左下角的 **确定** 按钮,完成当前步骤。 + +设置基本信息完成后,可以直接单击页面下方的 **下一步:确认 SQL** 按钮进入第四步 **确认 SQL**,或可以按需进入第二步进行基表选择的操作。 + +### 步骤 2:选择基表 + +指定基本信息后,可按需继续进行第二步基表选择的操作,该步骤可跳过。 + +在 **基表选择** 页签中,左侧的列表按 Schema \> 库 \> 表 / 视图的层级关系展示了可被选择的基表,列表支持搜索。在基表列表中选中目标表或视图,单击列表旁的添加按钮 > 添加选中的表或视图到页签右侧的表操作区中。 + +![步骤2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%BA%8C.png) + +在表操作区中,可对选择的基表进行以下操作: + + +| 信息项 | 说明 | +|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 设置别名 | 为选中的基表设置一个别名,可选操作。在表操作区中单击表名后的 **\<别名\>** 标签在文本框中输入别名。 | +| 设置关联关系 | 表操作区中存在两个或两个以上的表时可通过下拉框选择表与表之间的关联关系,默认值为 **JOIN,** 最后一张表无需设置关联关系。单击别名标签后的下拉列表标签![下拉列表](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E4%B8%8B%E6%8B%89%E5%88%97%E8%A1%A8.jpg)进行选择,可选 **JOIN** 、 **INNER JOIN** 、 **LEFT JOIN** 、 **RIGHT JOIN** 、 **CROSS JOIN** 、 **FULL JOIN** 、 **UNION** 、 **UNION ALL** 、 **INTERSECT** 、 **MINUS** 、 **LEFT OUTER JOIN** 、 **RIGHT OUTER JOIN** 和 **FULL OUTER JOIN** 等关联关系。 | +| 调整关联顺序 | 可直接在表操作区中拖动选择的基表进行顺序的调整。当拖动选中的表为最后一张表时该表之前设置的关联关系会被清空。 | +| 删除基表 | 在表操作区中单击每张表后的删除按钮,可从表操作区中删除该表,删除表会附带删除当前表与下一张表的关系。 | + + + +完成基表的选择和设置后,单击页签左下角的 **确定** 按钮,完成当前步骤。 + +### 步骤 3:选择字段 + +完成基表选择后,可进行第三步字段选择的操作。如已跳过第二步基表选择将无法进行字段选择。 + +在 **字段选择** 页签中,左侧的列表按 Schema \> 库 \> 表 / 视图的层级关系展示了在第二步被选择的基表所包含的字段,支持搜索字段。在字段列表中选中目标字段,单击列表旁的添加按钮 ![选择添加](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E9%80%89%E6%8B%A9%E6%B7%BB%E5%8A%A0.jpg) 添加选中的字段到页签右侧的字段操作区中。 + +![步骤3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%E4%B8%89.png) + +在字段操作区中,可对选择的字段进行以下操作: + + +| 信息项 | 说明 | +|--------|-----------------------------------------------------------| +| 设置别名 | 为选中的字段设置一个别名,可选操作。在字段操作区中单击字段名后的 **\<别名\>** 标签在文本框中输入别名。 | +| 调整关联顺序 | 可直接在表操作区中拖动选择的基表进行顺序的调整。每次调整,变更为最后一张表的关联关系将被清空。 | +| 删除字段 | 在表操作区中单击每张表后的删除按钮,可将该表从表操作区中删除。每次删除,变更为最后一张表的关联关系将被清空。 | +| 自定义字段 | 单击字段操作区右上角的 **+自定义** 标签会在字段操作区中添加一个字段,用户需要为新增的字段指定字段名称和别名。 | + + + +完成字段的选择和设置后,单击页签左下角的 **确定** 按钮,完成当前步骤。 + +### 步骤 4:确认 SQL + +完成上述所有信息的指定后,单击页面上 **下一步:确认 SQL** 按钮以进入语句编辑页面。 + +![步骤4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%204.png) + +在语句编辑页面中会根据 **基本信息** 、 **基表选择** 和 **字段选择** 页签中指定的信息生成对应的视图定义语句。当包含 2 个以上表时,需要根据表之间的关联关系和逻辑条件等补齐语句。补齐视图创建语句后,单击页面右上角的 **创建** 按钮,完成视图的创建。 + +用户可以在 SQL 创建确认页面编辑创建的视图语句。语法格式如下: + +```sql +CREATE VIEW view_name AS +SELECT + column1, + column2..... +FROM + table_name +WHERE + [condition]; +``` + + + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|--------------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,为脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| IN 值转化|可以将如 A B 的格式转化为 ('A','B') 的格式。 | +| 上一步 | 返回 **新建视图** 页面,用户可以继续编辑或修改 **基本信息** 、 **基表选择** 和 **字段选择** 页签中的指定的值。 | + + + +### 步骤 5:完成新建视图 + +单击 **创建** ,完成新建视图后,可以如同查询表对象一样,使用 `SELECT` 语句查询用户视图。 + +![步骤4.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%205.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击视图列表中的视图名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **下载** 、 **复制** 和 **删除** ),可快速管理和操作目标对象。 + +视图具体操作,请参见 [管理视图](../2.client-odc-view-objects/3.client-odc-manage-views.md)。 + +语法格式: + +```sql +SELECT +column1, +column2..... +FROM +table_name; +``` + + + +示例: + +```sql +SELECT `name`, `budget`, `department_name` FROM `salary`; +``` + + + +![步骤5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E8%A7%86%E5%9B%BE-%E6%AD%A5%E9%AA%A4%205.2.png) + +相关信息 +------------------------- + +* [新建表](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [新建函数](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [新建存储过程](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [新建序列](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [新建程序包](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [新建触发器](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [新建类型](../8.client-odc-type-objects/2.client-odc-create-a-type.md) +* [新建同义词](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/3.client-odc-manage-views.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/3.client-odc-manage-views.md new file mode 100644 index 00000000..ddb8cf40 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/2.client-odc-view-objects/3.client-odc-manage-views.md @@ -0,0 +1,64 @@ +管理视图 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **视图** 标签可查看视图列表,在视图列表中展示了当前连接的数据库中存在的视图对象。 + +您可以在视图列表中查看该对象的 **结构树** 或右键目标对象以进行一些 **管理操作** 。或者在视图列表中双击目标视图名进入视图管理页面,您可以在视图管理页面的 **属性和数据页签**。 + +结构树 +------------ + +如下图所示,在视图列表中单击目标视图名前的下弹标志会在弹出的下拉列表中展示其结构树,对象视图的结构树最深有三层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表** : + +![Image 193](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-1.png) + +管理操作 +------------- + +在视图列表中,视图对象名称默认支持按头字符升序排序。 +右键结构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|--------|-------------------------------------------------------------| +| 查看视图属性 | 进入 **属性** 页签,全量查看视图的基本信息、列和代码等信息。 | +| 查看视图数据 | 进入 **数据** 页签,查看视图中的数据。 | +| 新建视图 | 进入新建视图页面,根据步骤创建新的视图对象。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载视图对象的 SQL 文件。 | +| 复制 | 选择对象名、Select 语句、Insert 语句、Update 语句或 Delete 语句。 | +| 删除 | 删除当前视图对象。 | + + + +属性和数据页签 +---------------- + +![manage view2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%86%E5%9B%BE-2.png) + + +* 属性页签: + + * **基本信息** :查看 **视图名称** 、 **检查项** 和 **创建人** 等信息。 + + + + * **列** :查看视图对应基表的 **字段名称** 、 **数据类型** 和 **字段注释** 等信息。工具栏中单击刷新图标,刷新字段信息。 + + + + * **代码** :当前视图的定义脚本。工具栏中单击下载图标,下载 DDL 为本地文件;单击格式化图标,格式化语句以方便查看。 + + + + + + +* 数据页签:展示视图中包含的字段名(列)。 + + + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/1.client-odc-functin-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/1.client-odc-functin-objects-overview.md new file mode 100644 index 00000000..6729d0c3 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/1.client-odc-functin-objects-overview.md @@ -0,0 +1,29 @@ +概述 +======================= + +函数即定义了一组 SQL 脚本的集合,可以在SQL语句中对函数进行调用以返回一个指定的结果。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击函数标签可以查看函数列表。在函数列表中双击函数名进入函数管理页面,您可以在函数管理页面查看函数的基本信息、参数和 DDL 等信息。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V2.0.0 及以上。 | + + + +本章节将分篇介绍以下 ODC 中函数对象的相关操作: + +* [新建函数](../3.client-odc-function-objects/2.client-odc-create-a-function.md) + + + +* [管理函数](../3.client-odc-function-objects/3.client-odc-manage-functions.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/2.client-odc-create-a-function.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/2.client-odc-create-a-function.md new file mode 100644 index 00000000..88a997d8 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/2.client-odc-create-a-function.md @@ -0,0 +1,193 @@ +新建函数 +========================= + + + +概述 +----------------------- + +函数是在数据库内定义的子程序,可以从内置 SQL 语句中调用函数。如果自带的函数不能满足业务需求,则可以通过 ODC 新建函数,添加自定义函数,以实现某些功能运算和完成各种特定操作,且自定义函数可以减少重复编码,提高程序可读性。 + +函数是一种与存储过程十分相似的过程式数据库对象。与存储过程一样,都是由 SQL 语句和过程式语句组成的代码片段,并且可以被应用程序和其他 SQL 语句调用。 + +自定义函数与存储过程的区别: + +* 函数有且仅有一个返回,适合做处理数据后返回一个结果;存储过程可有 0 个或多个返回,适合做批量插入、批量更新。 + +* 可以直接通过 select 语句调用函数,而存储过程的调用需要使用 call 语句。 + +![创建函数1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%9B%E5%BB%BA%E5%87%BD%E6%95%B01.png) + +如上图所示,创建函数包含以下 6 个步骤: + +1. 输入函数名称。 + +2. 选择函数返回值的数据类型。 + +3. 添加参数。 + +4. 确定新建函数信息。 + +5. 编辑函数信息。 + +6. 完成新建函数。 + +操作步骤 +------------------------- + +### 步骤一:输入函数名称。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **函数** 标签可以查看函数列表。在函数列表的右上角,单击 + 创建函数,或是在 ODC 上方导航栏中单击 **新建** 以创建您需要的对象。 + +![创建函数2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6422441361/p138325.png) + +### 步骤二:选择函数返回值的数据类型。 + +具体数据类型,请参考 [OceanBase 数据库的开发指南](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.3/data-type-overview)。 + +### 步骤三:添加参数。 + +1. 参数即调用函数时传入的信息,需指定参数信息: + + * Oracle 模式:需指定参数的 **名称** 、 **模式** 、 **类型** 和 **默认值** **。** + + + + * MySQL 模式: 需指定参数的 **名称** 、 **类型** 和 **长度** 。 + + + + + + +2. 添加函数提供三种功能操作: + + + + | 功能项 | 说明 | + |----------|-------------------------------------------------------------------------------------------------------------------------------------------------| + | 弹窗引导辅助菜单 | 通过弹窗引导辅助菜单,可添加、删除、上下移动参数。 | + | 单击表序号 | - 单击表序号,选中整行,显示辅助菜单(删除、上/下移动)。
                  - 单击并选中表序号,可拖动整行参数以调整顺序。 | + | 右键操作 | - 拖动鼠标选中整行,右键单击鼠标,进行复制行 / 向下移动一行。
                  - 选择单元格,右键单击鼠标,进行复制。 | + + + +3. **参数** 中需指定的 **模式** 指参数类型。 + + MySQL 模式下不支持设定参数模式,Oracle 模式下支持三种参数模式 **IN** (输入)、 **OUT** (输出)、 **INOUT** (输入输出): + + + | **参数** | **类型** | + |--------|-------------------------------------------------------------------| + | IN | 输入参数,调用函数时将参数的值传入函数供执行函数时使用。 | + | OUT | 输出参数,调用函数时,函数会忽略输出参数本身的值并传入一个空值,在函数体中可以修改输出参数并将修改结果返回给输出参数所代表的实参。 | + | INOUT | 输入输出参数,即同时具备输入参数和输出参数的功能。 | + + + > **说明**
                  + > Oracle 模式下函数和存储过程均包含 IN/OUT/INOUT 参数;MySQL 模式下只包含 IN 参数,而存储过程包含 IN/OUT/INOUT 参数。 + + + + + +### 步骤四:单击确定,进入 SQL 创建确认页面。 + +### 步骤五:在 SQL 创建确认页面 ,编辑函数语句。 + +![创建函数3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%9B%E5%BB%BA%E5%87%BD%E6%95%B03.png) + +用户可以在 SQL 创建确认页面编辑创建的函数语句。语法格式如下: + +```sql +create function < 函数名 > ([ <参数1> <类型1> [ , <参数2> <类型2>] ] ...) +RETURNS < 类型 > +< 函数主体 > +``` + + + +参数说明: + + +| 参数 | 说明 | +|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| \<函数名\> | 指定自定义函数的名称。
                  **注意**
                  自定义函数不能与存储过程具有相同的名称。 | +| \<参数\>\<类型\> | 用于指定自定义函数的参数。 该参数只有名称和类型,不能指定关键字 IN、OUT 和 INOUT。 | +| RETURNS\<类型\> | 用于声明自定义函数返回值的数据类型。其中,`<类型>` 用于指定返回值的数据类型。
                  **注意**
                  在 RETURN VALUE 语句中包含 SELECT 语句时,SELECT 语句的返回结果只能是一行且只能有一列值。 | +| \<函数主体\> | 自定义函数的主体部分,亦称函数体。 函数体必须包含一个 `RETURN<值>` 语句,其中`<值>`用于指定自定义函数的返回值。 | + + + +示例: + +```sql +create function `function_test` ( + `p1` int(45) -- 申明参数 +) returns int(11) -- 申明返回值类型 + +-- 函数体开始 +begin + +-- 申明变量 +declare +v1 int; + +-- 变量赋值 +set v1 = p1 + 1; + +-- 返回值 +return v1; + +-- 函数体结束 +end +``` + + + +### 步骤六:完成新建函数。 + +单击 **创建** ,完成新建函数后,可以如同调用系统内置函数一样,使用关键字 select 调用用户自定义的函数。 +**说明** + + + +在左侧导航栏中,右键鼠标单击函数列表中的函数名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **编辑** 、 **编译** 、 **调试** 、 **运行** 、 **下载** 、 **删除** 和 **刷新** ),可快速管理和操作目标对象。 + +函数具体操作,请参见 [管理函数](7.client-odc-user-guide/10.client-odc-database-objects/../../3.client-odc-manage-functions.md)。 +语法格式: + +```sql +select <函数名> ([<参数> [,...]]) +``` + + + +示例: + +```sql +select function_test(2); +``` + + + +* MySQL 模式 + + ![创建函数4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%9B%E5%BB%BA%E5%87%BD%E6%95%B04.png) + + +* Oracle 模式 + + ![新建函数](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%96%B0%E5%BB%BA%E5%87%BD%E6%95%B0.png) + + + > **注意**
                  + >
                • Oracle 模式下如果包含 OUT 参数,则需通过 `call` 方式调用。
                • + >
                • 函数列表中如果出现黄色图标,表示目前有错误或者警告。
                • + + + +相关信息 +------------------------- + +[新建存储过程](7.client-odc-user-guide/10.client-odc-database-objects/../../../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/3.client-odc-manage-functions.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/3.client-odc-manage-functions.md new file mode 100644 index 00000000..8fe783f0 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/3.client-odc-function-objects/3.client-odc-manage-functions.md @@ -0,0 +1,94 @@ +管理函数 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **函数** 标签可以查看函数列表,在函数列表中展示了当前连接的数据库中存在的函数对象。 + +可在函数列表中查看该对象的 **结构树** 或右键目标对象以进行一些 **管理操作**。或者,在函数列表中双击目标函数名进入 **函数管理页面**。 + +结构树 +------------ + +如下图所示,在函数列表中单击目标函数名前的下弹标志会在弹出的下拉列表中展示其结构树,对象函数的结构树最深有三层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表** : + +![Image 194](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-1.png) + +管理操作 +------------- + +在函数列表中,函数对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|--------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建函数。 | +| 筛选 | 单击筛选图标选择显示有效/无效函数。 | +| 批量编译 | 单击批量编译图标对函数对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
                  ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png) | +| 刷新 | 对当前函数对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键鼠标单击结构树中的目标项,通过弹出的管理操作列表,可快速管理和操作目标对象。管理操作键表如下所示: + + +| 操作键 | 说明 | +|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 查看 | 进入 **函数管理页面**,全量查看当前函数的基本信息、参数和代码等信息。 | +| 新建 | 进入新建函数页面,根据步骤创建新的函数对象。 | +| 编辑 | 在 **函数管理页面** 中展示定义当前函数的语句,您可以在窗口中继续编辑该函数。 | +| 编译 | 编译目标函数。 | +| 调试 | 进入调试页面以对当前函数进行调试。
                  **说明**
                  • 推荐升级至 OBServer V2.2.77 及之后版本(因 OBServer 部分版本存在 PL 调试类已知问题,可能导致 OBServer 不稳定)。
                  • ODC V3.2.2 之前版本,通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。
                  • 自 ODC V3.2.2 及之后版本,支持通过 OBProxy 连接 OBServer 情况下进行 PL 调试。
                  • ODC V4.0.0 及之后版本,支持设置参数值为 DEFAULT、NULL 或空字符串。
                  | +| 运行 | 运行当前函数。| +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载函数对象的 SQL 文件。| +| 删除 | 删除当前函数。 | +| 刷新 | 对当前函数对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +函数管理页面 +--------------------------- + +![Image 817](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%87%BD%E6%95%B0-2.png) + +在函数列表中双击目标函数名进入函数管理页面。可在函数管理页面查看以下信息: + + +| 功能 | 说明 | +|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 基本信息 | 显示 **函数名称** 、 **返回类型** 和 **创建人** 等信息。 | +| 参数 | 显示参数 **名称** 、 **顺序** 、 **模式** 、 **数据类型** 、 **默认值** 等信息。单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7659061361/p326053.jpg)图标,可刷新参数。 | +| DDL | 显示定义函数的脚本,同时提供 **编辑** 、 **下载**、**查找** 和 **刷新** 功能键。 **说明** 单击 **编辑** 图标,会跳转至 PL 对象编辑窗口。 | + + + +函数编辑页面 +--------------- + + + +在函数列表中右键目标项,在提供的操作键中单击 **编辑** 可进入函数编辑页面,在编辑页面的代码区会展示该函数的定义语句, 您可以继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 确认修改 | 单击以更新本次修改。 | +| 编译 | 编译当前页面中的语句。 | +| 运行 | 单击该按钮运行代码区中的语句。 | +| 终止 | 单击该按钮终止正在运行的语句。 | +| 调试 | 单击该按钮进入调试页面,并对代码区内的 PL 对象进行调试。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| IN 值转化 | 批量复制转化工具,适用于查询数据时对复制的行或列结果进行格式转化。 将批量数据粘贴在 SQL 编辑区后,选择复制的数据,单击 **IN 值转化** 按钮,即可转化成 in('A','B')格式。
                • 列值分隔符号为换行符。
                • 行值分隔符为空格或 TAB 值。
                • | +| 代码片段 | 提供内置语法片段和自定义语法片段供您查看和引用。详情请查看 **用户指南** > **使用工作台** > **代码片段**。 | +| 下载 | 下载函数对象的 SQL 文件。 | \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/1.client-odc-stored-procedure-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/1.client-odc-stored-procedure-objects-overview.md new file mode 100644 index 00000000..26f84246 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/1.client-odc-stored-procedure-objects-overview.md @@ -0,0 +1,46 @@ +概述 +======================= + +存储过程(Stored Procedure)是在数据库系统中,一组为了完成特定功能的 SQL 语句集,它存储在数据库中,一次编译后永久有效。 + +函数和存储过程的定义类似,都是 SQL 脚本的集合,但是二者主要区别如下: + +* 函数一般只返回一个变量,而存储过程没有返回值。 + + + +* 函数是可以嵌入在 SQL 语句中使用,比如,可以在 `SELECT` 语句中调用函数,但是存储过程一般是作为一个独立的部分被执行。 + + + +* 函数限制比较多,而存储过程的限制相对就比较少。一般来说,存储过程实现的功能要复杂一点,而函数的实现的功能针对性比较强。 + + + + + + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **存储过程** 标签可以查看存储过程列表。在存储过程列表中双击存储过程名进入存储过程管理页面,您可以在存储过程管理页面查看存储过程的基本信息、参数和 DDL 等信息。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.0.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V2.0.0 及以上。 | + + + +本章节将分篇介绍以下 ODC 中存储过程对象的相关操作: + +* [新建存储过程](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) + + + +* [管理存储过程](../4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md new file mode 100644 index 00000000..f52858a4 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md @@ -0,0 +1,231 @@ +新建存储过程 +=========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建存储过程。本文介绍如何使用 ODC 创建存储过程。 + +概述 +----------------------- + +存储过程是一条或多条语句的集合,对数据库进行一系列复杂操作时,存储过程可以在数据库内将这类复杂操作封装成一个代码块,以便重复使用,从而减少数据库开发人员的工作量。 + +存储过程旨在完成特定功能的 SQL 语句集,经编译创建并保存在数据库中,用户可以通过指定存储过程名并指定所需参数来调用执行,利用存储过程可以加速 SQL 语句的执行。 + +新建存储过程,即由用户创建并能够完成某一特定功能的存储过程,存储过程可以包含参数和返回值。 + +### 存储过程与函数的区别 + +* 函数的返回值显示具体结果值,而存储过程的返回值仅指明执行是否成功。 + + + +* 可以直接通过 `SELECT` 语句调用函数,而存储过程的调用需要使用 `CALL` 语句。 + + + + + + +### 存储过程作用 + +* 提高应用程序的通用性和可移植性:新建存储过程完成后,可以在程序中被多次调用,无需重新编写该存储过程的 SQL 语句,且支持修改存储过程,对程序源代码无影响,从而提高程序的可移植性。 + + + +* 提高 SQL 执行速度:存储过程编译完成,如果某一个操作包含大量的 SQL 代码或者分别被执行多次,则使用存储过程比直接使用单条 SQL 语句执行速度更快速。 + + + +* 减轻服务器的负担:在进行数据库对象操作时,如果使用单条调用的方式,则网络上必须传输大量的 SQL 语句;如果使用存储过程,则可以直接发送过程的调用命令,从而降低网络负担。 + + + + +![概述](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%A6%82%E8%BF%B0.png) + + +如上图所示,创建存储过程包含以下 5 个步骤: + +1. 输入存储过程名称。 + +2. 添加参数。 + +3. 确定新建存储过程信息。 + +4. 编辑存储过程信息。 + +5. 完成新建存储过程。 + +操作步骤 +------------------------- + +以在 ODC 中创建部门预算存储过程(proc_total)为例,存储过程 proc_total 中包含 budget_r 和 budget_s 两个 INT 类型的输入参数,计算两个参数之和。具体操作步骤如下: + +### 步骤 1:指定存储过程名称 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **存储过程** 标签可以查看存储过程列表。在存储过程列表的右上角,单击 **+** 创建存储过程,或是在顶部导航栏中单击 **新建** \> **存储过程** 以创建所需的对象。 + +在 **新建存储过程** 中,输入存储过程名称。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A41.png) + +### 步骤 2:添加参数 + +1. 参数即调用函数时传入的信息,需指定参数信息: + + * Oracle 模式:需指定参数的 **名称** 、 **模式** 、 **类型** 和 **默认值** **。** + + + + * MySQL 模式: 需指定参数的 **名称** 、 **模式** 、 **类型** 和 **长度** 。 + + + + + + +2. 添加函数提供三种功能操作: + + + + | 功能项 | 说明 | + |----------|-------------------------------------------------------------------------------------------------------------------------------------------------| + | 弹窗引导辅助菜单 | 通过弹窗引导辅助菜单,可添加、删除、上下移动参数。 | + | 单击表序号 | - 单击表序号,选中整行,显示辅助菜单(删除、上/下移动)。
                  - 单击并选中表序号,可拖动整行参数以调整顺序。 | + | 鼠标右键操作 | 右键单击鼠标选中整行,进行复制行 / 向下移动一行。 | | + + > **说明** + > + > 复制行后,可选中某行并通过快捷键 Command + V / Ctrl + V 进行粘贴。 + + + +3. **参数** 中需指定的 **模式** 指参数类型 + + MySQL 模式下不支持设定参数模式,Oracle 模式下支持三种参数模式 **IN** (输入)、 **OUT** (输出)、 **INOUT** (输入输出): + + ```sql + CREATE PROCEDURE proc_name ([[IN |OUT |INOUT ] parameter_name parameter_type...]) + ``` + + + * 参数说明 + + + + | **参数** | **类型** | + |--------|----------------------------------------------------------------------------------------------------------------------------------| + | IN | 输入参数。
                  调用存储过程时将参数的值传入存储过程供执行存储过程时使用。 IN 类型参数一般只用于传入,在调用存储过程中一般不作修改和返回。 | + | OUT | 输出参数。
                  调用存储过程时,存储过程会忽略输出参数本身的值并传入一个空值,执行结束后,输出参数会被赋予存储过程对其修改的值。一般用输出参数获取存储过程的执行结果数据。 OUT 类型参数可以用于调用存储过程中需要修改和返回值。 | + | INOUT | 输入输出参数。
                  同时具备输入参数和输出参数的功能。 | + + + + * 参数设置 + + + + | 属性 | 是否必填 | 默认 | 模式 | + |-----|------|---------|--------------| + | 名称 | 必填 | 空 | Oracle/MySQL | + | 模式 | 必填 | IN | Oracle/MySQL | + | 类型 | 必填 | VARCHAR | Oracle/MySQL | + | 长度 | 必填 | 45 | MySQL | + | 默认值 | 非必填 | 空 | Oracle | + + + + + + + + + +### 步骤 3:确定新建存储过程 + +单击 **确定** ,进入 SQL 创建确认页面。 + +### 步骤 4:编辑存储过程 + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-4.png) + +在 SQL 创建确认页面 ,编辑存储过程语句。 + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,为脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,为脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| IN 值转化 | 可以将如 A B 的格式转化为 ('A','B') 的格式。 | + + +用户可以在 SQL 创建确认页面编辑创建的存储过程语句。语法格式如下: + +```sql +CREATE PROCEDURE proc_name ( + [proc_parameter[,...]]) +BEGIN +proc_body: +  Valid SQL routine statement +END [end_label] +``` + + + +参数说明: + + +| 参数 | 说明 | +|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| proc_name | 存储过程的名称,默认在当前数据库中创建。 如需在特定数据库中创建存储过程,需要在名称前加上数据库名称,即 db_name.sp_name。
                  **注意**
                  名称应当尽量避免选取与 MySQL 内置函数相同的名称,否则会发生错误。 | +| [proc_parameter[,…] ] | 存储过程的参数列表,包括 `[IN|OUT|INOUT] parameter_name parameter_type`。
                  其中,`parameter_name` 为参数名,`parameter_type` 为参数的类型(可以是任何有效的 MySQL 数据类型)。当有多个参数时,参数列表中彼此间用逗号分隔。存储过程可以无参数(此时存储过程的名称后仍需加上一对括号),也可以有 1 个或多个参数。
                  **注意**
                  参数名避免与数据表的列名相同,否则存储过程的 SQL 语句会将参数名看作列名,从而可能出错。 | +| proc_body | 存储过程的主体部分,包含在过程调用的时候必须执行的 SQL 语句。
                  此部分以 **BEGIN** 开始, **END** 结束。如存储过程体中只有一条 SQL 语句,则可以省略 BEGIN-END 标志。 | + + + +### 步骤 5:完成新建存储过程 + +单击 **创建** ,完成新建存储过程后,可以如同调用系统内置函数一样,使用 `CALL` 语句调用用户自定义的存储过程。 + +![5.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-5.1.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击存储过程列表中的存储过程名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **编辑** 、 **运行** 、 **下载** 、 **删除** 和 **刷新** 等),可快速管理和操作目标对象。 + +存储过程具体操作,请参见 [管理存储过程](../4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md)。 + +语法格式: + +```sql +CALL proc_name ([proc_parameter [,...]]); +``` + + + +示例: + +```sql +CALL proc_total (30000, 20000); +``` + + + +![5.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-5.2.png) + +相关信息 +------------------------- + +* [新建表](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [新建视图](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [新建函数](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [新建序列](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [新建程序包](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [新建触发器](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [新建类型](../8.client-odc-type-objects/2.client-odc-create-a-type.md) +* [新建同义词](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md new file mode 100644 index 00000000..e2d8a4f7 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/4.client-odc-stored-procedure-objects/3.client-odc-manage-stored-procedures.md @@ -0,0 +1,119 @@ +管理存储过程 +=========================== + + + +概述 +----------------------- + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页单击连接名进入连接后,在左导航栏中单击 **存储过程** 标签可查看存储过程列表,在存储过程列表中显示当前连接的数据库中存在的存储过程对象。 + +在存储过程列表中,可查看该对象的 **结构树** 或右键目标对象以进行 **管理操作** 。或者,在存储过程列表中双击目标存储过程名进入 **存储过程管理页面** 。 + +结构树 +------------------------ + +如下图所示,在存储过程列表中,单击目标存储过程名左侧的下拉图标![下拉按钮2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2334377361/p354912.jpg),在弹出的下拉列表中会展示其结构树。 + +对象存储过程的结构树最深包含三层,右键单击结构树中不同层级中的项,提供对该项的操作键选项,具体操作请参见 **管理操作** 中的 **管理操作键表** : + +![Image 195](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-1.png) + +管理操作 +------------------------- + +在存储过程列表中,存储过程对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|----------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建存储过程。 | +| 筛选 | 单击筛选图标选择显示有效/无效存储过程。 | +| 批量编译 | 单击批量编译图标对存储过程对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
                  ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png) | +| 刷新 | 对当前存储过程对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键结构树中的目标项,在弹出的右键管理操作列表中,ODC 提供操作键选项以快速管理目标对象。下述为管理操作键表: + + +右键结构树中的目标项,在弹出的右键管理操作列表中,ODC 提供操作键选项以快速管理目标对象。 + +下述为管理操作键表: + + +| 操作键 | 说明 | +|-----|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 查看 | 进入 **存储过程管理页面,** 全量查看当前存储过程的基本信息、参数和代码等信息。 | +| 新建 | 进入新建存储过程页面,根据步骤创建新的存储过程对象。 | +| 编辑 | 在 **存储过程编辑页面** 中展示定义当前存储过程的语句,可以窗口中继续编辑该存储过程。 | +| 编译 | 编译目标存储过程。 | +| 调试 | 进入 **调试页面** 以对当前存储过程进行调试。
                  **说明**
                  ODC V4.0.0 及之后版本,支持设置参数值为 DEFAULT、NULL 或空字符串。
                  | +| 运行 | 运行当前存储过程。 | +| 运行 | 运行当前存储过程。| +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载存储过程对象的 SQL 文件。 | +| 删除 | 删除当前存储过程。 | +| 刷新 | 对当前存储过程对象进行管理操作后,刷新结构树以显示最新信息。
                  **说明**
                • 推荐升级至 OBServer V2.2.77 及之后版本(因 OBServer 部分版本存在 PL 调试类已知问题,可能导致 OBServer 不稳定)。
                • ODC V3.2.2 之前版本,通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。
                • 自 ODC V3.2.2 及之后版本,ODC 支持通过 OBProxy 连接 OBServer 情况下进行 PL 调试。
                • | + + + +存储过程管理页面 +----------------------------- + +![管理存储对象2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B-2.png) + +在函数列表中,双击目标存储过程对象名进入存储过程管理页面。可在存储过程管理页面查看以下信息: + + +| 功能 | 说明 | +|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 基本信息 | 显示 **存储过程名称** 、 **创建人** 、 **创建时间** 和 **最近修改时间** 等信息。 | +| 参数 | 显示参数 **名称** 、 **模式** 、 **数据类型** 、 **长度** 和 **默认值** 等信息。单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7659061361/p326053.jpg)图标,可刷新参数。 | +| DDL | 显示定义存储过程的脚本,同时提供 **编辑** 、**下载**、 **查找** **、** **格式化** 和 **刷新** 功能键。 **说明** 单击 **编辑** 图标,会跳转至 PL 对象编辑窗口。 | + + + +存储过程编辑页面 +----------------------------- + +在存储过程列表中右键目标项,在提供的操作键中单击 **编辑** 可进入存储过程编辑页面,在编辑页面的代码区会显示该存储过程的定义语句, 可继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 确认修改 | 单击以更新本次修改。 | +| 编译 | 编译当前页面中的语句。 **说明** * 编译过程中,如存在引用无效的外部对象时 对象名所在行高亮 * 编译完成后, **编译结果** 中会显示编译状态(如存在告警,会显示告警详情)。 | +| 运行 | 单击该按钮![运行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7267628361/p358390.jpg)运行代码区中的语句。 | +| 调试 | 单击该按钮![调试](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7267628361/p358392.jpg)进入调试模式,并对代码区内的 PL/SQL 对象进行调试。 调试完成后,可直接关闭调试窗口。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,旨在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,旨在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| IN 值转化 | 批量复制转化工具,适用于查询数据时对复制的行或列结果进行格式转化。 将批量数据粘贴在 SQL 编辑区后,选择复制的数据,单击 **IN 值转化** 按钮,即可转化成 in('A','B')格式。
                • 列值分隔符号为换行符。
                • 行值分隔符为空格或 TAB 值。
                • | + + + +储存过程运行结果页面 +------------------------------- + +![存储过程-运行结果](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2334377361/p350898.png) + +存储过程执行完毕后,可查看 **运行结果** 和 **DBMS 输出** 信息。 + + +| 功能 | 说明 | +|---------|----------------------------------------| +| 运行结果 | 在运行结果页签中,可查看存储过程运行状态、参数、类型、值、返回类型和返回值。 | +| DBMS 输出 | 在 DBMS 输出页签中,可查看存储过程 DBMS 输出信息。 | + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/1.client-odc-squence-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/1.client-odc-squence-objects-overview.md new file mode 100644 index 00000000..09ae7e02 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/1.client-odc-squence-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +序列(Sequence)是指在数据库中按照一定规则自增的一种数字序列。因为自增所以不会出现重复的值,所以通常用来做为表的主键或唯一键。 +> **注意**
                  +> 连接 V2.1.0 及之后版本 OceanBase 数据库 Oracle 模式支持创建序列对象,MySQL 模式暂不支持。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击序列标签可以查看序列列表。在序列列表中双击序列名进入序列管理页面,您可以在序列管理页面查看序列的基本信息、参数和 DDL 等信息。 + +本章节将分篇介绍以下 ODC 中序列对象的相关操作: + +* [新建序列](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) + + + +* [管理序列](../5.client-odc-sequence-objects/3.client-odc-manage-sequence.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md new file mode 100644 index 00000000..ab69cd06 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md @@ -0,0 +1,38 @@ +新建序列 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击 **序列** 标签可以查看序列列表。在序列列表的右上角,单击 **+** 创建序列,或是在 ODC 上方导航栏中单击 **新建 \> 序列** 以创建所需的对象。创建序列有以下两个步骤: + +![](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4729171361/p138331.png) + +1. 设置 **基本信息** :需指定 **序列名称** 和 **当前用户** (根据当前连接账号自动填充)。 + + + +2. **设置列** (可选)。在该步骤需指定以下信息: + + + + | 信息项 | 说明 | + |------|-----------------------------------------------| + | 起始于 | 指定序列的起始值,要保证不小于属性 **最小值** 。 | + | 增量 | 指定序列值自增时的步长,可以为负数。 | + | 最小值 | 指定序列可获取的最小值,数据库支持的最小值为-1026。 | + | 最大值 | 指定序列可获取的最大值,数据库支持的最大值为 1027。 | + | 缓存设置 | 指定序列缓存的大小,合理设置缓存值可以提高序列取值的执行性能,也可设置 **无缓存** 。 | + | 是否排序 | 指定序列的取值是否有序,有序取值场景下,序列的取值性能不如无序。 | + | 是否循环 | 指定序列取值超过指定的 **最大值** 后,是否重新从最小值开始取值。 | + + + +3. 单击 **下一步:确认 SQL** 按钮后,进入SQL创建确认页面。 + + ![数据库对象-新建序列-确认创建](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4729171361/p326072.png) + + +4. 根据您指定的信息会预生成一个 SQL 脚本,检查 SQL 脚本无误后,单击页面右上角的 **创建** 按钮,开始执行脚本并生成序列。 + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/3.client-odc-manage-sequence.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/3.client-odc-manage-sequence.md new file mode 100644 index 00000000..d266f6b3 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/5.client-odc-sequence-objects/3.client-odc-manage-sequence.md @@ -0,0 +1,47 @@ +管理序列 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击 **序列** 标签可以查看序列列表。 + +您可以在序列列表中右键目标对象以进行一些 **管理操作** 。或者,在序列列表中双击目标序列名进入 **序列管理页面**。 +![Image 196](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-1.png) + +管理操作 +------------- + +在序列列表中,序列对象名称默认支持按头字符升序排序。 +在序列列表中右键目标对象,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。 + +下述为管理操作键表: + + +| 操作键 | 说明 | +|------|--------------------------------------------------------------------------| +| 新建序列 | 进入新建序列页面,根据步骤创建新的序列对象。 | +| 查看序列 | 进入 **序列管理页面** **,** 全量查看当前序列的基本信息、属性和 DDL 等信息。 | +| 修改 | 进入 **序列管理页面** 的属性部分修改当前序列的信息。 | +| 删除 | 删除当前序列。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载序列对象的 SQL 文件。 | +| 刷新 | 对当前序列对象进行一些管理操作后,刷新列表以展示最新信息。 | + + + +序列管理页面 +--------------- + +您可以在序列管理页面查看以下信息: + +* **基本信息** :展示 **序列名称** 和 **用户名** 等信息。 + +* **属性** :展示属性 **下一个缓冲值** 、 **增量** 、 **最小值** 、 **最大值** 、 **缓存设置** 、 **是否排序** 和 **是否循环** 等信息。其中 **下一个缓冲值** 展示的是序列视图中 `last_number` 的值,该值仅做展示不允许修改。 + +* **DDL** :展示定义序列的脚本。 + ![sequence2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%BA%8F%E5%88%97-2.png) + + + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/1.client-odc-package-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/1.client-odc-package-objects-overview.md new file mode 100644 index 00000000..0b5e28b5 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/1.client-odc-package-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +程序包(Package)是由一组相关的函数、过程、变量和游标等 PL 程序设计元素的组合。程序包类似于 Java 中的类,变量类似于类中的成员变量,函数和过程类似 Java 类中的方法。其主要作用是把相同或相似的东西归类,方便维护和管理,提高开发效率,提高性能。 +> **注意**
                  +> 连接 V2.2.20 及之后版本的 OceanBase 数据库 Oracle 模式支持创建触发器对象,MySQL 模式暂不支持。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击程序包标签可以查看程序包列表。在程序包列表中双击程序包名进入程序包管理页面,您可以在程序包管理页面查看包头和包体的的基本信息和代码等信息。 + +本章节将分篇介绍以下 ODC 中程序包对象的相关操作: + +* [新建程序包](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) + + + +* [管理程序包](../6.client-odc-package-objects/3.client-odc-manage-program-packages.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/2.client-odc-create-a-program-package.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/2.client-odc-create-a-program-package.md new file mode 100644 index 00000000..0c50b1ee --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/2.client-odc-create-a-program-package.md @@ -0,0 +1,24 @@ +新建程序包 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **程序包** 标签可以查看程序包列表。在程序包列表的右上角,单击 **+** 创建程序包,或是在上方导航栏中单击 **新建** 以创建您需要的对象。新建程序包需要分别创建包头和创建包体。 + +创建包头 +------------- + +在程序包列表单击右上角的 **+** 或是在 ODC 导航栏中单击 **新建** 以进入新建程序包页面指定包头。 + +![程序包对象-新建程序包](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4429171361/p326070.png) + +在新建程序包页面中指定程序包名称后,单击 **下一步:确认 SQL** 按钮进入包头定义页面。 + +如下图所示,ODC 会为您自动生成模板语句,在包头定义页面的导航栏中,ODC 提供了功能键 **格式化** 方便您规范语句格式。完成包头定义语句后单击页面右上角的 **创建** 按钮生成包头: + +![Image 197](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4429171361/p241381.png) + +创建包体 +------------- + +创建包头后,新建的程序包就会出现在程序包列表中,在列表中找到刚刚创建好的程序包,右键目标程序包名,单击 **新建包体** 以进入包体定义页面。如下图所示,和包头定义页面相似,ODC 会为您自动生成模板语句并在导航栏中提供功能键 **格式化** 方便您规范语句格式。完成包体定义语句后单击页面右上角的 **创建** 按钮生成包体: + +![Image 198](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4429171361/p241382.png) diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/3.client-odc-manage-program-packages.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/3.client-odc-manage-program-packages.md new file mode 100644 index 00000000..71358ad2 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/6.client-odc-package-objects/3.client-odc-manage-program-packages.md @@ -0,0 +1,107 @@ +管理程序包 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **程序包** 标签可以查看程序包列表,在程序包列表中展示了当前连接的数据库中存在的程序包对象。 + +您可以在程序包列表中查看该对象的 **结构树** 或右键目标对象以进行一些 **管理操作**。或者,在程序包列表中双击目标程序包名进入程序包管理页面,程序包管理页面提供了 **包头页签** 和 **包体页签**。 + +结构树 +------------------------ + +如下图所示,在程序包列表中单击目标程序包名前的下弹标志会在弹出的下拉列表中展示其结构树,对象程序包的结构树最深有六层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表**: + +![Image 227](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-1.png) + +管理操作 +------------------------- + +在程序包列表中,程序包对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|---------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建程序包。 | +| 筛选 | 单击筛选图标选择显示有效/无效程序包。 | +| 批量编译 | 单击批量编译图标对程序包对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
                  ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png) | +| 刷新 | 对当前程序包对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键结构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------| +| 新建程序包 | 进入新建程序包页面,根据步骤创建新的程序包包头。 | +| 新建包体 | 进入包体定义页面以新建包体。 | +| 编辑包头包体 | 同时打开 **包头/包体编辑页面**,您可以在窗口中继续编辑包头和包体。 | +| 删除 | 删除当前程序包。 | +| 刷新 | 对当前程序包对象进行一些管理操作后,刷新结构树以展示最新信息。 | +| 查看 | 进入 **包头页签** 或是 **包体页签** **,** 全量查看当前程序包的基本信息和代码等信息。 | +| 编辑 | 在 **包头/包体编辑页面** 中展示定义包头/包体的语句,您可以在窗口中继续编辑包头/包体。 | +| 编译 | 编译目标程序包。 | +| 调试 | 进入调试页面以对当前程序包进行调试。PL 对象调试仅支持连接 OBServer V2.2.70、V3.0.00 及以后版本。
                  **说明**
                  ODC V4.0.0 及之后版本,支持设置参数值为 DEFAULT、NULL 或空字符串。
                  | +| 运行 | 运行程序包体子程序中的存储过程或函数。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载程序包对象的 SQL 文件。 | +| 删除 | 删除当前程序包包体。 | + + + +包头页签 +------------------------- + +在程序包管理页面,单击导航栏中的 **包头** 标签会展示以下信息: + +* **基本信息** :展示 **程序包名称** 、 **创建人** 、 **创建时间** 和 **最近修改时间** 等程序包信息。 + + + +* **代码** :展示包头的定义代码,还提供了 **编辑** (进入包头编辑页面)和 **查找** 两个功能键。 + + + + + + +包体页签 +------------------------- + +在程序包管理页面,单击导航栏中的 **包体** 标签会展示以下信息: + +* **基本信息** :和包头页签相同,展示 **程序包名称** 、 **创建人** 、 **创建时间** 和 **最近修改时间** 等程序包信息。 + +* **代码** :展示包体的定义代码,还提供了 **编辑** (进入包体编辑页面)和 **查找** 两个功能键。 + + + + +包头/包体编辑页面 +------------------------------ + +![programpackage2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%E5%8C%85-2.png) + +在程序包列表中右键目标项,在提供的操作键中单击 **编辑** 可进入程序包编辑页面,在编辑页面的代码区会展示该程序包的定义语句, 您可以继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 确认修改 | 单击以更新您本次修改。 | +| 编译 | 编译当前页面中的语句。只有包体编辑页面提供该功能键。 | +| 终止 | 单击该按钮终止正在运行的语句。 | +| 调试 | 进入调试页面以对当前程序包进行调试。PL 对象调试仅支持连接 OBServer V2.2.70、V3.0.00 及以后版本。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/1.client-odc-trigger-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/1.client-odc-trigger-objects-overview.md new file mode 100644 index 00000000..ed03a8d9 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/1.client-odc-trigger-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +触发器(Trigger)是一种特殊类型的存储过程,它不能被显式的调用,而是由事件来触发。所以,触发器用于监视某种情况并触发某种操作。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个 Oracle 模式的连接后,在左导航栏中单击触发器标签可以查看触发器列表。单击列表右上角的 **+** 按钮可进入触发器新建页面,在触发器列表中双击触发器名进入触发器管理页面,您可以在触发器管理页面查看触发器的基本信息和代码。 +> **注意**
                  +> 连接 V2.2.20 及之后版本的 OceanBase 数据库 Oracle 模式支持创建触发器对象,MySQL 模式暂不支持。 + +本章节将分篇介绍以下 ODC 中触发器对象的相关操作: + +* [新建触发器](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) + + + +* [管理触发器](../7.client-odc-trigger-objects/3.client-odc-manage-triggers.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md new file mode 100644 index 00000000..c87f5df2 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md @@ -0,0 +1,114 @@ +新建触发器 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **触发器** 标签可以查看触发器列表。在触发器列表的右上角,单击 **+** 创建触发器,或是在上方导航栏中单击 **新建** 以创建您需要的对象。 + +创建触发器需要进行以下 3 步操作: + +1. 指定基本信息。 + + + +2. 设置高级设置信息。 + + + +3. 确认 SQL。 + + + + + + +![Image 228](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9951704161/p242686.png) + +指定基本信息 +--------------------------- + +在新建触发器页面,第一步需要指定基本信息。 **基本信息** 页签中包含以下信息项: + +* **触发器名称** :为触发器指定一个名称。 + + + +* **基准对象模式** :触发器作用的对象所在的 Schema。 + + + +* **基准对象类型** :触发器作用的对象的类型,当前版本只支持 **TABLE** 表对象。 + + + +* **基准对象名称** :触发器作用的对象的名称。 + + + +* **触发器状态** :指定当前触发器为 **启用** 或 **禁用** 。 + + + + + + +设置高级设置信息 +----------------------------- + +指定基本信息后,第二步需要指定一些高级设置信息。 **高级设置** 页签包含以下信息项: + +* **触发器类型** :选择触发器的类型,当前版本只支持创建 **SIMPLE** 简单触发器。 + + + +* **触发** :指定触发时间,即该触发器是在触发事件发生之前( **BEFORE** )或之后( **AFTER** )触发。 + + + +* **级别** :指定触发器的级别。当前版本只支持行级别触发器(Row-level)。 + + + +* **事件** :指定会触发此触发器的操作,支持选择 **INSERT** 、 **UPDATE** 和 **DELETE** 事件。 + + + +* **列(选填)** :指定 **事件** 作用的范围,在 **事件** 中选择 **SELECT** 事件后展示该项。当前版本只支持在表对象中创建行级触发器,所以这里要选择事件作用的列。 + + + +* **引用旧值** **(选填)** :为引用的对象指定一个别名,对应触发器创建语法中 `REFERENCEING OLD` 的值。 + + + +* **引用新值** **(选填)** :为引用的对象指定一个别名,对应触发器创建语法中 `REFERENCEING NEW` 的值。 + + + +* **子句条件** **(选填)** :指定一个逻辑表达式,只有当该表达式的值为 True 时,遇到触发事件才会自动执行触发器指定的操作。 + + + + + + +确认 SQL +--------------------------- + +完成 **基本信息** 和 **高级设置** 页签上所有信息的指定后,单击页面上 **下一步:确认 SQL** 按钮以进入语句编辑页面。 + +在语句编辑页面中会根据 **基本信息** 和 **高级设置** 中指定的信息生成对应的触发器定义语句,您需要补齐语句中触发器触发后需执行的操作,即触发体。补齐触发体语句后,单击页面右上角的 **创建** 按钮,完成触发器的创建。 + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|--------------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| 上一步 | 回到 **新建触** **发器** 页面,您可以继续编辑或修改 **基本信息** 和 **高级设** **置** 页签中的指定的值。 | + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/3.client-odc-manage-triggers.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/3.client-odc-manage-triggers.md new file mode 100644 index 00000000..6c9e9307 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/7.client-odc-trigger-objects/3.client-odc-manage-triggers.md @@ -0,0 +1,80 @@ +管理触发器 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **触发器** 标签可以查看触发器列表。在触发器列表中展示了当前连接的数据库中存在的触发器对象,您可以在触发器列表中右键目标对象以进行一些管理操作。或者,在触发器列表中双击目标触发器名进入触发器管理页面。 + +![Image 200](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-1.png) + +管理操作 +------------------------- + +在触发器列表中,触发器对象名称默认支持按头字符升序排序。 +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建触发器。 | +| 筛选 | 单击筛选图标选择显示有效/无效触发器。 | +| 刷新 | 对当前触发器对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键列表中的目标对象,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|-------|----------------------------------------------------------------------------------| +| 查看触发器 | 进入 **触发器管理页面**,查看当前触发器的基本信息、参数和代码等信息。 | +| 新建触发器 | 进入新建触发器页面,根据引导步骤创建新的触发器。 | +| 编辑 | 在 **触发器编辑页面** 中展示当前触发器的定义语句,您可以在窗口中继续编辑该触发器。 | +| 编译 | 编译当前触发器。 | +| 启用 | 启用当前触发器。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载触发器对象的 SQL 文件。 | +| 禁用 | 禁用当前触发器。 | +| 删除 | 删除当前触发器。 | +| 刷新 | 对当前触发器对象进行一些管理操作后,刷新以展示最新信息。 | + + + +触发器管理页面 +---------------------------- + +[trigger2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E8%A7%A6%E5%8F%91%E5%99%A8-2.png) + +在触发器列表中双击目标触发器名进入触发器管理页面,页面中提供以下 3 个页签: + +* **基本信息** :展示触发器的 **名称** 、 **所有者** 和 **是否启用** 等信息。 + +* **基准对象** :展示该触发器基准对象的 **名称** 、 **所有者** 和 **类型** 等信息。 + +* **DDL** :展示定义触发器的脚本,还提供了 **编辑** (进入触发器页面)、 **查找** 和 **刷新** 等功能键。 + + + + + + +触发器编辑页面 +---------------------------- + +在触发器列表中右键目标项,在提供的操作键中单击 **编辑** 可进入触发器编辑页面,或者在触发器管理页面的 DDL 页签中单击 **编辑** 按钮也可进入触发器编辑页面。在编辑页面的代码区会展示该触发器的定义语句, 您可以继续进行编辑。同时,工具栏提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| 确认修改 | 单击以更新您本次修改。 | + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/1.client-odc-type-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/1.client-odc-type-objects-overview.md new file mode 100644 index 00000000..d546b0fc --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/1.client-odc-type-objects-overview.md @@ -0,0 +1,21 @@ +概述 +======================= + +在数据库中可以创建自定义的对象类型(Type)。数据库的对象类型和 Java 中的类相似,可以包含属性和方法(函数和存储过程)。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个连接后,在左导航栏中单击类型标签可以查看类型列表。单击列表右上角的 **+** 按钮可进入类型新建页面,在类型列表中双击类型名进入类型管理页面,您可以在类型管理页面查看类型的的基本信息和代码。 +> **注意**
                  +> 连接 V2.2.20 及之后版本的 OceanBase 数据库 Oracle 模式支持创建类型对象,MySQL 模式暂不支持。 + +本章节将分篇介绍以下 ODC 中类型对象的相关操作: + +* [新建类型](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) + + + +* [管理类型](../7.client-odc-trigger-objects/3.client-odc-manage-triggers.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/2.client-odc-create-a-type.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/2.client-odc-create-a-type.md new file mode 100644 index 00000000..bf6c272c --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/2.client-odc-create-a-type.md @@ -0,0 +1,162 @@ +新建类型 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建类型。本文介绍如何使用 ODC 创建类型。 + +概述 +----------------------- + +数据库类型对象用于指定类型的名称及其属性、方法和其它属性。 + +ODC 类型对象支持创建三种类型:对象类型、数组类型和表类型。 + +* 对象类型:抽象数据类型(Abstract Data Type,ADT),是将数据库对象、数据库对象之间的关系和数据库对象的基本操作封装在一起的一种表达方式。 + + + +* 数组类型:可变数组与嵌套表相似,也是一种集合。一个可变数组是对象的一个集合,其中每个对象都具有相同的数据类型。可变数组的大小由创建时决定。允许表的列的数据类型是可变长度的多维数组。数组的类型可以是任何基本类型、枚举类型、复合类型或用户自定义类型。 + + + +* 表类型:独立嵌套表类型,用创建的数组直接定义到表的列上。 + + +![新建类型](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%A6%82%E8%BF%B0.png) + + +如上图所示,创建类型包含以下 4 个步骤: + +1. 指定类型名称。 +2. 选择类型对象。 +3. 编辑语句。 +4. 完成新建类型。 + +操作步骤 +------------------------- + +以在 ODC 中创建对象类型(ob_var)为例,类型中包含 var 和 var1 两个 varchar 类型的参数。具体操作步骤如下: + +### 步骤 1:指定类型名称 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **类型** 标签可以查看类型列表。在类型列表的右上角,单击 **+** 创建类型,或在顶部导航栏中单击 **新建** 以创建所需对象。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E7%B1%BB%E5%9E%8B-%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A41.png) + +### 步骤 2:选择新建的类型对象 + + + +| 类型 | 说明 | 示例 | +|------|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| 对象类型 | 抽象数据类型(ADT)。
                  **说明**
                  只有对象类型包含子程序。 | ``` CREATE OR REPLACE TYPE ob_var AS object( var varchar2(10), var1 varchar(10) ); ``` | +| 数组类型 | 独立可变数组(varray)类型。 | ``` CREATE OR REPLACE TYPE test AS VARRAY(20) of varchar2(20); ``` | +| 表类型 | 独立嵌套表类型。 | ``` CREATE OR REPLACE TYPE test AS TABLE OF varchar2(100 BYTE); ``` 通过 `AS TABLE OF` 创建一个数组 list\。 | + + + +### 步骤 3:编辑语句 + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A43.png) + +指定上述信息后,单击 **下一步** 按钮,进入语句编辑页面,在语句编辑页面中会根据在 **新建类型** 弹窗中指定的信息生成对应的类型定义语句,用户需要根据需求补齐语句。补齐语句后,单击页面右上角的 **创建** 按钮,完成类型的创建。 + +同时,在编辑页面的工具栏中提供了以下功能键: + + +| 功能 | 说明 | +|-------|----------------------------------------------------------------| +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,为脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,为脚本中选中的语句转换为注释或转换为 SQL 语句。 | + + + +### 步骤 4:完成新建类型 + +单击 **创建** ,完成新建类型后,类型通常用于 PL 语句中,使用关键字 `INSERT` 调用用户自定义的类型。 + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E7%B1%BB%E5%9E%8B-%E6%AD%A5%E9%AA%A44.png) + +> **说明** +> 在左侧导航栏中,右键鼠标单击类型列表中的类型名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **下载** 、 **删除** 和 **刷新** ),可快速管理和操作目标对象。 +> 类型具体操作,请参见 [管理类型](../8.client-odc-type-objects/3.client-odc-manage-types.md)。 + +示例: + +```sql +-- 创建表 +create table data_type (id number(10),name varchar2(50),age int,address varchar2(50),salary float); + +-- 插入表数据 +insert into data_type values(1,'baba',20,'hangzhou',3000.00); + +-- 新建类型 +create or replace type ob_var as object( + var varchar2(10), + var1 varchar(10) +); + +delimiter / +-- 新建存储过程 +create or replace procedure p_datatype is +begin + declare + rec data_type%rowtype; + v_age rec.age%type; + var varchar2(50); + v_name var%type; + v_salary data_type.salary%type; + +-- 自定义类型 + type salary is table of number index by varchar2(20); + arr salary; + v_arr arr%type; + + CURSOR c2 IS SELECT name, age FROM data_type; + c_row c2%rowtype; + v_rec c_row%type; + + ob ob_var; + v_obj ob%type; + + begin + v_name := 'ali '; + v_age := 30; + v_salary := 2000; + dbms_output.put_line('被引用项:变量,记录,表列名称:' || v_name || ' * ' || v_age || ' * ' || v_salary); + + v_arr('James') := 78000; + dbms_output.put_line('被引用项:集合变量的名称:' || v_arr.FIRST); + + open c2; + fetch c2 into v_rec; + dbms_output.put_line('被引用项:游标变量名称:' || v_rec.name || ' * ' || v_rec.age); + close c2; + + v_obj:=ob_var('test','object'); + dbms_output.put_line('被引用项:对象实例的名称:' || v_obj.var || ' * ' || v_obj.var1); + end; +end; +/ + +begin + p_datatype; +end; +/ +``` + +相关信息 +------------------------- + +* [新建表](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [新建视图](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [新建函数](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [新建存储过程](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [新建序列](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [新建程序包](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [新建触发器](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [新建同义词](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/3.client-odc-manage-types.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/3.client-odc-manage-types.md new file mode 100644 index 00000000..6d219fc0 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/8.client-odc-type-objects/3.client-odc-manage-types.md @@ -0,0 +1,61 @@ +管理类型 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **类型** 标签可以查看类型列表。在类型列表中展示了当前连接的数据库中存在的类型对象,您可以在类型列表中右键目标对象以进行一些管理操作。或者,在类型列表中双击目标类型名进入类型管理页面。 + +结构树 +------------------------ + +如下图所示,在类型列表中单击目标类型名前的下弹标志会在弹出的下拉列表中展示其结构树,对象类型的结构树最深有五层,右键结构树中不同层级中的项会提供对该项的一些操作键,操作键的具体信息请查看 **管理操作** 中的 **管理操作键表** : +![Image 201](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%B1%BB%E5%9E%8B-1.png) + +管理操作 +------------------------- + +在类型列表中,类型对象名称默认支持按头字符升序排序。 + +### 快捷功能 + +在结构树中的右上角提供以下功能: + + +| 操作键 | 说明 | +|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 新建 | 单击新建图标新建类型。 | +| 筛选 | 单击筛选图标选择显示有效/无效类型。 | +| 批量编译 | 单击批量编译图标对类型对象进行批量编译。包括: **编译全部对象** 和 **编译无效对象** 。
                  ![批量编译](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%89%B9%E9%87%8F%E7%BC%96%E8%AF%91.png)
                  **说明**
                  类型对象如果支持调试功能,则同时支持批量编译;如果不支持调试功能,则同时不支持批量编译。 | +| 刷新 | 对当前类型对象进行一些管理操作后,刷新结构树以展示最新信息。 | + + + +### 右键功能 + +右键结构树中的目标项,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + +下述为管理操作键表: + + +| 操作键 | 说明 | +|------|-------------------------------------------------------------------------------------------------| +| 查看类型 | 进入 **类型管理页面**,查看当前类型的基本信息和代码。 | +| 新建类型 | 进入新建类型页面,根据引导步骤创建新的类型。 | +| 编辑主体 | 若类型中包含子程序,该项可用。单击后在 **类型编辑页面** 中展示当前类型的定义语句,您可以在窗口中继续编辑该类型。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载类型对象的 SQL 文件。 | +| 删除 | 删除当前类型。 | +| 刷新 | 对当前类型对象进行一些管理操作后,刷新以展示最新信息。 | + + + +类型管理页面 +--------------------------- + +![type2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E7%B1%BB%E5%9E%8B-2.png) + +在类型列表中双击目标类型名进入类型管理页面,页面中提供以下 2 个页签: + +* **基本信息** :展示类型的 **名称** 、 **所有者** 、 **类型** 、 **创建时间** 和 **修改时间** 等信息。 + +* **DDL**:展示定义类型的脚本,还提供了 **下载**、**查找**、**刷新** 和 **格式化** 等功能键。 + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/1.client-odc-synonym-objects-overview.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/1.client-odc-synonym-objects-overview.md new file mode 100644 index 00000000..ff33c870 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/1.client-odc-synonym-objects-overview.md @@ -0,0 +1,29 @@ +概述 +======================= + +同义词(synonyms)是数据库对象的一个别名,经常用于简化对象访问和提高对象访问的安全性。与视图类似,同义词并不占用实际存储空间,只有在数据字典中保存了同义词的定义。同义词有两种类型,分别是公用同义词和普通同义词。 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入一个连接后,在左导航栏中单击同义词标签可以查看同义词列表。单击列表右上角的 **+** 按钮可进入同义词新建页面,在同义词列表中双击同义词名进入同义词管理页面,您可以在同义词管理页面查看同义词的的基本信息和代码。 + +数据库版本要求如下: + + +| 数据库 | 版本 | +|-------------------------|-------------| +| OceanBase 数据库 Oracle 模式 | V2.2.0 及以上。 | +| OceanBase 数据库 MySQL 模式 | V2.2.0 及以上。 | + + + +本章节将分篇介绍以下 ODC 中同义词对象的相关操作: + +* [新建同义词](../9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md) + + + +* [管理同义词](../9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md new file mode 100644 index 00000000..bb0437ed --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/2.client-odc-create-a-synonym.md @@ -0,0 +1,144 @@ +新建同义词 +========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持可视化方式创建同义词。本文介绍如何使用 ODC 创建同义词。 + +概述 +----------------------- + +同义词是数据库当前用户通过给另外一个用户的对象创建一个别名,然后可以通过对别名进行查询和操作,从而直接操作该数据库对象。 + +同义词类似于视图功能,支持对表进行增删改查。在 Oracle 数据库中的大部分数据库对象,如表、视图、物化视图、序列、函数、存储过程、包、同义词等等,数据库管理员都可以根据实际情况为它们定义同义词。 + +同义词扩展了数据库的使用范围,能够在不同的数据库用户之间实现无缝交互。经常用于简化对象访问和提高对象访问的安全性。 + +### 同义词类型 + +同义词类型包括普通同义词和公用同义词。 + +* 普通同义词:普通用户创建的同义词一般都是私有同义词,普通同义词只能当前用户可以访问,其他用户仅在授权后才可访问,当前用户具有创建同义词权限。 + + + +* 公用同义词:一般由具有 DBA 角色(如:system)的用户创建,所有用户都可以访问。 + + + +具体请参考 [OceanBase 数据库](https://www.oceanbase.com/docs/enterprise/oceanbase-database/oceanbase-database/V3.2.2/synonyms)。 + +![新建同义词](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%A6%82%E8%BF%B0.png) + +如上图所示,创建同义词包含以下 8 个步骤: + +1. 指定同义词名称。 +2. 指定对象所有者。 +3. 指定对象类型。 +4. 指定对象名称。 +5. 指定同义词类型。 +6. 确定新建同义词信息。 +7. 编辑同义词信息。 +8. 完成新建同义词。 + +操作步骤 +------------------------- + +以在 ODC 中创建员工表同义词(syn_employee)为例,对 SYS 数据库中的 employee 表创建同义词 syn_employee。具体操作步骤如下: + +### 步骤 1:指定同义词名称 + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **同义词** 标签可以查看同义词列表,同义词列表按类型分为普通同义词列表和公用同义词列表。在同义词列表的右上角,单击 **+** 创建同义词,或是在 ODC 上方导航栏中单击 **新建** \> **同义词** 以创建所需对象。 + +在 **新建同义词** 中,指定同义词名称。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/333/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-1.png) + +### 步骤 2:指定对象所有者 + +指定所属 Schema。 + +### 步骤 3:指定对象类型 + +指定对象类型:表或者视图。 + +### 步骤 4:指定对象名称 + +指定所创建同义词对应的对象名称。 + +### 步骤 5:指定同义词类型 + +指定同义词类型:普通同义词或者公用同义词。 + +### 步骤 6:确定新建同义词 + +单击 **下一步:确定 SQL** ,进入 SQL 创建确认页面。 + +### 步骤 7:编辑同义词 + +![7](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%AD%A5%E9%AA%A47.png) + +在 SQL 创建确认页面,编辑同义词语句。 + +在语句编辑页面中会根据在 **新建同义词** 弹窗中指定的信息生成对应的同义词定义语句,用户需要直接修改语句。确认语句后,单击页面右上角的 **创建** 按钮,完成同义词的创建。同义词创建后不支持修改。 + +用户可以在 SQL 创建确认页面编辑创建的同义词语句。语法格式如下: + +```sql +CREATE OR REPLACE SYNONYM syn_name FOR schema_name.object_name; +``` + + + +参数说明: + + +| 参数 | 说明 | +|-------------|----------------------------------------------------| +| OR REPLACE | 创建同义词时,如同义词存在则更新。 | +| syn_name | 同义词的名称。 普通同义词名称在某个 Schema 下必须是唯一的。 | +| schema_name | 指定对象所属的数据库 Schema。 | +| object_name | 指定对象名称。 | + + + +### 步骤 8:完成新建同义词 + +单击 **创建** ,完成新建同义词后,可以如同调用系统内置同义词一样使用。 + +![8.1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%AD%A5%E9%AA%A48.1.png) +**说明** + + + +在左侧导航栏中,右键鼠标单击类型列表中的类型名,通过弹出的管理操作列表(包括 **查看** 、 **新建** 、 **删除** 、 **下载** 和 **刷新** ),可快速管理和操作目标对象。 + +类型具体操作,请参见 [管理同义词](../9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md)。 + +语法格式: + +```sql +SELECT * FROM syn_name ([syn_parameter[,...]) +``` + + + +示例: + +```sql +SELECT * FROM syn_employee; +``` + + + +![8.2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E6%96%B0%E5%BB%BA%E5%90%8C%E4%B9%89%E8%AF%8D-%E6%AD%A5%E9%AA%A48.2.png) + +相关信息 +------------------------- + +* [新建表](../1.client-odc-table-objects/2.client-odc-create-a-table.md) +* [新建视图](../2.client-odc-view-objects/2.client-odc-create-a-view.md) +* [新建函数](../3.client-odc-function-objects/2.client-odc-create-a-function.md) +* [新建存储过程](../4.client-odc-stored-procedure-objects/2.client-odc-create-a-stored-procedure.md) +* [新建序列](../5.client-odc-sequence-objects/2.client-odc-create-a-sequence.md) +* [新建程序包](../6.client-odc-package-objects/2.client-odc-create-a-program-package.md) +* [新建触发器](../7.client-odc-trigger-objects/2.client-odc-create-a-trigger.md) +* [新建类型](../8.client-odc-type-objects/2.client-odc-create-a-type.md) diff --git a/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md new file mode 100644 index 00000000..dce8cdd5 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/10.client-odc-database-objects/9.client-odc-synonym-objects/3.client-odc-manage-synonyms.md @@ -0,0 +1,38 @@ +管理同义词 +========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击连接名进入连接后,在左导航栏中单击 **同义词** 标签可以查看同义词列表,同义词列表按类型分为普通同义词列表和公用同义词列表。在同义词列表中展示了当前连接的数据库中存在的同义词对象,您可以在同义词列表中右键目标对象以进行一些管理操作。或者,在列表中双击目标同义词名进入同义词管理页面。 + + +管理操作 +------------------------- + +![同义词对象-同义词列表-右键操作](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%90%8C%E4%B9%89%E8%AF%8D-1.png) + +在同义词列表中,同义词对象名称默认支持按头字符升序排序。 + +右键列表中的目标对象,在弹出的右键管理操作列表中 ODC 提供了一些操作键供您快速管理目标对象。下述为管理操作键表: + + +| 操作键 | 说明 | +|-------|---------------------------------------------------------------------------| +| 查看同义词 | 进入 **同义词管理页面**,查看当前同义词的基本信息和代码。 | +| 新建同义词 | 进入 **新建同义词** 页面,根据引导步骤创建新的同义词。 | +| 删除 | 删除当前同义词。 | +|导出|导出对象,默认导出当前对象,同时支持同时导出多个对象。具体请参见本手册文档 **单表导出与导入**。| +| 下载 | 下载同义词对象的 SQL 文件。 | +| 刷新 | 对当前同义词对象进行一些管理操作后,刷新以展示最新信息。 | + + + +同义词管理页面 +---------------------------- + +![synonym2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E7%AE%A1%E7%90%86%E5%90%8C%E4%B9%89%E8%AF%8D-2.png) + +在同义词列表中双击目标同义词名进入同义词管理页面,页面中提供以下 2 个页签: + +* **基本信息** :展示同义词的 **名称** 、 **对象所有者** 、 **对象名称** 、 **创建时间** 和 **修改时间** 等信息。 + +* **DDL** :展示定义同义词的脚本。同义词创建后不支持修改,可以 **下载** 和 **格式化** 脚本。 + diff --git a/zh-CN/7.client-odc-user-guide/11.client-odc-help-center.md b/zh-CN/7.client-odc-user-guide/11.client-odc-help-center.md new file mode 100644 index 00000000..92cc4842 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/11.client-odc-help-center.md @@ -0,0 +1,62 @@ +帮助中心 +========================= + + + +概述 +----------------------- + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页的顶部导航栏中,通过 **帮助** ,可查看 **新功能介绍** 和 **浏览帮助文档** 并在 **关于开发者中心** 和 **意见反馈** 页签获取产品信息与服务邮箱。 + +![Image 909](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6083197361/p313332.png) + +产品功能介绍 +--------------------------- + +首次访问 ODC 时,会自动弹出 **产品** **功能介绍** 弹窗,弹窗内容包括当前版本的特性和核心功能以快速了解 ODC。 + +关闭弹窗后,可单击 **帮助** 下拉列表中的 **产品** **功能介绍** 标签再次打开弹窗。 +> **说明**
                  +> 同一版本内不同权限的用户查看产品功能介绍时,弹窗内的内容可能会有所不同。 + +浏览帮助文档 +--------------------------- + +在 **帮助** 下拉列表中,单击 **浏览帮助文档** 标签: + +* Web 版 ODC:在浏览器的新页签中展示对应版本的 HTML 格式文档; + + + +* 客户端版 ODC:弹出文档浏览窗。 + + + + + + +如需查看最新或历史版本的产品文档,请至 **[OceanBase 文档中心](https://www.oceanbase.com/docs/enterprise/oceanbase-developer-center/odc/V3.3.1/product-updates)** 浏览。 + +关于开发者中心 +---------------------------- + +在 **帮助** 下拉列表中,单击 **关于开发者中心** 标签,在弹出的窗口中可获得产品名称、版本号、发版日期、官网地址和版权等信息。 + +![Image 910](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0897962561/p313341.png) + +意见反馈 +------------------------- + +在 **帮助** 下拉列表中,单击 **意见反馈** 标签: + +* Web 版 ODC:获取 ODC 的支持邮箱(odcsupport@service.alipay.com),通过邮箱可与联系 ODC 技术支持并反馈意见。 + + + +* 客户端版 ODC:获取 ODC 的支持邮箱并提供一键下载反馈包功能(在弹窗中单击 **Generate information package** ,ODC 则会将前后端日志和系统环境等信息打包至反馈包中)。 + + ![Image 911](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9754197361/p313345.png) + + + + diff --git a/zh-CN/7.client-odc-user-guide/2.client-odc-homepage.md b/zh-CN/7.client-odc-user-guide/2.client-odc-homepage.md new file mode 100644 index 00000000..fc856e0c --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/2.client-odc-homepage.md @@ -0,0 +1,102 @@ +ODC 首页 +=========================== + + + +概述 +----------------------- + +打开客户端版 OceanBase 开发者中心(OceanBase Developer Center,ODC)后会进入 ODC 首页。 + +在 ODC 首页可查看 [任务](8.client-odc-task-management/1.client-odc-task-management-overview.md)、[操作记录](../7.client-odc-user-guide/7.view-operation-records.md) 和 [帮助](../7.client-odc-user-guide/11.client-odc-help-center.md)、进行数据库连接管理、语言切换、个人设置、修改账户密码和退出登录等操作,同时可在首页查看使用指南、相关工具和相关资源等信息。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/homepage/1.png) + +数据库连接管理 +---------------------------- + +首页中可查看 **连接** 页签,页签中以列表的形式展示所创建的个人连接信息。 + +在 **全部连接** 列表中,可[新建个人连接](3.client-odc-connect-database/1.client-odc-create-connection.md)、搜索、筛选、排序和刷新连接。更多详情,请参见 [管理连接](3.client-odc-connect-database/2.client-odc-manage-connections.md)。 + +## 查看历史会话 + +在 ODC 首页的 **历史** 页签中可查看历史打开窗口。 + +![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/homepage/2.png) + +面板显示如下信息: + + +| 信息项 |说明| +|-----------|----------------------------------------------------| +| 连接名 | 显示已访问的连接名称。 | +| 库名/Schema | 显示访问连接后,进入的数据库或 Schema 名称。 | +| 最近打开时间 | 最近一次访问该连接的时间。 | +| SQL/PL 窗口 | 显示此次访问创建的工作台窗口,将数据放置在对应窗口名上,将显示在窗口中编辑过的脚本。 | +| 操作 | 提供 **打开** 操作键,单击该按钮在新窗口中恢复当前连接,同时恢复对应的工作台窗口和其中的内容。 | + + +> **说明** +> 面板中的历史记录信息默认保存 48 个小时,您可通过该入口快速恢复未保存的 SQL 窗口的内容。 + +## 任务管理 + +在 ODC 首页的 **任务** 页签中可新建和查看任务。更多详情,请参见 [任务管理](8.client-odc-task-management/1.client-odc-task-management-overview.md)。 + + + +主题切换 +------------------------- + +![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/homepage/3.png) + +在 ODC 首页的左下角单击 **我的** > **主题**,支持切换应用模式为 **默认主题** 或者 **暗黑主题**。 + + + +语言切换 +------------------------- + +在 ODC 登录页面和 ODC 首页的左下角单击 **我的** > **语言** 会显示应用的显示语言,默认为 **简体中文** ,单击该标签可切换应用的显示语言。目前 ODC 支持 **English** (英文)、 **简体中文** 和 **繁体中文** 等三种显示语言。 + +个人设置 +------------------------- + +![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/homepage/4.png) + +ODC 首页顶部导航栏的左下角单击 **我的** > **偏好设置** 会显示当前登录账号或单击账号在弹出的下拉菜单中选择 **个人设置** 以弹出 **编辑个人设置** 面板。 + +在面板中可全局统一修改支持自定义的功能设置。同时可在每个连接中分别对这些功能进行独立设置,独立设置仅对当前连接生效。个人设置的优先级低于每个连接中的独立设置且持久保存。 + + + +面板中支持进行以下全局设置: + + +| 设置 | 说明 | +|-------------------|----------------------------------------------------------------------------------------------------| +| SQL 窗口 Session 模式 | 设置 SQL 窗口的 Session 模式。 | +| 界定符设置 | 设置在 SQL 窗口内运行 PL 语句时默认使用的 Delimiter 符号。目前支持设置 **;** 、 **/** 、 **//** 、 **$** 和 **$$** 等 5 种形式的界定符。 | +| Oracle 事务提交模式 | 设置 Oracle 模式下事务的默认提交模式。可设置事务手动提交或自动提交。 | +| MySQL 事务提交模式 | 设置 MySQL 模式下事务的默认提交模式。可设置事务手动提交或自动提交。| +| 结果集查询条数限制 | 设置 SQL 窗口内执行 SQL 语句默认返回的结果行数。| +| 对象拖放生成语句类型 | 设置拖放表/视图对象时默认生成的语句类型。 | + + + +设置应用密码 +--------------------------- + +客户版 ODC 无需登录,打开时使用一个默认用户进行标识。出于安全考虑,客户版 ODC 支持设置应用密码。设置后在系统中打开客户端版 ODC 应用时,需首先输入密码才能进入 ODC 首页,如密码输入错误超过 3 次,则会提示尝试重置数据,重置后 ODC 中的连接信息将被清空。 + +单击 ODC 首页导航栏右上角的 **我的** 按钮在弹出的列表中单击 **应用密码**。在弹出的弹窗中指定一个密码即可,应用密码支持进行删除和修改操作。 + +![5](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3593778361/p264493.png) + +使用帮助 +------------------------- + +在 ODC 首页左下角的 **帮助** 页签中,可直接查看 ODC 常用操作的教程文档,以及当前版本的新增功能与常见问题等信息。 + +在页签中单击 **帮助文档** ,可查看帮助文档。 \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md b/zh-CN/7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md new file mode 100644 index 00000000..1c488bf4 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/3.client-odc-connect-database/1.client-odc-create-connection.md @@ -0,0 +1,66 @@ +创建个人连接 +=========================== + + + +概述 +----------------------- + +登录 OceanBase 开发者中心(OceanBase Developer Center,ODC)并进入 ODC 首页,可在 **个人连接** 页签中单击 **新建个人连接** 按钮创建个人连接。 + +创建完成后,再次进入 ODC 时,可在连接列表中查看已保存的数据库连接。 + + +> **注意**
                  +>
                • 自 ODC V2.3.0 版本起,导入导出功能需在创建连接的高级配置中设置 root@sys 用户,否则会提示无法使用导入导出功能,因自该版本起,导入导出功能查询视图信息时依赖 root@sys 账号。
                • +>
                • 分区信息查看同样依赖 root@sys 账号,因此如需展示表的分区信息须在创建连接的高级配置中设置 root@sys 用户。
                • +>
                • 自 ODC V3.3.0 版本起,ODC 支持独立 Session 模式和共享 Session 模式。独立 Session 模式下,每个 SQL 窗口对应一个数据库会话,所有的修改只会影响当前窗口;共享 Session 模式下,所有的 SQL 窗口共享同一个数据库会话,任意 SQL 窗口的修改均会影响到其它 SQL 窗口。
                • +>
                • 事务手动提交模式下,需设置 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会终止。同时需注意 `ob_trx_idle_timeout` 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。
                • + + + + + + +操作步骤 +------------------------- + +创建连接的操作步骤如下所示: + + +1. 进入 ODC 后,在左侧导航栏的 **连接** 页签中单击 **个人连接** > **新建个人连接** 按钮。 + + ![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/connection/create%20connection/1.png) + +2. 在创建连接页签需填写或选择以下信息,如已拥有 OceanBase 数据库连接串,则以下信息均可从连接串中直接获取(mysql -h **主机名** -P **端口号** -u **数据库用户名@租户名** # **集群名** -D **默认数据库** -p ' **数据库密码** ')或直接使用页签中提供的智能解析工具进行填充: + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/connection/create%20connection/2.png) + + + + | 信息项 | 说明 | + |-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 智能解析 | 在文本框中粘贴连接串信息,ODC 会自动识别连接串并在窗口中填充各项连接信息。 | + | 连接类型 | 选择 **MySQL** 或 **Oracle** (逻辑库仅支持 MySQL 模式)。 | + | 连接地址 |
                  • **主机 IP** :连接的数据库所在服务器的 IP 信息。
                  • **端口** :连接的数据库所在服务器的端口号信息。
                  • **集群名** :连接的数据库所在集群的名称(逻辑库无需填写)。
                  • **租户名** :连接的数据库所在租户的名称(逻辑库无需填写)。
                  **说明**
                  主机名和端口号可从连接的数据库所在租户信息页面获取,如在公有云或 OCP 上创建的租户。
                  | + | 数据库账号 |
                  • 数据库用户名:在租户中创建的账号(MySQL 模式下,该账户必须具有访问默认数据库的权限)。
                  • 数据库密码:在租户中创建的账号的密码。单击数据库密码框后的 **测试连接** 按钮,测试是否能够连接到目标数据库。
                  • 保存密码:关闭该项,连接信息中将不保存数据库密码信息,每次进入连接或测试连接时,需在弹出的密码弹窗中输入数据库密码以进入连接;开启该项,连接信息将保存数据库密码信息,每次进入连接无需输入数据库密码。
                  **说明**
                  • 如配置信息有误,会出现异常提示,例如用户或密码不对、网络异常等。
                  • 用户只可连接本租户下的数据库,否则会报出测试失败的错误。
                  • ODC V4.0.0 及之后版本支持不填账号密码即可保存连接。
                  | + | 默认数据库/schema(可选) | 连接 MySQL 租户中的数据库时,需填写该连接使用的默认数据库(连接 Oracle 租户时无需填写该项)。
                  **说明**
                  MySQL 模式下,如不指定默认库,则默认连接 information_schema 库。 如 information_schema 库连接失败,请将默认数据库设置为该用户有权限的库。
                  | + | sys 租户账号设置 | 选择是否 **使用 sys 租户账号查询租户视图**,勾选后输入 **账号** 和 **密码**。
                  数据库类型为物理库时,请输入拥有查询 sys 租户视图权限的账号和密码,当 **连接地址** 中已指定 **租户** 为 sys 时,该项被自动填充。
                  • **账户** :拥有 sys 租户视图查看权限的账号。
                  • **密码** :账号对应的密码。
                  输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。
                  **说明**
                  • 自 ODC V2.3.0 之后版本,导入导出功能需在创建连接的高级配置中设置 root@sys 用户。
                  • 自 ODC V2.4.1 之后版本,导入导出功能查询视图信息时取消 root@sys 账号强依赖(如未配置 root@sys 账号,ODC 部分对象如存储过程和函数等不支持导出功能;如配置 root@sys 账号,通过访问 sys 租户下的视图信息得到最优的数据路由策略,可提升导出速度)。
                  • **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入“@sys#集群”)。例如:账号为 root。
                  | + |启用 SSL|选择是否启用 SSL 加密 SSL 链路,以保证客户端和服务器之间数据的安全传输。请参考 [SSL 链路加密](https://help.aliyun.com/document_detail/254643.html) 获取客户端密钥、客户端证书和 CA 证书。| + + +3. 指定上述信息后,单击面板右下角的 **保存** 按钮,在的弹窗中输入连接名后,单击 **确定** 按钮,即可将当前的配置信息持久保存在 ODC 连接列表中。再次登录 ODC 时,可在连接配置列表中直接选择该连接,保存连接配置时不要求测试连接一定成功。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/connection/create%20connection/3.png) + + > **说明** + > + > 保存前,可以单击 **测试连接** 进行数据库连接测试,如果数据库用户名和密码正确,则会提示 **连接成功**。 + + + +4. 在页签下方,ODC 同时提供 **复制连接串** 按钮。单击该按钮,ODC 会将当前编辑的连接信息复制为连接串格式以方便获取当前配置的连接信息。 + + + +5. 如无需保存当前的连接配置,可单击页签下方的 **取消** 按钮,ODC 会弹出弹窗以确认是否退出当前新建连接窗口。 \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/3.client-odc-connect-database/2.client-odc-manage-connections.md b/zh-CN/7.client-odc-user-guide/3.client-odc-connect-database/2.client-odc-manage-connections.md new file mode 100644 index 00000000..dfa69833 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/3.client-odc-connect-database/2.client-odc-manage-connections.md @@ -0,0 +1,124 @@ +管理连接 +========================= + + + +概述 +----------------------- + +所创建并保存的连接配置会直接显示在 OceanBase 开发者中心(OceanBase Developer Center,ODC)首页的 **个人连接** 页签中。 + +**个人连接** 页签以列表的形式显示所创建的所有连接以供查看和管理连接信息。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/connection/create%20connection/1.png) + +查看连接 +------------------------- + +在 **个人连接** 页签,连接信息以列表的形式显示: + +* 通过列表上方的搜索图标![search](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg)查找目标连接。 + +* 通过![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg)按照类型、权限和标签筛选连接。按钮通过刷新按钮可刷新列表信息。 + +* 通过![sort](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%8E%92%E5%BA%8F.png)排序连接。 + +* 通过![update](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%88%B7%E6%96%B0.jpg)刷新列表信息。 + +* 支持调整连接列表的列宽。 + + + + + +个人连接列表中显示如下连接信息: + + +| 信息项 | 说明 | +|------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 连接名 | 显示连接的名称、属性、类型、集群/租户、主机名/端口号和数据库用户名信息,单击连接名称可进入数据库连接。 其中连接名称前会通过图标显示该连接的状态,蓝色图标表示有效连接,红色图标表示失效连接,灰色图标表示连接未保存数据库密码信息。 | +| 集群 | 显示并筛选集群信息。 单击筛选图标,可筛选所属集群信息(勾选 **空** ,可筛选出无所属集群的连接) | +| 租户 | 显示并筛选租户信息。 单击筛选图标![filter](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属租户信息(勾选 **空** ,可筛选出无所属租户的连接)。 | +|主机:端口|显示主机:端口号。| +|置顶|单击![upper](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E9%A1%B6%E7%BD%AE.png),置顶/取消置顶连接。
                  连接列表默认按对连接的创建时间进行排序,最新创建的连接显示在列表最上方。列表无法进行自定义排序,但可将常用的连接进行置顶。| +| 标签 | 单击![label](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E6%A0%87%E7%AD%BE.png)自定义标签内容并将标签指派给目标连接,每个连接只能设置一个标签。| +| 操作 | 单击更多图标,显示 **编辑** 、 **复制** 和 **移除** 功能键以及更新时间。| + + + + +设置标签 +------------------------- + +ODC 支持自定义标签并将标签指派给目标连接,每个连接只能设置一个标签。可也可在连接创建完成后在连接列表中将鼠标放置在目标连接的标签项上,单击浮现的 **设置标签** 按钮,在弹出的下拉列表中进行新建标签、设置标签和管理标签的操作。 + +* 新建标签:通过两种方式新建标签 + + * 新建连接面板新建:新建连接时,在 **新建连接** 面板单击 **连接名称** 文本框后的 **设置标签** 按钮进行设置。 + + * 连接列表中新建:将鼠标放置在目标连接的标签项上,单击浮现的 **设置标签** 按钮,在弹出的下拉列表中,单击 **新建标签** 按钮。在弹出的 **标签管理** 页面中指定标签的名称和颜色,完成指定后单击对勾图表完成新建。 + +* 设置标签:弹出的下拉列表会显示您所有创建过的标签,在下拉列表中选择目标标签完成设置。 + +* 管理标签:在弹出的下拉列表中,单击右上角的设置图标弹出 **标签管理** 窗口。在标签管理窗口可对创建好的标签进行编辑和删除操作。 + + + + + +置顶连接 +------------------------- + +连接列表默认以创建连接时间进行排序,最新创建的连接显示在列表最上方。可将常用的连接进行置顶(暂不支持自定义排序)。 + +在连接列表中,单击目标连接名称后的旗标![首页-顶置连接名](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5289084361/p342106.png)可将连接置顶,置顶后旗标将被点亮为黄色,再次单击旗标取消置顶。 + +编辑连接 +------------------------- + +单击目标连接 **操作** 项下的 **编辑** 按钮弹出 **编辑连接** 面板,面板与 **新建连接** 面板的结构相同并显示当前连接的配置信息。可在 **编辑连接** 面板中直接对显示的信息进行修改。 + +修改 **数据库密码** 时,需先单击密码框后的 **修改密码** 按钮,方可修改密码。修改过程中如想放弃本次修改,则继续单击密码框后的 **取消修改** 按钮,密码框的内容就会被重置回修改前的状态。 + +复制连接 +------------------------- + +单击目标连接 **操作** 项下的 **复制** 按钮会弹出 **新建连接** 面板,且面板中会自动填充当前连接的配置信息,旨在已有的信息基础上,简单修改连接信息以快速新建连接。 + +使用复制功能可有助于快捷创建类似连接信息的数据库连接。 + +删除连接 +------------------------- + +单击目标连接 **操作** 项下的 **删除** 按钮以删除当前的连接配置。 + +例如连接的数据库已不存在或后续不再继续访问该数据库时,可直接删除当前的连接配置。 + +其它操作 +------------------------- + +* 除 **个人连接** 页签中提供的上述管理操作,在进入数据库连接后,工作台顶部导航栏的主页菜单![主页菜单](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352089.jpg)按钮同时会提供以下与连接相关的操作: + + * **新窗口打开连接** :在弹出的连接列表中单击需进入的连接,ODC 会生成一个新窗口并进入目标连接。 + * **连接管理** :生成新窗口并进入 ODC 首页以查看和管理所有的连接配置信息。 + * **重新加载** :重新加载当前页面。 + * **退出连接** :退出当前连接并跳转至 ODC 首页。 + + ![Image 031](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8906118461/p232235.png) + +* 在工作台顶部导航栏左上方的标题支持显示数据库名。 + ![Image 032](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%BF%9E%E6%8E%A5%E7%AE%A1%E7%90%86-%E8%BF%9E%E6%8E%A5%E5%B7%A5%E4%BD%9C%E5%8F%B0%E9%A1%B5%E9%9D%A2%E9%A1%B6%E9%83%A8%E6%98%BE%E7%A4%BA%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%8D.png) + +* 在工作台顶部导航栏的左上方,会显示连接名称和 Schema(Oracle 模式)或数据库名称(MySQL 模式)等信息。 + + * 将鼠标放置在上方导航栏的连接名称上,弹出的信息框会显示 **连接模式** 、 **主机名/端口** 、 **集群/租户** 和 **数据库用户名** 等信息。 + + + + * 单击显示 Schema 名称或数据库名称的下拉弹窗,在弹出的列表中会显示当前数据库用户可进入的 Schema 或数据库,在列表中单击 Schema 或数据库的名称,可切换至目标 Schema 或数据库中。 + + ![管理个人连接-其它操作](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4986712561/p358120.png) + + + + diff --git a/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/1.client-odc-use-workspace-overview.md b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/1.client-odc-use-workspace-overview.md new file mode 100644 index 00000000..e7d232bd --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/1.client-odc-use-workspace-overview.md @@ -0,0 +1,52 @@ +概述 +======================= + +工作台是 OceanBase 开发者中心(OceanBase Developer Center,ODC)为您提供的进行数据库开发工作的主要功能模块。 + +进入对应的数据库连接后,在上方导航栏中单击 **工作台** 标签在弹出的列表中工作台模块提供了以下功能: + +* **SQL 窗口** :数据库开发者编辑 SQL 和 PL 语句的工作区,在 SQL 窗口中 ODC 还提供 **代码片段** 功能。 + + + +* **匿名块窗口** :数据库开发者编辑匿名块脚本的工作区。 + + + +* **命令行窗口** :集成了 OceanBase 客户端(OBClient)到命令行窗口,可在命令行窗口中更直接灵活的执行 SQL 或 PL 语句并实时查看结果。 + + + +* **已保存的脚本** :数据库开发者可以在这里打开之前在 ODC 中保存过的脚本。 + + + + + +> **注意**
                  +> 只有 Oracle 模式下支持创建匿名块窗口。 + +本章节将分篇介绍工作台提供的功能: + +* [SQL 窗口](../4.client-odc-use-workspace/2.client-odc-sql-window.md) + + + +* [匿名块窗口](../4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md) + + + +* [命令行窗口](../4.client-odc-use-workspace/4.client-odc-command-line-window.md) + + + +* [已保存的脚本](../4.client-odc-use-workspace/5.client-odc-stored-scripts.md) + + + +* [代码片段](../4.client-odc-use-workspace/6.client-odc-snippet.md) + + + + + diff --git a/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/2.client-odc-sql-window.md b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/2.client-odc-sql-window.md new file mode 100644 index 00000000..92b00360 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/2.client-odc-sql-window.md @@ -0,0 +1,150 @@ +SQL 窗口 +=========================== + + + +概述 +----------------------- + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,在顶部导航栏单击 **工作台** 标签,在弹出下拉菜单中单击 **SQL 窗口** 以完成新建。 + +SQL 窗口中提供可编辑脚本的 SQL 编辑区域,显示运行结果的执行记录页签与结果页签,同时 SQL 窗口也支持运行 PL 语句。 + +![Image 461](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-%E6%A6%82%E8%BF%B0.png) + +SQL 编辑区域 +----------------------------- + +在 SQL 窗口的编辑区域可体验更多细节: + +| 操作 | 说明 | +|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 提供输入自动提示功能 | 在 SQL 编辑区编写脚本时提供输入自动提示功能以提升编辑 SQL 语句效率。 例如:权限账户进行 SQL 语句编辑时,支持自动补全表名功能(跨库查询支持补全表名) | +| 标识关键字和智能识别代码 | 窗口中会对数据库的关键字进行不同颜色的标识并可智能识别代码。 | +| 右键单击编辑区 `SELECT` 语句中的表、视图和函数名称 | 右键单击编辑区 `SELECT` 语句中的表、视图和函数名称时将提供常见操作键,同时将鼠标放置在表的名称上会显示字段信息。 | +| 拖拽对象列表至 SQL 编辑区 | 在对象列表中可将目标对象直接拖放至 SQL 编辑区中,以方便在语句中填充对象名。
                  - 如为表 / 视图对象,拖放对象名 SQL 编辑区时,在 **快速生成** 弹窗中,可选择快速生成的 SQL 语句(在登录账号的 **个人设置** \> **对象拖放生成语句类型** 中,可设置拖放表 / 视图对象时默认生成的语句类型)。
                  - 除表/视图外的其它对象,拖拽对象名直接将对象名拖拽至 SQL/PL 窗口。
                  ![SQL 窗口-编辑区域-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F1.png) | +| 支持共享/独立 Session | ODC SQL 窗口支持 **共享 Session** 和 **独立 Session** 模式。
                  - 共享 Session:支持在同一个连接内打开多个窗口,但不允许多窗口并行执行 SQL 。
                  - 独立 Session:支持在同一个连接内打开多个窗口,允许并行执行 SQL。 在 SQL 窗口标签右侧单击 +,即可打开多个 SQL 窗口。SQL 窗口默认为共享 Session 模式,可以在顶部导航栏的右上角登录账号的 **个人设置** 中设置为 **独** 立 Session 模式。
                  ![SQL 窗口-SQL 编辑区域2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F2.png) | +| 支持特殊符号异常识别 | SQL 窗口的编辑区支持特殊符号异常识别,异常符号会被黄色波浪下划线进行标识。 | +| 查看执行状态 | 鼠标悬停在 SQL 窗口标签上,会显示窗口名称和执行状态。
                  ![SQL 窗口-SQL 编辑区域3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F3.png) | + + +> **说明** +> Oracle 模式下 ODC 自动提交默认设置为关,如需手动提交事务,可在 SQL 窗口中的设置 > 设置会话变量或在顶部导航栏中的会话 > 会话属性 页面修改变量 `autocommit` 的值进行设置,但 SQL 窗口中的设置操作仅对当前 SQL 窗口有效。详情请参见 [会话管理](10.client-odc-session-management.md)。
                  +> 事务手动提交模式下,需设置变量 `ob_trx_idle_timeout` 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 `ob_trx_idle_timeout` 设置的时间,连接会终止。同时需注意 `ob_trx_idle_timeout` 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。 + +![用户指南-SQL 窗口-SQL 编辑区域-4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-SQL%20%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F4.png) + +除编辑 SQL 语句时可体验上述细节,编辑区的工具栏中同时提供以下功能键: + +| 功能 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 运行 | 单击该按钮运行当前 SQL 窗口中所有的 SQL 语句。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。 | +| 运行当前语句 | 单击该按钮运行当前您选中的所有 SQL 语句或当前光标所在行的 SQL 语句。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。 | +| 终止 | 单击该按钮终止正在运行的语句。 | +| 执行计划 | 查看选中的或当前光标所在的 SQL 语句在执行前系统预估的执行计划(`EXPLAINPLAN`操作的结果),展示的执行数据可能与实际执行语句后的数据略有不同,您可以使用该功能评估 SQL 语句。
                  单击 **执行计划** 按钮,在 **计划详情** 页签中,单击 **查看格式化信息** 切换至格式化展示页面。 | +| 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | +| 撤销 | 将脚本回退到上一步操作执行的结果。 | +| 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | +| 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | +| IN 值转化 | 批量复制转化工具,适用于查询数据时对复制的行或列结果进行格式转化。
                  将批量数据粘贴在 SQL 编辑区后,选择复制的数据,单击 **IN 值转化** 按钮,即可转化成 in('A','B')格式。
                  - 列值分隔符号为换行符。
                  - 行值分隔符为空格或 TAB 值。 | +| 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | +| 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | +| 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | +| 保存脚本 | 单击该按钮保存当前窗口中的脚本。之后您再次进入工作台可以直接打开保存好的脚本。每个用户只能看到自己保存的 SQL 脚本,且脚本名不允许重复。打开已保存的脚本后,您可以继续对该脚本进行编辑。 | +| 设置 | - **Delimiter** :在下拉列表中选择您想要的符号以完成界定符的设置。目前支持设置 **;** 、 **/** 、 **//** 、 **$** 和 **$$** 等 5 种形式的界定符。
                  - **查询结果限制** :设置查询结果返回的条数,默认值为 1000 行。
                  - **会话变量** :可编辑、刷新和搜索变量。 | +| 代码片段 | 提供内置语法片段和自定义语法片段供您查看和引用。详情请查看 [代码片段](../4.client-odc-use-workspace/6.client-odc-snippet.md)。 | +| 提交 | - Oracle 模式下自动提交(autocommit)默认设置为关(OFF),因此需单击该按钮以手动提交当前事务。单击提交时会提示当前连接采用共享 Session,提交操作会对所有窗口生效,单击 **确认** 后提交生效。
                  - MySQL 模式下自动提交(autocommit)默认设置为开(ON)将不展示该按钮。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。
                  **说明**
                  可通过 SQL 窗口中的设置 > **会话变量** 或顶部导航栏中的 **工具** > **会话属性** ,修改自动提交(autocommit)属性。 | +| 回滚 | - Oracle 模式下, **会话变量** 中的自动提交(autocommit)为关(OFF)时,单击该按钮以回滚当前事务。单击时会提示您当前连接采用共享 Session,回滚操作会对所有窗口生效,单击 **确认** 后回滚生效。
                  - MySQL 模式下, **会话变量** 中的自动提交(autocommit)为开(ON)将不展示该按钮。连接中有多个窗口且其他窗口中的语句在正在运行时,该按钮不可用。 | + + + +运行 PL 语句 +----------------------------- + +SQL 窗口中支持编辑 PL 语句,在编辑区中编写 PL 语句完毕后使用选择的界定符作为结尾。 + +ODC 目前支持通过以下方式完成界定符的设置: + +* 在 SQL 编辑区的工具栏中单击 **设置** 按钮,在弹窗中的 **Delimiter** 选择框中选择所需设定的界定符。 + + + +* 在 **个人设置** 页面中的 **界定符设置** 选择框中选择所需的界定符。 + + + +* 显示 PL 行号和错误位置的编译错误信息。 + +* 在左侧导航栏中鼠标右键单击 PL 对象并选择 **运行**,支持设置参数值为 DEFAULT、NULL 或空字符串。 + + > **注意** + >
                  • 自 ODC V2.4.1 之后版本,可在编辑区中使用 `DELIMITER` 语句直接定义界定符, 设置中的 Delimiter 项会回显所设置的界定符。
                  • + >
                  • 可直接使用 / 分隔 PL 语句。
                  + +在 SQL 中运行 PL 语句后,结果页签支持 DBMS 输出。 + +![SQL 窗口-运行 PL 语句](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-%E8%BF%90%E8%A1%8C%20PL%20%E8%AF%AD%E5%8F%A5.png) + +执行记录页签 +--------------------------- + +![用户指南-SQL 窗口-执行结果页签](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8890972561/p326145.png) + +在执行记录页签中您可以查看当前连接进程中每次执行 SQL 语句的记录,包括 **状态** 、 **时间** 、 **SQL 语句** 、 **结果** 、 **TRACE ID** **、** **耗时** 和 **执行详情** (即执行计划)等信息。 + +| 功能 | 说明 | +|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 复选框 | 勾选列表前的复选框后单击 **删除** ,可批量选中并清理多条执行记录。 | +| TRACE ID | 执行记录 ID。
                  **注意**
                  如 TRACE ID 为空,请确保该语句运行时 enable_sql_audit 系统参数及 ob_enable_trace_log 变量值均为 **ON** 。具体步骤:
                  1. 单击 **会话** > **会话属性** > **会话变量**,分别搜索 enable_sql_audit 和 ob_enable_trace_log 参数;
                  2. 单击 **会话变量** 页签中的 **编辑** 图标,在弹出的 **编辑变量** 中,将 **OFF** 值改为 **ON** 后确定。
                  3. 打开系统参数: ```sql obclient> alter system set enable_sql_audit='True'; Query OK, 0 rows affected (0.06 sec) ``` | +| DB 耗时 | 可将鼠标箭头放置在 **DB 耗时** 信息后的提示图标上,弹出的提示信息中可查看对 SQL 执行的全链路耗时信息,以验证各个阶段的耗时与实际是否相符。 | +| 执行详情 | 默认展示文本计划。 在 **执行详情** 项下,单击 **查看** ,可在 **执行详情** 页面查看 **基本信息** 、 **耗时统计** 、 **I/O 统计、执行的 SQL 语句** 、 **计划统计和 大纲** 。 | + + + +日志页签 +------------------------- + +在该页签可查看当前 SQL 窗口的执行记录。 + +![SQL 窗口-日志页签](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-%E6%97%A5%E5%BF%97%E9%A1%B5%E7%AD%BE.png) + +结果页签 +------------------------- + +![SQL 窗口-结果页签](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-%E7%BB%93%E6%9E%9C%E9%A1%B5%E7%AD%BE-1.png) + +在该页签可查看当前 SQL 语句的执行结果。结果页签中显示的结果集支持进行以下交互操作以方便日常开发工作: + +| 操作 | 说明 | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 鼠标选中目标范围 | 返回的结果集支持通过鼠标选中目标范围后直接通过快捷键复制至外部文件,可单击字段名称或行号直接选中整行或整列。 亦可通过工具栏中的 **导出** 工具将结果集中的数据导出到本地文件。 | +| 选择多行/多列 |
                • 按 Shift 键,可选择连续多行/多列;
                • 按 Ctrl/Command 键,可选择不连续的多行/多列。
                • | +| 右键单击单元格 | 提供 **复制** / **输出到剪切板** 功能键以直接将数据复制到外部文件中。 | +| 右键单击行序号 | 提供 **复制行** / **冻结此行** / **解除全部冻结行** 功能。
                • 复制行:复制选中的行;
                • 冻结此行:将选中行置顶并冻结,冻结行和表头固定下方内容可垂直滚动;支持冻结多行;
                • 解除全部冻结行:将所有冻结行恢复。
                • | +| 放大图标 | 当单元格中的数据过长导致无法全部显示时,可通过放大图标查看单元格中的全部数据:
                  1. 将鼠标箭头放置在目标单元格上;
                  2. 单击单元格右侧出现的放大图标![放大按钮](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8892277361/p353161.jpg),在弹出的大字段展示弹窗中可查看单元格中的全部数据。
                  **说明**
                  如为大字段,默认按文本展示大字段内容,可切换至十六进制查看同时支持下载打字段内容至本地。 | +| BLOB 大对象 | 结果页签中:
                • Oracle 模式下,CLOB,BLOB,RAW 支持直接编辑文本内容、编辑十六进制数据和上传文件(限制在 200 KB 内)。
                • Mysql 模式下,BLOB,MEDIUMBLOB,TINYBLOB 等 XLOB 支持直接编辑文本内容、编辑十六进制数据和上传文件。
                • | +| 右键单击结果页签的标签名(如 **结果1** ) | 在弹出的列表中单击 **固定** 可使当前结果页签保持展示状态,当执行一条新的查询时当前结果不会被覆盖而是生成一个新的结果展示页签,以方便对比不同的查询结果。 单击 **解除固定** 以取消目标结果页签的固定状态。 | +| 筛选、排序和搜索按钮 | 结果集中每个字段名称后提供筛选、排序和搜索按钮,可对单列的数据直接进行筛选、排序和搜索。 | +| 拖动列名 | 支持在结果集中直接拖动列名以调整各字段的顺序。 | +| 调整列宽 | 支持拖动调整列宽。 | + + + +同时,结果页签的导航栏中提供以下工具: + +![SQL 窗口-结果页签2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-%E7%BB%93%E6%9E%9C%E9%A1%B5%E7%AD%BE2.png) + +| 工具 | 说明 | +|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 列模式 | 以表格的形式展示一行选中的数据。在 **列模式** 页面可以进行上一行、下一行的切换展示,对于列数量比较多场景, **列模式** 比较方便行数据的查看。参考步骤如下:
                  1. 选中需查看的数据后,单击 **列模式** ![列模式按钮](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326038.jpg)按钮;
                  2. 在弹出的 **列模式** 页面中,可单击左右按钮查看上下行列值;
                  3. 鼠标移动至某值字段,单击 放大按钮![放大按钮](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8084861361/p326047.jpg),可查看该列字段详情;
                  4. 在 **列模式** 列表中,可通过 **备注** 查看表中对应的列注释信息。修改备注信息步骤如下:
                  a. 在左侧导航栏的表列表中,右键单击目标表,选择 **查看表结构** ,进入表属性管理页签;
                  b. 在属性页签的左导航栏中单击 **列** 标签;
                  c. 选择字段名,单击编辑图标,弹出 **编辑字段** 弹窗;
                  d. 在 **字段注释** 中,填写字段注释后,单击 **确定**;
                  e. 在 **SQL 确认** 弹窗,单击 **执行** ,完成修改备注信息;
                  f. 在 **列模式** 中即会显示修改的备注信息。 | +| 列管理 | 筛选在页面中展示的列。 | +| 回到开始 | 跳转至第 1 页。 | +| 上一页 | 向上翻页。 | +| 下一页 | 向下翻页。 | +| 跳至底部 | 跳转至最后一页。 | +| 搜索 | 在搜索框中输入关键字查询所需结果。 | +| 编辑 | 单击 **编辑** 按钮开启对当前展示的结果集的编辑状态,编辑态中提供 **添加一行** 、 **删除** 、 **复制当前行** 、 **取消** 、 **确认修改** (当自动提交设置为开时,单击该按钮事务被自动提交) 和 **修改并提交** (自动提交设置为关时显示该按钮) 等编辑操作。同时可在编辑态下双击目标数据直接进行修改,或是通过上述操作按钮进行快捷操作。 在编辑态中右键单元格,弹出的菜单中提供 **复制** 和 **设置为 Null** 两个操作键。
                  **说明**
                  通过结果集是否支持编辑预判断功能,在 SQL 执行时获取到 ResultMetaData 信息,可在 SQL 执行结果出来时同步判断结果集是否可编辑:
                  - 如当前结果集不支持编辑,编辑按钮隐藏,且提示当前结果集不可编辑。
                  - 如当前结果集支持编辑,编辑按钮呈可点击态,可点击进入结果集编辑页面(支持编辑场景:单表/单视图查询)。
                  - 目前不支持包含 SET 类型和 ENUM 类型的结果集编辑。 | +| 下载数据 | 将查询结果导出为 CSV、SQL 或 Excel 文件:
                  - 导出 SQL 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、** **文件格式** (SQL) **、** **文件编码** 、 **数据脱敏** 和 **SQL 文件设置** ( **表名** );
                  - 导出 CSV 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、** **文件格式** **、** **文件编码** 、 **数据脱敏** 和 **CSV 设置** ( **包含列头** 、 **空字符串转为空值** 、 **字段分隔符** 、 **文本识别符** 和 **换行符号** );
                  - 导出 EXCEL 文件:编辑 **查询 SQL** 语句,选择导出的 **查询结果条数限制** 、 **文件名称** **、** **文件格式** **、** **文件编码** 、 **数据脱敏** 和 **Excel 文件设置** ( **包含列头** 和 **导出 SQL 到另一个 Sheet** )。
                  **说明**
                  - 支持对导出数据进行脱敏处理。 * 导出数据条数不再受查询窗口的条数限制,可自定义导出条数。
                  - 导出 CSV 格式时,默认导出的是 CSV 文件可以直接用 EXCEL 软件打开。
                  - 导出 EXCEL 格式时可自定义是否包含列头,可选择是否导出查询的 SQL 语句。
                  ![SQL 窗口-结果页签-下载数据](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/SQL%20%E7%AA%97%E5%8F%A3-%E7%BB%93%E6%9E%9C%E9%A1%B5%E7%AD%BE-3-%E4%B8%8B%E8%BD%BD%E6%95%B0%E6%8D%AE.png) | +| 计划 | 查看当前 SQL 语句执行后的实际资源消耗及执行计划,可快速判断 SQL 语句的优劣。 | + + diff --git a/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md new file mode 100644 index 00000000..e7083d61 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/3.client-odc-anonymous-block-window.md @@ -0,0 +1,111 @@ +匿名块窗口 +========================== + + + +概述 +----------------------- + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,单击顶部导航栏中的 **工作台** 标签,在弹出下拉菜单中选择 **匿名块窗口** 以新建窗口。 + +匿名块窗口中提供 **PL 编辑区域**、**PL 运行结果和 DBMS 输出** 页签以及 **调试页面**。 + +![Image 460](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7838838161/p263569.png) + +PL 编辑区域 +---------------------------- + +在匿名块窗口的编辑区域,可体验到较多的细节功能,如当新建一个匿名块窗口时: + +* 会自动生成引导代码方便编写脚本; + + + +* 窗口中会对数据库的关键字进行不同颜色的标识; + + + +* 支持格式化等功能以提升编辑 PL 语句的效率。 + + 除编辑 PL 语句时可体验到上述细节功能外,编辑区域的工具栏中同时提供以下功能键: + + + | 功能 | 说明 | + |-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 运行 | 单击该按钮运行代码区中的语句。 | + | 终止 | 单击该按钮终止正在运行的语句。 | + | 调试 | 单击该按钮进入调试页面,并对代码区内的匿名块对象进行调试。 | + | 格式化 | 单击该按钮对选中的 SQL 语句或当前 SQL 窗口中的所有 SQL 语句进行统一的格式化(缩进、换行和高亮关键字等操作)。 | + | 查找/替换 | 在查找框内输入内容以对脚本进行检索,查找后可在替换框内输入内容以对查找内容进行替换。 | + | 撤销 | 将脚本回退到上一步操作执行的结果。 | + | 重做 | 执行 **撤销** 操作后,对脚本重新执行撤销前的操作。 | + | 大小写 | 提供 **全部大写** 、 **全部小写** 和 **首字母大写** 三种效果,将您在脚本中选中的语句转换为对应形式。 | + | 缩进 | 提供 **添加缩进** 和 **删除缩进** 两种效果,为您在脚本中选中的语句添加或删除包含的缩进。 | + | 注释 | 提供 **添加注释** 和 **删除注释** 两种效果,将您在脚本中选中的语句转换为注释或转换为 SQL 语句。 | + | 保存 | 单击该按钮保存当前窗口中的脚本。 保存后,再次进入工作台可直接打开已保存的脚本。 **说明** * 每个用户只能查看自己保存的 SQL 脚本,且脚本名不允许重复。 * 打开已保存的脚本后,可继续对该脚本进行编辑。 | + + + + + + +PL 运行结果和 DBMS 输出页签 +--------------------------------------- + +在匿名块编辑区域的工具栏单击运行图标![运行](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9861058361/p361443.jpg)后,会运行编辑区域中的匿名块脚本,可在编辑区域下方查看 **运行结果** 和 **DBMS 输出** 页签: + +* **运行结果** :展示脚本运行的结果,如运行无误则显示 **运行成功** ,如运行有误则展示错误提示信息。 + +* **DBMS 输出** :如子程序中包含 PL 输出语句则展示其调用后的输出结果(例如 `dbms_output.put_line`)。 + + + + +调试页面 +------------------------- + +在匿名块的编辑区域,单击 **调试** 按钮后可进入调试页面。 + +进入调试页面后可对当前窗口中的匿名块进行调试。 +> **注意**
                  +>
                • 推荐升级至 OBServer V2.2.77 及之后版本(因 OBServer 部分版本存在 PL 调试类已知问题,可能导致 OBServer 不稳定)。
                • +>
                • ODC V3.2.2 之前版本,通过 OBProxy 连接至目标实例时无法使用调试功能,请在 ODC 中直连到目标实例。
                • +>
                • 自 ODC V3.2.2 及之后版本,ODC 支持通过 OBProxy 连接 OBServer 情况下进行 PL 调试。
                • +>
                • 在调试前请确保连接的数据库中已安装 DBMS_DEBUG 和 DBMS_OUTPUT 等调试包。
                • + + + + + + +![调试](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/1136530161/p203467.png) + +在调试模式下,编辑区的工具栏中提供以下功能键: + + +| 功能 | 说明 | +|------|-------------------------------------------------------| +| 批量执行 | 批量运行至最近断点,如果无断点直接运行至结尾语句。 | +| 单步执行 | 单步执行,不会进入子程序。 | +| 跳入 | 单步执行,如当前行是调用已定义的存储过程或函数,则会进入被调用的子程序。 | +| 跳出 | 在子程序内,执行跳出操作后,返回到上层调用位置的下一行;主程序内运行跳出,效果与 **自动调试** 相同。 | +| 终止调试 | 继续运行直到结束,会跳过设置的断点。 | +| 重新调试 | 对当前调试对象发起新一轮的调试,与 **调试** 的区别在于:无需新建调试连接。 | +| 退出调试 | 关闭调试连接,并退出调试交互窗口。 | + + + +在调试模式下,除编辑区外,同时提供以下页签: + +* **参数** :参数页签展示该调试对象所有的参数定义信息(参数名、模式和类型)及对应的值,其中对应的值会根据调试过程作出相应的变化。 + +* **堆栈和变量** :展示当前栈上的变量与其对应的值。 + +* **DBMS 输出** :如子程序中包含 PL 输出语句则展示其调用后的输出结果(例如 `dbms_output.put_line`)。 + +* **断点** :在编辑区单击行号设置断点(再次单击取消断点)。在断点页签可查看设置的所有断点,列表默认按照断点执行顺序进行排序,在列表中选中多个断点后可批量取消。每一行断点信息的操作栏中同时提供 **取消** (取消该断点)和 **查看** (在编辑区光标会跳转至该断点所处的位置)两个操作。 + +* **调试日志** :展示调试开始、调试结束、断点添加、断点取消等信息和错误日志。 + + + diff --git a/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/4.client-odc-command-line-window.md b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/4.client-odc-command-line-window.md new file mode 100644 index 00000000..39f842ef --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/4.client-odc-command-line-window.md @@ -0,0 +1,47 @@ +命令行窗口 +========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)集成了命令行工具 OceanBase 客户端(OBClient) 到命令行窗口,OBClient 是推荐的 OceanBase 数据库黑屏客户端工具。现在您无需再单独下载安装 OBClient,使用命令行窗口就可更直接灵活的执行 SQL 或 PL 语句并实时查看结果,还可以通过 `SOURCE` 命令运行上传在服务器中的文件。 + +新建命令行窗口 +---------------------------- + +登录 ODC 单击目标连接进入对应的数据库连接后,单击上方导航栏中的 **工作台** 标签,在弹出的下拉菜单中选择 **命令行窗口** 以新建一个命令行窗口。打开的窗口会自动连接到当前实例并显示一段默认代码展示连接的 ID、版本信息和帮助信息。 +> **注意**
                  +> 最多可同时新建 3 个命令行窗口,以保持其连接状态。 + +当连接提示断开时,命令行窗口的右上角会出现 **重新连接** 按钮,单击该按钮重建连接。 + +![Image 510](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2700619161/p267479.png) + +脚本管理 +------------------------- + +如果您在开发过程中需要引用脚本,可使用 **命令行窗口** 提供的 **脚本管理** 功能导入脚本后引用。 + +引用脚本的操作步骤如下: + +1. 进入脚本管理面板。 + + 在命令行窗口的右上角单击 **脚本管理** 标签以弹出 **脚本管理** 面板。 + + +2. 导入被引用的脚本。 + + 单击 **导入脚本** 标签下的文件池进入文件资源管理器选择要引用的脚本或者直接将脚本文件拖入文件池中完成上传。导入的文件最大不超过 250 MB。 + + +3. 获取文件路径。 + + 脚本上传成功后,可以在面板的 **脚本列表** 中查看被上传脚本的 **脚本路径** 、 **脚本名称** 、 **文件大小** 和 **上传时间** 等信息。可单击操作列中的 **复制路径** 按钮,然后在命令行窗口中的语句中粘贴路径信息以引用脚本。 + + +4. 删除脚本文件。 + + 上传的脚本文件只有上传者可以查看,文件上传 30 分钟后会被自动清理以防止占用过多空间,您也可以通过单击操作栏中的 **删除** 按钮清除文件。 + + + + + +![Image 161](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3130004161/p239418.png) diff --git a/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/5.client-odc-stored-scripts.md b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/5.client-odc-stored-scripts.md new file mode 100644 index 00000000..371964c3 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/5.client-odc-stored-scripts.md @@ -0,0 +1,113 @@ +已保存的脚本 +=========================== + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,单击顶部导航栏中的 **工作台** 标签,在弹出的下拉菜单中选择并单击 **已保存的脚本** 以进入之前在 SQL 窗口和匿名块窗口中保存的脚本。 + +概述 +----------------------- + +![Image 560](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7092168461/p269155.png) + +在下拉菜单展示的脚本列表中单击脚本名以继续编辑或运行该脚本,如脚本为 SQL 脚本则自动生成 SQL 窗口以展示脚本,若是匿名块脚本则自动生成匿名块窗口以展示脚本。在脚本列表中,脚本名后还提供了以下功能键: + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------------------------------------------| +| 编辑 | 单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424761.jpg),修改脚本的名称和脚本内容。 | +| 删除 | 单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424762.jpg),删除该脚本。 | +| 脚本管理 | 单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424763.jpg)脚本管理,编辑/导入/下载/删除脚本。 | + + + +管理脚本 +------------------------- + +### 编辑脚本 + +![已保存的脚本-管理脚本-编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424769.png) + +1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面后,单击 **工作台** \> **已保存的脚本** 。 + + + +2. 在 **已保存的脚本** 的下拉列表中,选择脚本并单击![编辑](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424782.jpg)进入编辑脚本面板(或单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424763.jpg)脚本管理,在脚本管理面板中,选择脚本并单击编辑)。 + + + +3. 在 **编辑脚本** 面板中,编辑 **脚本名称** 和 **脚本内容** 后,单击 **保存** 。 + + + + + + +### 删除脚本 + +1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面后,单击 **工作台** \> **已保存的脚本** 。 + + + +2. 在 **已保存的脚本** 的下拉列表中,选择脚本并单击![删除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424762.jpg),删除脚本。 + + + + + + +### 脚本管理 + +![已保存的脚本-管理脚本](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3679168461/p424794.png) + +1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面后,单击 **工作台** \> **已保存的脚本** 。 + + + +2. 在 **已保存的脚本** 的下拉列表中,单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424763.jpg)脚本管理,进入脚本管理面板。 + + + +3. 在导入脚本上传框中,通过单击或拖拽文件可导入多个脚本。 + + > **说明**
                  + > - 单个上传文件大小限制:250M。
                  + > - 支持上传 .sql/.pl/.txt 后缀的文件。 + + + + + + + +4. 在脚本列表中,支持如下功能。 + + * 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3679168461/p424801.jpg),可刷新脚本列表。 + + + + * 通过搜索框直接查找脚本名称。 + + + + * 单击复选框![复选框](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4679168461/p424802.jpg),支持选择多个脚本,可批量下载/批量删除。 + + + + * 单击 **复制路径** ,复制脚本路径。 + + + + * 单击 **编辑** ,编辑脚本。 + + * 单击 **下载** ,下载脚本。 + + + + * 单击 **删除** ,删除脚本。 + + + + + + + + diff --git a/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/6.client-odc-snippet.md b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/6.client-odc-snippet.md new file mode 100644 index 00000000..55aa208e --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/4.client-odc-use-workspace/6.client-odc-snippet.md @@ -0,0 +1,77 @@ +代码片段 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)作为企业级数据库开发平台,为您提供代码片段模块以供在 ODC 中进行数据库开发工作。如在开发过程中遗忘某些语句的具体用法,可直接在 ODC 提供的代码片段模块中进行查询。代码片段模块会根据当前连接的数据库模式(Oracle 或 MySQL)提供对应的代码片段。除内置的代码片段外,同时可自定义代码片段以记录常用代码方便下次使用,仅创建者可查看自定义代码片段。 + +在 SQL 窗口、匿名块窗口和 PL 对象编辑页面的工具栏中,单击 **代码片段** 按钮弹出代码片段面板。![Image 225](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8764861361/p242639.png) + +查看代码片段 +--------------------------- + +在代码片段面板中以卡片列表的形式展示代码片段,每个卡片上直接展示了代码片段名称、代码片段描述和代码片段类型等信息。将鼠标放置在卡片代码片段名称后的提示图标![代码片段提示标](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8764861361/p325006.png)上,会浮现提示窗展示目标代码片段的全部代码信息。 + +在卡片列表的上方 ODC 提供了搜索框,可借助搜索功能直接查找具体的代码片段。在搜索框的下方提供按类型进行筛选的筛选器。筛选器中默认选中全部类型,可单击筛选器选择筛选出 **常规** 、 **DML** 、 **DDL** 、 **流程控制语句** 和 **全部类型** 的代码片段。 + +新建代码片段 +--------------------------- + +在代码片段列表的右上角,单击 **+新建** 按钮弹出 **新建代码片段** 面板。在面板中需指定以下信息: + +* **代码片段名称** :指定代码片段的名称。名称可由英文字母、数字和下划线组成,长度不超过 60 字符,必填项。 + + + +* **代码片段类型** :选择代码的类型。支持选择 **常规** 、 **DML** 、 **DDL** 和 **流程控制语句** 等类型,默认为 **常规** 类型。 + + + +* **代码片段** :在 **代码片段** 标签下的编辑框中输入代码片段的具体代码内容,长度不能超过 2000 字符,必填项。与 SQL 窗口类似,编辑区的工具栏中还提供了格式化、查找/替换、撤销、重做、大小写、缩进和注释等工具,且提供代码高亮和联想等功能。 + + + +* **代码片段描述** :对代码片段内容的补充说明,长度不能超过 200 个字符,非必填项。 + + > **说明**
                  + > 代码片段描述中,如有描述则展示描述的内容,如无内容则会展示代码片段中具体内容的前 30 个字符。 + + + + + + ![Image 224](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8764861361/p242637.png) + +引用代码片段 +--------------------------- + +创建好的代码片段除了供您在编辑脚本的时候查看代码的具体内容外,还支持直接将内容直接引用进脚本。引用代码片段有以下三种方法: + +* 方法一:您可以直接将列表中的卡片拖拽进编辑区中,该代码片段指定的代码内容将被粘贴进编辑区。 + + + +* 方法二:在目标代码片段的卡片上,单击卡片右下角的复制图标以复制代码内容,在编辑区中通过快捷键 Ctrl+V 或 Cmd + V 将代码内容粘贴进编辑区。 + + + +* 方法三:SQL 窗口的编辑区支持代码联想功能,当您在编辑区中编辑脚本时,创建好的代码片段会出现在代码联想的提示窗中,您可以通过代码联想的提示查看和引用代码片段。 + + + + + + +管理代码片段 +--------------------------- + +自定义的代码片段提供 **编辑** 和 **删除** 两个管理操作,您无法对内置的代码片段进行管理。 + +* **编辑** :单击目标代码卡片右上角的管理图标(···)在弹出的列表中单击 **编辑** 按钮进入 **编辑代码片段** 面板。面板中展示新建代码片段时指定的 **代码片段名称** 、 **代码片段类型** 、 **代码片段** 和 **代码片段描述** 等信息,可按需进行修改。 + + + +* **删除** :单击目标代码卡片右上角的管理图标(···)在弹出的列表中单击 **删除** 按钮以删除当前代码片段。 + + + + + diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/1.client-odc-data-export-and-import-overview.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/1.client-odc-data-export-and-import-overview.md new file mode 100644 index 00000000..ffd01879 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/1.client-odc-data-export-and-import-overview.md @@ -0,0 +1,28 @@ +概述 +======================= + +为了让数据库开发者更方便的维护数据库内的数据,OceanBase 开发者中心(OceanBase Developer Center,ODC)提供整库导入导出和单表导入导出功能。通过整库导入导出用户可以批量选择数据库中的表以导入或导出其中的数据,通过单表导入导出,用户可以导入导出目标表中的数据和结构。 + +创建导入或导出任务后,ODC 提供导入导出任务页签功能。页签中会显示当前的导入或导出任务列表,您还可以查看目标任务的任务详情和日志等信息。 + +> **注意**
                  +>
                • OceanBase V2.2.30 版本之前仅支持字符编码 UTF8。
                • +>
                • 在 ODC V2.2.1 及之前的低版本中使用导入导出功能时必须通过 OBProxy 连接至目标实例,直连时 ODC 不支持导入导出功能。
                • +>
                • ODC V2.4.1 版本后,您可以选择配置 sys 租户账号以提升导出导入速度。同时,导出时如果勾选了表和视图之外的其它对象,必须配置该项以使用 sys 租户账号进行导出。
                • + + + + + + +本章节将分篇介绍以下导入导出的相关功能: + +* [导出导入格式](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md) + + + +* [批量导出与导入](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/3.web-odc-batch-export-and-import.md) + + + +* [单表导出与导入](../../../6.web-odc-user-guide/6.web-odc-use-tools/1.web-odc-data-export-and-import/4.web-odc-single-table-export-and-import.md) diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md new file mode 100644 index 00000000..695413bb --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md @@ -0,0 +1,26 @@ +导出导入格式 +=========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)数据导出与导入支持导出的内容有导出结构和数据、仅导出数据和仅导出结构等三种模式。其中结构是指被导出对象的结构定义(DDL)文件,数据是对象中实际保存的数据文件。根据您选择的导出导入格式不同,其中结构和数据文件的类型也不同。 + +目前 ODC 支持的数据导出格式有 SQL 格式和 CSV 格式,支持的导入文件格式有 ZIP 压缩文件、SQL 文件(批量导入)和 CSV 文件(单表导入)。 + +导出文件格式 +--------------------------- + +ODC 导出工具会将数据导出到以 .zip 结尾的压缩文件包中,压缩包中包含元数据文件 MANIFEST.bin 和 Schema 下导入导出对象的结构定义文件和数据文件。 + +创建导出任务时,如果您指定 **数据格式** 为 **SQL 格式** ,那文件包中的结构定义文件是以 `对象名-schema.sql` 命名的 SQL 文本,数据文件是以 `对象名.sql` 命名的 SQL 文本,其中对象名与数据库实际对象名保持一致。![Image 445](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2671938161/p263147.png) + +如果您指定 **数据格式** 为 **CSV 格式** ,那文件包中的结构定义文件是以 `对象名-schema.sql` 命名的 SQL 文本,数据文件是以 `对象名.csv` 命名的 CSV 文本,其中对象名与数据库实际对象名保持一致。![Image 444](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3671938161/p263148.png) + +导入文件格式 +--------------------------- + +ODC 导入工具支持导入 ZIP 压缩文件(批量导入和单表导入)、SQL 文件(批量导入)和 CSV 文件(单表导入)。 + +其中,ZIP 压缩文件是以 .zip 结尾的压缩包。创建导入任务时在面板中的 **导入内容** 项中选择了 **ZIP 压缩文件** 后还需在 **数据格式** 项中选择压缩包中的数据格式是 **CSV 格式** 或 **SQL 格式** 。对应数据格式的导入压缩文件内容可参考 **导出文件格式** 中导出 CSV 格式和 SQL 格式数据所产生的压缩包内容。 + +批量导入时支持导入 SQL 文件,SQL 文件是以 .sql 结尾包含可直接在数据库中执行的 `SELECT`、`INSERT`、`UPDATE`、`DELETE`、`CREATE` 和 `DROP` 语句的文件。 + +单表导入时支持导入 CSV 文件,CSV 文件是 .csv 或 .txt 结尾的支持自定义分割符的数据文件。 diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md new file mode 100644 index 00000000..f83801a9 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md @@ -0,0 +1,239 @@ +# 批量导出与导入 + + + + +## 概述 + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持批量导出和导入数据库对象的结构和数据。 + +进入数据库连接后,单击顶部导航栏中的 **工具** 标签,在弹出的下拉菜单中单击 **导出** 或 **导入** 标签进入导出设置与导入设置面板。 + +OceanBase 开发者中心(ODC)对导出与导入数据大小和保留时间的要求如下: + +| 要求 | 说明 | +|------------------------|--------------| +| 服务器上文件保留时间 |
                • 任务的状态(成功,失败,取消等)不影响文件的生命周期。
                • 任务永久保留,任务相关的文件默认保留 14 天。
                • | + + + +## 批量导出 + + +在 **新建导出** 面板中,可以选择同时导出多个对象到指定格式的文件中。 + +![批量导出](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export1.png) + + + +以在 ODC 中批量导出员工表(employee)和视图(salary)为例。具体操作步骤如下: + +### 步骤 1:选择导出内容 + +如上图所示,ODC 目前支持 **导出结构和数据** 、 **仅导出数据** 和 **仅导出结构** 三种方式。其中导出结构是指导出目标对象的定义语句。可在 **导出内容** 标签下的选择框中选择导出的内容。 + +### 步骤 2:选择所属库 + +选择导出对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 3:选择导出范围 + +支持选择 **部分导出** 和 **整库导出** 。 + +* 部分导出:在 **导出对象** 的 **选择对象** 窗口中勾选需要导出的对象。支持使用搜索框直接进行搜索对象。 + + + +* 整库导出:导出当前库中的所有对象。 + + + + + + +### 步骤 4:进入导出设置面板 + +单击 **下一步:导出设置** 对导出的文件和 sys 租户账号进行设置。 + +### 步骤 5:设置数据文件 + +![批量导出-2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/export2.png) + +1. 选择数据格式。 + + ODC 目前支持将数据导出为 **CSV 格式** 和 **SQL 格式**。当 **导出内容** 为 **仅导出结构** 时,只支持导出数据为 SQL 格式。具体格式信息,请参见 [导出导入格式](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + + +2. 选择文件编码。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + +3. 进行数据文件设置。 + + 当 **导出内容** 为仅导出结构时无需进行导出数据设置,该项包含以下设置项: + + * **使用全局快照** :勾选该项后 ODC 将导出全局中指定表的最新快照点中的数据,勾选该项可以保证全局数据的一致性。 + + + + * **批量提交数量** (SQL 格式):单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。选择 **数据格式** 为 SQL 格式时,通过指定批量提交数量,可在导出文件中导出指定数量数据时添加一句 `COMMIT` 命令。 + + + + * 指定 CSV 格式信息。当 **数据格式** 为 CSV 格式且 **导出内容** 为导出结构和数据时,可指定以下信息: + + * **包含列头** :该项默认勾选,选择导出数据为 CSV 格式时是否包含列头。 + + + + * **空字符串转为空值** :该项默认勾选,选择导出数据为 CSV 格式时是否将表中的空字符串转换为空值 \\N。 + + + + * **字段分隔符** :设置字段间的分隔符。支持选择 **,** (逗号)、 **;** (分号)和 **:** (冒号)作为字段分割符。同时支持自定义一个字符长度的字符作为分隔符。 + + + + * **文本识别符** :设置文本内容的识别符。支持选择 **'** (单引号)和 **"** (双引号)作为文本识别符。 + + + + * **换行符号** :设置换行符。支持选择 **\\n** 、 **\\r** 和 **\\r\\n** 作为换行符。 + + + +### 步骤 6:设置结构文件 + +在该项下选择是否在 **Create 语句前添加 Drop 语句** 。勾选该项后,在导出对象结构文件时,在对象的 `CREATE` 语句前均会添加对应的 `DROP` 语句。 + +### 步骤 7:设置任务执行方式 + +在该项下选择 **立即执行**。 + +### 步骤 8:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + **注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
                  + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + + - 如未配置 **sys** 租户账号,会导致导入导出缺注释和索引。 + + +### 步骤 9:保留当前配置 + +勾选 保留当前配置,保留当前部分数据文件和结构文件配置。 + + +### 步骤 10:生成导出任务 + +指定所有信息后,单击面板右下角的 **导出** 按钮以生成导出任务,并将备份文件直接导出到本地目录。 + +### 步骤 11:查看导出任务 + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。详情请参见 [导出任务](../../8.client-odc-task-management/3.client-odc-export-tasks.md)。 + + +## 批量导入 + + +在 **新建导入** 面板中,可以选择同时导入结构和数据到多个数据库对象中。 + +![批量导入](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import1.png) + + + +以在 ODC 中批量导入 ZIP 压缩文件(6000219_import_file)为例,其中包含员工表(employee)和视图(salary)。具体操作步骤如下: + +### 步骤 1:选择导入文件格式 + +如上图所示,ODC 目前支持批量导入 **CSV 文件** 、 **SQL 文件** 和 **ZIP 压缩文件** 。可在 **导入文件格式** 标签下的下拉框中选择需要的文件格式。具体格式信息,请参见 [导出导入格式](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + +### 步骤 2:上传导入文件 + +单击文件池进入文件资源管理器以选择需要导入的文件,或者直接将文件拖入文件池中以完成文件上传。上传的文件格式需要与所选择的导入文件格式相同,ZIP 压缩文件支持上传 .zip 结尾的文件、SQL 文件支持上传 .sql 文件以及 CSV 文件支持上传 .csv 文件。 + +### 步骤 3:选择文件编码 + +ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + +### 步骤 4:进入导入设置面板 + +单击 **下一步:导入设置** 对导入的文件和 sys 租户账号进行设置。 + +### 步骤 5:选择导入内容 + +![批量导入-2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/tool/export%20and%20import/batch%20export%20and%20import/import2.png) + +当 **导入格式** 为 ZIP 压缩文件时需指定该项。ODC 目前支持 **仅导入数据** 、 **仅导入结构** 和 **导入数据和结构** 三种方式 **。** 其中导入结构指是否要导入对象的定义语句。可在 **导入内容** 标签下的选择框中选择需要导入的内容。 + +### 步骤 6:选择所属库 + +选择导入对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 7:设置导入数据 + +当 **导入格式** 为 ZIP 压缩文件且 **导入内容** 不为仅导入结构时需设置导入数据。该项包含以下设置项: + +* **导入前清空数据** :勾选该项后,导入数据时将首先清空目标对象中原有的数据。 + + + +* **批量提交数量** :单击 **导入数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。通过指定批量提交数量,可在导入文件中导入指定数量数据时添加一句 `COMMIT` 命令。 + + + +* **不导入的数据类型** (可选):可以通过该项指定导入数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + + + + + + +### 步骤 8:设置导入结构 + +当 **导入内容** 为仅导入数据时,该项不可被指定。在该项下选择当对象结构已存在时的操作。选择 **跳过** 操作则在导入时跳过导入文件中的结构定义语句直接导入数据,该项会保留对象中的原数据。选择 **替换** 操作时则执行导入文件中的结构定义语句以重新创建并替换原对象,该项会清空对象中的原数据。 + +### 步骤 9:设置执行方式 + +支持选择 **立即执行**。 + + + + + + +### 步骤 10:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + **注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
                  + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + + - 如未配置 **sys** 租户账号,会导致导入导出缺注释和索引。 + +### 步骤 11:保留当前配置 + +勾选 **保留当前配置**,保留当前部分数据文件和结构文件配置。 + + + +### 步骤 12:生成导入任务 + +指定所有信息后,单击面板右下角的 **提交** 按钮以生成导入任务。 + +### 步骤 13:查看导入任务 + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息,详情请参见 [导入任务](../../8.client-odc-task-management/2.client-odc-import-tasks.md)。 + diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md new file mode 100644 index 00000000..6cab6668 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/4.client-odc-single-table-export-and-import.md @@ -0,0 +1,229 @@ +# 单表导出与导入 + + + + +## 概述 + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持对指定表导出和导入结构和数据。 + +进入数据库连接后,左导航栏中单击对象标签查看对象列表,在对象列表中右键目标对象名或者在顶部导航栏中单击 **工具** ,在弹出的列表中您可以选择使用 **导出** 或 **导入** 功能以导出或导入当前表中的数据和结构。 + +OceanBase 开发者中心(ODC)对导出与导入数据大小和保留时间的要求如下: + + +| 要求 | 说明 | +|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 服务器上文件保留时间 |
                • 任务的状态(成功,失败,取消等)不影响文件的生命周期。
                • 任务永久保留,任务相关的文件默认保留 14 天。
                • | + + + +## 单表导出 + + +![单表导出-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%87%BA-1.png) + + + +单表导出的操作与 [批量导出](../1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md) 的操作基本一致。以在 ODC 中导出员工表(employee)为例。具体操作步骤如下: + +### 步骤 1:选择导出内容 + +如上图所示,ODC 目前支持 **导出结构和数据** 、 **仅导出数据** 和 **仅导出结构** 三种方式 **。** 其中导出结构是指导出目标对象的定义语句。可在 **导出内容** 标签下的选择框中选择导出的内容。 + +### 步骤 2:选择所属库 + +选择导出对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 3:选择导出范围 + +默认导出当前表,支持选择 **部分导出** 和 **整库导出** 。 + +* 部分导出:在 **导出对象** 的 **选择对象** 窗口中勾选需要导出的对象。支持使用搜索框直接进行搜索对象。 + + + +* 整库导出:导出当前库中的所有对象。 + + + + + + +### 步骤 4:进入导出设置面板 + +单击 **下一步:导出设置** 对导出的文件和 sys 租户账号进行设置。 + +### 步骤 5:设置数据文件 + +![单表导出-2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%87%BA.png) + +1. 选择数据格式。 + + ODC 目前支持将数据导出为 **CSV 格式** 和 **SQL 格式** 。当 **导出内容** 为 **仅导出结构** 时,只支持导出数据为 SQL 格式。具体格式信息,请参见 [导出导入格式](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + + +2. 选择文件编码。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + + +3. 进行数据文件设置。 + + 当 **导出内容** 为仅导出结构时无需进行导出数据设置,该项包含以下设置项: + * **使用全局快照** :勾选该项后 ODC 将导出全局中指定表的最新快照点中的数据,勾选该项可以保证全局数据的一致性。 + + + + * **批量提交数量** (SQL 格式):单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。选择 **数据格式** 为 SQL 格式时,通过指定批量提交数量,可在导出文件中导出指定数量数据时添加一句 `COMMIT` 命令。 + + + + * 指定 CSV 格式信息。当 **数据格式** 为 CSV 格式且 **导出内容** 为导出结构和数据时,可指定以下信息: + + * **包含列头** :该项默认勾选,选择导出数据为 CSV 格式时是否包含列头。 + + + + * **空字符串转为空值** :该项默认勾选,选择导出数据为 CSV 格式时是否将表中的空字符串转换为空值 \\N。 + + + + * **字段分隔符** :设置字段间的分隔符。支持选择 **,** (逗号)、 **;** (分号)和 **:** (冒号)作为字段分割符。同时支持自定义一个字符长度的字符作为分隔符。 + + + + * **文本识别符** :设置文本内容的识别符。支持选择 **'** (单引号)和 **"** (双引号)作为文本识别符。 + + + + * **换行符号** :设置换行符。支持选择 **\\n** 、 **\\r** 和 **\\r\\n** 作为换行符。 + + +### 步骤 6:设置结构文件 + +在该项下选择是否在 **Create 语句前添加 Drop 语句** 。勾选该项后,在导出对象结构文件时,在对象的 `CREATE` 语句前均会添加对应的 `DROP` 语句。 + +### 步骤 7:设置任务执行方式 + +在该项下选择 **立即执行** / **定时执行** 。 + +### 步骤 8:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + **注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
                  + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + - 如未配置 **sys** 租户账号,会导致导入导出缺注释和索引。 + +### 步骤 9:生成导出任务 + +指定所有信息后,单击面板右下角的 **导出** 按钮以生成导出任务。 + +### 步骤 10:查看导出任务 + +![单表导出-3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%87%BA-3.png) + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。详情请参见 [导出任务](../../8.client-odc-task-management/3.client-odc-export-tasks.md)。 + +## 单表导入 + + +![单表导入-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%85%A5-1.png) + + + +单表导入的操作页面如下所示,与 [批量导出与导入](../1.client-odc-data-export-and-import/3.client-odc-batch-export-and-import.md) 的操作基本一致。以在 ODC 中导入 ZIP 压缩文件(6000219_import_file)为例,其中包含员工表(employee)。具体操作步骤如下: + +### 步骤 1:选择导入文件格式 + +如上图所示,ODC 目前支持导入 **CSV 文件** 和 **ZIP 压缩文件** 。可在 **导入文件格式** 标签下的下拉框中选择需要的文件格式。具体格式信息,请参见 [导出导入格式](../1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + +### 步骤 2:上传导入文件 + +单击文件池进入文件资源管理器以选择需要导入的文件,或者直接将文件拖入文件池中以完成文件上传。上传的文件格式需要与所选择的导入文件格式相同,ZIP 压缩文件支持上传 .zip 结尾的文件、CSV 文件支持上传 .csv 文件。 + +> **说明** +> 支持上传单表或者多表。 + +### 步骤 3:选择文件编码 + +ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + +### 步骤 4:进入导入设置面板 + +单击 **下一步:导入设置** 对导入的文件和 sys 租户账号进行设置。 + +### 步骤 5:选择导入内容 + +![单表导入-2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%8D%95%E8%A1%A8%E5%AF%BC%E5%85%A5-2.png) + +当 **导入格式** 为 ZIP 压缩文件时需指定该项。ODC 目前支持 **仅导入数据** 、 **仅导入结构** 和 **导入数据和结构** 三种方式 **。** 其中导入结构指是否要导入对象的定义语句。可在 **导入内容** 标签下的选择框中选择需要导入的内容。 + +### 步骤 6:选择所属库 + +选择导入对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +### 步骤 7:导入目标表 + +默认导入当前表,如果导入多表,支持选择需要导入的表。 + +### 步骤 8:设置导入数据 + +当 **导入格式** 为 ZIP 压缩文件且 **导入内容** 不为仅导入结构时需设置导入数据。该项包含以下设置项: + +* **导入前清空数据** :勾选该项后,导入数据时将首先清空目标对象中原有的数据。 + + + +* **批量提交数量** :单击 **导入数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。通过指定批量提交数量,可在导入文件中导入指定数量数据时添加一句 `COMMIT` 命令。 + + + +* **不导入的数据类型** (可选):可以通过该项指定导入数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + + + + + + +### 步骤 9:设置导入结构 + +当 **导入内容** 为仅导入数据时,该项不可被指定。在该项下选择当对象结构已存在时的操作。选择 **跳过** 操作则在导入时跳过导入文件中的结构定义语句直接导入数据,该项会保留对象中的原数据。选择 **替换** 操作时则执行导入文件中的结构定义语句以重新创建并替换原对象,该项会清空对象中的原数据。 + +### 步骤 10:设置任务错误处理和执行方式 + +* ODC 提供 **停止任务** 和 **忽略错误继续任务** 两种错误处理方式。需要在 **任务错误处理** 标签下选择需要的处理方式。 +* 支持选择 **立即执行** / **定时执行** 。 + + + + + + +### 步骤 11:设置 sys 租户账号 + +1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + + +2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + **注意** + - **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
                  + ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png) + - 如未配置 **sys** 租户账号,会导致导入导出缺注释和索引。 + +### 步骤 12:生成导入任务 + +指定所有信息后,单击面板右下角的 **提交** 按钮以生成导入任务。 + +### 步骤 13:查看导入任务 + +任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息,详情请参见 [导入任务](../../8.client-odc-task-management/2.client-odc-import-tasks.md)。 diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/2.client-odc-data-mocking.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/2.client-odc-data-mocking.md new file mode 100644 index 00000000..41445429 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/2.client-odc-data-mocking.md @@ -0,0 +1,76 @@ +模拟数据 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)提供模拟数据功能供您在测试数据库性能或者验证功能等需要大量模拟数据的场景下,能够快速根据表中的字段类型生成数据。 + +![Image 171](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/1175437461/p240476.png) + + +使用模拟数据功能生成数据的步骤如下: + +1. 进入 **模拟数据** 面板。 + + 进入 ODC 单击目标连接进入对应的数据库对象管理页面后,单击上方导航栏中的 **工具** 标签,在弹出的下拉菜单中选择 **模拟数据** 以弹出 **模拟数据** 面板。 + + +2. 查看 **所属连接** 。 + + 显示目标任务所在的数据库连接名称。 + + +3. 指定 **所属库** 。 + + 选择需变更的数据库。 + + +4. 指定生成数据的表。 + + 在模拟数据面板的 **表** 标签下的下拉列表中选择要在其中生成数据的表。下拉列表中会展示当前实例中所有存在的表。 + + +5. 指定生成的数据量。 + + 在模拟数据面板的 **模拟生成数据量** 标签下的文本框中输入您需要生成的数据量。默认会生成 1000 条数据,最多生成不超过 1000000 行数据,所以您可以在文本框中输入 1\~1000000 间的任意正整数。 + + +6. 指定批量处理数据的大小。 + + 在模拟数据面板的 **批处理大小** 标签下的文本框中指定每生成多少条数据进行一次提交(`COMMIT` 命令)操作。默认每生成 200 条数据进行一次提交,最大不超过 500 条,所以您可以在文本框中输入 1\~500 间的任意正整数。 + + +7. 选择在表中插入模拟数据时是否清空表。 + + 在模拟数据面板的 **插入模拟数据清空表** 标签下的单选列表中选择当在表中插入模拟数据时是否清空表中原有的数据。 + + +8. 选择数据冲突处理方式。 + + 在模拟数据面板的 **数据冲突处理方式** 标签下的单选列表中选择当生成的数据有冲突时处理的方式。ODC 提供以下处理方式: + * **忽略** :默认为忽略,若数据有冲突则冲突数据不被插入。 + + + + * **覆盖** :若数据有冲突则删除原数据插入新数据。 + + + + * **终止** :若数据有冲突则停止生成数据终止整个模拟数据任务。 + + + + + + +9. 设置数据生成规则。 + + 在模拟数据面板的 **规则设置** 标签下的表格会根据您在第 2 步选择的表展示表的 **字段名称** 和 **字段类型** 信息。您可以在 **规则** 和 **细则** 列中针对目标字段设置模拟数据生成的规则。 其中 **规则** 列中会根据字段类型提供一些内置的对应规则,您可以按需进行选择。 **细则** 列会根据您选择的规则展示具体的规则信息,您可以单击细则信息后的编辑图标对细则信息进行修改。 + + +10. 提交信息,生成模拟数据任务。 + + 单击模拟数据面板右下角的 **提交** 按钮生成模拟数据任务。您可以在 **任务中心** 面板查看任务详情,详情请参见 [模拟数据任务](../8.client-odc-task-management/4.client-odc-data-mocking-tasks.md)。 + + + + + diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/3.client-odc-database-change.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/3.client-odc-database-change.md new file mode 100644 index 00000000..19bdef75 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/3.client-odc-database-change.md @@ -0,0 +1,105 @@ +数据库变更 +========================== + + + +概述 +----------------------- + +OceanBase 开发者中心(OceanBase Developer Center,ODC)SQL 窗口中的语句是同步执行的,当语句运行时间过长时可能会出现执行超时的问题。可使用数据库变更工具来运行耗时较高的 SQL 语句以避免语句执行超时。 + +![Image 441](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8492996461/p293273.png) + + +操作步骤 +------------------------- + +新建数据库变更的步骤如下: + +1. 进入 **数据库变更** 面板。 + + 1. 在 ODC 首页,单击目标连接进入对应的数据库对象管理页面; + + + + 2. 单击顶部导航栏中的 **工具** 标签; + + + + 3. 在弹出的下拉菜单中选择 **数据库变更** 以弹出 **新建数据库变更** 面板。 + + + + + + +2. 查看 **所属连接** (当前连接,不可切换)。 + + + +3. 选择 **所属库** (默认显示当前库)。 + + + +4. 指定 **SQL 内容** 。 + + 数据库变更支持两种指定 SQL 内容的方式: + * **SQL 录入** :SQL 录入为默认方式,可在编辑区中直接录入 SQL 脚本。 + + > **说明**
                  + > 单击 **IN 值转化** 按钮,可将批量复制的数据转化成 in('A','B')格式。 + > 列值分隔符号为换行符;行值分隔符为空格或 TAB 值。 + + * **上传附件** :选择上传附件方式后,单击文件池进入文件资源管理器选择要导入的文件或者直接将导入文件拖入文件池中以完成文件上传。 + + > **说明**
                  + > 单击 **IN 值转化** 按钮,可将批量复制的数据转化成 in('A','B')格式。
                  + > 列值分隔符号为换行符;行值分隔符为空格或 TAB 值。 + + * **上传附件** :选择上传附件方式后,单击文件池进入文件资源管理器选择要导入的文件或者直接将导入文件拖入文件池中以完成文件上传。 + + > **说明**
                  + > - 最多支持上传 500 个文件,总文件大小不超过不超过 256 MB。
                  + > - 默认附件按上传的先后排序,可拖拽改变顺序,任务执行时按文件顺序执行。
                  + > - 当前只支持上传 .sql 后缀的 SQL 文件。 + + +5. 指定 **回滚方案** 。 + + 回滚方案支持 SQL 文本录入及上传附件方式,具体参见"指定 SQL 内容"步骤。 + + +6. **分隔符** :支持 delimiter 分隔符号。 + + + +7. **查询结果限制** :支持设置查询结果限制 (1-100w)。 + + + +8. 指定 **任务错误处理** 方式。 + + 异步执行工具提供两种任务错误处理方式: + * **停止任务** :停止任务为默认方式,运行脚本的过程中出现错误时会停止运行。 + + + + * **忽略错误继续任务** :选择忽略错误继续任务方式,在运行脚本出现错后将跳过错误语句继续执行。 + + +9. 指定 **执行超时时间** 。 + + 在 **执行超时时间** 文本框中输入数字指定语句执行超时时间,单位为小时(默认超时时间为 48 小时,最大不超过 480 小时)。 + + +10. 指定 **任务描述** (选填)。 + + 可在 **任务描述** 文本框中输入不超过 200 个字符的描述信息,该项为选填项。 + + +11. 生成数据库变更任务。 + + 在面板中完成上述信息的指定后,单击右下角的 **新建** 按钮以提交信息生成数据库变更任务。 + + +12. 新建完成后,会自动转入 **任务中心** > **数据库变更** 页面,可单击 **查看** 按钮,在任务详情页面查看 **任务信息** 、 **执行结果** 和 **任务日志** 。 diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/4.client-odc-shadow-table-synchronization.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/4.client-odc-shadow-table-synchronization.md new file mode 100644 index 00000000..6c3e8e93 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/4.client-odc-shadow-table-synchronization.md @@ -0,0 +1,62 @@ +# 影子表同步 + +## 背景信息 + +ODC 的影子表同步功能支持根据源表的表结构自动在当前库中创建影子表(表名是在源表名上增加前缀或后缀的方式生成),适用于全链路压测等场景。 + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上新建影子表同步。 +> **说明** +>
                • ODC V4.0.0 版本的影子表同步功能仅支持 MySQL 模式,且如果源表中包含二级分区,仅支持 HASH/KEY 的二级模板分区。
                • +>
                • 影子表创建完成后,可以在表对象列表中查看创建的影子表。
                • +>
                • 创建影子表时,如果表名已存在但表结构不同,则会生成同步 SQL 语句,更新影子表结构。
                • + + +## 新建影子表同步 + +1. 登录 ODC 后,单击目标连接进入对应的数据库对象管理页面。 + + +2. 在顶部导航栏中,选择 **工具** > **影子表同步**, 以弹出 **新建影子表同步** 面板。 + + ![影子表同步-1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5-1.png) + +3. 在 **新建影子表同步** 面板中指定以下信息。 + + 1. 选择对象。 + + ![影子表同步-新建1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5-%E6%96%B0%E5%BB%BA2.png) + + + | **信息项** | **说明** | + |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属库 | 选择创建影子表的所属库并可查看当前连接名。 | + | 同步范围 | 选择需要同步的表:
                  • **部分表** :选定的表在当前库中创建影子表。
                  • **全部表**:来源库中所有的表都会在当前库中创建影子表。
                  | + | 影子表名 | 支持以" **前缀** +源表名"或"源表名+ **后缀** "的格式创建影子表名,并且支持自定义前、后缀。 | + | 同步对象 | 同步部分表时,需在 **同步对象** 中选择源表以同步为影子表。 | + + + 2. 同步影子表结构分析。 + + ![影子表同步-新建2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5-%E6%96%B0%E5%BB%BA3.png) + + + | **信息项** | **说明** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 同步的表 | **同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **查看** 支持查看源表结构、影子表结构和结构变更 SQL 语句,单击 **跳过** 支持不同步该影子表。 | + | 不同步的表 | **不同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **取消跳过** 支持同步该影子表。
                  **说明**
                  选择跳过同步的表,会显示在 **不同步的表** 页签中。
                  如果影子表名已存在且结构与源表一致,则会自动跳过同步表结构。
                  | + | SQL 预览 | 显示同步表结构的 SQL 语句。 | + | 任务设置 | 选择审批完成后的 **执行方式** 。
                  • **立即同步** :立即执行同步任务。
                  • **定时同步** :定时执行同步任务。
                  | + | 任务设置 | 选择 **任务错误处理** 方式。
                  • **停止任务** :在执行过程中,遇到出错则中断后面的 SQL 脚本,不再执行。
                  • **忽略错误继续执行** :在执行过程中,跳过当前出错的 SQL 脚本继续执行,并执行完所有 SQL 脚本。
                  | + | 备注 | 描述项目的业务背景信息,例如变更目的、预期目标等。 | + +4. 指定上述信息后,单击面板右下角的 **提交** 按钮完成创建影子表同步任务。 + + +5. 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务状态和任务信息。详情请参见 [影子表同步任务](../../7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-shadow-table-synchronization-task.md)。 + + ![影子表同步-审批任务3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%AE%A2%E6%88%B7%E7%AB%AF-%E5%BD%B1%E5%AD%90%E8%A1%A8%E5%90%8C%E6%AD%A5%E5%88%97%E8%A1%A8-4.png) + + +## 相关信息 + +[影子表同步任务](../../7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-shadow-table-synchronization-task.md) \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/5.client-odc-partition-plan.md b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/5.client-odc-partition-plan.md new file mode 100644 index 00000000..09a36258 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/5.client-odc-use-tools/5.client-odc-partition-plan.md @@ -0,0 +1,40 @@ +# 分区计划 + +## 背景信息 + +- **RANGE 分区**:基于属于一个给定连续区间的列值,将多行分配给分区。范围必须是有序的、连续的和不重叠的。详情请参见 [设置分区规则](../10.client-odc-database-objects/1.client-odc-table-objects/2.client-odc-create-a-table.md)。 + +- **分区计划**:在 RANGE 分区表中插入数据时,如果插入的数据超出当前分区的区间上限值,将无法插入数据并且会返回错误。分区计划是专门针对 Range 分区的扩展功能,ODC 支持依据用户设置的分区策略对 Range 分区表进行自动管理,用户无需手动创建新分区,以方便维护 RANGE 分区表。 + + 本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上使用分区计划,包括对新建和删除的表分区进行自动管理。 + +## 新建分区计划 + +1. 登录 ODC 后,单击目标连接进入对应的数据库对象管理页面。 + +2. 在顶部导航栏中,选择 **工具** > **分区计划**, 以弹出 **新建分区计划** 面板。 + + + ![分区计划1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-1.png) + +3. 在 **新建分区计划** 面板中指定以下信息。 + + ![分区计划2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/2022%E5%AE%A2%E6%88%B7%E7%AB%AF-%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-2.png) + + | **信息项** | **说明** | + |---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属连接 | 选择创建分区计划所属连接。默认为当前连接。 | + | 分区策略 | 搜索和勾选所属库中的 Range 分区表,并编辑对应的分区策略。
                  • 勾选 **分区策略** 右侧的 **仅显示未设置的表** 时,支持过滤未设置的表。
                  • 勾选 Range 分区表时,支持批量设置分区策略。
                  • 在 **分区策略** 项下,单击编辑图标,支持编辑预创建分区数量、分区间隔、保留时长和命名规则等。
                    • **预创建分区数量**:设置将要创建的分区数量。
                    • **分区间隔**:支持根据所设置的分区时间间隔创建分区,单位:日/月/年。
                    • **保留时长**:超过保留时长后,创建的分区将被自动清理,单位:日/月/年。
                      示例:预创建分区数量 1,分区间隔 1 月,保留时长 1 月,表示对当前表预创建 1 个分区,每隔 1 个月会创建 1 个分区,且超过 1 个月后所创建的分区会被自动清理。
                      ![edit](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92-edit-3.png)
                  | + | 备注 | 描述项目的业务背景信息,例如变更目的、预期目标等。 | + +4. 指定上述信息后,单击面板右下角的 **提交** 按钮完成创建分区计划任务。 + +5. 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务状态和任务信息。详情请参见 [分区计划任务](../../7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-partition-plan-task.md)。 + + ![分区计划3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E5%88%86%E5%8C%BA%E5%92%8C%E5%BD%B1%E5%AD%90%E8%A1%A8/%E5%AE%A2%E6%88%B7%E7%AB%AF-%E5%88%86%E5%8C%BA%E8%AE%A1%E5%88%92%E5%88%97%E8%A1%A8-3.png) + + +**相关信息** +------------------------- + +[分区计划任务](../../7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-partition-plan-task.md) \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/6.client-odc-recycle-bin.md b/zh-CN/7.client-odc-user-guide/6.client-odc-recycle-bin.md new file mode 100644 index 00000000..4e21658b --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/6.client-odc-recycle-bin.md @@ -0,0 +1,41 @@ +使用回收站 +========================== + +进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)单击目标连接名后,进入对应的数据库对象管理页面后,单击右上角的 **回收站** 标签即可进入回收站页面。 + + + +回收站旨在短暂保存被删除的数据库对象,可帮助您轻松查询和还原被删除的数据库对象。 + +原理上,回收站是一个数据字典表,用于放置已删除的数据库对象信息。此处删除系指 `DROP` 操作,`DELETE` 操作删除的数据不会进入回收站。因此被 `DROP` 操作删除的对象并没有被数据库彻底删除,此类对象仍会占用空间,您可进行 `PURGE` 操作或在 ODC 中清空回收站以彻底释放空间。 + +如图所示,回收站页面展示以下信息: +![回收站](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6479168461/p203469.png) + + +| 信息 | 说明 | +|---------|---------------------------------------------------------------------| +| 原名称 | 显示被删除的对象的名称(用户创建对象时自定义的名称)。 单击 原名称,可升序或降序。 | +| 对象名称 | 系统中为该对象命名的名称。 与原名称不同,对象名称由系统指定不会出现重复名称,可以作为对象的唯一标识。 | +| 对象类型 | 显示被删除的对象的类型。 | +| 进入回收站时间 | 显示该对象被删除的时间戳,以方便更具体的回溯被删除的对象。 | + + + +回收站页面的导航栏中同时提供以下功能键: + + +| 操作键 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 清空 | 单击![清空](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p412872.jpg),清空回收站中当前所有的被删除对象并释放空间。 | +| 刷新 | 单击![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9525548461/p412817.jpg),刷新回收站中被删除对象的列表。 | +| 清除 | 单击![清除](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6479168461/p412873.jpg),将当前选中的对象从回收站中立即删除并释放存储空间。 | +| 还原 | 单击![还原](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p412874.jpg),将当前选中的对象从回收站中恢复到原来的位置。 | +| 搜索 | 在搜索框中输入对象名称,搜索被删除的对象。 | +| 设置 | 单击![设置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p413502.jpg),选择是否启用回收站以及是否启用 Truncate Table。 * 启用回收站:删除的对象会送入回收站。 * 启用 Truncate Table:支持保留对象数据。 | +| 选择所有对象 | 单击复选框图标![复选框](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/6479168461/p422119.jpg),选择所有对象或取消所有对象。
                  ![回收站-选择所有对象](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7479168461/p422121.png) | + + + + + diff --git a/zh-CN/7.client-odc-user-guide/7.view-operation-records.md b/zh-CN/7.client-odc-user-guide/7.view-operation-records.md new file mode 100644 index 00000000..24d4c6ea --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/7.view-operation-records.md @@ -0,0 +1,79 @@ +查看操作记录 +=========================== + +本文档旨在介绍如何在 OceanBase 开发者中心(OceanBase Developer Center,ODC)上查看操作事件的历史记录。 + +背景信息 +------------------------- + +通过 ODC 查看操作记录,可满足以下需求: + +* 安全合规:数据库操作记录支持的多项功能协助用户完成安全合规建设,帮助用户满足安全合规要求。 + + + +* 实时监测:数据库操作记录提供公共连接相关的业务操作记录功能。 + + + +* 事件追溯:数据库操作记录可对数据库行为进行周期性对比,帮助用户快速定位异常点和异常行为,并提供风险检索能力,帮助用户追溯风险来源,并且可根据访问来源实现数据库的关联查询和关联分析,使数据库的访问行为有效定位到具体业务工作人员。 + + + + + + +操作记录列表 +--------------------------- + +> **说明**
                  +> 所有用户均支持通过此入口查看自己的操作记录。 +> 操作记录当前永久保留。 + +1. 进入 OceanBase 开发者中心(OceanBase Developer Center,ODC)的数据库管理页面后,在顶部导航栏单击 **操作记录** 标签。 + + ![操作记录1](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3785078461/p411756.png) + + +2. 弹出 **操作记录** 标签。 + + ![操作记录](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/3785078461/p411758.png) + * 可通过列表上方的刷新按钮![刷新](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7205818461/p420126.jpg)可刷新列表信息。 + * 通过 **执行时间** 筛选时间,可支持查看最近7天/最近15天/最近30天/最近半年以及自定义时间段查看。 + + 操作记录列表中展示并提供基本信息如下所示。 + + + | 信息项 | 说明 | + |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 事件类型 | 显示操作事件类型,包括个人设置、密码管理、连接管理、脚本管理、数据库操作、组织配置、成员管理、资源组管理、模拟数据、数据库变更、导入、导出和任务流程等。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选事件类型。 | + | 事件操作 | 显示操作事件信息。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选事件操作。 | + | 所属连接 | 显示操作所属的连接名。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p417135.jpg),可搜索所属连接。 | + | IP 来源 | 显示 IP 来源。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p417135.jpg),可搜索 IP。 | + | 执行时间 | 显示操作执行的时间。 默认操作记录列表按执行时间排序,最新的执行记录显示在最前。 单击图标![升序降序](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/7155018461/p420143.jpg),可升序或降序。 | + | 执行结果 | 显示执行结果,包括 **成功** 或 **失败** 。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选执行结果。 | + | 操作 | 显示 **查看** 功能键。 | + + + + + + + + + + + +查看操作记录 +--------------------------- + +在操作记录列表中,单击 **操作** 项下的 **查看** 按钮,以弹出 **记录详情** 面板。 + +![前台-操作记录-查看](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2679533561/p420132.png) + +记录详情中可查看 **事件类型** 、 **事件操作** 、 **IP 来源** 、 **执行细则** 、 **执行人** 、 **执行时间** 和 **执行结果** 信息。 + +相关信息 +------------------------- + +有关管理操作记录,请参见公共资源管控台 [操作记录管理](../6.web-odc-user-guide/4.web-odc-public-resource-management/5.web-odc-operating-records.md)。 diff --git a/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/1.client-odc-task-management-overview.md b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/1.client-odc-task-management-overview.md new file mode 100644 index 00000000..b583aedb --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/1.client-odc-task-management-overview.md @@ -0,0 +1,57 @@ +概述 +======================= + +使用 OceanBase 开发者中心(OceanBase Developer Center,ODC)提供的 [工具](../5.client-odc-use-tools/1.client-odc-data-export-and-import/1.client-odc-data-export-and-import-overview.md) 功能会生成对应的任务,可在 **任务中心** 新建和查看任务。 + +查看任务 +------------------------- + +可通过 ODC 首页或连接页面进入任务中心查看任务。 + +* 通过 ODC 首页查看:在 ODC 首页的顶部导航栏,单击 **任务** 。 + + ![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/overview/client/1.png) + + + > **说明**
                  + >
                • 从 ODC 首页进入的任务中心,不支持新建任务。
                • + >
                • 图标![消息](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9229808461/p420517.jpg)表示待处理的任务数量。
                • + + + + + +* 通过连接页面查看:登录 ODC 进入目标连接后,单击顶部导航栏中的 **任务中心** 按钮会弹出 **任务中心** 面板,在面板中可查看对应任务的详细信息。 + + ![任务-概述2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/overview/2.png) + + ![任务入口-连接内2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/overview/client/2.png) + + + + + +支持功能 +------------------------- + +ODC 任务管理支持如下功能: + +* [导入任务](../8.client-odc-task-management/2.client-odc-import-tasks.md) + + + +* [导出任务](../8.client-odc-task-management/3.client-odc-export-tasks.md) + + + +* [模拟数据任务](../8.client-odc-task-management/4.client-odc-data-mocking-tasks.md) + + + +* [数据库变更任务](../8.client-odc-task-management/5.client-odc-database-change-task.md) + +* [影子表同步](../8.client-odc-task-management/6.client-odc-shadow-table-synchronization-task.md) + +* [分区计划任务](../8.client-odc-task-management/7.client-odc-partition-plan-task.md) + + diff --git a/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/2.client-odc-import-tasks.md b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/2.client-odc-import-tasks.md new file mode 100644 index 00000000..54ffbe1b --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/2.client-odc-import-tasks.md @@ -0,0 +1,148 @@ +导入任务 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建批量导入和单表导入任务后,可在 **任务中心** 面板的 **导入** 页签新建和查看任务。 + +任务列表 +------------------------- + +> **说明**
                  +> 任务列表会显示最近 48 小时内的任务。 +> 最大支持 3 个导入任务并行运行,后续任务在队列中等待运行。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击 **导入** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/1.png) + +进入导入任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| 信息项 | 说明 | +|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务编号 | 导入任务编号。| +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建导入任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。| +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 和 **下载** 等任务管理操作。
                • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务信息** 和 **任务日志**。
                • 通过/拒绝:单击该按钮审批执行中的任务。
                • 终止:任务运行中时,单击该按钮终止任务。
                • 下载:任务成功时,单击该按钮下载导出文件至本地。
                • | + + + +新建导入任务 +--------------------------- + + + +1. 在弹出的任务中心面板中,单击 **导入** 右侧 **+** ,弹出新建导入任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/2.png) + +2. 在弹出的任务面板中,选择导入文件格式。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/3.png) + + 如上图所示,ODC 目前支持批量导入 **CSV 文件** 、 **SQL 文件** 和 **ZIP 压缩文件** 。可在 **导入文件格式** 标签下的下拉框中选择需要的文件格式。具体格式信息,请参见 [导出导入格式](../../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + + +3. 上传导入文件。 + + 单击文件池进入文件资源管理器以选择需要导入的文件,或者直接将文件拖入文件池中以完成文件上传。上传的文件格式需要与所选择的导入文件格式相同,ZIP 压缩文件支持上传 .zip 结尾的文件、SQL 文件支持上传 .sql 文件以及 CSV 文件支持上传 .csv 文件。 + +4. 选择文件编码。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + +5. 进入导入设置面板。 + + 单击 **下一步:导入设置** 对导入的文件和 sys 租户账号进行设置。 + +6. 选择导入内容。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/4.png) + + + + 当 **导入格式** 为 ZIP 压缩文件时需指定该项。ODC 目前支持 **仅导入数据** 、 **仅导入结构** 和 **导入数据和结构** 三种方式 **。** 其中导入结构指是否要导入对象的定义语句。可在 **导入内容** 标签下的选择框中选择需要导入的内容。 + +7. 选择所属库。 + + 选择导入对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +8. 设置导入数据。 + + 当 **导入格式** 为 ZIP 压缩文件且 **导入内容** 不为仅导入结构时需设置导入数据。该项包含以下设置项: + + * **导入前清空数据** :勾选该项后,导入数据时将首先清空目标对象中原有的数据。 + + * **批量提交数量** :单击 **导入数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。通过指定批量提交数量,可在导入文件中导入指定数量数据时添加一句 `COMMIT` 命令。 + + * **不导入的数据类型** (可选):可以通过该项指定导入数据时要跳过的数据类型。MySQL 和 Oracle 下可跳过的类型不同,支持多选。 + +9. 设置导入结构。 + + 当 **导入内容** 为仅导入数据时,该项不可被指定。在该项下选择当对象结构已存在时的操作。选择 **跳过** 操作则在导入时跳过导入文件中的结构定义语句直接导入数据,该项会保留对象中的原数据。选择 **替换** 操作时则执行导入文件中的结构定义语句以重新创建并替换原对象,该项会清空对象中的原数据。 + +10. 设置执行方式。 + + 支持选择 **立即执行**。 + +11. 设置 sys 租户账号。 + + a. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + b. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + > **注意** + >
                  • **sys 租户账号和密码** 为集群租户下用户的账号和密码 (账号请勿填入"@sys#集群")。如图所示:
                    ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png)
                  • 导出时如勾选表和视图之外的其它对象,须配置该项使用 sys 租户账号进行导入。
                  • 如未配置 sys租户账号,会导致导入导出缺注释和索引。
                  + + +12. 保留当前配置。 + + 指定所有信息后,勾选面板左下角的 **保留当前配置** 以保留当前部分数据文件和结构文件配置。 + +13. 生成导入任务。 + + 指定所有信息后,单击面板右下角的 **提交** 按钮以生成导入任务。 + +14. 查看导入任务。 + + 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息。 + + ![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/task/import/5.png) + + +查看导入任务 +--------------------------- + +### 任务信息 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务信息** 标签查看任务基本信息、导入文件信息和导入对象信息。 + + +| 信息项 | 说明 | +|--------|---------------------------------------------------------------------------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务编号** 、 **所属连接** 、 **所属数据库** 和 **任务类型** 等信息。 | +| 导入文件信息 | 显示创建导入导出任务时您选择的 **导入文件格式**、 **导入文件**、 **文件编码**、 **导入内容**、 **数据格式**、 **导入数据设置**、**任务错误处理**、**sys 租户账号配置** 和 **CSV 设置** 等信息。 | +| 导入对象信息 | 显示该任务中您选择的对象在导出或导入数据时的完成情况,包括 **对象名称**、 **对象类型**、**计划处理数量**、**实际处理数量** 和 **数据处理状态** 等信息。 | + + + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------| +| 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 | +| 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。当任务失败时,可通过告警日志查看错误信息。 | + +同时,工具栏提供了以下功能键: + +| 功能 | 说明 | +|------|-----------------------------------------------------------| +| 查找 | 单击该按钮查找日志信息。 | +| 下载 | 单击该按钮下载日志信息。 | +| 复制 | 单击该按钮复制日志信息。 | \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/3.client-odc-export-tasks.md b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/3.client-odc-export-tasks.md new file mode 100644 index 00000000..2fb62ed1 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/3.client-odc-export-tasks.md @@ -0,0 +1,164 @@ +导出任务 +========================= + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建批量导出和单表导出任务后,可在 **任务中心** 面板的 **导出** 页签新建和查看任务。 + + + +任务列表 +------------------------- + +> **说明**
                  +> 任务列表会显示最近 48 小时内的任务。 +> 最大支持 3 个导出任务并行运行,后续任务在队列中等待运行。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击 **导出** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/export/1.png) + +进入导出任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| **信息项** | **说明** | +|-------|-----------------------------------------------------------------| +| 任务编号 | 导出任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建导出任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 和 **下载** 等任务管理操作。
                • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务详情** 和 **任务日志**。
                • 通过/拒绝:单击该按钮审批执行中的任务。
                • 终止:任务运行中时,单击该按钮终止任务。
                • 下载:任务成功时,单击该按钮下载导出文件至本地。
                • | + + + +新建导出任务 +--------------------------- + +1. 在弹出的任务中心面板中,单击 **导出** 右侧 **+** ,弹出新建导出任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/export/2.png) + +2. 在弹出的任务面板中,选择导出内容。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/export/3.png) + + 如上图所示,ODC 目前支持 **导出结构和数据** 、 **仅导出数据** 和 **仅导出结构** 三种方式 **。** 其中导出结构是指导出目标对象的定义语句。可在 **导出内容** 标签下的选择框中选择导出的内容。 + +3. 选择所属库。 + + 选择导出对象所在的数据库。该项下同时显示目标任务所在数据库的连接名称。 + +4. 选择导出范围。 + + 支持选择 **部分导出** 和 **整库导出**。 + * 部分导出:在 **导出对象** 的 **选择对象** 窗口中勾选需要导出的对象。支持使用搜索框直接进行搜索对象。 + + * 整库导出:导出当前库中的所有对象。 + +5. 进入导出设置面板。 + + 单击 **下一步:导出设置** 对导出的文件和 sys 租户账号进行设置。 + +6. 设置数据文件。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/export/4.png) + + + a. 选择 **数据格式** 。 + + ODC 目前支持将数据导出为 **CSV 格式** 和 **SQL 格式** 。当 **导出内容** 为 **仅导出结构** 时,只支持导出数据为 SQL 格式。具体格式信息,请参见 [导出导入格式](../../7.client-odc-user-guide/5.client-odc-use-tools/1.client-odc-data-export-and-import/2.client-odc-export-and-import-formats.md)。 + + b. 选择 **文件编码**。 + + ODC 目前支持 **ASCII** 、 **ISO-8859-1** 、 **GB2312** 、 **GBK** 、 **GB18030** 、 **Unicode(UTF-8)** 、 **Unicode(UTF-16)** 、 **Unicode(UTF-32)** 和 **BIG5** 等编码格式。可在 **文件编码** 下拉框中选择需要的编码格式。 + + c. 进行 **数据文件设置**。 + + 当 **导出内容** 为仅导出结构时无需进行导出数据设置,该项包含以下设置项: + * **使用全局快照** :勾选该项后 ODC 将导出全局中指定表的最新快照点中的数据,勾选该项可以保证全局数据的一致性。 + + * **批量提交数量** (SQL 格式):单击 **导出数据设置** 标签后的 **高级** 按钮,在弹出的列表中可指定该项。选择 **数据格式** 为 SQL 格式时,通过指定批量提交数量,可在导出文件中导出指定数量数据时添加一句 `COMMIT` 命令。 + + * 指定 CSV 格式信息。当 **数据格式** 为 CSV 格式且 **导出内容** 为导出结构和数据时,可指定以下信息: + + * **包含列头** :该项默认勾选,选择导出数据为 CSV 格式时是否包含列头。 + + * **空字符串转为空值** :该项默认勾选,选择导出数据为 CSV 格式时是否将表中的空字符串转换为空值 \\N。 + + * **字段分隔符** :设置字段间的分隔符。支持选择 **,** (逗号)、 **;** (分号)和 **:** (冒号)作为字段分割符。同时支持自定义一个字符长度的字符作为分隔符。 + + * **文本识别符** :设置文本内容的识别符。支持选择 **'** (单引号)和 **"** (双引号)作为文本识别符。 + + * **换行符号** :设置换行符。支持选择 **\\n** 、 **\\r** 和 **\\r\\n** 作为换行符。 + +7. 设置结构文件。 + + 在该项下选择是否在 **Create 语句前添加 Drop 语句** 。勾选该项后,在导出对象结构文件时,在对象的 `CREATE` 语句前均会添加对应的 `DROP` 语句。 + +8. 设置任务执行方式。 + + 在该项下选择 **立即执行**。 + +9. 设置 sys 租户账号。 + + 1. 在该项下选择是否 **使用 sys 租户账号提升导出速度** ,勾选后输入 **账户** 和 **密码** 。 + + 2. 输入账户和密码信息后,单击密码框后的 **测试连接** 按钮测试账户信息是否正确。默认自动填入连接设置的账号,如连接失败,建议修改密码用于此次导出。 + + > **重要** + > **sys 租户账号和密码** 为集群租户下用户的账号和密码(账号请勿填入"@sys#集群")。如图所示:
                  ![sys 租户账号配置](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9555336361/p348256.png)
                  • 导出时如勾选表和视图之外的其它对象,须配置该项使用 sys 租户账号进行导出。
                  • 如未配置 sys租户账号,会导致导入导出缺注释和索引。
                  + +10. 保留当前配置。 + + 指定所有信息后,勾选面板左下角的 **保留当前配置** 以保留当前部分数据文件和结构文件配置。 + +11. 生成导出任务。 + + 指定所有信息后,单击面板右下角的 **导出** 按钮以生成导出任务,并将备份文件直接导出到本地目录。 + +12. 查看导出任务。 + + 任务生成后会自动弹出 **任务中心** 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。 + + ![5](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/export/5.png) + + + +查看导出任务 +--------------------------- + +### 任务详情 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务信息** 标签查看任务基本信息、导出文件信息和导出对象信息。 + + +| 信息项 | 说明 | +|--------|-----------------------------------------------------------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务编号** 、 **连接名** 、 **模式名** 、 **任务类型** 、 **创建时间** 、 **重试次数** 和 **重试时间** 等信息。 | +| 导出文件信息 | 显示创建导出任务时您选择的 **导出内容** 、 **数据格式** 、 **文件编码** 、 **导出数据设置** 、 **导出结构设置** **、** **任务错误处理** 和 **sys 租户账号配置** 等信息。 | +| 导出对象信息 | 显示该任务中您选择的对象在导出或导出数据时的完成情况,包括 **对象名称** 、 **对象类型** 、 **结构处理状态** 、 **数据总记录数** 、 **数据已处理数** 和 **数据处理状态** 等信息。 | + + + +### 任务流程 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务流程** 标签查看 **发起任务** 、 **审批** 和 **执行** 状态等信息。 + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------| +| 全部日志 | 显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 | +| 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。 当任务失败时,可查看告警日志以获得错误信息。 | + +同时,工具栏提供了以下功能键: + +| 功能 | 说明 | +|------|-----------------------------------------------------------| +| 查找 | 单击该按钮查找日志信息。 | +| 下载 | 单击该按钮下载日志信息。 | +| 复制 | 单击该按钮复制日志信息。 | diff --git a/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/4.client-odc-data-mocking-tasks.md b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/4.client-odc-data-mocking-tasks.md new file mode 100644 index 00000000..f130de8d --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/4.client-odc-data-mocking-tasks.md @@ -0,0 +1,93 @@ +模拟数据任务 +=========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建模拟数据任务后,可在 **任务中心** 面板的 **模拟数据** 页签新建和查看任务。 + +任务列表 +------------------------- + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击 **模拟数据** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/data%20mocking/1.png) + +进入模拟数据任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| 信息项 |说明 | +|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务编号 | 模拟数据任务编号。| +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建模拟数据任务任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。| +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。| +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 和 **下载** 等任务管理操作。
                • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务信息**、执行结果和 **任务日志**。
                • 通过/拒绝:单击该按钮审批执行中的任务。
                • 终止:任务运行中时,单击该按钮终止任务。
                • 下载:任务成功时,单击该按钮下载模拟数据对应的 SQL 文件至本地。
                • | + + + +新建模拟数据任务 +----------------------------- + +1. 在弹出的任务中心面板中,单击 模拟数据 右侧 +,弹出新建模拟数据任务面板。 + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/data%20mocking/2.png) + + + +2. 在 **新建模拟数据** 面板中,输入以下信息。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/data%20mocking/3.png) + + + | 信息项 | 说明 | + |-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属连接 | 显示目标任务所在的数据库连接名称。 | + | 所属库 | 选择需变更的数据库。 | + | 表 | 指定生成数据的表。 在模拟数据面板的 **表** 标签下的下拉列表中选择要在其中生成数据的表。下拉列表中会显示当前实例中所有存在的表。 | + | 模拟生成数据量 | 指定生成的数据量。 在模拟数据面板的 **模拟生成数据量** 标签下的文本框中输入您需要生成的数据量。默认会生成 1000 条数据,最多生成不超过 1000000 行数据,所以您可以在文本框中输入 1\~1000000 间的任意正整数。 | + | 批处理大小 | 指定批量处理数据的大小。 在模拟数据面板的 **批处理大小** 标签下的文本框中指定每生成多少条数据进行一次提交(`COMMIT` 命令)操作。默认每生成 200 条数据进行一次提交,最大不超过 500 条,所以您可以在文本框中输入 1\~500 间的任意正整数。 | + | 插入模拟数据清空表 | 选择在表中插入模拟数据时是否清空表。 在模拟数据面板的 **插入模拟数据清空表** 标签下的单选列表中选择当在表中插入模拟数据时是否清空表中原有的数据。 | + | 数据冲突处理方式 | 选择数据冲突处理方式。
                  在模拟数据面板的 **数据冲突处理方式** 标签下的单选列表中选择当生成的数据有冲突时处理的方式。ODC 提供以下处理方式:
                  - **忽略** :默认为忽略,若数据有冲突则冲突数据不被插入。
                  - **覆盖** :若数据有冲突则删除原数据插入新数据。
                  - **终止** :若数据有冲突则停止生成数据终止整个模拟数据任务。 | + | 规则设置 | 设置数据生成规则。
                  在模拟数据面板的 **规则设置** 标签下的表格会根据您在第 2 步选择的表显示表的 **字段名称** 和 **字段类型** 信息。您可在 **规则** 和 **细则** 列中针对目标字段设置模拟数据生成的规则。 其中 **规则** 列中会根据字段类型提供一些内置的对应规则,您可以按需进行选择。 **细则** 列会根据您选择的规则显示具体的规则信息,您可以单击细则信息后的编辑图标对细则信息进行修改。 | + + + +3. 单击 **提交** ,完成新建模拟数据任务。 + +4. 任务生成后会自动弹出 任务中心 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。 + + + + +查看模拟数据任务 +----------------------------- + +### 任务信息 + +1. 单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务信息** 标签查看任务基本信息和模拟数据设置信息。 + + +| 信息项 | 说明 | +|----------|---------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务编号**、**所属连接**、**所属数据库**、**任务类型**、**执行方式**、**创建人** 和 **创建时间** 等信息。| +| 模拟数据设置信息 | 显示创建模拟数据任务时您选择的 **目标表**、 **模拟生成数据量**、 **批处理大小**、 **插入模拟数据前清空表**、 **数据冲突处理方式**、 **实际插入记录**、 **冲突记录**、 **忽略插入**、 **清除记录** 和 **规则设置展示** 等信息。 | + +2. 在任务信息面板右下角,单击 **再次发起** 和 **下载**,可以重新发起任务和下载导出文件至本地。 + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------| +| 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 | +| 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。 当任务失败时,可查看告警日志以获得错误信息。 | + +同时,工具栏提供了以下功能键: + +| 功能 | 说明 | +|------|-----------------------------------------------------------| +| 查找 | 单击该按钮查找日志信息。 | +| 下载 | 单击该按钮下载日志信息。 | +| 复制 | 单击该按钮复制日志信息。 | \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/5.client-odc-database-change-task.md b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/5.client-odc-database-change-task.md new file mode 100644 index 00000000..6c239b8a --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/5.client-odc-database-change-task.md @@ -0,0 +1,93 @@ +模拟数据任务 +=========================== + +在 OceanBase 开发者中心(OceanBase Developer Center,ODC)创建模拟数据任务后,可在 **任务中心** 面板的 **模拟数据** 页签新建和查看任务。 + +任务列表 +------------------------- + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 标签弹出任务中心面板,在面板中单击 **模拟数据** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/database%20change/1.png) + +进入模拟数据任务页签后,列表中会显示以下信息并且支持筛选和排序: + + +| 信息项 |说明 | +|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务编号 | 模拟数据任务编号。| +| 任务类型 | 显示新建任务时指定的任务类型(导入、导出、模拟数据或数据库变更)。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建模拟数据任务任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。| +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。| +| 操作 | 提供 **查看** 、 **通过/拒绝** 、 **终止** 和 **下载** 等任务管理操作。
                • 查看:单击该按钮进入任务详情页面以查看目标任务的 **任务信息**、执行结果和 **任务日志**。
                • 通过/拒绝:单击该按钮审批执行中的任务。
                • 终止:任务运行中时,单击该按钮终止任务。
                • 下载:任务成功时,单击该按钮下载模拟数据对应的 SQL 文件至本地。
                • | + + + +新建模拟数据任务 +----------------------------- + +1. 在弹出的任务中心面板中,单击 模拟数据 右侧 +,弹出新建模拟数据任务面板。 + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/database%20change/2.png) + + + +2. 在 **新建模拟数据** 面板中,输入以下信息。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/database%20change/3.png) + + + | 信息项 | 说明 | + |-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属连接 | 显示目标任务所在的数据库连接名称。 | + | 所属库 | 选择需变更的数据库。 | + | 表 | 指定生成数据的表。 在模拟数据面板的 **表** 标签下的下拉列表中选择要在其中生成数据的表。下拉列表中会显示当前实例中所有存在的表。 | + | 模拟生成数据量 | 指定生成的数据量。 在模拟数据面板的 **模拟生成数据量** 标签下的文本框中输入您需要生成的数据量。默认会生成 1000 条数据,最多生成不超过 1000000 行数据,所以您可以在文本框中输入 1\~1000000 间的任意正整数。 | + | 批处理大小 | 指定批量处理数据的大小。 在模拟数据面板的 **批处理大小** 标签下的文本框中指定每生成多少条数据进行一次提交(`COMMIT` 命令)操作。默认每生成 200 条数据进行一次提交,最大不超过 500 条,所以您可以在文本框中输入 1\~500 间的任意正整数。 | + | 插入模拟数据清空表 | 选择在表中插入模拟数据时是否清空表。 在模拟数据面板的 **插入模拟数据清空表** 标签下的单选列表中选择当在表中插入模拟数据时是否清空表中原有的数据。 | + | 数据冲突处理方式 | 选择数据冲突处理方式。
                  在模拟数据面板的 **数据冲突处理方式** 标签下的单选列表中选择当生成的数据有冲突时处理的方式。ODC 提供以下处理方式:
                  - **忽略** :默认为忽略,若数据有冲突则冲突数据不被插入。
                  - **覆盖** :若数据有冲突则删除原数据插入新数据。
                  - **终止** :若数据有冲突则停止生成数据终止整个模拟数据任务。 | + | 规则设置 | 设置数据生成规则。
                  在模拟数据面板的 **规则设置** 标签下的表格会根据您在第 2 步选择的表显示表的 **字段名称** 和 **字段类型** 信息。您可在 **规则** 和 **细则** 列中针对目标字段设置模拟数据生成的规则。 其中 **规则** 列中会根据字段类型提供一些内置的对应规则,您可以按需进行选择。 **细则** 列会根据您选择的规则显示具体的规则信息,您可以单击细则信息后的编辑图标对细则信息进行修改。 | + + + +3. 单击 **提交** ,完成新建模拟数据任务。 + +4. 任务生成后会自动弹出 任务中心 面板,在任务中心可以查看任务信息并下载导出的数据结构文件。 + + + + +查看模拟数据任务 +----------------------------- + +### 任务信息 + +1. 单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务信息** 标签查看任务基本信息和模拟数据设置信息。 + + +| 信息项 | 说明 | +|----------|---------------------------------------------------------------------------------------------------------------------------------------------------| +| 任务基本信息 | 显示 **任务编号**、**所属连接**、**所属数据库**、**任务类型**、**执行方式**、**创建人** 和 **创建时间** 等信息。| +| 模拟数据设置信息 | 显示创建模拟数据任务时您选择的 **目标表**、 **模拟生成数据量**、 **批处理大小**、 **插入模拟数据前清空表**、 **数据冲突处理方式**、 **实际插入记录**、 **冲突记录**、 **忽略插入**、 **清除记录** 和 **规则设置展示** 等信息。 | + +2. 在任务信息面板右下角,单击 **再次发起** 和 **下载**,可以重新发起任务和下载导出文件至本地。 + +### 任务日志 + +单击操作列中的 **查看** 按钮弹出目标任务的任务详情面板,在面板的右上角单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + +| 信息项 | 说明 | +|------|-----------------------------------------------------------------------------| +| 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 | +| 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。 当任务失败时,可查看告警日志以获得错误信息。 | + +同时,工具栏提供了以下功能键: + +| 功能 | 说明 | +|------|-----------------------------------------------------------| +| 查找 | 单击该按钮查找日志信息。 | +| 下载 | 单击该按钮下载日志信息。 | +| 复制 | 单击该按钮复制日志信息。 | \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-shadow-table-synchronization-task.md b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-shadow-table-synchronization-task.md new file mode 100644 index 00000000..8d94c348 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/6.client-odc-shadow-table-synchronization-task.md @@ -0,0 +1,111 @@ +# 影子表同步任务 + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持用户向公共资源管控台管理员申请创建影子表同步的权限。 + +用户在 **任务中心** 创建影子表同步任务后,管理员会在任务中心的任务列表中审批任务,申请权限的用户可以在任务中心的任务列表中查看任务信息和审批状态。 + +## 任务列表 + +> **说明** +> 任务列表会显示最近 48 小时内的任务。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 页签弹出任务中心面板,在面板中单击 **影子表同步** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/shadow%20table/1.png) + +进入影子表同步任务页签后,列表中会显示以下信息并且支持筛选和排序: + +| **信息项** | **说明** | +|---------|----------------------------------------------------------------------------------------------------| +| 任务编号 | 显示任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建任务的用户。单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 和 **终止** 等任务管理操作。
                  • 查看:单击该按钮进入任务详情页面以查看目标任务信息。
                  • 通过/拒绝:单击该按钮审批任务。
                  • 终止:任务运行中时,单击该按钮终止任务。
                  | + + +## 新建影子表同步任务 + +1. 在弹出的任务中心面板中,单击 **影子表同步** 右侧 **+**,弹出新建影子表同步任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/shadow%20table/2.png) + + +2. 在 **新建影子表同步** 面板中,输入以下信息。 + + a. 选择对象。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/shadow%20table/3.png) + + + | **信息项** | **说明** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 所属库 | 选择创建影子表的所属库并可查看当前连接名。 | + | 同步范围 | 选择需要同步的表:
                  • **部分表** :选定的表在当前库中创建影子表。
                  • **全部表** :来源库中所有的表都会在当前库中创建影子表。
                  | + | 影子表名 | 支持以" **前缀** +源表名"或"源表名+ **后缀** "的格式创建影子表名,并且支持自定义前、后缀。 | + | 同步对象 | 同步部分表时,需在 **同步对象** 中选择源表以同步为影子表。 | + + b. 同步影子表结构分析。 + + ![4](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/shadow%20table/4.png) + + | **信息项** | **说明** | + |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | 同步的表 | **同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **查看** 支持查看源表结构、影子表结构和结构变更 SQL 语句,单击 **跳过** 支持不同步该影子表。 | + | 不同步的表 | **不同步的表** 页签中,显示源表名、影子表名和分析结果,单击 **取消跳过** 支持同步该影子表。
                  **说明**
                  选择跳过同步的表,会显示在 **不同步的表** 页签中。 如果影子表名已存在且结构与源表一致,则会自动跳过同步表结构。
                  | + | SQL 预览 | 显示同步表结构的 SQL 语句。 | + | 任务设置 |
                  • 选择审批完成后的 **执行方式** 。
                    • **立即同步** :立即执行同步任务。
                    • **定时同步** :定时执行同步任务。
                  • 选择 **任务错误处理** 方式。
                    • **停止任务** :在执行过程中,遇到出错则中断后面的 SQL 脚本,不再执行。
                    • **忽略错误继续执行** :在执行过程中,跳过当前出错的 SQL 脚本继续执行,并执行完所有 SQL 脚本。
                  | + | 任务设置 | | + | 备注 | 描述项目的业务背景信息,例如变更目的、预期目标等。 | + +3. 单击 **提交** ,完成任务申请。 + + > **说明** + > 任务申请创建完成后,任务会自动匹配管理员在公共资源管控台中创建的申请影子表同步任务流程。 + > 任务将按管理员在公共资源管控台的 **设置优先级** 中设置的优先级排序匹配执行。 + +## 查看影子表同步任务 + +### 任务信息 + +1. 在 **任务中心** > **影子表同步** 的任务列表页签中,单击任务列表操作列中的 **查看** 按钮弹出目标任务的任务详情面板。 + +2. 在 **任务详情** 面板中,单击 **任务信息** 页签查看任务基本信息和设置信息。 + + | **信息项** | **说明** | + |---------|---------------------------------------------------------------------------------------------------------| + | 任务基本信息 | 显示 **任务状态** 、 **任务编号** 、 **任务类型** 、 **所属连接** 、 **所属数据库** 、 **执行方式** 、 **任务错误处理、备注、创建人** 和 **创建时间** 等信息。 | + | 任务设置信息 | 显示创建影子表同步任务时所选择的 **同步表/不同步表/** 待执行的 **SQL 脚本** 信息。| + + +3. 在任务信息面板右下角,单击 **再次发起** ,可以重新发起任务。 + +### **任务流程** + +1. 在 **任务详情面板** 中,单击 **任务流程** 页签查看 **发起任务状态** 、 **审批状态** 、 **执行状态** 和 **完成结果** 等信息。 + + +2. 在面板右下角,单击 **再次发起** ,可重新发起任务。 + +### 任务日志 + +1. 在 **任务详情** 面板中,单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + | 信息项 | 说明 | + |------|-----------------------------------------------------------------------------------------------------------------------------| + | 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。
                  单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制全部日志信息。 | + | 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。当任务失败时,可通过告警日志查看错误信息。
                  单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制告警日志信息。 | + + +2. 单击 **再次发起** ,可重新发起任务。 + + + +## 相关信息 + +* [新建影子表同步](../../7.client-odc-user-guide/5.client-odc-use-tools/4.client-odc-shadow-table-synchronization.md) \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-partition-plan-task.md b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-partition-plan-task.md new file mode 100644 index 00000000..9ac3cdeb --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/8.client-odc-task-management/7.client-odc-partition-plan-task.md @@ -0,0 +1,104 @@ +# 分区计划任务 + + + +## 背景信息 + +OceanBase 开发者中心(OceanBase Developer Center,ODC)支持用户向公共资源管控台管理员申请分区计划的权限。 + +用户在 **任务中心** 创建分区计划任务后,管理员会在任务中心的任务列表中审批任务,申请权限的用户可以在任务中心的任务列表中查看任务信息和审批状态。 + +## 任务列表 + +> **说明** +> 任务列表会显示最近 48 小时内的任务。 + +进入目标数据库连接后,单击顶部导航栏中的 **任务中心** 页签弹出任务中心面板,在面板中单击 **分区计划** 页签显示任务列表。 + +![1](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/partitioning%20plan/1.png) + +进入分区计划任务页签后,列表中会显示以下信息并且支持筛选和排序: + +| 信息项 | 说明 | +|---------|----------------| +| 任务编号 | 显示任务编号。 | +| 任务类型 | 显示新建任务时指定的任务类型。 | +| 所属连接 | 显示目标任务所在的数据库连接名称。 单击筛选图标![筛选](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/0583667361/p352180.jpg),可筛选所属连接。 | +| 所属数据库 | 显示目标任务所在的数据库。单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选所属数据库。 | +| 创建人 | 创建任务的用户。 单击搜索图标![搜索](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/5526247461/p416691.jpg),可搜索和筛选创建人。 | +| 创建时间 | 显示该任务生成的具体日期和时间。 | +| 任务状态 | 显示任务的当前状态(不同状态下提供的管理操作不同)。 | +| 操作 | 提供 **查看** 、 **通过/拒绝** 和 **终止** 等任务管理操作。
                  • 查看:单击该按钮进入任务详情页面以查看目标任务信息。
                  • 通过/拒绝:单击该按钮审批任务。
                  • 终止:任务运行中时,单击该按钮终止任务。
                  | + +## 新建分区计划任务 + + + +1. 在弹出的任务中心面板中,单击 **分区计划** 右侧 **+**,弹出新建分区计划任务面板。 + + ![2](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/partitioning%20plan/2.png) + +2. 在 **新建分区计划** 面板中,输入以下信息。 + + ![3](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/410/client/task/partitioning%20plan/3.png) + + | 信息项 | 说明 | + |---------|--------------------| + | 所属连接 | 选择创建分区计划所属连接。默认为当前连接。 | + | 分区策略 | 搜索和勾选所属库中的 Range 分区表,并编辑对应的分区策略。
                  • 勾选 **设置分区计划** 右侧的 仅显示未设置的表时,支持过滤未设置的表。
                  • 勾选 Range 分区表时,支持批量设置分区策略。
                  • 在 **分区策略** 项下,单击编辑图标,支持编辑预创建分区数量、分区间隔、保留时长和命名规则等。
                  | + | 备注(可选) | 输入申请原因。 | + +3. 单击 **提交** ,完成任务申请。 + + > **说明** + > 任务申请创建完成后,任务会自动匹配公共资源管控台中默认的申请分区计划任务流程。 + > 有关任务流程更多详情,请参见 [任务流程管理](../../6.web-odc-user-guide/4.web-odc-public-resource-management/4.web-odc-task-process.md)。 + + + +## 查看分区计划任务 + +### **任务信息** + +1. 在 **任务中心** > **分区计划** 的任务列表页签中,单击任务列表操作列中的 **查看** 按钮弹出目标任务的任务详情面板。 + + +2. 在 **任务详情** 面板中,单击 **任务信息** 页签查看任务基本信息和设置信息。 + + | 信息项 | 说明 | + |---------|---------------------------------------------------| + | 任务基本信息 | 显示 **任务状态** 、 **任务编号** 、 **任务类型、所属连接**、 **备注、创建人** 和 **创建时间** 等信息。 | + | 任务设置信息 | 显示创建分区计划任务时所选择的 Range 分区表的分区策略信息。| + +3. 在任务信息面板右下角,单击 **再次发起** ,可以重新发起任务。 + +### **任务流程** + +1. 在 **任务详情面板** 中,单击 **任务流程** 页签查看 **发起任务状态** 、 **审批状态** 、 **执行状态** 和 **完成结果** 等信息。 + + +2. 在面板右下角,单击 **再次发起** ,可重新发起任务。 + +### 关联记录 + +1. 在 **任务详情面板** 中,单击 **关联记录** 页签查看 **任务编号** 、 **所属库** 、 **创建时间** 、 **任务状态** 和 **查看** 操作等信息。 + +2. 在面板右下角,单击 **再次发起** ,可重新发起任务。 + +### 任务日志 + + +1. 在 **任务详情面板** 中,单击 **任务日志** 标签查看任务的全部日志和告警日志。 + + + | 信息项 | 说明 | + |------|-----------------------------| + | 全部日志 | 全部日志显示任务的 **INFO** 、 **ERROR** 和 **WARN** 日志等全量信息。 单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制全部日志信息。 | + | 告警日志 | 告警日志单独显示任务的 **ERROR** 和 **WARN** 日志。当任务失败时,可通过告警日志查看错误信息。 单击 **查找** 、 **下载** 和 **复制** 按钮,可查找信息、下载或复制告警日志信息。 | + +2. 单击 **再次发起** ,可重新发起任务。 + + +## 相关信息 + +* [新建分区计划](../../7.client-odc-user-guide/5.client-odc-use-tools/5.client-odc-partition-plan.md) \ No newline at end of file diff --git a/zh-CN/7.client-odc-user-guide/9.client-odc-session-management.md b/zh-CN/7.client-odc-user-guide/9.client-odc-session-management.md new file mode 100644 index 00000000..a7e76339 --- /dev/null +++ b/zh-CN/7.client-odc-user-guide/9.client-odc-session-management.md @@ -0,0 +1,80 @@ +会话管理 +========================= + +应用与数据库的连接被称为一个会话,在 OceanBase 开发者中心(OceanBase Developer Center,ODC)会话管理页面您可以查看连接到当前数据库所有会话的详细信息。同时在会话属性页面 ODC 提供了可视化界面使您可以清晰直观的查看和修改当前数据库支持的会话变量和全局变量。 + +进入 ODC 对应的数据库连接后,单击页面上方导航栏的 **会话** 按钮,可选择进入 **会话属性** 或 **会话管理** 页面。 + +![Image 186](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/340/%E4%BC%9A%E8%AF%9D%E7%AE%A1%E7%90%86-1.png) + +会话属性 +------------------------- + +![会话管理2](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/4639171361/p203464.png) + +会话属性即数据库变量,OceanBase 中有会话变量和全局变量: + +* **会话变量** :当客户端连接到数据库后,数据库会复制全局变量以自动生成会话变量。会话变量的修改只对当前会话生效。 + +* **全局变量** :数据库实例共享全局变量。这意味着不同用户共享这些全局变量,且数据库会保存您对全局变量做出的更改,断开连接并再次进入数据库时,更改依旧有效。 + + + +> **说明**
                  +>
                • 当前版本的 ODC 中不支持编辑全局变量,可对会话变量进行修改。
                • +>
                • ODC 中共享 Session,相同连接只有一个 Session。ODC V2.3.2 后在 Oracle 模式下自动提交默认设置为关,所以您需要手动提交事务。您可以修改变量 autocommit 的值进行设置。
                • +>
                • 事务手动提交模式下,需要设置 ob_trx_idle_timeout 大于等于设置的 SQL 查询超时时间,否则一个事务内两个 SQL 之间的执行间隔超过 ob_trx_idle_timeout 设置的时间,连接会终止。同时需要注意 ob_trx_idle_timeout 设置过大会导致该会话占用内存无法及时释放,需谨慎设置。
                • + + + + + + +ODC 提供了可视化界面使您可以清晰直观的查看与修改当前数据库支持的变量。对于变量值的修改: + +* 针对会话变量,当前版本 ODC 区分了查看态和编辑态,选中需修改的变量后,单击工具栏中的编辑按钮以进入编辑弹窗进行修改。编辑完成后单击 **确定** 按钮,在弹出的 **SQL 确认** 页面中单击 **执行** ,修改生效。 + + + +* 如变量的值为字符或数字类型,可在变量编辑页面中直接输入修改值。 + + + +* 如变量的值为枚举类型,ODC 会在变量值的编辑框中列举出该变量支持的值的集合,可在不使用准确记忆变量名和值的情况下通过可视化界面完成修改,此方式可降低用户记忆变量的成本并提高变量修改的效率。 + + + + + + +会话管理 +------------------------- + +与当前数据库的连接被称为一个会话,在会话管理页面您可以查看连接到当前数据库的所有会话和以下会话信息: + + +| 会话信息 | 说明 | +|---------|--------------------------------------------------| +| 会话 ID | 展示当前会话的 ID,是会话的唯一标识。 | +| 用户 | 会话登录使用的数据库用户名。 | +| 来源 | 发起会话的地址。 | +| 数据库名 | 当前会话访问的数据库名称。 | +| 状态 | 展示当期会话的状态,有 **SLEEP** (休眠)和 **ACTIVE** (活跃)两种状态。 | +| 命令 | 会话当前执行的命令类型。 | +| 执行时间(s) | 会话当前执行 SQL 所花的时间。 | +| SQL | 会话当前执行 SQL 的具体内容。 | +| OBProxy | 会话访问的代理地址。 | + + +![管理会话](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/1238140161/p203463.png) + +会话管理页面的导航栏中提供了以下功能键供您管理会话: + +* **刷新** :刷新会话列表。 + +* **关闭会话** :终止当前会话。 + +* **关闭会话当前查询** :终止当前会话正在进行的 SQL 执行进程。 + + + diff --git a/zh-CN/8.deployment-guide/1.deployment-overview.md b/zh-CN/8.deployment-guide/1.deployment-overview.md new file mode 100644 index 00000000..f5040f64 --- /dev/null +++ b/zh-CN/8.deployment-guide/1.deployment-overview.md @@ -0,0 +1,18 @@ +部署概述 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)是为 OceanBase 数据库量身打造的企业级数据库开发平台。ODC 采用成熟的浏览器-服务端架构,提供了 Web 版和客户端版两种产品形态。 + +本手册将介绍 Web 版 ODC 的部署全过程,客户端版 ODC 无需部署直接安装客户端即可,详情请查看 [安装 ODC](../7.client-odc-user-guide/1.client-odc-install-odc.md)。 + +单节点部署 +-------------------------- + +单节点部署即只部署一个 ODC 应用节点,用户所有的请求都将由该节点的 ODC 应用进行处理。部署简易且占用资源少。 + +高可用部署 +-------------------------- + +高可用部署,即在多个节点上部署 ODC 应用,并在其中一个节点上部署一个 Nginx 代理服务以进行用户请求的路由。所以,单节点部署时用户请求将直接发到 ODC 应用系统,但是在高可用部署的情况下,用户请求将首先发送到部署了 Nginx 代理的节点上,再路由到不同节点的 ODC 应用上。 + +高可用部署的优点是当一个节点宕机导致服务不可用,Nginx 会将用户请求自动路由到其它节点上以保证服务。同时,对比单节点部署,高可用部署可以承担更高的并发用户数和处理更大数量的用户请求。 diff --git a/zh-CN/8.deployment-guide/2.preparations-before-deployment.md b/zh-CN/8.deployment-guide/2.preparations-before-deployment.md new file mode 100644 index 00000000..79da5916 --- /dev/null +++ b/zh-CN/8.deployment-guide/2.preparations-before-deployment.md @@ -0,0 +1,78 @@ +部署前准备 +========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)在部署前需要预先准备元数据库和机器环境,部署完成后请在谷歌浏览器 Chrome 中访问 Web 版 ODC。 + +元数据库 +------------------------- + +元数据库是用来存储用户使用 ODC 过程中新建的连接和脚本等操作产生的用户数据,Web 版 ODC 安装前需要先准备好元数据库(OceanBase MySQL 模式),桌面版的元数据库是本地数据库,首次使用时会自动创建,所以无需手动准备元数据库。 + +**操作步骤:** + +1. 在 OceanBase MySQL 模式下申请一个租户。租户大小为 2C8G,租户名称无限制,本手册中的示例租户在集群 odc_cluster 中,租户名称为 odc_tenant。 + + > **说明**
                  + > - ODC V3.3.0 之后版本提供变更流程和操作审计等企业级管控能力。
                  + > - ODC V3.3.1 之后版本解除对 MetaDB 版本的限制。
                  + > - MetaDB 所在 OceanBase 租户规格推荐 2C8G 及以上配置,配置过低容易导致性能问题。 + + + + + + + +2. 在租户下创建数据库和用户以作为 ODC 元数据库,用户名、密码和元数据库名称没有限制。本手册中的示例数据库命名为 odc_metadb,数据库用户名和密码均为 obodc。 + + + +3. 记录下元数据库的名称、用户名、密码、租户名称和租户所在集群的名称,在部署 ODC 时这些信息需要作为参数传入。 + + + + + + +机器环境 +------------------------- + +Web 版 ODC 部署环境配置,按照 ODC 用户数的经验值: + +* 20 内 ODC 用户,部署在规格为 4C8G 的服务器上; + + + +* 100 内 ODC 用户,部署在规格为 4C16G 的服务器上; + + + +* 500 内 ODC 用户,部署在规格为 8C32G 的服务器上; + + + +* 更多用户视使用情况调整资源。 + + + + + + +为实现轻量化的部署,ODC 使用了容器镜像,因此在部署前请在机器上安装 Docker 以拉取和运行镜像。 + +浏览器 +------------------------ + +推荐使用谷歌浏览器 Chrome 访问 Web 版 ODC,支持 78 及以上版本。 + +配置白名单 +-------------------------- + +ODC V3.3.1 之后版本支持配置数据库白名单,防止 SSRF 攻击。 + +部署管理员连接到 ODC 的 MetaDB 后,访问该连接并执行 ``UPDATE config_system_configuration SET `value`='x.x.x.x' WHERE `key` = 'odc.connect.host-white-list';`` 配置白名单。(多个 IP 使用逗号分隔,但不支持指定网段) + +安装与启动 Docker +--------------------------------- + +有关安装与启动 Docker,请参见 [绑定挂载](https://docs.docker.com/storage/bind-mounts/)。 diff --git a/zh-CN/8.deployment-guide/3.deploy-a-single-odc-node/1.deployment-process.md b/zh-CN/8.deployment-guide/3.deploy-a-single-odc-node/1.deployment-process.md new file mode 100644 index 00000000..4276bac1 --- /dev/null +++ b/zh-CN/8.deployment-guide/3.deploy-a-single-odc-node/1.deployment-process.md @@ -0,0 +1,18 @@ +部署流程 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)单节点部署只需在服务器上加载和运行 ODC 镜像,即可安装 ODC 应用。 + +浏览器通过 HTTP 协议访问 Web 版 ODC,因此首次通过浏览器访问 Web 版 ODC 时,会收到连接不安全的警告信息。可参考高可用部署的步骤在单节点 ODC 服务器上配置 SSL 证书并部署 Nginx 镜像,以安全访问 ODC。 + +
                  +

                  说明

                  +
                    +
                  • 用户首次登录的用户名和密码从管理员处获取。
                  • +
                  • 有关登录 Web 版 ODC 详情,请参见本手册中《用户指南 (Web 版 ODC)》> 登录 ODC > 登录账号。
                  • +
                  +
                  + + + + diff --git a/zh-CN/8.deployment-guide/3.deploy-a-single-odc-node/2.load-and-run-single-odc-images.md b/zh-CN/8.deployment-guide/3.deploy-a-single-odc-node/2.load-and-run-single-odc-images.md new file mode 100644 index 00000000..938c1990 --- /dev/null +++ b/zh-CN/8.deployment-guide/3.deploy-a-single-odc-node/2.load-and-run-single-odc-images.md @@ -0,0 +1,84 @@ +加载和运行 ODC 镜像 +================================= + +完成 OceanBase 开发者中心(OceanBase Developer Center,ODC)元数据库的初始化后,需拉取和运行 ODC 镜像。镜像运行成功 ODC 的单节点部署即可完成。 + +加载镜像 +------------------------- + +首先要在宿主机上获得 ODC 镜像,在以下列表选择所需镜像,单击 **\[下载\]** 以获得镜像: + +* X86 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz)
                  +* ARM 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +在宿主机上获得镜像文件后,在命令行工具中运行下述语句加载镜像: + +```javascript +gunzip -c obodc-{$version}.tar.gz | docker load +``` + + + +运行镜像 +------------------------- + +在宿主机上获得 ODC 镜像后,在命令行工具中运行镜像的示例语句如下所示: + +```javascript +#!/usr/bin/env bash +docker run --volume /var/log/odc:/opt/odc/log \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +其中,{image_tag} 可在宿主机上加载镜像后运行 `docker images` 语句查看,其他参数说明如下表所示: + + +| 参数 | 说明 | +|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --volume | 宿主机的 `/var/log/odc` 目录映射到 ODC 容器 内的 `/opt/odc/log` 目录。 `/var/log/odc` 为宿主机的目录,如不存在需先创建,创建目录的参考命令 `mkdir -p /var/log/odc`。 | +| --net | 指定容器的网络配置,指定该参数值为 `host` 即直接使用宿主机网络。 您也可以使用 `--publish`(`-p`)参数配置端口映射,但是部分环境可能出现因为 Docker 内 DNS 解析出错而启动容器失败,此时请使用 `--net host` 方式启动 Docker。 | +| --cpu-period --cpu-quota |
                • `---cpu-period` 用来指定容器对 CPU 的使用要在多长时间内做一次重新分配。单位:微秒。
                • `---cpu-quota` 用来指定在这个周期内,最多可以有多少时间用来运行当前容器。单位:微秒。
                • 配合使用可指定容器使用的 CPU 核数。`cpu-quota`/`cpu-period` 的值即为 Docker 可以使用的 CPU 核数,示例语句中 400000/100000=4 表示最多可以使用 4 个核。 | +| --memory | 设置容器使用的内存最大值。 | +| --name | 指定容器名称。 | +| DATABASE_HOST | 元数据库 IP 地址。 | +| DATABASE_PORT | 元数据库端口号。 | +| DATABASE_USERNAME | 元数据库用户名。OceanBase 数据库用户名的格式:`db_user@tenant_name#cluster_name`。 | +| DATABASE_PASSWORD | 连接数据库的密码。 | +| DATABASE_NAME | 元数据库名。 | +| ODC_PROFILE_MODE | 指定模式,默认指定:`alipay`。 | + + + +除上述参数外,运行镜像时您还可以根据需求使用下述参数: + + +| 参数 | 说明 | +|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | 指定日志目录。默认路径:`/opt/odc/log`。 | +| OBCLIENT_WORK_DIR | 指定 OBClient 工作目录。默认路径:`/opt/odc/data`。 | +| ODC_JAR_FILE | 指定 Jar 文件目录。默认路径:`/opt/odc/lib/odc-web-starter-*.jar`。 | +| ODC_WORK_DIR | 指定 ODC 工作目录。默认路径:`/opt/odc/script`。 | +| ODC_JVM_HEAP_OPTIONS | 指定 JVM 堆内存。默认最大内存参数 `-Xmx` 的值:可用物理内存的 60%。 ODC 启动脚本会检查当前环境的可用内存是否达到 2048 M, 按照 60% 计算需要有 3.4 G 内存才可以启动。如果宿主机或 Docker 的内存配置低于 3.4 G,可以通过指定参数 `ODC_JVM_HEAP_OPTIONS` 来绕过可用内存检查,例如可以配置为 `"-Xmx2048m -Xms2048m"`。 | +| ODC_JVM_GC_OPTIONS | 指定 JVM GC 策略。默认指定:`-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`。 | +| ODC_JVM_OOM_OPTIONS | 指定 JVM OutOfMemory 策略。默认指定:`-XX:+ExitOnOutOfMemoryError`。 | +| ODC_JVM_EXTRA_OPTIONS | 指定其它需要的 JVM 配置参数。默认值:空。 | +| ODC_SERVER_PORT | 指定 ODC-Server 的 HTTP 监听端口。默认值:8989。 | +| ODC_HOST | 指定 ODC 运行时的 IP 地址,该参数在高可用部署场景下做为远程过程调用的目的地址。 | +| ODC_MAPPING_PORT | 指定 ODC 运行时的端口号,避免因部署环境导致的端口号无法使用的问题。该参数适用于在 Docker 中部署 ODC 时进行端口映射的场景。 | +| ODC_APP_EXTRA_ARGS | 其它需要指定的 App 参数。
                  例如 `--server.servlet.session.timeout=10m`,表示 Session 过期时间为 10 分钟。
                  如需启用 AI 敏感列识别功能,可配置:`--odc.ai.enabled=true --odc.ai.api-key= --odc.ai.base-url= --odc.ai.model=`。
                  推荐使用魔搭社区模型 fylfy111/SensitiveColumn(基于 qwen2.5 7B Instruct),建议 --max-model-len=4096,至少需要单卡 3090 服务器部署。默认值:空。 | +| ODC_SERVER_RPC_PORT | 指定 ODC-Server 的内部 RPC 通信监听端口。默认值:8990。 | + diff --git a/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/1.ha-odc-deployment-process.md b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/1.ha-odc-deployment-process.md new file mode 100644 index 00000000..07404a2f --- /dev/null +++ b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/1.ha-odc-deployment-process.md @@ -0,0 +1,41 @@ +部署流程 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)高可用部署是在多个节点上均完成单节点部署后,在其中一个节点上部署 Nginx 镜像以实现用户请求的分发。 + +![高可用部署图](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/odc/400/%E9%83%A8%E7%BD%B2%E9%AB%98%E5%8F%AF%E7%94%A8.png) + +ODC 高可用部署需进行四步操作: + +1. [加载和运行 ODC 镜像](../4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md):在多个节点上分别运行 ODC 镜像以安装 ODC 应用。 + + + +2. [部署 SSL 证书](../4.deploy-the-ha-odc/3.deploy-ssl-certificates.md):浏览器通过 HTTP 协议访问 Web 版 ODC,因此首次通过浏览器访问 Web 版 ODC 时,会收到连接不安全的警告信息。可部署 SSL 证书通过 HTTPS 协议安全访问 ODC,以安全访问 ODC。如无需安全访问 ODC,可直接进行下一步部署 Nginx 代理的操作。 + + + +3. [部署 Nginx 代理](../4.deploy-the-ha-odc/4.deploy-nginx-proxy.md):在其中一个节点上拉取和运行 Nginx 镜像以实现高可用部署。 + + + +4. [配置证书信任](../4.deploy-the-ha-odc/5.configure-certificate-trust.md):某些浏览器不会直接信任自签证书,需在浏览器中手动配置证书信任。 + +
                  +

                  说明

                  +
                    +
                  • 用户首次登录的用户名和密码从管理员处获取。
                  • +
                  • 有关登录 Web 版 ODC 详情,请参见本手册中《用户指南 (Web 版 ODC)》> 登录 ODC > 登录账号。
                  • +
                  +
                  + + + + + + + + + + + diff --git a/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md new file mode 100644 index 00000000..a777f953 --- /dev/null +++ b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/2.load-and-run-ha-odc-images.md @@ -0,0 +1,85 @@ +加载和运行 ODC 镜像 +================================= + +完成 OceanBase 开发者中心(OceanBase Developer Center,ODC)元数据库的初始化后,高可用部署首先需在各个节点上分别拉取和运行 ODC 镜像以安装 ODC 应用。 + +加载镜像 +------------------------- + +首先要在宿主机上获得 ODC 镜像,在以下列表选择所需镜像,单击 **\[下载\]** 以获得镜像: + +* X86 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz)
                  +* ARM 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +在宿主机上获得镜像文件后F,在命令行工具中运行下述语句加载镜像: + +```javascript +gunzip -c obodc-{$version}.tar.gz | docker load +``` + + + +运行镜像 +------------------------- + +在宿主机上获得 ODC 镜像后,在命令行工具中运行镜像的示例语句如下所示: + +```javascript +#!/usr/bin/env bash +docker run --volume /var/log/odc:/opt/odc/log \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +其中,{image_tag} 可以在宿主机上加载镜像后运行 `docker images` 语句查看,其他参数说明如下表所示: + + +| 参数 | 说明 | +|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --volume | 宿主机的 `/var/log/odc` 目录映射到 ODC 容器 内的 `/opt/odc/log` 目录。 `/var/log/odc` 为宿主机的目录,如不存在需先创建,创建目录的参考命令 `mkdir -p /var/log/odc`。 | +| --net | 指定容器的网络配置,指定该参数值为 `host` 即直接使用宿主机网络。 您也可以使用 `--publish`(`-p`)参数配置端口映射,但是部分环境可能出现因为 Docker 内 DNS 解析出错而启动容器失败,此时请使用 `--net host` 方式启动 Docker。 | +| --cpu-period --cpu-quota |
                • `---cpu-period` 用来指定容器对 CPU 的使用要在多长时间内做一次重新分配。单位:微秒。
                • `---cpu-quota` 用来指定在这个周期内,最多可以有多少时间用来运行当前容器。单位:微秒。
                • 配合使用可指定容器使用的 CPU 核数。cpu-quota/cpu-period 的值即为 Docker 可以使用的 CPU 核数,示例语句中 400000/100000=4 表示最多可以使用 4 个核。 | +| --memory | 设置容器使用的内存最大值。 | +| --name | 指定容器名称。 | +| DATABASE_HOST | 元数据库 IP 地址。 | +| DATABASE_PORT | 元数据库端口号。 | +| DATABASE_USERNAME | 元数据库用户名。OceanBase 数据库用户名的格式:db_user@tenant_name#cluster_name。 | +| DATABASE_PASSWORD | 连接数据库的密码。 | +| DATABASE_NAME | 元数据库名。 | +| ODC_PROFILE_MODE | 指定模式。默认指定:`alipay`。 | + + + +除上述参数外,运行镜像时您还可以根据需求使用下述参数: + + +| 参数 | 说明 | +|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | 指定日志目录。默认路径:`/opt/odc/log`。 | +| OBCLIENT_WORK_DIR | 指定 OBClient 工作目录。默认路径:`/opt/odc/data`。 | +| ODC_JAR_FILE | 指定 Jar 文件目录。默认路径:`/opt/odc/lib/odc-web-starter-*.jar`。 | +| ODC_WORK_DIR | 指定 ODC 工作目录。默认路径:`/opt/odc/script`。 | +| ODC_JVM_HEAP_OPTIONS | 指定 JVM 堆内存。默认最大内存参数 `-Xmx` 的值:可用物理内存的 60%。 ODC 启动脚本会检查当前环境的可用内存是否达到 2048 M, 按照 60% 计算需要有 3.4 G 内存才可以启动。如果宿主机或 Docker 的内存配置低于 3.4 G,可以通过指定参数 `ODC_JVM_HEAP_OPTIONS` 来绕过可用内存检查,例如可以配置为 `"-Xmx2048m -Xms2048m"`。 | +| ODC_JVM_GC_OPTIONS | 指定 JVM GC 策略。默认指定:`-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`。 | +| ODC_JVM_OOM_OPTIONS | 指定 JVM OutOfMemory 策略。默认指定:`-XX:+ExitOnOutOfMemoryError`。 | +| ODC_JVM_EXTRA_OPTIONS | 指定其它需要的 JVM 配置参数。默认值:空。 | +| ODC_SERVER_PORT | 指定 ODC-Server 的 HTTP 监听端口。默认值:8989。 | +| ODC_HOST | 指定 ODC 运行时的 IP 地址,该参数在高可用部署场景下做为远程过程调用的目的地址。 | +| ODC_MAPPING_PORT | 指定 ODC 运行时的端口号,避免因部署环境导致的端口号无法使用的问题。该参数适用于在 Docker 中部署 ODC 时进行端口映射的场景。 | +| ODC_APP_EXTRA_ARGS | 其它需要指定的 App 参数。
                  例如 `--server.servlet.session.timeout=10m`,表示 Session 过期时间为 10 分钟。
                  如需启用 AI 敏感列识别功能,可配置:`--odc.ai.enabled=true --odc.ai.api-key= --odc.ai.base-url= --odc.ai.model=`。
                  推荐使用魔搭社区模型 fylfy111/SensitiveColumn(基于 qwen2.5 7B Instruct),建议 --max-model-len=4096,至少需要单卡 3090 服务器部署。默认值:空。 | +| ODC_SERVER_RPC_PORT | 指定 ODC-Server 的内部 RPC 通信监听端口。默认值:8990。 | + + diff --git a/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/3.deploy-ssl-certificates.md b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/3.deploy-ssl-certificates.md new file mode 100644 index 00000000..426342fa --- /dev/null +++ b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/3.deploy-ssl-certificates.md @@ -0,0 +1,71 @@ +部署 SSL 证书 +============================== + +浏览器通过 HTTP 协议访问 Web 版 ODC,所以首次通过浏览器访问 Web 版 ODC 时,会收到连接不安全的警告信息。若您想要安全访问 ODC,可部署 SSL 证书以使用 HTTPS 协议进行访问。您可以申请 CA 证书或自行配置 HTTPS 自签证书。若您不需要通过 HTTPS 协议访问 ODC,可直接进行 Nginx 的部署操作。 + +申请 CA 证书 +----------------------------- + +推荐您申请 CA 证书,您可以在阿里云可以购买 SSL 证书和服务,详情请参见 [SSL 证书](https://www.aliyun.com/product/cas)。 + +在使用企业内部网络的场景下,您可以咨询 IT 管理员内部 CA 证书的申请使用流程。 + +配置 SSL 自签证书 +-------------------------------- + +ODC 镜像包中包含了生成证书和密钥的执行文件 generate-odc-ssl-certificate.sh,在宿主机运行执行文件即可生成证书。自签证书能够实现加密通信,但是操作系统默认不信任自签证书,您可以在浏览器中把证书添加到 **受信任的根证书颁发机构** 目录中配置证书信任。 + +下述为执行文件的运行示例,其中 `domain` 项的配置必须和您的 ODC 站点使用的域名保持匹配,否则浏览器会认为是不匹配的证书: + +```shell +$./generate-odc-ssl-certificate.sh +Enter your domain [www.example.com]: +Enter your province [Zhejiang]: +Enter your city [Hangzhou]: +Enter your company name [OceanBase]: +Enter your company unit name [DBA]: +generate certificate... +Generating a 2048 bit RSA private key +.......................................+++ +....................... +......+++ +writing new private key to '/etc/pki/nginx/odcserver.key' +----- +end of string encountered while processing type of subject name element #5 +problems making Certificate Request +check generated files: +-rw-r--r-- 1 root root 1424 Jun 3 15:18 server.crt +-rw-r--r-- 1 root root 1708 Jun 3 15:18 server.key +``` + + + +执行文件 generate-odc-ssl-certificate.sh 的内容如下所示,您也可以直接执行下述命令生成自签证书。 + +```unknow +#!/usr/bin/env bash +# for generate self certificated ssl certificate files + +echo try create directory '/etc/pki/nginx' if not exists... +sudo mkdir -p /etc/pki/nginx +cd /etc/pki/nginx || exit + +#read configurations +read -rp "Enter your domain [www.example.com]: " DOMAIN +read -rp "Enter your province [Zhejiang]: " PROVINCE +read -rp "Enter your city [Hangzhou]: " CITY +read -rp "Enter your company name [OceanBase]: " COMPANY +read -rp "Enter your company unit name [DBA]: " UNIT + +echo generate certificate... +SUBJ="/C=CN/ST=${PROVINCE}/L=${CITY}/O=${COMPANY}/OU=${UNIT}/CN=${DOMAIN}" +sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \ + -keyout /etc/pki/nginx/odcserver.key \ + -out /etc/pki/nginx/odcserver.crt \ + -subj "${SUBJ}" + +echo "check generated files (use ls -l odcserver.*):" +ls -l odcserver.* +``` + + diff --git a/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/4.deploy-nginx-proxy.md b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/4.deploy-nginx-proxy.md new file mode 100644 index 00000000..67c541be --- /dev/null +++ b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/4.deploy-nginx-proxy.md @@ -0,0 +1,309 @@ +部署 Nginx 代理 +================================ + +在所有节点均完成部署 OceanBase 开发者中心(OceanBase Developer Center,ODC)镜像后,需在其中一个 ODC 节点上部署一个 Nginx 代理,通过 Nginx 将用户请求路由到不同的节点应用上。部署 Nginx 代理需在一个节点上拉取并运行 Nginx 镜像,运行后将配置文件拷贝到本地进行修改,在本地修改完配置文件后,先停运 Nginx 镜像再重启镜像以应用修改后的配置的文件。 + +加载镜像 +------------------------- + +选择一个节点加载并运行 Nginx 镜像,目前镜像可通过两种方式获得: + +* 在宿主机上从 Docker 仓库中直接拉取镜像。 + + + +* 下载镜像包到本地,再拷贝至宿主机中解压。 + + + + + + +### 从 Docker 仓库中直接拉取镜像 + +请确保宿主机上已安装 Docker 且可访问外网,在命令行工具中运行下述语句从 Docker 仓库中拉取 Nginx 镜像: + +```javascript +docker pull nginx +``` + + + +### 拷贝镜像包至宿主机中解压 + +1. 在可访问外网且已安装 Docker 的机器中运行下述语句,下载镜像包至本地: + + ```unknow + docker save nginx:latest | gzip - >nginx.tar.gz + ``` + + + +2. 拷贝镜像包至宿主机中,运行下述语句加载镜像: + + ```javascript + gunzip -c nginx.tar.gz | docker load + ``` + + + + + + +配置 conf 文件 +------------------------------- + +在启动 Nginx 镜像前,需修改配置文件。ODC 的镜像包中已提供配置文件模板,可复制模板到本地并进行编辑。配置文件模板根据您是否已部署自签证书而略有不同,请按需复制对应的模板并进行修改。 + +### 配置不包含自签证书的 conf 文件 + +运行下述语句从镜像包中复制配置文件到宿主机再进行编辑,复制路径可自定义(其中 \~ 是配置文件在本地的路径): + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.template ~/ +``` + + + +配置文件模板如下所示,请关注文件中注释需修改的部分。 + +```javascript +# Nginx conf template for http deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address + # 请修改为实际的 odc-server 地址(非必改内容) + server 127.0.0.1:8989; + # add more servers here + } + + #https server, proxy to odc-server 8989 port + server { + listen 80; + # uncomment below if ipv6 enabled + # 如启用 ipv6,请取消以下注释 + #listen [::]:80; + + # PLEASE CHANGE to your site domain + # 请修改为实际的站点域名(非必改内容) + server_name odc.oceanbase.com; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + + +### 配置包含自签证书的 conf 文件 + +运行下述语句从镜像包中拷贝配置文件到宿主机再进行编辑,复制路径可自定义(其中 ~ 是配置文件在本地的路径): + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.https.template ~/ +``` + + + +配置文件模板如下所示,请关注文件中注释需修改的部分。 + +```unknow +# Nginx conf template for https deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address + # 请修改为实际的 odc-server 地址(非必改内容) + server 127.0.0.1:8989; + #add more servers here + } + + # redirect http to https + server { + listen 80 default_server; + + # uncomment below if ipv6 enabled + # 如启用 ipv6,请取消以下注释 + #listen [::]:80 default_server; + + location / { + return 301 https://$host$request_uri; + } + } + + # https server, proxy to odc-server 8989 port + server { + listen 443 ssl http2; + # uncomment below if ipv6 enabled + # 如启用 ipv6,请取消以下注释 + #listen [::]:443 ssl http2; + + # PLEASE CHANGE to your site domain + # 请修改为实际的站点域名(非必改内容) + server_name odc.oceanbase.com; + + # you can use /opt/odc/bin/generate-odc-ssl-certificate.sh + # to generate self certificated SSL certificates + # 您可以使用 /opt/odc/bin/generate-odc-ssl-certificate.sh 生成自签证书 + + # PLEASE CHANGE certificate file location if unmatched + # 如不匹配,请修改证书文件路径 + ssl_certificate /etc/pki/nginx/odcserver.crt; + ssl_certificate_key /etc/pki/nginx/odcserver.key; + ssl_session_timeout 1d; + ssl_session_cache shared:MozSSL:10m; # about 40000 sessions + ssl_session_tickets off; + + # intermediate configuration + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; + ssl_prefer_server_ciphers off; + + # HSTS (ngx_http_headers_module is required) (63072000 seconds) + add_header Strict-Transport-Security "max-age=63072000" always; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + +> **说明**
                  +> 修改负载均衡配置,确保 proxy 超时配置时长充足,修改配置后需重启 nginx 。 +建议 `proxy_connect_timeout` 参数不超过 75 秒,请参见 proxy_connect_timeout:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout。 +> 设置 `proxy_next_upstream off` 旨在禁止 nginx 将请求转发至下一个 ODC 节点,导致用户需重新登录,且某些功能不可用,如异步任务结果集下载等与文件上传下载相关的功能。 + +启动镜像 +------------------------- + +在本地修改配置文件后,在命令行工具中运行下述语句以重启 Nginx 镜像(其中 ~ 是配置文件在本地的路径): + +```shell +docker run --network host --name nginx -v ~/:/etc/nginx/nginx.conf -v /etc/pki/nginx/:/etc/pki/nginx/ -d nginx +``` + + + +语句中的参数说明如下所示: + + +| 参数 | 说明 | +|-------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --network host | 表示使用宿主机网络端口,无需配置端口映射。 如不希望直接使用宿主机端口,可使用 `-p` 参数配置端口映射。例如 `-p 8080:80` 表示宿主机的 8080 端口映射为 Docker 内的 80 端口,`-p 8443:443` 表示宿主机的 8443 端口映射为 Docker 内的 443 端口。 | +| --name nginx | 指定容器的名称为 nginx,方便后续管理,或可使用其它名称,如 odc-nginx。 | +| -v \~/\:/etc/nginx/nginx.conf | 进行磁盘挂载,将宿主机内的本地文件映射到 Docker 内。 其中 `` 为配置 conf 文件时复制到宿主机的本地路径,然后将其映射至 Docker 内的 /etc/nginx/nginx.conf 文件中。 | +| -v /etc/pki/nginx/:/etc/pki/nginx/ | 将宿主机的 /etc/pki/nginx/ 路径映射到 Docker 内的 /etc/pki/nginx/ 路径。 | +| -d nginx | 表示后台运行 Docker。 | + + diff --git a/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/5.configure-certificate-trust.md b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/5.configure-certificate-trust.md new file mode 100644 index 00000000..c14ade8a --- /dev/null +++ b/zh-CN/8.deployment-guide/4.deploy-the-ha-odc/5.configure-certificate-trust.md @@ -0,0 +1,109 @@ +配置证书信任 +=========================== + +浏览器不会直接信任自签证书,需要您手动在浏览器中手动进行证书信任的配置。 +> **注意**
                  +> 由于 Chrome 不支持信任自签证书,所以您完成证书信任的操作后,仍会收到连接不安全的提示信息。 + +Windows 下配置证书信任 +------------------------------------ + +以谷歌浏览器 Chrome 为例,浏览器配置证书信任的步骤如下所示: + +1. 在浏览器中访问 ODC,提示连接非私密连接时,单击地址栏左侧 **不安全** 按钮,在弹出的列表中单击 **证书** 按钮查看证书详情。 + + ![Image 739](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284267.png) + + +2. 在弹出的 **证书** 窗口中,选择 **详细信息** 页签,然后单击页签右下角的 **复制到文件** 按钮。 + + ![Image 740](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284350.png) + + +3. 在弹出的 **证书导出向导** 窗口中,单击 **下一步** 。 + + ![Image 741](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284352.png) + + +4. 进入导出文件格式设置窗口,选择 DER 格式,单击 **下一步** 。 + + ![Image 742](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284355.png) + + +5. 进入指定导出文件窗口,单击窗口中的 **浏览** 按钮,在弹出的文件资源管理器窗口中选择导出路径并在 **文件名** 文本框中指定文件名称,在文件资源管理器窗口中单击右下角的 **保存** 按钮回到导出文件窗口,单击 **下一步** 。 + + ![Image 743](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284395.png) + + +6. 进入导出向导完成窗口,单击右下角的 **完成** 按钮以导出证书到本地。 + + ![Image 744](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284396.png) + + +7. 在第 5 步指定的导出路径中找到被导出的证书文件,右键证书文件,在弹出的列表中选择 **安装证书** 。 + + ![捕获](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284397.png) + + +8. 进入证书导入向导,单击 **下一步** 。 + + ![Image 745](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8556004261/p284403.png) + + +9. 进入证书存储窗口,选择 **将所有证书都放入下列存储** ,并单击选项下的 **浏览** 按钮,在弹出的存储列表窗口中,选择 **受信任的颁发机构** ,然后单击窗口中的 **确定** 按钮。回到证书存储窗口,单击 **下一步** 。 + + ![Image 746](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9556004261/p284409.png) + + +10. 进入导入向导完成窗口,单击右下角的 **完成** 按钮。 + + ![Image 747](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9556004261/p284413.png) + + +11. 证书信任配置完成,尝试重新重新在浏览器中访问 ODC。 + + + + + + +macOS 下配置证书信任 +---------------------------------- + +以谷歌浏览器 Chrome 为例,浏览器配置证书信任的步骤如下所示: + +1. 在浏览器中访问 ODC,提示连接非私密连接时,单击地址栏左侧 **不安全** 按钮,在弹出的列表中单击 **证书** 按钮查看证书详情。 + + ![Image 749](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9556004261/p284535.png) + + +2. 网页中将显示证书的内容。 + + ![Image 750](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9556004261/p284536.png) + + +3. 在本地创建后缀为 .cer 的文件,将网页中的证书内容复制到文件中,并保存文件。 + + ![Image 751](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9556004261/p284516.png) + + +4. 在 macOS 系统中单击 **应用程序** -\> **实用工具** -\> **钥匙串访问** 以进入 **钥匙串配置** 窗口。在窗口的左侧导航栏中单击 **系统** ,然后在上方导航栏中单击 **+** 按钮,在弹出的窗口中选择上一步创建好的证书文件以添加证书到系统中。 + + ![Image 758](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9556004261/p284534.png) + + +5. 添加完成后,双击 **odc.oceanbase.com,odc.oceanbse.net** 证书。在弹出的证书详情窗口中,单击 **信任** 配置项,在弹开的配置列表中将 **使用此证书时** 项配置为 **始终信任** 。 + + ![Image 754](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/9556004261/p284487.png) + + +6. 关闭证书详情窗口,关闭时会提示您输入密码以让修改生效,按步骤输入密码完成配置。 + + + +7. 证书信任配置完成,尝试重新在浏览器中访问 ODC。 + + + + + diff --git a/zh-CN/8.deployment-guide/5.deployment-verification.md b/zh-CN/8.deployment-guide/5.deployment-verification.md new file mode 100644 index 00000000..b10c8263 --- /dev/null +++ b/zh-CN/8.deployment-guide/5.deployment-verification.md @@ -0,0 +1,6 @@ +部署验证 +========================= + +完成 OceanBase 开发者中心(OceanBase Developer Center,ODC)的部署后,您可以在浏览器中通过 宿主机(高可用部署为 Nginx 代理所在宿主机)的 IP 和端口号(http://IP:PORT 或 http://DOMAIN:PORT)访问 Web 版 ODC。 + +访问后展示登录界面即证明访问成功,若您是初次访问请先注册账号后进行登录。若您在 ODC 中创建连接成功,且在 ODC 中可对数据库进行正常操作,则证明 Web 版 ODC 部署成功。更多关于 Web 版 ODC 的使用操作,请参见 《ODC 用户指南(Web 版 ODC)》。![Image 123](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2480107161/p243852.png) diff --git a/zh-CN/9.upgrade-guide/1.upgrade-guide-overview.md b/zh-CN/9.upgrade-guide/1.upgrade-guide-overview.md new file mode 100644 index 00000000..4b722ff0 --- /dev/null +++ b/zh-CN/9.upgrade-guide/1.upgrade-guide-overview.md @@ -0,0 +1,14 @@ +升级概述 +========================= + +OceanBase 开发者中心(OceanBase Developer Center,ODC)是为 OceanBase 数据库量身打造的企业级数据库开发平台。ODC 采用成熟的浏览器-服务端架构,提供了 Web 版和客户端版两种产品形态。本手册将介绍 Web 版 ODC 升级的全过程。客户端版 ODC 无需升级,直接重新安装新版 ODC 客户端即可。 + +单节点升级 +-------------------------- + +如果您的 ODC 是单节点部署,由于只部署了一个 ODC 应用节点,所以单节点升级只需升级该节点的 ODC 应用至新版本即可。 + +高可用升级 +-------------------------- + +如果您的 ODC 是高可用部署,只需在高可用部署的各个节点上将 ODC 升级到新版本即可。升级高可用部署的 ODC 应用时可按需选择是否将 Nginx 升级到最新版本。 diff --git a/zh-CN/9.upgrade-guide/2.preparation-for-upgrade.md b/zh-CN/9.upgrade-guide/2.preparation-for-upgrade.md new file mode 100644 index 00000000..6b11278a --- /dev/null +++ b/zh-CN/9.upgrade-guide/2.preparation-for-upgrade.md @@ -0,0 +1,49 @@ +升级前准备 +========================== + +OceanBase 开发者中心(OceanBase Developer Center,ODC)的升级需要预先确认元数据库和机器环境。 + +元数据库 +------------------------- + +部署 Web 版 ODC 时创建了元数据库用于存储使用 ODC 过程中产生的用户数据。 + +升级 ODC 时需重新初始化元数据库并运行对应版本的 ODC 镜像,因此在升级前,请先确认元数据库的租户名、租户所在的集群名、数据库名称、用户名和密码等信息。 + +> **说明**
                  +> * ODC V3.3.0 之后版本提供变更流程和操作审计等企业级管控能力。
                  +> * ODC V3.3.1 之后版本解除对 MetaDB 版本的限制。
                  +> * MetaDB 所在 OceanBase 租户规格推荐 2C8G 及以上配置,配置过低容易导致性能问题。 + + + + + + +机器环境 +------------------------- + +Web 版 ODC 运行环境配置,按照 ODC 用户数的经验值: + +* 20 内 ODC 用户,部署在规格为 4C8G 的服务器上; + + + +* 100 内 ODC 用户,部署在规格为 4C16G 的服务器上; + + + +* 500 内 ODC 用户,部署在规格为 8C32G 的服务器上; + + + +* 更多用户视使用情况调整资源。 + + + + + + +Web 版 ODC 需要运行在以上规格的服务器上,因此在升级 ODC 应用时请确认机器环境。 + +升级 ODC 应用时需重新在机器上拉取和运行 ODC 镜像,因此在升级前请确认机器安装了 Docker 并可以正常运行。 diff --git a/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/1.upgrade-process.md b/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/1.upgrade-process.md new file mode 100644 index 00000000..4028a65b --- /dev/null +++ b/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/1.upgrade-process.md @@ -0,0 +1,37 @@ +升级流程 +========================= + + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)单节点部署的升级需完成以下三步: + +1. [停运旧版本 ODC](../3.upgrade-single-node-odc/2.stop-the-old-odc-version.md):在 Docker 中停止运行旧版本 ODC 的容器。 + + + +2. [加载和运行 ODC 镜像](../3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md):在服务器上加载并运行新版本镜像以升级 ODC 应用。 + + + +3. [升级 Nginx 镜像](../4.upgrade-high-availability-odc/4.upgrade-nginx-image.md):若单节点 ODC 已配置 SSL 证书并部署 Nginx 镜像,可参考升级高可用 ODC 流程中的步骤升级 Nginx 镜像。 + +
                  +

                  说明

                  +
                    +
                  • 用户首次登录的用户名和密码从管理员处获取。
                  • +
                  • 有关登录 Web 版 ODC 详情,请参见本手册中《用户指南 (Web 版 ODC)》> 登录 ODC > 登录账号。
                  • +
                  +
                  + + + + + + + + + + + + + diff --git a/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/2.stop-the-old-odc-version.md b/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/2.stop-the-old-odc-version.md new file mode 100644 index 00000000..84095205 --- /dev/null +++ b/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/2.stop-the-old-odc-version.md @@ -0,0 +1,37 @@ +停运旧版本 ODC +============================== + +升级单节点部署的 OceanBase 开发者中心(OceanBase Developer Center,ODC)应用时,在完成元数据库的更新后,需要首先停止运行旧版本的 ODC。 + +**操作步骤:** + +1. 在宿主机的命令行工具中运行 `docker ps -a` 语句查看正在运行的容器,通过 `IMAGE` 列(镜像名称)可以定位到旧版本 ODC 容器的 ID,即对应容器 `CONTAINER ID` 列的值。运行结果如下所示: + + ```javascript + C:\Users\ob>docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 8bfecbc1cd03 acs-reg.alipay.com/oceanbase/obodc:2.0.1 "/bin/sh -c '/usr/bi..." 13 days ago Up 13 days 80/tcp, 8080/tcp, 0.0.0.0:8989->8989/tcp obodc + ``` + + + +2. 获得容器 ID 后继续在命令行工具中运行 `docker stop ;` 语句以停止运行旧版本 ODC 的容器。运行结果如下所示: + + ```javascript + C:\Users\ob>docker stop 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + +3. 在命令行工具中运行 `docker rm ;` 删除旧版本 ODC 镜像以释放旧版本镜像占用的端口。运行结果如下所示: + + ```javascript + C:\Users\ob>docker rm 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + + + diff --git a/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md b/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md new file mode 100644 index 00000000..45a96ee9 --- /dev/null +++ b/zh-CN/9.upgrade-guide/3.upgrade-single-node-odc/3.upgrade-guide-load-and-run-single-odc-images.md @@ -0,0 +1,83 @@ +加载和运行 ODC 镜像 +================================= + +升级单节点部署的 OceanBase 开发者中心(OceanBase Developer Center,ODC)应用时,在完成元数据库的更新和停运旧版本 ODC 容器后,需重新拉取和运行 ODC 的镜像。 + +加载镜像 +------------------------- + +首先要在宿主机上获得 ODC 镜像,在以下列表选择所需镜像,单击 **\[下载\]** 以获得镜像: + +* X86 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz)
                  +* ARM 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +在宿主机上获得镜像文件后,在命令行工具中运行下述语句加载镜像: + +```javascript +gunzip -c obodc-{$version}.tar.gz | docker load +``` + + + +运行镜像 +------------------------- + +在宿主机上获得 ODC 镜像后,在命令行工具中运行镜像的示例语句如下所示: + +```javascript +#!/usr/bin/env bash +docker run -v /var/log/odc:/opt/odc/log -v /var/data/odc:/opt/odc/data \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +其中,{image_tag} 可以在宿主机上加载镜像后运行 `docker images` 语句查看,其他参数说明如下表所示: + + +| 参数 | 说明 | +|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|-v |
                  • 宿主机的 `/var/log/odc` 目录映射到 ODC 容器内的 `/opt/odc/log` 目录。 `/var/log/odc` 为宿主机的目录,如不存在需先创建,创建目录的参考命令 `mkdir -p /var/log/odc`。
                  • 宿主机的 `/var/data/odc` 目录挂载到 ODC 容器内的 `/opt/odc/data` 目录。`/var/data/odc` 为宿主机的目录,可自定义,如不存在需先创建,创建目录的参考命令 `mkdir -p /var/data/odc`。
                  | +| --net | 指定容器的网络配置,指定该参数值为 `host` 即直接使用宿主机网络。 您也可以使用 `--publish`(`-p`)参数配置端口映射,但是部分环境可能出现因为 Docker 内 DNS 解析出错而启动容器失败,此时请使用 `--net host` 方式启动 Docker。 | +| --cpu-period --cpu-quota |
                • `---cpu-period` 用来指定容器对 CPU 的使用要在多长时间内做一次重新分配。单位:微秒。
                • `---cpu-quota` 用来指定在这个周期内,最多可以有多少时间用来运行当前容器。单位:微秒。
                • 配合使用可指定容器使用的 CPU 核数。cpu-quota/cpu-period 的值即为 Docker 可以使用的 CPU 核数,示例语句中 400000/100000=4 表示最多可以使用 4 个核。 | +| --memory | 设置容器使用的内存最大值。 | +| --name | 指定容器名称。 | +| DATABASE_HOST | 元数据库 IP 地址。 | +| DATABASE_PORT | 元数据库端口号。 | +| DATABASE_USERNAME | 元数据库用户名。OceanBase 数据库用户名的格式:db_user@tenant_name#cluster_name。 | +| DATABASE_PASSWORD | 连接数据库的密码。 | +| DATABASE_NAME | 元数据库名。 | +| ODC_PROFILE_MODE | 指定模式。默认指定:`alipay`。 | + + + +除上述参数外,运行镜像时您还可以根据需求使用下述参数: + + +| 参数 | 说明 | +|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | 指定日志目录。默认路径:`/opt/odc/log`。 | +| OBCLIENT_WORK_DIR | 指定 OBClient 工作目录。默认路径:`/opt/odc/data`。 | +| ODC_JAR_FILE | 指定 Jar 文件目录。默认路径:`/opt/odc/lib/odc-web-starter-*.jar`。 | +| ODC_WORK_DIR | 指定 ODC 工作目录。默认路径:`/opt/odc/script`。 | +| ODC_JVM_HEAP_OPTIONS | 指定 JVM 堆内存。默认最大内存参数 `-Xmx` 的值:可用物理内存的 60%。 ODC 启动脚本会检查当前环境的可用内存是否达到 2048 M, 按照 60% 计算需要有 3.4 G 内存才可以启动。如果宿主机或 Docker 的内存配置低于 3.4 G,可以通过指定参数 `ODC_JVM_HEAP_OPTIONS` 来绕过可用内存检查,例如可以配置为 `"-Xmx2048m -Xms2048m"`。 | +| ODC_JVM_GC_OPTIONS | 指定 JVM GC 策略。默认指定:`-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`。 | +| ODC_JVM_OOM_OPTIONS | 指定 JVM OutOfMemory 策略。默认指定:`-XX:+ExitOnOutOfMemoryError`。 | +| ODC_JVM_EXTRA_OPTIONS | 指定其它需要的 JVM 配置参数。默认值:空。 | +| ODC_SERVER_PORT | 指定 ODC-Server 的 HTTP 监听端口。默认值:8989。 | +| ODC_HOST | 指定 ODC 运行时的 IP 地址,该参数在高可用部署场景下做为远程过程调用的目的地址。 | +| ODC_MAPPING_PORT | 指定 ODC 运行时的端口号,避免因部署环境导致的端口号无法使用的问题。该参数适用于在 Docker 中部署 ODC 时进行端口映射的场景。| +| ODC_APP_EXTRA_ARGS | 其它需要指定的 App 参数。
                  例如 `--server.servlet.session.timeout=10m`,表示 Session 过期时间为 10 分钟。默认值:空。 | +| ODC_SERVER_RPC_PORT | 指定 ODC-Server 的内部 RPC 通信监听端口。默认值:8990。 | \ No newline at end of file diff --git a/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/1.ha-odc-upgrade-process.md b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/1.ha-odc-upgrade-process.md new file mode 100644 index 00000000..a8433e6f --- /dev/null +++ b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/1.ha-odc-upgrade-process.md @@ -0,0 +1,37 @@ +升级流程 +========================= + + + +OceanBase 开发者中心(OceanBase Developer Center,ODC)高可用部署的升级需完成以下三步: + +1. [停运旧版本 ODC](../4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md):在 Docker 中停止运行旧版本 ODC 的容器。 + + + +2. [加载和运行 ODC 镜像](../4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md):在高可用部署的每个节点上加载和运行新版 ODC 镜像以升级 ODC 应用。 + + + +3. [升级 Nginx 镜像](../4.upgrade-high-availability-odc/4.upgrade-nginx-image.md):可按需选择是否同时将 Nginx 镜像升级至最新版本。升级 Nginx 镜像,首先需停运并删除旧镜像,并在宿主机上获得新版本镜像后重新进行部署 Nginx 代理的操作。 + +
                  +

                  说明

                  +
                    +
                  • 用户首次登录的用户名和密码从管理员处获取。
                  • +
                  • 有关登录 Web 版 ODC 详情,请参见本手册中《用户指南 (Web 版 ODC)》> 登录 ODC > 登录账号。
                  • +
                  +
                  + + + + + + + + + + + + + diff --git a/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md new file mode 100644 index 00000000..9c40993f --- /dev/null +++ b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/2.ha-odc-stop-the-old-odc-version.md @@ -0,0 +1,37 @@ +停运旧版本 ODC +============================== + +升级高可用部署的 OceanBase 开发者中心(OceanBase Developer Center,ODC)应用时,在完成元数据库的更新后,需要首先停止运行各个节点上旧版本的 ODC。 + +**操作步骤:** + +1. 在宿主机的命令行工具中运行 `docker ps -a` 语句查看正在运行的容器,通过 `IMAGE` 列(镜像名称)可以定位到旧版本 ODC 容器的 ID,即对应容器 `CONTAINER ID` 列的值。运行结果如下所示: + + ```javascript + C:\Users\ob>docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 8bfecbc1cd03 acs-reg.alipay.com/oceanbase/obodc:2.0.1 "/bin/sh -c '/usr/bi..." 13 days ago Up 13 days 80/tcp, 8080/tcp, 0.0.0.0:8989->8989/tcp obodc + ``` + + + +2. 获得容器 ID 后继续在命令行工具中运行 `docker stop ;` 语句以停止运行旧版本 ODC 的容器。运行结果如下所示: + + ```javascript + C:\Users\ob>docker stop 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + +3. 在命令行工具中运行 `docker rm ;` 删除旧版本 ODC 镜像以释放旧版本镜像占用的端口。运行结果如下所示: + + ```javascript + C:\Users\ob>docker rm 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + + + diff --git a/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md new file mode 100644 index 00000000..5e687f0d --- /dev/null +++ b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/3.upgrade-load-and-run-ha-odc-images.md @@ -0,0 +1,84 @@ +加载和运行 ODC 镜像 +================================= + +升级高可用部署的 OceanBase 开发者中心(OceanBase Developer Center,ODC)应用时,在完成元数据库的更新后,需在各个节点上重新拉取和运行 ODC 的镜像。 + +加载镜像 +------------------------- + +首先要在宿主机上获得 ODC 镜像,在以下列表选择所需镜像,单击 **\[下载\]** 以获得镜像: + +* X86 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0.tar.gz)
                  +* ARM 镜像:[\[下载\]](https://ob-front.oss-cn-hangzhou.aliyuncs.com/client/4.0.0/obodc4.0.0_arm.tar.gz) + + + + + + +在宿主机上获得镜像文件后,在命令行工具中运行下述语句加载镜像: + +```javascript +gunzip -c obodc-{$version}.tar.gz | docker load +``` + + + +运行镜像 +------------------------- + +在宿主机上获得 ODC 镜像后,在命令行工具中运行镜像的示例语句如下所示: + +```javascript +#!/usr/bin/env bash +docker run -v /var/log/odc:/opt/odc/log -v /var/data/odc:/opt/odc/data \ +-d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" \ +-e "DATABASE_HOST=100.00.00.00" \ +-e "DATABASE_PORT=60805" \ +-e "DATABASE_USERNAME=obodc@obodc#odc_cluster" \ +-e "DATABASE_PASSWORD=obodc" \ +-e "DATABASE_NAME=odc_metadb" \ +-e "ODC_PROFILE_MODE=alipay" \ +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + + +其中,{image_tag} 可以在宿主机上加载镜像后运行 `docker images` 语句查看,其他参数说明如下表所示: + + +| 参数 | 说明 | +|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|-v |
                  • 宿主机的 `/var/log/odc` 目录映射到 ODC 容器内的 `/opt/odc/log` 目录。 `/var/log/odc` 为宿主机的目录,如不存在需先创建,创建目录的参考命令 `mkdir -p /var/log/odc`。
                  • 宿主机的 `/var/data/odc` 目录挂载到 ODC 容器内的 `/opt/odc/data` 目录。`/var/data/odc` 为宿主机的目录,可自定义,如不存在需先创建,创建目录的参考命令 `mkdir -p /var/data/odc`。
                  | +| --net | 指定容器的网络配置,指定该参数值为 `host` 即直接使用宿主机网络。 您也可以使用 `--publish`(`-p`)参数配置端口映射,但是部分环境可能出现因为 Docker 内 DNS 解析出错而启动容器失败,此时请使用 `--net host` 方式启动 Docker。 | +| --cpu-period --cpu-quota |
                • `---cpu-period` 用来指定容器对 CPU 的使用要在多长时间内做一次重新分配。单位:微秒。
                • `---cpu-quota` 用来指定在这个周期内,最多可以有多少时间用来运行当前容器。单位:微秒。
                • 配合使用可指定容器使用的 CPU 核数。cpu-quota/cpu-period 的值即为 Docker 可以使用的 CPU 核数,示例语句中 400000/100000=4 表示最多可以使用 4 个核。 | +| --memory | 设置容器使用的内存最大值。 | +| --name | 指定容器名称。 | +| DATABASE_HOST | 元数据库 IP 地址。 | +| DATABASE_PORT | 元数据库端口号。 | +| DATABASE_USERNAME | 元数据库用户名。OceanBase 数据库用户名的格式:db_user@tenant_name#cluster_name。 | +| DATABASE_PASSWORD | 连接数据库的密码。 | +| DATABASE_NAME | 元数据库名。 | +| ODC_PROFILE_MODE | 指定模式。默认指定:`alipay`。 | + + + +除上述参数外,运行镜像时您还可以根据需求使用下述参数: + + +| 参数 | 说明 | +|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ODC_LOG_DIR | 指定日志目录,默认路径为 `/opt/odc/log`。 | +| OBCLIENT_WORK_DIR | 指定 OBClient 工作目录。默认路径:`/opt/odc/data`。 | +| ODC_JAR_FILE | 指定 Jar 文件目录。默认路径:`/opt/odc/lib/odc-web-starter-*.jar`。 | +| ODC_WORK_DIR | 指定 ODC 工作目录。默认路径:`/opt/odc/script`。 | +| ODC_JVM_HEAP_OPTIONS | 指定 JVM 堆内存。默认最大内存参数 `-Xmx` 的值:可用物理内存的 60%。 ODC 启动脚本会检查当前环境的可用内存是否达到 2048 M, 按照 60% 计算需要有 3.4 G 内存才可以启动。如果宿主机或 Docker 的内存配置低于 3.4 G,可以通过指定参数 `ODC_JVM_HEAP_OPTIONS` 来绕过可用内存检查,例如可以配置为 `"-Xmx2048m -Xms2048m"`。 | +| ODC_JVM_GC_OPTIONS | 指定 JVM GC 策略。默认指定:`-XX:+UseG1GC -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:/opt/odc/log/gc.log -XX:+UseGCLogFileRotation -XX:GCLogFileSize=50M -XX:NumberOfGCLogFiles=5`。 | +| ODC_JVM_OOM_OPTIONS | 指定 JVM OutOfMemory 策略。默认指定:`-XX:+ExitOnOutOfMemoryError`。 | +| ODC_JVM_EXTRA_OPTIONS | 指定其它需要的 JVM 配置参数。默认值:空。 | +| ODC_SERVER_PORT | 指定 ODC-Server 的 HTTP 监听端口。默认值:8989。 | +| ODC_HOST | 指定 ODC 运行时的 IP 地址,该参数在高可用部署场景下做为远程过程调用的目的地址。 | +| ODC_MAPPING_PORT | 指定 ODC 运行时的端口号,避免因部署环境导致的端口号无法使用的问题。该参数适用于在 Docker 中部署 ODC 时进行端口映射的场景。 | +| ODC_APP_EXTRA_ARGS | 其它需要指定的 App 参数。
                  例如 `--server.servlet.session.timeout=10m`,表示 Session 过期时间为 10 分钟。默认值:空。 | +| ODC_SERVER_RPC_PORT | 指定 ODC-Server 的内部 RPC 通信监听端口。默认值:8990。 | + diff --git a/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/4.upgrade-nginx-image.md b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/4.upgrade-nginx-image.md new file mode 100644 index 00000000..3b3503a7 --- /dev/null +++ b/zh-CN/9.upgrade-guide/4.upgrade-high-availability-odc/4.upgrade-nginx-image.md @@ -0,0 +1,344 @@ +升级 Nginx 镜像 +================================ + +升级 Web 版 ODC 时,可按需选择是否将 Nginx 镜像也升级到最新版本。升级 Nginx 镜像,需首先停运并删除旧镜像,然后在宿主机上获得新版本镜像后重新进行部署 Nginx 代理的操作。 + +停运删除旧镜像 +---------------------------- + +部署新版本 Nginx 镜像前,需在宿主机上先停运并删除当前运行的旧版本 Nginx 镜像。 + +操作步骤如下: + +1. 在宿主机的命令行工具中运行 `docker ps -a` 语句查看正在运行的容器,通过 `IMAGE` 列(镜像名称)可以定位到旧版本 Nginx 容器的 ID,即对应容器 `CONTAINER ID` 列的值。运行结果如下所示: + + ```javascript + " C:\Users\ob>docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 8bfecbc1cd03 bdd6f8916e8b "/bin/sh -c '/usr/bi... 13 days ago Up 13 days 80/tcp, 8080/tcp, 0.0.0.0:8989->8989/tcp nginx + ``` + + + +2. 获得容器 ID 后继续在命令行工具中运行 `docker stop ;` 语句以停止运行旧版本 ODC 的容器。运行结果如下所示: + + ```javascript + C:\Users\ob>docker stop 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + +3. 在命令行工具中运行 `docker rm ;` 删除旧版本 ODC 镜像以释放旧版本镜像占用的端口。运行结果如下所示: + + ```javascript + C:\Users\ob>docker rm 8bfecbc1cd03 + 8bfecbc1cd03 + ``` + + + + + + +加载新镜像 +-------------------------- + +在宿主机上加载新版本的 Nginx 镜像,目前镜像可通过两种方式获得: + +* 在宿主机上从 Docker 仓库中直接拉取镜像。 + + + +* 下载镜像包到本地,再拷贝至宿主机中解压。 + + + + + + +### 从 Docker 仓库中直接拉取镜像 + +请确保宿主机上已安装了 Docker 并且可以访问外网,在命令行工具中运行下述语句从 Docker 仓库中拉取 Nginx 镜像: + +```javascript +docker pull nginx +``` + + + +### 拷贝镜像包至宿主机中解压 + +在可以访问外网且已安装了 Docker 的机器中运行下述语句,下载镜像包至本地: + +```unknow +docker save nginx:latest | gzip - >nginx.tar.gz +``` + + + +然后,拷贝镜像包至宿主机中,运行下述语句加载镜像: + +```javascript +gunzip -c nginx.tar.gz | docker load +``` + + + +配置 conf 文件 +------------------------------- + +在启动 Nginx 镜像前,需修改配置文件。ODC 的镜像包中已提供配置文件模板,可复制模板到本地并进行编辑。配置文件模板根据您是否已部署自签证书而略有不同,请按需复制对应的模板并进行修改。 + +### 配置不包含自签证书的 conf 文件 + +运行下述语句从镜像包中复制配置文件到宿主机再进行编辑,复制路径可自定义(其中 \~ 是配置文件在本地的路径): + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.template ~/ +``` + + + +配置文件模板如下所示,请关注文件中注释需修改的部分。 + +```javascript +# Nginx conf template for http deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address + # 请修改为实际的 odc-server 地址(非必改内容) + server 127.0.0.1:8989; + # add more servers here + } + + #https server, proxy to odc-server 8989 port + server { + listen 80; + # uncomment below if ipv6 enabled + # 如启用 ipv6,请取消以下注释 + #listen [::]:80; + + # PLEASE CHANGE to your site domain + # 请修改为实际的站点域名(非必改内容) + server_name odc.oceanbase.com; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + + +### 配置包含自签证书的 conf 文件 + +运行下述语句从镜像包中拷贝配置文件到宿主机再进行编辑,复制路径可自定义(其中 ~ 是配置文件在本地的路径): + +```javascript +docker cp -a :/opt/odc/conf/nginx.conf.https.template ~/ +``` + + + +配置文件模板如下所示,请关注文件中注释需修改的部分。 + +```unknow +# Nginx conf template for https deployment +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + #set 0 to disable request body size check, for support large size file upload + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # for websocket configuration + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # load balancing configuration + # notice under_score character are not allowed for upsteram name, 400 Bad Request happens if used + # please use ip_hash strategy + # one server line for each odc-server node + upstream odcbackends { + ip_hash; + # PLEASE CHANGE to real odc-server address + # 请修改为实际的 odc-server 地址(非必改内容) + server 127.0.0.1:8989; + #add more servers here + } + + # redirect http to https + server { + listen 80 default_server; + + # uncomment below if ipv6 enabled + # 如启用 ipv6,请取消以下注释 + #listen [::]:80 default_server; + + location / { + return 301 https://$host$request_uri; + } + } + + # https server, proxy to odc-server 8989 port + server { + listen 443 ssl http2; + # uncomment below if ipv6 enabled + # 如启用 ipv6,请取消以下注释 + #listen [::]:443 ssl http2; + + # PLEASE CHANGE to your site domain + # 请修改为实际的站点域名(非必改内容) + server_name odc.oceanbase.com; + + # you can use /opt/odc/bin/generate-odc-ssl-certificate.sh + # to generate self certificated SSL certificates + # 您可以使用 /opt/odc/bin/generate-odc-ssl-certificate.sh 生成自签证书 + + # PLEASE CHANGE certificate file location if unmatched + # 如不匹配,请修改证书文件路径 + ssl_certificate /etc/pki/nginx/odcserver.crt; + ssl_certificate_key /etc/pki/nginx/odcserver.key; + ssl_session_timeout 1d; + ssl_session_cache shared:MozSSL:10m; # about 40000 sessions + ssl_session_tickets off; + + # intermediate configuration + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; + ssl_prefer_server_ciphers off; + + # HSTS (ngx_http_headers_module is required) (63072000 seconds) + add_header Strict-Transport-Security "max-age=63072000" always; + + location / { + proxy_pass http://odcbackends; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1800; + proxy_send_timeout 1800; + proxy_connect_timeout 75; + proxy_next_upstream off; + } + } + +} +``` + + +> **说明**
                  +> 修改负载均衡配置,确保 proxy 超时配置时长充足,修改配置后需重启 nginx 。 +建议 `proxy_connect_timeout` 参数不超过 75 秒,请参见 proxy_connect_timeout:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout。 +> 设置 `proxy_next_upstream off` 旨在禁止 nginx 将请求转发至下一个 ODC 节点,导致用户需重新登录,且某些功能不可用,如异步任务结果集下载等与文件上传下载相关的功能。 + +启动镜像 +------------------------- + +在本地修改配置文件后,在命令行工具中运行下述语句以重启 Nginx 镜像(其中 ~ 是配置文件在本地的路径): + +```shell +docker run --network host --name nginx -v ~/:/etc/nginx/nginx.conf -v /etc/pki/nginx/:/etc/pki/nginx/ -d nginx +``` + + + +语句中的参数说明如下所示: + + +| 参数 | 说明 | +|-------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --network host | 表示使用宿主机网络端口,无需配置端口映射。 如不希望直接使用宿主机端口,可使用 `-p` 参数配置端口映射。例如 `-p 8080:80` 表示宿主机的 8080 端口映射为 Docker 内的 80 端口,`-p 8443:443` 表示宿主机的 8443 端口映射为 Docker 内的 443 端口。 | +| --name nginx | 指定容器的名称为 nginx,方便后续管理,或可使用其它名称,如 odc-nginx。 | +| -v \~/\:/etc/nginx/nginx.conf | 进行磁盘挂载,将宿主机内的本地文件映射到 Docker 内。 其中 `` 为配置 conf 文件时复制到宿主机的本地路径,然后将其映射至 Docker 内的 /etc/nginx/nginx.conf 文件中。 | +| -v /etc/pki/nginx/:/etc/pki/nginx/ | 将宿主机的 /etc/pki/nginx/ 路径映射到 Docker 内的 /etc/pki/nginx/ 路径。 | +| -d nginx | 表示后台运行 Docker。 | + + diff --git a/zh-CN/9.upgrade-guide/5.upgrade-verification.md b/zh-CN/9.upgrade-guide/5.upgrade-verification.md new file mode 100644 index 00000000..fa121a57 --- /dev/null +++ b/zh-CN/9.upgrade-guide/5.upgrade-verification.md @@ -0,0 +1,11 @@ +升级验证 +========================= + +完成 OceanBase 开发者中心(OceanBase Developer Center,ODC)的升级后,您可以在浏览器中通过宿主机(高可用部署时是 Nginx 代理所在的宿主机)的 IP 和端口号(http://IP:PORT 或 http://DOMAIN:PORT)访问 Web 版 ODC。 + +访问并登录 ODC 后,在连接列表页面的右上角,选择帮助中心,单击下拉列表中的 **关于开发者中心** 标签,在弹出的窗口中您可以获得当前应用的版本号以确定升级是否成功。更多关于 Web 版 ODC 的使用操作,请参见 《ODC 用户指南(Web 版 ODC)》。 + +![Image 246](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/2280107161/p243828.png) + + + diff --git a/zh-CN/9.upgrade-guide/6.rooback-after-upgrade-failed.md b/zh-CN/9.upgrade-guide/6.rooback-after-upgrade-failed.md new file mode 100644 index 00000000..92552b6b --- /dev/null +++ b/zh-CN/9.upgrade-guide/6.rooback-after-upgrade-failed.md @@ -0,0 +1,37 @@ +升级失败回滚 +=========================== + +升级 Web 版 OceanBase 开发者中心(OceanBase Developer Center,ODC)后,如果发现升级后的版本有严重的问题,可以进行回滚操作。 + +回滚 Web 版 ODC 时,只需在宿主机的命令行工具中运行下述语句,重新运行之前版本的 ODC 镜像即可: + +```javascript +#!/usr/bin/env bash +docker run -d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" +-e "DATABASE_HOST=100.00.00.00" +-e "DATABASE_PORT=60805" +-e "DATABASE_USERNAME=[用户名]@[租户名称]#[集群名称]" +-e "DATABASE_PASSWORD=******" +-e "DATABASE_NAME=odc_metadb" +-e "ODC_PROFILE_MODE=alipay" +reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag} +``` + + +其中,{image_tag} 可以在宿主机上加载镜像后运行 `docker images` 语句查看,其他参数说明如下表所示: + + +| 参数 | 说明 | +|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| --net | 指定容器的网络配置,指定该参数值为 `host` 即直接使用宿主机网络。 您也可以使用 `--publish`(`-p`)参数配置端口映射,但是部分环境可能出现因为 Docker 内 DNS 解析出错而启动容器失败,此时请使用 `--net host` 方式启动 Docker。 | +| --cpu-period --cpu-quota | ---cpu-period 用来指定容器对 CPU 的使用要在多长时间内做一次重新分配。单位为微秒。 ---cpu-quota 用来指定在这个周期内,最多可以有多少时间用来运行当前容器。单位为微秒。 配合使用可指定容器使用的 CPU 核数。cpu-quota/cpu-period 的值即为 Docker 可以使用的 CPU 核数,示例语句中 400000/100000=4 表示最多可以使用 4 个核。 | +| --memory | 设置容器使用的内存最大值。 | +| --name | 指定容器名称。 | +| DATABASE_HOST | 元数据库 IP 地址。 | +| DATABASE_PORT | 元数据库端口号。 | +| DATABASE_USERNAME | 元数据库用户名,OceanBase 数据库用户名的格式为 db_user@tenant_name#cluster_name。 | +| DATABASE_PASSWORD | 连接数据库的用户名。 | +| DATABASE_NAME | 元数据库名。 | +| ODC_PROFILE_MODE | 指定模式,默认指定为 `alipay`。 | + +