7 Commits

36 changed files with 710 additions and 468 deletions
Split View
  1. +1
    -2
      en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8400.set-names-of-mysql-mode.md
  2. +14
    -15
      en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8500.set-password-of-mysql-mode.md
  3. +9
    -9
      en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8600.set-transaction-of-mysql-mode.md
  4. +156
    -88
      en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8700.show-of-mysql-mode.md
  5. +33
    -33
      en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8800.transaction-of-mysql-mode.md
  6. +77
    -70
      en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/9200.value-of-mysql-mode.md
  7. +9
    -8
      zh-CN/400.deploy/300.deploy-oceanbase-enterprise-edition/200.preparations-before-deploy/200.configure-servers.md
  8. +2
    -2
      zh-CN/400.deploy/300.deploy-oceanbase-enterprise-edition/200.preparations-before-deploy/300.prepare-installation-packages.md
  9. +21
    -21
      zh-CN/400.deploy/500.deploy-oceanbase-database-community-edition/200.local-deployment/200.environment-and-configuration-checks/300.configure-the-clock-source-optional.md
  10. +21
    -21
      zh-CN/400.deploy/500.deploy-oceanbase-database-community-edition/200.local-deployment/400.deploy-by-ui/100.deploy-by-obd.md
  11. +29
    -17
      zh-CN/600.manage/100.cluster-management/300.common-cluster-operations/1500.oceanbase-version-upgrade/200.upgrade-oceanbase-enterprise-edition/100.upgrade-overview.md
  12. +1
    -1
      zh-CN/600.manage/900.performance-tuning/400.sql-tuning/200.execution-plan-optimization/400.join-order-and-join-algorithm/200.join-algorithm/100.nested-loops-joins.md
  13. +1
    -1
      zh-CN/600.manage/900.performance-tuning/400.sql-tuning/200.execution-plan-optimization/400.join-order-and-join-algorithm/200.join-algorithm/300.merge-join.md
  14. +1
    -0
      zh-CN/640.ob-vector-search/200.ob-vector-index/300.ob-dense-vector-index/200.ob-hnsw-index.md
  15. +5
    -0
      zh-CN/640.ob-vector-search/350.ob-vector-hybrid-search/200.ob-vector-index-hybrid-search.md
  16. +30
    -30
      zh-CN/690.practical-tutorial/200.building-an-intelligent-question-answering-robot-based-on-OceanBase.md
  17. +1
    -1
      zh-CN/700.reference/1000.performance-tuning-guide/500.sql-optimization/400.sql-optimization/400.optimizer-statistics/200.statistics-collection-methods/400.collect-statistics-automatically.md
  18. +1
    -3
      zh-CN/700.reference/1000.performance-tuning-guide/500.sql-optimization/400.sql-optimization/700.manage-execution-plans/200.plan-binding.md
  19. +21
    -21
      zh-CN/700.reference/300.database-object-management/100.manage-object-of-mysql-mode/1000.manage-catalog-of-mysql-mode/200.create-catalog-of-mysql-mode.md
  20. +1
    -1
      zh-CN/700.reference/300.database-object-management/100.manage-object-of-mysql-mode/300.manage-partitions-of-mysql-mode/100.partition-overview-of-mysql-mode.md
  21. +25
    -24
      zh-CN/700.reference/300.database-object-management/100.manage-object-of-mysql-mode/600.manage-views-of-mysql-mode/200.manage-materialized-views-of-mysql-mode/300.create-materialized-views-of-mysql-mode.md
  22. +25
    -24
      zh-CN/700.reference/300.database-object-management/200.manage-object-of-oracle-mode/500.manage-views-of-oracle-mode/200.manage-materialized-views-of-oracle-mode/300.create-materialized-views-of-oracle-mode.md
  23. +15
    -0
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/2230.create-location-of-mysql-mode-in-sql.md
  24. +4
    -0
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/2300.create-outline-of-mysql-mode.md
  25. +4
    -5
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8400.set-names-of-mysql-mode.md
  26. +5
    -7
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8500.set-password-of-mysql-mode.md
  27. +11
    -11
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8600.set-transaction-of-mysql-mode.md
  28. +43
    -14
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8700.show-of-mysql-mode.md
  29. +18
    -18
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8800.transaction-of-mysql-mode.md
  30. +14
    -7
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/9200.value-of-mysql-mode.md
  31. +76
    -1
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/300.common-tenant-of-oracle-mode/900.sql-statement-of-oracle-mode/100.ddl-of-oracle-mode/1730.create-location-of-oracle-mode.md
  32. +5
    -1
      zh-CN/700.reference/500.sql-reference/100.sql-syntax/300.common-tenant-of-oracle-mode/900.sql-statement-of-oracle-mode/100.ddl-of-oracle-mode/1800.create-outline-of-oracle-mode.md
  33. +6
    -1
      zh-CN/700.reference/500.sql-reference/200.sql-specifications-and-practices/200.sql-writing-Specification/300.multi-table-association-specification.md
  34. +1
    -1
      zh-CN/700.reference/600.pl-reference/300.pl-oracle/1400.pl-system-package-oracle/26400.utl-recomp-package-oracle/100.utl-recomp-overview-oracle.md
  35. +12
    -0
      zh-CN/700.reference/900.error-code/600.error-code-of-mysql-mode/1050.10000-12000-of-mysql-mode.md
  36. +12
    -10
      zh-CN/800.FAQ/300.deployment-faq.md

+ 1
- 2
en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8400.set-names-of-mysql-mode.md View File

@@ -21,7 +21,7 @@ SET NAMES charset_name [COLLATE collation_name]
## Parameters

| Parameter | Description |
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|----------------|-----------------------------|
| charset_name | The default character set for columns in the table. Valid values: <ul><li> `binary` </li><li> `utf8mb4` </li><li> `gbk` </li><li> `utf16` </li><li> `gb18030` </li></ul> |
| collation_name | The default collation for columns in the table. Valid values: <ul><li> `binary` </li><li> `gbk_bin` </li><li> `gbk_chinese_ci` </li><li> `utf8mb4_general_ci` </li><li> `utf8mb4__general_cs` </li><li> `utf8mb4_bin` </li><li> `utf8mb4_unicode_ci` </li><li> `utf16_general_ci` </li><li> `utf16_bin` </li><li> `utf16_unicode_ci` </li><li> `gb18030_chinese_ci` </li><li> `gb18030_bin` </li></ul> |

@@ -31,5 +31,4 @@ Set the character set to `gbk` and the collation to `gbk_bin` for the client, co

```sql
obclient> SET NAMES gbk COLLATE gbk_bin;
Query OK, 0 rows affected
```

+ 14
- 15
en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8500.set-password-of-mysql-mode.md View File

@@ -1,21 +1,21 @@
| Description | |
|---------------|-----------------|
| machine-translation ||
| keywords | |
| dir-name | |
| dir-name-en | |
| tenant-type | MySQL Mode |
|machine-translation| |

# SET PASSWORD

## Purpose

You can use this statement to change the password of a user that has logged on to OceanBase Database or another user.
This statement is used to change the password of the current login user or another user in OceanBase Database.

## Syntax

```sql
SET PASSWORD [FOR user] = password_option;
SET PASSWORD [FOR user] = password_option

password_option: {
PASSWORD('authstring')
@@ -25,22 +25,21 @@ PASSWORD('authstring')

## Parameters

| **Parameter** | **Description** |
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| FOR user | If the `FOR user` clause is absent, this statement changes the password of the current user. Any logged-on user can change their password. If the `FOR user` clause is present, this statement changes the password of the specified user. To change the password of the specified user, you must have the global `CREATE USER` privilege (MySQL mode). |
| Parameter | Description |
|----------|-----------------------------|
| FOR user | If the `FOR user` clause is not specified, it means changing the password of the current user. Any successfully logged-in user can change the password of the current user. If the `FOR user` clause is specified, it means changing the password of the specified user. To change the password of the specified user, you must have the `CREATE USER` privilege on the global (MySQL) database. |
|password_option | The password option. You can use `PASSWORD('authstring')` to specify a plaintext password, which will be automatically encoded by the system; or you can directly use `'hashstring'` to specify an encrypted hash string.|

## Examples

* Change the password of the current user.

```sql
obclient> SET PASSWORD = PASSWORD('**1***');
Query OK, 0 rows affected
```
```sql
obclient> SET PASSWORD = PASSWORD('**1***');
```

* Change the password of user `sqluser01`.
* Change the password of the `sqluser01` user.

```sql
obclient> SET PASSWORD FOR sqluser01 = PASSWORD('**2***');
Query OK, 0 rows affected
```
```sql
obclient> SET PASSWORD FOR sqluser01 = PASSWORD('**2***');
```

+ 9
- 9
en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8600.set-transaction-of-mysql-mode.md View File

@@ -25,7 +25,7 @@ OceanBase Database supports two isolation levels in MySQL mode: read committed a
## Syntax

```sql
SET [GLOBAL | SESSION | LOCAL] TRANSACTION trans_opt;
SET [GLOBAL | SESSION | LOCAL] TRANSACTION trans_opt

trans_opt:
transaction_access_mode
@@ -38,8 +38,8 @@ transaction_access_mode:

isolation_level:
ISOLATION LEVEL {
READ UNCOMMITED
| READ COMMITED
READ UNCOMMITTED
| READ COMMITTED
| REPEATABLE READ
| SERIALIZABLE
}
@@ -47,13 +47,13 @@ isolation_level:

## Parameters

| Parameter | Description |
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Parameter | Description |
|----------------|--------------|
| GLOBAL \| SESSION \| LOCAL | The effective scope of the transaction isolation level. This parameter is unspecified by default. <ul><li> `GLOBAL`: indicates that the transaction isolation level applies to all subsequent sessions, without affecting the current session. </li><li> `SESSION | LOCAL`: indicates that the transaction isolation level applies to all transactions subsequently executed in the current session, without affecting the transaction in progress. If this statement is executed in an interval between transactions, it overrides any previous statement that sets the next-transaction value of the named characteristics. </li><li> Unspecified: indicates that the transaction isolation level applies to the next single transaction executed in the session. Subsequent transactions continue to use the session value of the named characteristics. </li></ul> |
| READ ONLY \| READ WRITE | The read/write mode of the transaction. |
| READ UNCOMMITED | Specifies that the transaction isolation level is read uncommitted. <br> **Note** The current version does not support the read uncommitted isolation level. |
| READ COMMITED | Specifies that the transaction isolation level is read committed. |
| REPEATABLE READ | Specifies that the transaction isolation level is repeatable read. |
| READ ONLY \| READ WRITE | The read/write mode of the transaction. |
| READ UNCOMMITTED | Specifies that the transaction isolation level is read uncommitted. <br> **Note** The current version does not support the read uncommitted isolation level. |
| READ COMMITTED | Specifies that the transaction isolation level is read committed. |
| REPEATABLE READ | Specifies that the transaction isolation level is repeatable read. |
| SERIALIZABLE | Specifies that the transaction isolation level is serializable. <br>**Note** OceanBase Database does not support the serializable isolation level for the <code>sys</code> tenant because GTS cannot be enabled for the sys tenant. |

## Examples


+ 156
- 88
en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8700.show-of-mysql-mode.md
File diff suppressed because it is too large
View File


+ 33
- 33
en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8800.transaction-of-mysql-mode.md View File

@@ -1,20 +1,20 @@
| Description | |
|---------------|-----------------|
| machine-translation ||
| keywords | |
| dir-name | |
| dir-name-en | |
| tenant-type | MySQL Mode |
|machine-translation| |

# TRANSACTION

## Purpose

You can use this statement to start a transaction.
This statement is used to start a transaction.

A database transaction is a series of operations performed as a logical unit of work. A transaction can be used to maintain the integrity of the database by ensuring that SQL operations in a batch are either all executed or none of them are executed.
A database transaction is a series of operations executed as a single logical unit. Transaction processing is used to maintain database integrity and ensure that all SQL operations in a batch are either executed or not executed.

Explicit transactions are user-defined or user-specified transactions. You can explicitly start a transaction by using the `BEGIN` or `BEGIN WORK` statement (which is an alias of `START TRANSACTION`) and explicitly end the transaction by using the `COMMIT` or `ROLLBACK` statement.
Explicit transactions are user-defined or user-specified transactions. They are explicitly started using the `BEGIN` or `BEGIN WORK` statement (which is an alias for `START TRANSACTION`) and explicitly ended using the `COMMIT` or `ROLLBACK` statement.

## Syntax

@@ -29,60 +29,60 @@ transaction_stmt:

## Parameters

| **Parameter** | **Description** |
|-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| START TRANSACTION \[READ ONLY \| READ WRITE\] | Starts a transaction. After a transaction is started, the subsequent SQL data operation statements (such as `INSERT`, `UPDATE`, and `DELETE`) do not take effect until it is explicitly committed. `READ ONLY` indicates that the transaction is started in read-only mode and modifications to the transaction are not allowed. `READ WRITE` indicates that the transaction is started in read and write mode, which is the default mode. |
| BEGIN | `BEGIN` and `BEGIN WORK` are used as the alias of `START TRANSACTION`. |
| COMMIT | Commits the current transaction. |
| ROLLBACK | Rolls back the current transaction. |
| SET TRANSACTION {READ ONLY \| READ WRITE} | Sets the current transaction to the `READ ONLY` or `READ WRITE` mode. |
| Parameter | Description |
|----------------|--------------|
| START TRANSACTION \[READ ONLY \| READ WRITE\] | Starts a transaction. Once a transaction is started, subsequent SQL data manipulation statements (such as `INSERT`, `UPDATE`, and `DELETE`) will only take effect until the transaction is explicitly committed. `READ ONLY` indicates that the transaction is started in read-only mode, and no modification operations can be executed within the transaction. `READ WRITE` indicates that the transaction is started in read-write mode, which is the default mode. |
| BEGIN | `BEGIN` and `BEGIN WORK` are aliases for `START TRANSACTION`. |
| COMMIT | Commits the current transaction. |
| ROLLBACK | Rolls back the current transaction. |
| SET TRANSACTION {READ ONLY \| READ WRITE} | Sets the current transaction to `READ ONLY` or `READ WRITE` mode.|

## Examples

* Assume that you have table `a` with the following data in your database.
Assume the `a` table is as follows:

| id | name | num | sell_date |
|----|------|-----|---------------------|
| 1 | a | 100 | 2013-06-21 10:06:43 |
| 2 | b | 200 | 2013-06-21 13:07:21 |
| 3 | a | 50 | 2013-06-21 13:08:15 |
```sql
| id | name | num | sell_date |
|----|------|-----|---------------------|
| 1 | a | 100 | 2013-06-21 10:06:43 |
| 2 | b | 200 | 2013-06-21 13:07:21 |
| 3 | a | 50 | 2013-06-21 13:08:15 |
```

1. Execute the following statements in sequence to start the transaction, change the `name` value of the record whose `id` is `3` to `c`, and insert a row for the record of selling `a`.
1. Execute the following commands to start a transaction, change the `name` of the record with `id` `3` to `c`, and insert a new record for the current sale of `a`.

```sql
obclient> START TRANSACTION;
Query OK, 0 rows affected

obclient> UPDATE a SET name = 'c' WHERE id = 3;
Query OK, 1 rows affected

obclient> INSERT INTO a VALUES (4, 'a', 30, '2013-06-21 16:09:13');
Query OK, 1 rows affected

obclient> COMMIT;
Query OK, 0 rows affected
```

2. Commit the transaction and execute the following statement to query the information of table `a`.
2. After the transaction is committed, execute the following command to view the information of the `a` table.

```sql
SELECT * FROM a;
obclient> SELECT * FROM a;
```

The result is as follows:

| id | name | num | sell_date |
```sql
| id | name | num | sell_date |
|----|------|-----|---------------------|
| 1 | a | 100 | 2013-06-21 10:06:43 |
| 2 | b | 200 | 2013-06-21 13:07:21 |
| 3 | c | 50 | 2013-06-21 13:08:15 |
| 4 | a | 30 | 2013-06-21 16:09:13 |
| 1 | a | 100 | 2013-06-21 10:06:43 |
| 2 | b | 200 | 2013-06-21 13:07:21 |
| 3 | c | 50 | 2013-06-21 13:08:15 |
| 4 | a | 30 | 2013-06-21 16:09:13 |
```

<main id="notice" type='notice'>
<h4>Notice</h4>
<ul>
<li>Before a transaction is committed, you can view whether the operation in the transaction has taken effect. For example, you can execute the <code>SELECT * FROM a</code> statement before you commit a transaction. </li>
<li>You can access the sessions of the current transaction to obtain the latest result. Access to sessions beyond the current transaction does not take effect. Before you <code>COMMIT</code> the transaction, your operations are visible only to the current transaction session. </li>
<li>To roll back a transaction, replace <code>COMMIT</code> with <code>ROLLBACK</code>. </li>
<li>Before the transaction is <code>COMMIT</code>, you can check whether the operations in the transaction have taken effect. For example, you can execute the SQL statement <code>SELECT * FROM a;</code> before <code>COMMIT</code>.</li>
<li>Within the transaction session, the latest results can be read, but outside the transaction session, the results are not effective. Before the transaction is <code>COMMIT</code>, the operations performed are only visible within the current transaction session.</li>
<li>To roll back the transaction, use <code>ROLLBACK</code> instead of <code>COMMIT</code>.</li>
</ul>
</main>
</main>

+ 77
- 70
en-US/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/9200.value-of-mysql-mode.md View File

@@ -1,18 +1,18 @@
| Description | |
|---------------|-----------------|
| machine-translation ||
| keywords | |
| dir-name | |
| dir-name-en | |
| tenant-type | MySQL Mode |
|machine-translation| |

# VALUES

## Purpose

You can use this statement to return a set of one or more rows as a table.
This statement is used to return a set of single or multiple rows of data as a table.

The `VALUES` statement is a table value constructor, which can be used independently or together with `UNION`, `EXCEPT`, `INTERSECT`, and so on.
`VALUES` is a table-valued constructor and can also be used as a standalone SQL statement in conjunction with `UNION`, `EXCEPT`, and `INTERSECT`.

## Syntax

@@ -31,74 +31,81 @@ column_designator:

## Parameters

| Parameter | Description |
| Parameter | Description |
|---------------|-----------|
| row_constructor_list | The list of row constructors, each of which has a `ROW()` clause, separated by commas(,). `ROW()` cannot be empty, but each of its scalar value enclosed in parentheses can be `NULL`. |
| value_list | A list of one or more scalar values. A scalar value can be a literal, or an expression that resolves to a scalar value. Each `ROW()` in the same `VALUES` statement must have the same number of values in `value_list`. |
| column_designator | The column designated for sorting rows. Columns are implicitly named as `column_0`, `column_1`, and so forth. You can use the optional `ORDER BY` clause to sort rows by the designated column. |
|row_constructor_list| A list of row constructors, composed of `ROW()` clauses, separated by commas. `ROW()` cannot be empty, but each scalar value within the parentheses can be `NULL`.|
|value_list| A list of one or more scalar values. Scalar values can be literals or expressions that resolve to scalar values. Each `ROW()` in the same `VALUES` statement must contain the same number of values in the `value_list`.|
|column_designator| Specifies the column, named as `column_0`, `column_1`, etc. Use the optional `ORDER BY` clause to sort the rows by this specified column.|

## Examples

* Use `VALUES` to generate a table where rows are sorted by the `column_0` column.

```shell
obclient> VALUES ROW(4,6,8), ROW(5,7,9), ROW(1,-2,3) ORDER BY column_0;
```

The output of the example is as follows:

```shell
+----------+----------+----------+----------+
| column_0 | column_1 | column_2 |
+----------+----------+----------+----------+
| 1 | -2 | 3 |
| 4 | 6 | 8 |
| 5 | 7 | 9 |
+----------+----------+----------+----------+
3 rows in set
```

* Use `VALUES` to generate a table where a column contains data of mixed types.

```shell
obclient> VALUES ROW("q", 23, '2022-12-18'), ROW(87, "x+z", 92.6), ROW(25.0009, "Well Smith", '{"a": 11, "b": 55}');
```

The output of the example is as follows:

```shell
+----------+------------+--------------------+
| column_0 | column_1 | column_2 |
+----------+------------+--------------------+
| q | 23 | 2022-12-18 |
| 87 | x+z | 92.6 |
| 25.0009 | Well Smith | {"a": 11, "b": 55} |
+----------+------------+--------------------+
```

* Use `VALUES` together with `UNION`, which is equivalent to `SELECT`.

```shell
obclient> SELECT 11,22 UNION SELECT 33,44;
+------+------+
| 11 | 22 |
+------+------+
| 11 | 22 |
| 33 | 44 |
+------+------+
2 rows in set

obclient> VALUES ROW(11,22) UNION VALUES ROW(33,44);
```

The output of the example is as follows:

```shell
+----------+----------+
| column_0 | column_1 |
+----------+----------+
| 11 | 22 |
| 33 | 44 |
+----------+----------+
2 rows in set
```
* Use `VALUES` to output a table and sort by the specified column `column_0`.

```sql
obclient> VALUES ROW(4,6,8), ROW(5,7,9), ROW(1,-2,3) ORDER BY column_0;
```

The output of the example is as follows:

```sql
+----------+----------+----------+
| column_0 | column_1 | column_2 |
+----------+----------+----------+
| 1 | -2 | 3 |
| 4 | 6 | 8 |
| 5 | 7 | 9 |
+----------+----------+----------+
3 rows in set
```

* The `VALUES` statement supports mixed data types in the same column.

```sql
obclient> VALUES ROW("q", 23, '2022-12-18'), ROW(87, "x+z", 92.6), ROW(25.0009, "Well Smith", '{"a": 11, "b": 55}');
```

The output of the example is as follows:

```sql
+----------+------------+--------------------+
| column_0 | column_1 | column_2 |
+----------+------------+--------------------+
| q | 23 | 2022-12-18 |
| 87 | x+z | 92.6 |
| 25.0009 | Well Smith | {"a": 11, "b": 55} |
+----------+------------+--------------------+
```

* `VALUES` is used with `UNION`, which is equivalent to `SELECT`.

```sql
obclient> SELECT 11,22 UNION SELECT 33,44;
```

The output of the example is as follows:

```sql
+------+------+
| 11 | 22 |
+------+------+
| 11 | 22 |
| 33 | 44 |
+------+------+
2 rows in set
```

```sql
obclient> VALUES ROW(11,22) UNION VALUES ROW(33,44);
```

The output of the example is as follows:

```sql
+----------+----------+
| column_0 | column_1 |
+----------+----------+
| 11 | 22 |
| 33 | 44 |
+----------+----------+
2 rows in set
```

+ 9
- 8
zh-CN/400.deploy/300.deploy-oceanbase-enterprise-edition/200.preparations-before-deploy/200.configure-servers.md View File

@@ -17,17 +17,18 @@

| 操作系统 | 支持版本 | 服务器类型 |
|----------------------------------------|---------|------------|
| CentOS/RHEL(Red Hat Enterprise Linux)| 7、8 | x86_64/ARM aarch64 |
| Rocky Linux | 9 | x86_64/ARM aarch64 |
| Anolis | 8 | x86_64/ARM aarch64 |
| Alibaba Cloud Linux | 2、3 | x86_64/ARM aarch64 |
| 麒麟 OS | V10、V11 | x86_64/ARM aarch64 |
| 龙蜥 AnolisOS | 8 | x86_64/ARM aarch64 |
| 麒麟 OS(KylinOS) | V10、V11 | x86_64/ARM aarch64 |
| 统信 UOS | V20 | x86_64/ARM aarch64 |
| 凝思 OS | V6.0.99、V6.0.100 | x86_64/ARM aarch64 |
| 中科方德 | 4.0 | x86_64/ARM aarch64 |
| 中科方德 NFSChina | 4.0 | x86_64/ARM aarch64 |
| CentOS/RHEL(Red Hat Enterprise Linux)| 7、8、9 | x86_64/ARM aarch64 |
| openSUSE | 12SP5 | x86_64/ARM aarch64 |
| Debian | 12 | x86_64/ARM aarch64 |
| openEuler | 20.03 LTS、22.03 LTS | x86_64/ARM aarch64 |
| 凝思 OS | V6.0.99、V6.0.100 | x86_64/ARM aarch64 |
| Ubuntu | 22.04 LTS、24.04 LTS | x86_64/ARM aarch64 |
| openSUSE | 12SP5 | x86_64/ARM aarch64 |

### OceanBase 数据库支持的操作系统

@@ -42,11 +43,11 @@
| 统信 UOS | V20 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 中科方德 NFSChina | 4.0 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 浪潮 Inspur kos | 5.8 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| CentOS / Red Hat Enterprise Linux | 7、8 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| CentOS / Red Hat Enterprise Linux | 7、8、9 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| SUSE Enterprise Linux | 12SP5 | x86_64(包括海光)|
| Debian | 12 | x86_64(包括海光)|
| openEuler | 20.03 LTS、22.03 LTS | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 凝思 LinxOS | V6.0.99、V6.0.100 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 凝思 Linux | V6.0.99、V6.0.100 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| Ubuntu | 22.04 LTS、24.04 LTS | x86_64(包括海光)|

<main id="notice" type='explain'>


+ 2
- 2
zh-CN/400.deploy/300.deploy-oceanbase-enterprise-edition/200.preparations-before-deploy/300.prepare-installation-packages.md View File

@@ -48,7 +48,7 @@
</tr>
<tr>
<td>OceanBase 数据库</td>
<td>OceanBase RPM 包</td>
<td>OceanBase RPM 包 <main id="notice" type='explain'><h4>说明</h4><p>对于 Debian/Ubuntu 的系统,可直接使用 RPM 包,由 OCP 来负责安装部署,不需要转换成 <code>.deb</code> 包。</p></main></td>
<td>用于部署 OceanBase 集群。</td>
<td><ul><li>X86_64 平台:
<ul><li>el7:oceanbase-x.x.x.x-xxxxxxxxxxxxxxxxxx.el7.x86_64.rpm
@@ -67,7 +67,7 @@
</tr>
<tr>
<td>OceanBase 数据库代理(可选)</td>
<td>ODP RPM 包</td>
<td>ODP RPM 包 <main id="notice" type='explain'><h4>说明</h4><p>对于 Debian/Ubuntu 的系统,可直接使用 RPM 包,由 OCP 来负责安装部署,不需要转换成 <code>.deb</code> 包。</p></main></td>
<td>用于部署代理服务。</td>
<td><ul><li>X86_64 平台:
<ul><li>el7:obproxy-x.x.x.x-xxxxxxxxxxxxxx.el7.x86_64.rpm


+ 21
- 21
zh-CN/400.deploy/500.deploy-oceanbase-database-community-edition/200.local-deployment/200.environment-and-configuration-checks/300.configure-the-clock-source-optional.md View File

@@ -96,27 +96,27 @@
```

3. 运行以下命令同步 NTP 服务端时间:
```shell
[root@test002 ~]# ntpdate 10.10.10.1
```
4. 编辑配置文件。
运行以下命令打开配置文件:
```shell
[root@test002 ~]# vi /etc/ntp.conf
```
在配置文件中添加以下内容:
```shell
server <your_ntp_server_ip>
```
5. 运行以下命令,启动 NTP 服务:
```shell
[root@test002 ~]# ntpdate 10.10.10.1
```
4. 编辑配置文件。
运行以下命令打开配置文件:
```shell
[root@test002 ~]# vi /etc/ntp.conf
```
在配置文件中添加以下内容:
```shell
server <your_ntp_server_ip>
```
5. 运行以下命令,启动 NTP 服务:
```shell
[root@test002 ~]# /etc/init.d/ntpd start
```


+ 21
- 21
zh-CN/400.deploy/500.deploy-oceanbase-database-community-edition/200.local-deployment/400.deploy-by-ui/100.deploy-by-obd.md View File

@@ -173,27 +173,27 @@
</thead>
<tr>
<td rowspan="3">数据库节点配置</td>
<td>Zone 名称</td>
<td>配置 OceanBase 数据库中的 Zone 名称,可自定义。Zone 名称需以英文字母开头,英文或数字结尾,可包含英文、数字和下划线,且长度在 2~32 个字符之间。部署多 Zone 的 OceanBase 集群必须有一个 Zone 与主 Zone 的 Region 相同。可单击 <b>+ 新增 Zone</b> 或对应 Zone 后的删除图标新增或删除 Zone。</td>
</tr>
<tr>
<td>OBServer 节点</td>
<td>配置 OceanBase 集群中的 OBServer 节点 IP,输入 IP 后单击键盘 Enter 可配置多个节点 IP。<main id="notice" type='notice'><h4>注意</h4><ul><li>禁止为不同的 Zone 输入相同的节点。</li><li><p>当 OBServer 节点配置为 <code>127.0.0.1</code> 时,此 OceanBase 集群不支持扩展为分布式集群和配置主备租户。</p></li></ul></main></td>
</tr>
<tr>
<td>RootServer 节点</td>
<td>可通过下拉框在 <b>OBServer 节点</b> 配置的 IP 中选择一个 IP 作为 OceanBase 集群的 RootServer 节点。对于多副本的 OceanBase 集群,其每个 Zone 都需指定一个 RootServer。</td>
</tr>
<tr>
<td rowspan="6">组件节点配置</td>
<td>OBProxy 节点</td>
<td>支持配置多个节点,既可通过下拉框选择 OBServer 节点 IP,也可输入新的节点 IP,建议使用非 <code>127.0.0.1</code> IP 地址。输入 IP 后单击键盘 Enter 即可配置多个节点 IP。</td>
</tr>
<tr>
<td>负载均衡管理</td>
<td>单击展开按钮可设置负载均衡,用于业务访问 OceanBase 集群,建议部署多节点 OBProxy 时提供 VIP/DNS 地址,避免后期更改 OBProxy 访问地址。若不配置,系统默认选择 <b>OBProxy 节点</b> 中配置的第一个 IP 地址设置连接串。您可通过 <b>访问方式</b> 下的下拉框选择使用 VIP 访问或使用 DNS(域名)访问:<ul><li>选择使用 VIP 访问时,您需配置 VIP 的 <b>IP 地址</b> 和 <b>访问端口</b>。</li><li>选择使用 DNS 访问时,您需配置对应 <b>域名</b>。</li></ul><main id="notice" type='notice'><h4>注意</h4><p>obd 不提供负载均衡的部署,如需设置负载均衡,请提前部署并配置好对应负载均衡。</p></main></td>
</tr>
<tr>
<td>Zone 名称</td>
<td>配置 OceanBase 数据库中的 Zone 名称,可自定义。Zone 名称需以英文字母开头,英文或数字结尾,可包含英文、数字和下划线,且长度在 2~32 个字符之间。部署多 Zone 的 OceanBase 集群必须有一个 Zone 与主 Zone 的 Region 相同。可单击 <b>+ 新增 Zone</b> 或对应 Zone 后的删除图标新增或删除 Zone。</td>
</tr>
<tr>
<td>OBServer 节点</td>
<td>配置 OceanBase 集群中的 OBServer 节点 IP,输入 IP 后单击键盘 Enter 可配置多个节点 IP。<main id="notice" type='notice'><h4>注意</h4><ul><li>禁止为不同的 Zone 输入相同的节点。</li><li><p>当 OBServer 节点配置为 <code>127.0.0.1</code> 时,此 OceanBase 集群不支持扩展为分布式集群和配置主备租户。</p></li></ul></main></td>
</tr>
<tr>
<td>RootServer 节点</td>
<td>可通过下拉框在 <b>OBServer 节点</b> 配置的 IP 中选择一个 IP 作为 OceanBase 集群的 RootServer 节点。对于多副本的 OceanBase 集群,其每个 Zone 都需指定一个 RootServer。</td>
</tr>
<tr>
<td rowspan="6">组件节点配置</td>
<td>OBProxy 节点</td>
<td>支持配置多个节点,既可通过下拉框选择 OBServer 节点 IP,也可输入新的节点 IP,建议使用非 <code>127.0.0.1</code> IP 地址。输入 IP 后单击键盘 Enter 即可配置多个节点 IP。</td>
</tr>
<tr>
<td>负载均衡管理</td>
<td>单击展开按钮可设置负载均衡,用于业务访问 OceanBase 集群,建议部署多节点 OBProxy 时提供 VIP/DNS 地址,避免后期更改 OBProxy 访问地址。若不配置,系统默认选择 <b>OBProxy 节点</b> 中配置的第一个 IP 地址设置连接串。您可通过 <b>访问方式</b> 下的下拉框选择使用 VIP 访问或使用 DNS(域名)访问:<ul><li>选择使用 VIP 访问时,您需配置 VIP 的 <b>IP 地址</b> 和 <b>访问端口</b>。</li><li>选择使用 DNS 访问时,您需配置对应 <b>域名</b>。</li></ul><main id="notice" type='notice'><h4>注意</h4><p>obd 不提供负载均衡的部署,如需设置负载均衡,请提前部署并配置好对应负载均衡。</p></main></td>
</tr>
<tr>
<td>Prometheus 节点</td>
<td>支持配置多个节点,既可通过下拉框选择 OBServer 节点 IP,也可输入新的节点 IP,建议使用非 <code>127.0.0.1</code> IP 地址。输入 IP 后单击键盘 Enter 即可配置多个节点 IP。</td>
</tr>


+ 29
- 17
zh-CN/600.manage/100.cluster-management/300.common-cluster-operations/1500.oceanbase-version-upgrade/200.upgrade-oceanbase-enterprise-edition/100.upgrade-overview.md View File

@@ -52,21 +52,29 @@ OceanBase 集群升级时,需要注意以下几点:
* 在升级过程中,不允许使用 `zlib` 作为 OBKV-Table 连接的压缩算法。请通过设置 `tableapi_transport_compress_func` 参数来选择其他的压缩算法。

* 在 ARM 架构和不支持 AVX2(Advanced Vector Extensions 2) 指令集的 x86 机型集群内,如果存在使用过列存表时(存在使用列存表或列存表修改为行存表的场景),不能从 V4.3 的低版本(V4.3.0、V4.3.1 和 V4.3.2)升级到 V4.3.3 及往后的版本,以防止升级后出现数据正确性风险。

* 当有 V4.3 的低版本集群升级到 V4.3.3 及往后的版本集群时,对于备租户,低版本集群无法解析高版本集群生成的日志,此时会在备租户提交日志时报错(仅报错,对应日志不会持久化)。恢复数据的详细信息,参见 [恢复前准备](../../../../600.backup-and-recovery/600.restore-data/100.preparation-before-recovery.md)。

* 在 V4.3.2 版本的集群中备份的租户无法在 V4.3.3 版本的集群中恢复。
* 备份恢复 V4.3.2 的版本,无法升级到 V4.3.3(V4.3.2 版本的备份,无法在 V4.3.3 版本恢复)版本。

## 升级说明

* 支持 V4.3.0 Beta 及之后 BP 版本、V4.3.1 Beta 及之后 BP 版本、V4.3.2 Beta Hotfix1 及之后 BP 版本、V4.3.3 GA 及之后 GA 版本、V4.3.4 GA 及之后 GA 版本(SN 模式),V4.3.5 GA 及之后 GA 版本(SN 模式),原地升级到 V4.4.0(SN 模式)。
* 不支持 V4.3.5 GA 及之后 GA 版本(SS 模式),平滑升级到 V4.4.0(SS 模式)。
* 暂不支持 V4.2.x 系列或更低版本升级到 V4.4.0,随着版本演进,后续会增加 V4.2.x 到 V4.4.x 升级路径支持。
* 自 V4.3.2 重构了多源数据的持久化格式,升级过程中需要对新旧多源数据格式进行转换,在分区数较多时需要预留相对充足的升级时间。
### 非共享存储模式

* 支持从 V4.4.0/V4.4.0 BP1/V4.4.1 版本平滑升级到 V4.5.0 版本。
* 没有使用向量索引的环境支持从 V4.3.0/V4.3.1/V4.3.2/V4.3.3/V4.3.4/V4.3.5/V4.3.5 BP1/V4.3.5 BP2 版本到 V4.5.0 版本的升级,但仅限于 POC 和测试环境,有一定的升级风险,如果升级遇到问题环境可能需要重建。
* 使用了向量索引的环境从 V4.3.0/V4.3.1/V4.3.2/V4.3.3/V4.3.4/V4.3.5/V4.3.5 BP1/V4.3.5 BP2 升级到 V4.5.0 版本,请联系 OceanBase 数据库技术人员进行评估。
* 不支持 V4.2.x 系列或更低版本升级到 V4.5.0 版本。

### 共享存储模式

* 支持从 V4.4.0 BP1/V4.4.1/V4.4.1 hotfix1~3 升级到 V4.5.0 版本,租户单副本部署升级会停服务。
* 对于使用 V4.4.1 hotfix4、V4.4.1 hotfix5 的集群不建议升级到 V4.5.0 版本。
* 不支持从 V4.3.5 BP2/V4.4.0 升级到 V4.5.0 版本。
* 从 V4.4.0 BP1 升级 V4.5.0 版本,需要先升级对应的 logservice 集群到 V1.1.0 版本。

## 升级路径图

![42111-4254-440](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/observer-enterprise/V4.4.0/600.manage/100.cluster-management/1500.oceanbase-version-upgrade/3-42111-4254-440.png)
![4257-4355-450](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/observer-enterprise/V4.3.5/1500.oceanbase-version-upgrade/5-4257-4355-450-3.png)

<main id="notice" type='explain'>
<h4>说明</h4>
@@ -75,21 +83,25 @@ OceanBase 集群升级时,需要注意以下几点:

**升级路径图含义如下:**

* V4.2.x 的路径:
* V4.2.x 版本的路径:

* V4.0.0.0/V4.1.0.0-V4.1.0.2/V4.2.0.0 版本可以升级到 V4.2.1.11 版本,然后再升级至 V4.2.5.7 版本。
* V4.2.2-V4.2.4 可以直接升级到 V4.2.5.7 版本,也可以先升级到 V4.2.5.0-V4.2.5.6 版本,然后再升级至 V4.2.5.7 版本。
* barrier 版本:V4.2.1.11、V4.2.5.7。

* V4.3.x 版本的升级路径:

* V4.2.1.2 至 V4.2.1.9 的版本可以升级到 V4.2.1.10 再升级到 V4.2.5.1。
* V4.2.1.2 至 V4.2.1.9 的版本可以升级到 V4.2.1.11 再升级到 V4.2.5.3 及后续的 V4.2.5 系列版本。
* barrier 版本:V4.2.1.2、V4.2.1.10 和 V4.2.1.11。
* V4.3.x 各版本都可以升级直接到 V4.3.5.5 版本。
* 暂不支持 V4.2.x 系列或更低版本升级到 V4.3.x 版本。

* V4.3.x 的升级路径:
* V4.4.x 版本的升级路径:

* V4.3.x 的版本都可以升级到下一个 GA 版本,最终升级到 V4.3.5。
* V4.3.x 的版本都可以直接升级到 V4.3.5。
* 备份恢复 V4.3.2 的版本,无法升级到 V4.3.3(V4.3.2 版本的备份,无法在 V4.3.3 版本恢复)版本。
* V4.4.0-V4.4.0.1 版本可以升级到 V4.4.1 版本。
* 暂不支持 V4.2.x 系列或更低版本升级到 V4.4.1 版本。

* V4.4.x 的升级路径:
* V4.5.x 的升级路径:

* V4.3.x 的版本,可以直接升级到 V4.4.0 版本。
* V4.4.0-V4.4.1 版本可以升级到 V4.5.0 版本。

## 后续操作



+ 1
- 1
zh-CN/600.manage/900.performance-tuning/400.sql-tuning/200.execution-plan-optimization/400.join-order-and-join-algorithm/200.join-algorithm/100.nested-loops-joins.md View File

@@ -60,7 +60,7 @@ Outputs & filters:

## 如何控制优化器使用 Nested Loops Joins

最直接的控制手段就是通过hint指定联接算法,可以通过使用 `USE_NL` 指示优化器使用 Nested Loops Join 算法。通常还需要配合使用 `LEADINGhint`,因为指定 Nested Loops Join 算法之后计划的成本可能不是最低的,会被其他成本更低的计划(联接次序不同)覆盖。`USE_NL` 的参数为联接的右表。
最直接的控制手段就是通过hint指定联接算法,可以通过使用 `USE_NL` 指示优化器使用 Nested Loops Join 算法。通常还需要配合使用 `LEADING` Hint,因为指定 Nested Loops Join 算法之后计划的成本可能不是最低的,会被其他成本更低的计划(联接次序不同)覆盖。`USE_NL` 的参数为联接的右表。

使用示例。在默认情况下,优化器自主选择了 Hash Join 算法。



+ 1
- 1
zh-CN/600.manage/900.performance-tuning/400.sql-tuning/200.execution-plan-optimization/400.join-order-and-join-algorithm/200.join-algorithm/300.merge-join.md View File

@@ -33,7 +33,7 @@ Merge Join 同样适合大数据量的联接,如果联接两侧的数据源都

## 如何控制优化器使用 Merge Join

最直接的控制手段就是通过 hint 指定联接算法,可以通过使用 `USE_MERGE` 指示优化器使用 Merge Join 算法。通常还需要配合使用 `LEADINGhint`,因为指定 Merge Join 算法之后计划的成本可能不是最低的,会被其他成本更低的计划(联接次序不同)覆盖。`USE_MERGE` 的参数为联接的右表。
最直接的控制手段就是通过 hint 指定联接算法,可以通过使用 `USE_MERGE` 指示优化器使用 Merge Join 算法。通常还需要配合使用 `LEADING` Hint,因为指定 Merge Join 算法之后计划的成本可能不是最低的,会被其他成本更低的计划(联接次序不同)覆盖。`USE_MERGE` 的参数为联接的右表。

使用示例。在默认情况下,优化器自主选择了 Hash Join 算法。



+ 1
- 0
zh-CN/640.ob-vector-search/200.ob-vector-index/300.ob-dense-vector-index/200.ob-hnsw-index.md View File

@@ -20,6 +20,7 @@ HNSW 系列索引包含 HNSW、HNSW_SQ 和 HNSW_BQ 三种索引,其创建支
* 如果数据量较大,建议先写完数据,再创建索引,以获得最佳搜索性能。
* HNSW_SQ 索引建议在写入数据后再创建索引,并在写入较多增量数据后进行索引重建。每个索引具体的创建说明见下文具体示例。
* 创建 HNSW 索引时,索引名长度暂不支持超过 25 个字符,否则可能因为索引辅助表名长度超过 `index_name` 限制导致异常。未来版本会支持更长的索引名。
* 建议在堆表上创建 HNSW 系列索引,以获得最佳搜索性能。

:::tab
tab 建表时创建


+ 5
- 0
zh-CN/640.ob-vector-search/350.ob-vector-hybrid-search/200.ob-vector-index-hybrid-search.md View File

@@ -24,6 +24,11 @@

## 使用场景说明及示例

<main id="notice" type='notice'>
<h4>注意</h4>
<p>建议在堆表上使用混合搜索接口,,以获得更好的性能和功能支持。</p>
</main>

### 创建示例表并插入数据

为了演示混合搜索功能,本节将创建以下几张示例表并插入数据,这些表将用于下文不同场景的搜索示例。


+ 30
- 30
zh-CN/690.practical-tutorial/200.building-an-intelligent-question-answering-robot-based-on-OceanBase.md View File

@@ -1,12 +1,12 @@
# 基于 OceanBase 构建智能问答机器人
## 背景信息
在当今信息爆炸的时代,用户常需要从海量数据中迅速搜索所需信息。例如在线文献数据库、电商平台产品目录、以及不断增长的多媒体内容库,都需要高效的搜索系统来快速定位到用户感兴趣的内容。随着数据量不断激增,传统的基于关键字的搜索方法已经无法满足用户对于搜索精度和速度的需求,向量搜索技术应运而生。它通过将文本、图片、音频等不同类型的数据编码为数学上的向量,并在向量空间中进行搜索。这种方法允许系统捕捉数据的深层次语义信息,从而提供更为准确和高效的搜索结果。
本文通过 OceanBase 的向量搜索能力构建文档智能助手。
## 文档智能助手架构
# 基于 OceanBase 构建智能问答机器人
## 背景信息
在当今信息爆炸的时代,用户常需要从海量数据中迅速搜索所需信息。例如在线文献数据库、电商平台产品目录、以及不断增长的多媒体内容库,都需要高效的搜索系统来快速定位到用户感兴趣的内容。随着数据量不断激增,传统的基于关键字的搜索方法已经无法满足用户对于搜索精度和速度的需求,向量搜索技术应运而生。它通过将文本、图片、音频等不同类型的数据编码为数学上的向量,并在向量空间中进行搜索。这种方法允许系统捕捉数据的深层次语义信息,从而提供更为准确和高效的搜索结果。
本文通过 OceanBase 的向量搜索能力构建文档智能助手。
## 文档智能助手架构

文档智能助手将文档以向量的形式批量存储在 OceanBase 数据库内。用户通过 UI 界面提问,程序使用 BGE-M3 模型将提问内容嵌入成为向量并在数据库中搜索相似向量,得到相似向量对应的文档内容后,应用将它们会同用户提问一起发送给 LLM,LLM 会根据提供的文档生成更加准确的回答。

@@ -81,27 +81,27 @@ cp .env.example .env
vi .env
```

### 连接数据库
您可使用我们准备好的脚本来尝试连接数据库,以确保数据库相关的环境变量设置成功:
```bash
bash utils/connect_db.sh
# 如果顺利进入 MySQL 连接当中,则验证了环境变量设置成功
```
### 准备文档语料
在该步骤中,我们将克隆 OceanBase 相关组件的开源文档仓库并处理它们,生成文档的向量数据和其他结构化数据后将数据插入到 OceanBase 数据库。
1. 克隆并处理文档仓库
<main id="notice" type='notice'>
<h4>注意</h4>
<p>此步骤需下载和处理大量 OceanBase 文档,会花费较长时间。</p>
</main>
```shell
### 连接数据库
您可使用我们准备好的脚本来尝试连接数据库,以确保数据库相关的环境变量设置成功:
```bash
bash utils/connect_db.sh
# 如果顺利进入 MySQL 连接当中,则验证了环境变量设置成功
```
### 准备文档语料
在该步骤中,我们将克隆 OceanBase 相关组件的开源文档仓库并处理它们,生成文档的向量数据和其他结构化数据后将数据插入到 OceanBase 数据库。
1. 克隆并处理文档仓库
<main id="notice" type='notice'>
<h4>注意</h4>
<p>此步骤需下载和处理大量 OceanBase 文档,会花费较长时间。</p>
</main>
```shell
git clone --single-branch --branch V4.3.3 https://github.com/oceanbase/oceanbase-doc.git doc_repos/oceanbase-doc
# 如果您访问 Github 仓库速度较慢,可以使用以下命令克隆 Gitee 的镜像版本
git clone --single-branch --branch V4.3.4 https://gitee.com/oceanbase-devhub/oceanbase-doc.git doc_repos/oceanbase-doc


+ 1
- 1
zh-CN/700.reference/1000.performance-tuning-guide/500.sql-optimization/400.sql-optimization/400.optimizer-statistics/200.statistics-collection-methods/400.collect-statistics-automatically.md View File

@@ -81,7 +81,7 @@ DML STATS 用于记录一张表做增、删、改的次数。

## 自动统计信息收集策略

OceanBase 数据库中表的统计信息过期判断标准为,如果当前表增量的 DML 次数(上一次收集统计信息时 DML 次数到本次收集统计信息期间发生的增/删/改总次数)超过设置的阈值时就会过期。阈值的默认值是 10%,阈值可以通过 peres 调整设置,详细信息请参见 [收集策略配置项(Prefs)管理功能](../300.statistics-management/700.collection-policy-configuration-items-prefs-management.md)。
OceanBase 数据库中表的统计信息过期判断标准为,如果当前表增量的 DML 次数(上一次收集统计信息时 DML 次数到本次收集统计信息期间发生的增/删/改总次数)超过设置的阈值时就会过期。阈值的默认值是 10%,阈值可以通过 prefs 调整设置,详细信息请参见 [收集策略配置项(Prefs)管理功能](../300.statistics-management/700.collection-policy-configuration-items-prefs-management.md)。

目前 OceanBase 数据库优化器的自动统计信息收集策略如下:



+ 1
- 3
zh-CN/700.reference/1000.performance-tuning-guide/500.sql-optimization/400.sql-optimization/700.manage-execution-plans/200.plan-binding.md View File

@@ -1,8 +1,6 @@
# 计划绑定

通过对某条 SQL 创建 Outline 可实现计划绑定。

在系统上线前,可以直接在 SQL 语句中添加 Hint,控制优化器按 Hint 指定的行为进行计划生成。
OceanBase 数据库通过 `CREATE OUTLINE` 语句将某条 SQL 语句与特定的执行计划进行绑定,从而保证该 SQL 在后续执行时始终使用指定的执行计划,避免因优化器选择不当导致性能波动。即通过对某条 SQL 创建 Outline 可实现计划绑定,在系统上线前,可以直接在 SQL 语句中添加 Hint,控制优化器按 Hint 指定的行为进行计划生成。

但对于已上线的业务,如果出现优化器选择的计划不够优化时,则需要在线进行计划绑定,即无需业务进行 SQL 更改,而是通过 DDL 操作将一组 Hint 加入到 SQL 中,从而使优化器根据指定的一组 Hint,对该 SQL 生成更优计划。该组 Hint 称为 Outline。



+ 21
- 21
zh-CN/700.reference/300.database-object-management/100.manage-object-of-mysql-mode/1000.manage-catalog-of-mysql-mode/200.create-catalog-of-mysql-mode.md View File

@@ -92,27 +92,27 @@ obclient> CREATE EXTERNAL CATALOG test_odps_catalog
```
## 创建 HMS 类型的 External Catalog
OceanBase 数据库通过 HMS Catalog 功能,实现对 Hive 元数据(Metastore)的统一管理。通过 HMS Catalog,OceanBase 可直接访问 Hive 表对应的 HDFS 存储路径中的数据,支持高效的数据湖查询与分析。
<main id="notice" type='notice'>
<h4>注意</h4>
<p>创建 HMS Catalog 前,如果 HMS 预期访问底层存储的文件数据在 HDFS 上,则需要完成 Java SDK 环境部署。有关配置 JAVA SDK 环境的详细信息,参见 <a href="../../../../400.deploy/300.deploy-oceanbase-enterprise-edition/500.deploy-the-ob-java-sdk-environment.md">部署 OceanBase 数据库 JAVA SDK 环境</a>。</p>
</main>
### HMS Catalog 支持情况
当前版本 HMS Catalog 支持 Hive 和 Iceberg 两种表格式,支持读取 Hive 和 Iceberg 的统计信息,优化 SQL Plan。
#### Hive 格式支持情况
当前版本支持 `Parquet`、`ORC`、`Textfile`、`OpenCSV` 四种格式。
<main id="notice" type='explain'>
<h4>说明</h4>
<p>复杂类型当前版本仅支持了 <code>Parquet</code> 格式的 <code>ARRAY</code> 类型。</p>
</main>
OceanBase 数据库通过 HMS Catalog 功能,实现对 Hive 元数据(Metastore)的统一管理。通过 HMS Catalog,OceanBase 可直接访问 Hive 表对应的 HDFS 存储路径中的数据,支持高效的数据湖查询与分析。
<main id="notice" type='notice'>
<h4>注意</h4>
<p>创建 HMS Catalog 前,如果 HMS 预期访问底层存储的文件数据在 HDFS 上,则需要完成 Java SDK 环境部署。有关配置 JAVA SDK 环境的详细信息,参见 <a href="../../../../400.deploy/300.deploy-oceanbase-enterprise-edition/500.deploy-the-ob-java-sdk-environment.md">部署 OceanBase 数据库 JAVA SDK 环境</a>。</p>
</main>
### HMS Catalog 支持情况
当前版本 HMS Catalog 支持 Hive 和 Iceberg 两种表格式,支持读取 Hive 和 Iceberg 的统计信息,优化 SQL Plan。
#### Hive 格式支持情况
当前版本支持 `Parquet`、`ORC`、`Textfile`、`OpenCSV` 四种格式。
<main id="notice" type='explain'>
<h4>说明</h4>
<p>复杂类型当前版本仅支持了 <code>Parquet</code> 格式的 <code>ARRAY</code> 类型。</p>
</main>
#### Iceberg 支持情况

当前版本支持 Iceberg V1 和 V2 两种版本。


+ 1
- 1
zh-CN/700.reference/300.database-object-management/100.manage-object-of-mysql-mode/300.manage-partitions-of-mysql-mode/100.partition-overview-of-mysql-mode.md View File

@@ -218,7 +218,7 @@ Key 分区有如下特点:

* [TIME_TO_USEC\(\)](../../../500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/400.functions-of-mysql-mode/200.single-row-functions-of-mysql-mode/100.date-and-time-functions-of-mysql-mode/4300.time-to-usec-of-mysql-mode.md)

* [UNIX_TIMESATMP\(\)](../../../500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/400.functions-of-mysql-mode/200.single-row-functions-of-mysql-mode/100.date-and-time-functions-of-mysql-mode/5000.unix-timestamp-of-mysql-mode.md)
* [UNIX_TIMESTAMP\(\)](../../../500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/400.functions-of-mysql-mode/200.single-row-functions-of-mysql-mode/100.date-and-time-functions-of-mysql-mode/5000.unix-timestamp-of-mysql-mode.md)

* [WEEKDAY\(\)](../../../500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/400.functions-of-mysql-mode/200.single-row-functions-of-mysql-mode/100.date-and-time-functions-of-mysql-mode/5600.weekday-of-mysql-mode.md)



+ 25
- 24
zh-CN/700.reference/300.database-object-management/100.manage-object-of-mysql-mode/600.manage-views-of-mysql-mode/200.manage-materialized-views-of-mysql-mode/300.create-materialized-views-of-mysql-mode.md View File

@@ -127,30 +127,31 @@ CREATE MATERIALIZED VIEW view_name [([column_list] [PRIMARY KEY(column_list)])]
CREATE MATERIALIZED VIEW mv_mv1_tbl3_tbl4
REFRESH COMPLETE
AS SELECT SUM(AGE) age_sum
FROM mv1_tbl3_tbl4;
```
### 创建实时物化视图
创建物化视图时,指定 `ENABLE ON QUERY COMPUTATION` 子句创建实时物化视图。
#### 实时物化视图注意事项
* 在创建实时物化视图前,物化视图依赖的基表都需要创建物化视图日志。
* 只有特定类型的物化视图支持指定为实时物化视图,对于不满足条件的物化视图指定实时物化视图时,会导致报错。实时物化视图的要求与增量刷新的物化视图要求是相同的。详细信息,参见 [刷新物化视图](400.refresh-materialized-views-of-mysql-mode.md) 中 **增量刷新基本要求** 内容。
* 如果一个物化视图(嵌套物化视图)是实时物化视图,则需要先对下层物化视图进行增量刷新来更新 mlog。由于实时物化视图的查询结果是通过模拟 mlog 的方式去查询下层物化视图和自身结果进行合并。因此,需要先对下层物化视图进行增量刷新来更新 mlog,以此保证实时物化视图的数据是最新的。
**示例如下:**
1. 创建表 `tbl2` 作为物化视图的基表。
```sql
CREATE TABLE tbl2(col1 INT, col2 INT, col3 INT);
```
2. 在 `tbl2` 表上创建物化视图日志。
```sql
FROM mv1_tbl3_tbl4;
```

### 创建实时物化视图

创建物化视图时,指定 `ENABLE ON QUERY COMPUTATION` 子句创建实时物化视图。

#### 实时物化视图注意事项

* 在创建实时物化视图前,物化视图依赖的基表都需要创建物化视图日志。
* 只有特定类型的物化视图支持指定为实时物化视图,对于不满足条件的物化视图指定实时物化视图时,会导致报错。实时物化视图的要求与增量刷新的物化视图要求是相同的。详细信息,参见 [刷新物化视图](400.refresh-materialized-views-of-mysql-mode.md) 中 **增量刷新基本要求** 内容。
* 如果一个物化视图(嵌套物化视图)是实时物化视图,则需要先对下层物化视图进行增量刷新来更新 mlog。由于实时物化视图的查询结果是通过模拟 mlog 的方式去查询下层物化视图和自身结果进行合并。因此,需要先对下层物化视图进行增量刷新来更新 mlog,以此保证实时物化视图的数据是最新的。
* 当执行查询的 Session 上的系统变量值和创建物化视图时固化在物化视图中的 Session 变量不一致时,需要将 Session 上的系统变量值修改为实时物化视图中固化的 Session 变量值,否则实时物化视图不可用,即实时物化视图查询改写不生效或直接查询实时物化视图会报错。

**示例如下:**

1. 创建表 `tbl2` 作为物化视图的基表。

```sql
CREATE TABLE tbl2(col1 INT, col2 INT, col3 INT);
```

2. 在 `tbl2` 表上创建物化视图日志。

```sql
CREATE MATERIALIZED VIEW LOG ON tbl2
WITH PRIMARY KEY, ROWID, SEQUENCE (col1, col2, col3) INCLUDING NEW VALUES;
```


+ 25
- 24
zh-CN/700.reference/300.database-object-management/200.manage-object-of-oracle-mode/500.manage-views-of-oracle-mode/200.manage-materialized-views-of-oracle-mode/300.create-materialized-views-of-oracle-mode.md View File

@@ -139,30 +139,31 @@ CREATE MATERIALIZED VIEW view_name [([column_list] [PRIMARY KEY(column_list)])]
### 创建实时物化视图
创建物化视图时,指定 `ENABLE ON QUERY COMPUTATION` 子句创建实时物化视图。
<main id="notice" type='notice'>
<h4>注意</h4>
<p>OceanBase 数据库 Oracle 模式下,创建实时物化视图必须指定刷新方式(<code>refresh_clause</code>)。</p>
</main>
### 创建实时物化视图注意事项
* 在创建实时物化视图前,物化视图依赖的基表都需要创建物化视图日志。
* 只有特定类型的物化视图支持指定为实时物化视图,对于不满足条件的物化视图指定实时物化视图时,会导致报错。实时物化视图的要求与增量刷新的物化视图要求是相同的。详细信息,参见 [刷新物化视图](400.refresh-materialized-views-of-oracle-mode.md) 中 **增量刷新基本要求** 内容。
* 如果一个物化视图(嵌套物化视图)是实时物化视图,则需要先对下层物化视图进行增量刷新来更新 mlog。由于实时物化视图的查询结果是通过模拟 mlog 的方式去查询下层物化视图和自身结果进行合并。因此,需要先对下层物化视图进行增量刷新来更新 mlog,以此保证实时物化视图的数据是最新的。
**示例如下:**
1. 创建表 `tbl2` 作为物化视图的基表。
```sql
CREATE TABLE tbl2(col1 INT, col2 INT, col3 INT);
```
2. 在 `tbl2` 表上创建物化视图日志。
```sql
创建物化视图时,指定 `ENABLE ON QUERY COMPUTATION` 子句创建实时物化视图。

<main id="notice" type='notice'>
<h4>注意</h4>
<p>OceanBase 数据库 Oracle 模式下,创建实时物化视图必须指定刷新方式(<code>refresh_clause</code>)。</p>
</main>

### 创建实时物化视图注意事项

* 在创建实时物化视图前,物化视图依赖的基表都需要创建物化视图日志。
* 只有特定类型的物化视图支持指定为实时物化视图,对于不满足条件的物化视图指定实时物化视图时,会导致报错。实时物化视图的要求与增量刷新的物化视图要求是相同的。详细信息,参见 [刷新物化视图](400.refresh-materialized-views-of-oracle-mode.md) 中 **增量刷新基本要求** 内容。
* 如果一个物化视图(嵌套物化视图)是实时物化视图,则需要先对下层物化视图进行增量刷新来更新 mlog。由于实时物化视图的查询结果是通过模拟 mlog 的方式去查询下层物化视图和自身结果进行合并。因此,需要先对下层物化视图进行增量刷新来更新 mlog,以此保证实时物化视图的数据是最新的。
* 当执行查询的 Session 上的系统变量值和创建物化视图时固化在物化视图中的 Session 变量不一致时,需要将 Session 上的系统变量值修改为实时物化视图中固化的 Session 变量值,否则实时物化视图不可用,即实时物化视图查询改写不生效或直接查询实时物化视图会报错。

**示例如下:**

1. 创建表 `tbl2` 作为物化视图的基表。

```sql
CREATE TABLE tbl2(col1 INT, col2 INT, col3 INT);
```

2. 在 `tbl2` 表上创建物化视图日志。

```sql
CREATE MATERIALIZED VIEW LOG ON tbl2
WITH PRIMARY KEY, ROWID, SEQUENCE (col1, col2, col3) INCLUDING NEW VALUES;
```


+ 15
- 0
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/2230.create-location-of-mysql-mode-in-sql.md View File

@@ -160,6 +160,21 @@ CREATE [OR REPLACE] LOCATION location_name
);
```

* 未启用 Kerberos,但 HDFS 为高可用(HA)模式。

<main id="notice" type='explain'>
<h4>说明</h4>
<p>未启用 Kerberos,但 HDFS 为高可用(HA)模式,无需设置 <code>PRINCIPAL</code>、<code>KEYTAB</code> 和 <code>KRB5CONF</code> 参数。</p>
</main>

```shell
CREATE LOCATION hdfs_location_ha
URL = 'hdfs://${nameservice id}'
CREDENTIAL (
CONFIGS = 'dfs.nameservices=${nameservice id}#dfs.ha.namenodes.${nameservice id}=${namenode1}, ${namenode2}#dfs.namenode.rpc-address.${nameservice id}.${namenode1}=${namenode 1 address}#dfs.namenode.rpc-address.${nameservice id}.${namenode2}=${namenode 2 address}#dfs.ha.automatic-failover.enabled.${nameservice id}=true#dfs.client.failover.proxy.provider.${nameservice id}=org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'
);
```

## 相关文档

* 关于查看 Location 对象下文件的介绍信息,参见 [SHOW](8700.show-of-mysql-mode.md)。


+ 4
- 0
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/2300.create-outline-of-mysql-mode.md View File

@@ -62,3 +62,7 @@
ON 'ED570339F2C856BA96008A29EDF04C74'
USING HINT /*+ index(t1 idx_c2)*/ ;
```

## 相关文档

[计划绑定](../../../../1000.performance-tuning-guide/500.sql-optimization/400.sql-optimization/700.manage-execution-plans/200.plan-binding.md)

+ 4
- 5
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8400.set-names-of-mysql-mode.md View File

@@ -20,9 +20,9 @@ SET NAMES charset_name [COLLATE collation_name]

## 参数解释

| 参数 | 描述 |
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| charset_name | 指定表中列的默认字符集,可使用字符集如下: <ul><li> `binary` </li><li> `utf8mb4` </li><li> `gbk` </li><li> `utf16` </li><li> `gb18030` </li></ul> |
| 参数 | 描述 |
|----------------|-----------------------------|
| charset_name | 指定表中列的默认字符集,可使用字符集如下: <ul><li> `binary` </li><li> `utf8mb4` </li><li> `gbk` </li><li> `utf16` </li><li> `gb18030` </li></ul> |
| collation_name | 指定表中列的默认字符序,可使用字符序如下: <ul><li> `binary` </li><li> `gbk_bin` </li><li> `gbk_chinese_ci` </li><li> `utf8mb4_general_ci` </li><li> `utf8mb4__general_cs` </li><li> `utf8mb4_bin` </li><li> `utf8mb4_unicode_ci` </li><li> `utf16_general_ci` </li><li> `utf16_bin` </li><li> `utf16_unicode_ci` </li><li> `gb18030_chinese_ci` </li><li> `gb18030_bin` </li></ul> |

## 示例
@@ -31,5 +31,4 @@ SET NAMES charset_name [COLLATE collation_name]

```sql
obclient> SET NAMES gbk COLLATE gbk_bin;
Query OK, 0 rows affected
```
```

+ 5
- 7
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8500.set-password-of-mysql-mode.md View File

@@ -15,7 +15,7 @@
## 语法

```sql
SET PASSWORD [FOR user] = password_option;
SET PASSWORD [FOR user] = password_option

password_option: {
PASSWORD('authstring')
@@ -25,10 +25,10 @@ PASSWORD('authstring')

## 参数解释

| **参数** | **描述** |
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| 参数 | 描述 |
|----------|-----------------------------|
| FOR user | 如果没有 `FOR user` 子句,表示修改当前用户的密码。任何成功登录的用户都可以修改当前用户的密码。 如果有 `FOR user` 子句,表示修改指定用户的密码。必须拥有全局(MySQL 库)的 `CREATE USER` 权限,才可以修改指定用户的密码。 |
|password|默认 `password` 为明文传输, 会在内核做一次编码。|
|password_option | 密码选项。可以使用 `PASSWORD('authstring')` 指定明文密码,系统会自动进行编码;也可以直接使用 `'hashstring'` 指定已加密的哈希字符串。|

## 示例

@@ -36,12 +36,10 @@ PASSWORD('authstring')

```sql
obclient> SET PASSWORD = PASSWORD('**1***');
Query OK, 0 rows affected
```

* 修改 `sqluser01` 用户的密码。

```sql
obclient> SET PASSWORD FOR sqluser01 = PASSWORD('**2***');
Query OK, 0 rows affected
```
```

+ 11
- 11
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8600.set-transaction-of-mysql-mode.md View File

@@ -25,7 +25,7 @@ OceanBase 数据库的 MySQL 模式支持读已提交、可重复读两种隔离
## 语法

```sql
SET [GLOBAL | SESSION | LOCAL] TRANSACTION trans_opt;
SET [GLOBAL | SESSION | LOCAL] TRANSACTION trans_opt

trans_opt:
transaction_access_mode
@@ -38,8 +38,8 @@ transaction_access_mode:

isolation_level:
ISOLATION LEVEL {
READ UNCOMMITED
| READ COMMITED
READ UNCOMMITTED
| READ COMMITTED
| REPEATABLE READ
| SERIALIZABLE
}
@@ -47,14 +47,14 @@ isolation_level:

## 参数解释

| 参数 | 描述 |
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 参数 | 描述 |
|----------------|--------------|
| GLOBAL \| SESSION \| LOCAL | 声明事务隔离级别的生效范围,默认为空。 <ul><li> `GLOBAL`:适用于所有后续会话,当前会话不受影响。 </li><li> `SESSION | LOCAL`:适用于当前会话中执行的所有后续事务,不影响当前正在进行的事务,如果在事务之间执行,该语句将覆盖任何先前设置命名特征的下一个事务值的语句。 </li><li> 无声明:适用于会话中执行的下一个单个事务,后续事务恢复使用命名特征的会话值。</li></ul> |
| READ ONLY \| READ WRITE | 指定事务的读写模式。 |
| READ UNCOMMITED | 指定事务隔离级别为读未提交。<br> **说明** 当前版本暂不支持将事务隔离级别设置为读未提交。 |
| READ COMMITED | 指定事务隔离级别为读已提交。 |
| REPEATABLE READ | 指定事务隔离级别为可重复读。 |
| SERIALIZABLE | 指定事务隔离级别为可串行化。 <br>**说明** OceanBase 数据库不支持将 sys 租户的事务隔离级别设置为可串行化,这是由于不能在 sys 租户开启全局时间戳(GTS)。 |
| READ ONLY \| READ WRITE | 指定事务的读写模式。 |
| READ UNCOMMITTED | 指定事务隔离级别为读未提交。<br> **说明** 当前版本暂不支持将事务隔离级别设置为读未提交。 |
| READ COMMITTED | 指定事务隔离级别为读已提交。 |
| REPEATABLE READ | 指定事务隔离级别为可重复读。 |
| SERIALIZABLE | 指定事务隔离级别为可串行化。 <br>**说明** OceanBase 数据库不支持将 sys 租户的事务隔离级别设置为可串行化,这是由于不能在 sys |

## 示例

@@ -68,4 +68,4 @@ isolation_level:

```sql
obclient> SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
```
```

+ 43
- 14
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8700.show-of-mysql-mode.md
File diff suppressed because it is too large
View File


+ 18
- 18
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/8800.transaction-of-mysql-mode.md View File

@@ -29,54 +29,54 @@ transaction_stmt:

## 参数解释

| **参数** | **描述** |
|-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 参数 | 描述 |
|----------------|--------------|
| START TRANSACTION \[READ ONLY \| READ WRITE\] | 开启事务语句。一旦开启事务,则随后的 SQL 数据操作语句(即 `INSERT` 、`UPDATE` 、`DELETE`等)直到显式提交时才会生效。`READ ONLY` 表示事务是只读方式开启,事务内不允许执行修改操作。`READ WRITE` 表示事务是读写方式开启,默认就是此种模式。 |
| BEGIN | `BEGIN` 和 `BEGIN WORK` 被作为 `START TRANSACTION` 的别名。 |
| COMMIT | 提交当前事务。 |
| ROLLBACK | 回滚当前事务。 |
| SET TRANSACTION {READ ONLY \| READ WRITE} | 将当前事务设置成 `READ ONLY` 或者 `READ WRITE` 模式。 |
| BEGIN | `BEGIN` 和 `BEGIN WORK` 被作为 `START TRANSACTION` 的别名。 |
| COMMIT | 提交当前事务。 |
| ROLLBACK | 回滚当前事务。 |
| SET TRANSACTION {READ ONLY \| READ WRITE} | 将当前事务设置成 `READ ONLY` 或者 `READ WRITE` 模式。|

## 示例

* 假设现有表 `a` 如下所示。
假设现有表 `a` 如下所示。

| id | name | num | sell_date |
|----|------|-----|---------------------|
| 1 | a | 100 | 2013-06-21 10:06:43 |
| 2 | b | 200 | 2013-06-21 13:07:21 |
| 3 | a | 50 | 2013-06-21 13:08:15 |
```sql
| id | name | num | sell_date |
|----|------|-----|---------------------|
| 1 | a | 100 | 2013-06-21 10:06:43 |
| 2 | b | 200 | 2013-06-21 13:07:21 |
| 3 | a | 50 | 2013-06-21 13:08:15 |
```

1. 依次执行以下命令开始执行事务,将 `id` 为 `3` 的 `name` 改为 `c`,并插入一行当前卖出 `a` 的记录。

```sql
obclient> START TRANSACTION;
Query OK, 0 rows affected

obclient> UPDATE a SET name = 'c' WHERE id = 3;
Query OK, 1 rows affected

obclient> INSERT INTO a VALUES (4, 'a', 30, '2013-06-21 16:09:13');
Query OK, 1 rows affected

obclient> COMMIT;
Query OK, 0 rows affected
```

2. 事务提交后,执行命令查看表 `a` 信息。

```sql
SELECT * FROM a;
obclient> SELECT * FROM a;
```

结果如下:

```sql
| id | name | num | sell_date |
|----|------|-----|---------------------|
| 1 | a | 100 | 2013-06-21 10:06:43 |
| 2 | b | 200 | 2013-06-21 13:07:21 |
| 3 | c | 50 | 2013-06-21 13:08:15 |
| 4 | a | 30 | 2013-06-21 16:09:13 |
```

<main id="notice" type='notice'>
<h4>注意</h4>
@@ -85,4 +85,4 @@ transaction_stmt:
<li>本事务 Session 的访问能读到最新的结果,本事务 Session 之外的访问结果肯定是没有生效,在事务还没有 <code>COMMIT</code> 前,之前做的操作除当前事务连接之外都是不可见的。</li>
<li>如果想回滚该事务,直接用 <code>ROLLBACK</code> 代替 <code>COMMIT</code>。</li>
</ul>
</main>
</main>

+ 14
- 7
zh-CN/700.reference/500.sql-reference/100.sql-syntax/200.common-tenant-of-mysql-mode/600.sql-statement-of-mysql-mode/9200.value-of-mysql-mode.md View File

@@ -41,13 +41,13 @@ column_designator:

* 使用 `VALUES` 输出是一张表并按指定列 `column_0` 排序。

```shell
```sql
obclient> VALUES ROW(4,6,8), ROW(5,7,9), ROW(1,-2,3) ORDER BY column_0;
```

示例的输出结果如下:

```shell
```sql
+----------+----------+----------+
| column_0 | column_1 | column_2 |
+----------+----------+----------+
@@ -60,13 +60,13 @@ column_designator:

* `VALUES` 语句支持同一列中的数据为混合数据类型。

```shell
```sql
obclient> VALUES ROW("q", 23, '2022-12-18'), ROW(87, "x+z", 92.6), ROW(25.0009, "Well Smith", '{"a": 11, "b": 55}');
```

示例的输出结果如下:

```shell
```sql
+----------+------------+--------------------+
| column_0 | column_1 | column_2 |
+----------+------------+--------------------+
@@ -78,8 +78,13 @@ column_designator:

* `VALUES` 与 `UNION` 一起使用,功能等效于 `SELECT`。

```shell
```sql
obclient> SELECT 11,22 UNION SELECT 33,44;
```

示例的输出结果如下:

```sql
+------+------+
| 11 | 22 |
+------+------+
@@ -87,13 +92,15 @@ column_designator:
| 33 | 44 |
+------+------+
2 rows in set
```

```sql
obclient> VALUES ROW(11,22) UNION VALUES ROW(33,44);
```

示例的输出结果如下:

```shell
```sql
+----------+----------+
| column_0 | column_1 |
+----------+----------+
@@ -101,4 +108,4 @@ column_designator:
| 33 | 44 |
+----------+----------+
2 rows in set
```
```

+ 76
- 1
zh-CN/700.reference/500.sql-reference/100.sql-syntax/300.common-tenant-of-oracle-mode/900.sql-statement-of-oracle-mode/100.ddl-of-oracle-mode/1730.create-location-of-oracle-mode.md View File

@@ -61,7 +61,7 @@ CREATE [OR REPLACE] LOCATION location_name
| PRINCIPAL | 可选项,目标 HDFS 集群带 kerberos 环境时,需要配置登陆认证用户。|
| KEYTAB | 可选项,目标 HDFS 集群带 kerberos 环境时,需要配置认证密钥文件。|
| KRB5CONF | 可选项,目标 HDFS 集群带 kerberos 环境时,需要指定用户使用 kerberos 环境。|
| CONFIGS | 可选项,目标 HDFS 集群带 kerberos 环境时,需要指定额外的集群配置项。|
| CONFIGS | 可选项,目标 HDFS 集群带 kerberos 环境时,需要指定额外的 Hadoop 客户端配置参数,以 `key=value` 形式拼接,用 `#` 分隔。详细介绍可参见下文 [configs_option](#configs_option)。|
| USERNAME | 可选项,目标 HDFS 集群带 Kerberos 环境时,需要指定唯一标识用户身份。|

### file_path
@@ -79,6 +79,18 @@ CREATE [OR REPLACE] LOCATION location_name
<p>创建 Location 对象的路径中不应该带有参数。</p>
</main>

### configs_option

| 参数 | 作用 |
|------|------|
| dfs.data.transfer.protection=integrity | 表示启用数据传输完整性保护(SASL)。|
| dfs.nameservices=${nameservice id} | 指明当前 HA 集群的 `namesevice`(别名)。例如,`dfs.nameservices=mycluster` 表示定义逻辑集群名为 `mycluster`。|
| dfs.ha.namenodes.${nameservice id}=${namenode1}, ${namenode2} | 指明 HA 集群的 namenode 后备 ID 列表。例如,`dfs.ha.namenodes.mycluster=nn1,nn2` 表示指定该集群有两个 NameNode:`nn1,nn2`。|
| dfs.namenode.rpc-address.${nameservice id}.${namenode1}=${namenode 1 address} | 设置说明 `namenode1` 具体 namenode,方便客户端路由。例如,`dfs.namenode.rpc-address.mycluster.nn1=test1:18020` 表示 `nn1` 的 RPC 地址。|
| dfs.namenode.rpc-address.${nameservice id}.${namenode2}=${namenode 2 address} | 设置说明 `namenode2` 具体 namenode,方便客户端路由。例如,`dfs.namenode.rpc-address.mycluster.nn2=test2:18020` 表示 `nn2` 的 RPC 地址。|
| dfs.ha.automatic-failover.enabled.${nameservice id}=true | 表示启用自动故障转移,即让 HA 集群获取相关请求之后,自动获取可用 namenode 进行响应服务。|
| dfs.client.failover.proxy.provider.${nameservice id}=org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider | 指示 HA 集群进行主备切换的逻辑工具类,也可自定义打包上传 HA 集群自己需要的逻辑等。|

## 示例

* 创建存储位置在本地的 Location 对象。
@@ -100,6 +112,69 @@ CREATE [OR REPLACE] LOCATION location_name
);
```

* 创建用户认证模式的 Location 对象。

无需 Kerberos,但需以特定 HDFS 用户身份访问。

<main id="notice" type='explain'>
<h4>说明</h4>
<p>适用于未开启 Kerberos 权限认证的集群,但相关 HDFS 路径需要特定用户才能访问的场景。</p>
</main>

```shell
CREATE LOCATION hdfs_user
URL = 'hdfs://namenode:8020/'
CREDENTIAL (
USER = 'hdfs_user_name'
);
```

* 创建启用 Kerberos,HDFS 为单 NameNode(非 HA 模式)的 Location 对象。

<main id="notice" type='explain'>
<h4>说明</h4>
<p><code>CONFIGS</code> 中的 <code>dfs.data.transfer.protection</code> 必须与 HDFS 集群配置一致。</p>
</main>

```shell
CREATE LOCATION hdfs_kerberos_single
URL = 'hdfs://namenode.example.com:8020/'
CREDENTIAL (
PRINCIPAL = "hdfs/xxx@xxx.COM",
KEYTAB = "/data/hdfs.keytab",
KRB5CONF = "/data/krb5.conf",
CONFIGS = 'dfs.data.transfer.protection=integrity'
);
```

* 创建启用 Kerberos,HDFS 为高可用(HA)模式的 Location 对象。

```shell
CREATE LOCATION hdfs_kerberos_ha
URL = 'hdfs://${nameservice id}'
CREDENTIAL (
PRINCIPAL = "hdfs/xxx@xxx.COM",
KEYTAB = "/etc/ob/hdfs.keytab",
KRB5CONF = "/etc/krb5.conf",
CONFIGS = 'dfs.data.transfer.protection=${string}#dfs.nameservices=${nameservice id}#dfs.ha.namenodes.${nameservice id}=${namenode1}, ${namenode2}#dfs.namenode.rpc-address.${nameservice id}.${namenode1}=${namenode 1 address}#dfs.namenode.rpc-address.${nameservice id}.${namenode2}=${namenode 2 address}#dfs.ha.automatic-failover.enabled.${nameservice id}=true#dfs.client.failover.proxy.provider.${nameservice id}=org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'
);
```

* 未启用 Kerberos,但 HDFS 为高可用(HA)模式。

<main id="notice" type='explain'>
<h4>说明</h4>
<p>未启用 Kerberos,但 HDFS 为高可用(HA)模式,无需设置 <code>PRINCIPAL</code>、<code>KEYTAB</code> 和 <code>KRB5CONF</code> 参数。</p>
</main>

```shell
CREATE LOCATION hdfs_location_ha
URL = 'hdfs://${nameservice id}'
CREDENTIAL (
CONFIGS = 'dfs.nameservices=${nameservice id}#dfs.ha.namenodes.${nameservice id}=${namenode1}, ${namenode2}#dfs.namenode.rpc-address.${nameservice id}.${namenode1}=${namenode 1 address}#dfs.namenode.rpc-address.${nameservice id}.${namenode2}=${namenode 2 address}#dfs.ha.automatic-failover.enabled.${nameservice id}=true#dfs.client.failover.proxy.provider.${nameservice id}=org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'
);
```

## 相关文档

* 关于查看 Location 对象下文件的介绍信息,参见 [SHOW](../300.dcl-of-oracle-mode/3600.show-of-oracle-mode.md)。


+ 5
- 1
zh-CN/700.reference/500.sql-reference/100.sql-syntax/300.common-tenant-of-oracle-mode/900.sql-statement-of-oracle-mode/100.ddl-of-oracle-mode/1800.create-outline-of-oracle-mode.md View File

@@ -79,4 +79,8 @@ CREATE [OR REPLACE] OUTLINE outline_name ON 'sql_id' USING HINT hint_list

当 `SQL_ID` 相同时,使用 `SQL_TEXT` 方式创建的 Outline 会覆盖 `SQL_ID` 方式创建的 Outline,`SQL_TEXT` 方式创建的优先级更高。

此外,OceanBase 数据库通过 `SQL_ID` 区分不同的 SQL,而 `SQL_ID` 是通过 `SQL_TEXT` 取 `MD5` 加密得到的,相同的 SQL 文本即使多一个换行或制表符,`MD5` 得到的 `SQL_ID` 都会不同。在实际生产系统中,推荐通过 `SQL_ID` 进行 Outline 绑定。
此外,OceanBase 数据库通过 `SQL_ID` 区分不同的 SQL,而 `SQL_ID` 是通过 `SQL_TEXT` 取 `MD5` 加密得到的,相同的 SQL 文本即使多一个换行或制表符,`MD5` 得到的 `SQL_ID` 都会不同。在实际生产系统中,推荐通过 `SQL_ID` 进行 Outline 绑定。

## 相关文档

[计划绑定](../../../../../1000.performance-tuning-guide/500.sql-optimization/400.sql-optimization/700.manage-execution-plans/200.plan-binding.md)

+ 6
- 1
zh-CN/700.reference/500.sql-reference/200.sql-specifications-and-practices/200.sql-writing-Specification/300.multi-table-association-specification.md View File

@@ -14,7 +14,12 @@

示例 `select a.cid from deposit_account.tbluser a where ...`

* 生产系统中,强烈不推荐使用外关联,包括左外关联,右外关联和全外关联。
* 多表连接场景中建议优先使用内连接。

<main id="notice" type='explain'>
<h4>说明</h4>
<p>OceanBase 数据库支持 <code>LEFT JOIN</code>、<code>RIGHT JOIN</code> 和 <code>FULL JOIN</code> 等外连接语法,但在生产环境中,不推荐直接使用外连接。</p>
</main>

* 在多表连接的查询中,驱动表须要选择结果集较小的表。



+ 1
- 1
zh-CN/700.reference/600.pl-reference/300.pl-oracle/1400.pl-system-package-oracle/26400.utl-recomp-package-oracle/100.utl-recomp-overview-oracle.md View File

@@ -19,7 +19,7 @@

* 对于 OceanBase 数据库 V4.3.5 BP2 之前的版本该包必须连接 SYS 用户才能使用,其他用户没有权限调用此包。V4.3.5 BP2 及之后版本普通用户也可以调用此包。
* 调用 `recomp_parallel`,`recomp_serial` 时,建议用户保证系统中没有正在执行的 DDL 操作,否则可能会有非预期情况发生。
* 此包编译的对象包括 `procedure`、`functon`、`package`、`trigger`、`user define type`。
* 此包编译的对象包括 `procedure`、`function`、`package`、`trigger`、`user defined type`。
* 对象编译过程出现的单个对象相关的错误,可以通过 `all_errors` 视图查看。
* 编译过程中出现的系统错误记录在 `SYS.UTL_RECOMP_ERRORS` 表中。



+ 12
- 0
zh-CN/700.reference/900.error-code/600.error-code-of-mysql-mode/1050.10000-12000-of-mysql-mode.md View File

@@ -573,6 +573,18 @@
<p>该错误码从 V4.5.0 版本开始引入。</p>
</main>

## ERROR 11126 (HY000) : unit \'%.*s\' not recognized

* OceanBase 错误码:11126
* 错误原因:调用日期截断函数(如 DATE_TRUNC 或 DATETRUNC)时,传入的时间单位参数不被识别。

* 解决方法:检查您的 SQL 语句中日期截断函数的第一个参数,确保其拼写正确且是 OceanBase 数据库支持的有效时间单位关键字。

<main id="notice" type='explain'>
<h4>说明</h4>
<p>该错误码从 V4.5.0 版本开始引入。</p>
</main>

## ERROR 11127 (HY000) : Privilege not allowed for sensitive rules

* OceanBase 错误码:11127


+ 12
- 10
zh-CN/800.FAQ/300.deployment-faq.md View File

@@ -20,19 +20,21 @@

支持在下表所示的 Linux 操作系统中安装 OceanBase 数据库。

| Linux 操作系统 | 版本 | 服务器架构 |
| Linux 操作系统 | 版本 | 服务器架构 |
|-------------------------|-----------|-------------------------------|
| Alibaba Cloud Linux | 2 | x86_64,ARM_64 |
| 龙蜥 AnolisOS | 8.6 及以上 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| KylinOS | V10 | x86_64(包括海光),ARM_64(鲲鹏、飞腾) |
| Rocky Linux | 9 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| Alibaba Cloud Linux | 2、3 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 龙蜥 AnolisOS | 8 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| KylinOS | V10、V11 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 统信 UOS | V20 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 中科方德 NFSChina | 4.0 及以上 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 中科方德 NFSChina | 4.0 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 浪潮 Inspur kos | 5.8 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| CentOS / Red Hat Enterprise Linux | 7.x、8.x | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| SUSE Enterprise Linux | 12SP3 及以上 | x86_64(包括海光)|
| Debian | 8.3 及以上 | x86_64(包括海光)|
| openEuler | 20.03 LTS SP1/SP2 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 凝思 LinxOS | V6.0.99、V6.0.100 | x86_64(包括海光),ARM_64(鲲鹏、飞腾) |
| CentOS / Red Hat Enterprise Linux | 7、8、9 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| SUSE Enterprise Linux | 12SP5 | x86_64(包括海光)|
| Debian | 12 | x86_64(包括海光)|
| openEuler | 20.03 LTS、22.03 LTS | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| 凝思 Linux | V6.0.99、V6.0.100 | x86_64(包括海光),ARM_64(鲲鹏、飞腾)|
| Ubuntu | 22.04 LTS、24.04 LTS | x86_64(包括海光)|

<main id="notice" type='explain'>
<h4>说明</h4>


Loading…
Cancel
Save
Baidu
map