OceanBase Database provides parameters for managing DBLinks. You can enable or disable the DBLink feature based on your business strategies and modify the reusability of connections to remote databases based on your business requirements.
Enable or disable the DBLink feature
You can specify the enable_dblink parameter to enable or disable the DBLink feature for a cluster. The default value is True. The value True indicates to enable the DBLink feature. The value False indicates to disable the DBLink feature. If you attempt to use the DBLink feature when this parameter is set to False, the OB_OP_NOT_ALLOW error will be returned, indicating that the operation is not allowed.
For more information about the enable_dblink parameter, see enable_dblink.
Here is an example:
Log on to the sys tenant and specify whether to enable or disable the DBLink feature.
Enable the DBLink feature.
ALTER SYSTEM SET enable_dblink = True;Disable the DBLink feature.
Note
The
enable_dblinkparameter takes effect on a cluster. You do need to disable the DBLink feature unless otherwise required.ALTER SYSTEM SET enable_dblink = False;
Configure the reusability of connections to remote databases over DBLinks
You can specify the hidden parameter _enable_dblink_reuse_connection to control the reusability of connections over DBLinks. The value True indicates to allow you to reuse the connection to a remote database within the same session to improve efficiency and performance. In this case, the connection is a persistent connection. When the network environment is unstable or abnormal, you can set this parameter to False to require that a new connection be established for each access to the remote database to avoid connection errors. In this case, the connection is a short-lived connection.
| Attribute | Description |
|---|---|
| Parameter type | Integer |
| Default value | 1, which indicates to enable reuse of connections. |
| Value range | 0 or 1.
|
| Effective mode | Immediate |
| Level | Tenant level |
Here is an example:
Execute the following statement in a user tenant to disable reuse of connections over a DBLink in a session.
ALTER SYSTEM SET "_enable_dblink_reuse_connection" = 0;Execute the following statement in a user tenant to enable reuse of connections over a DBLink in a session.
ALTER SYSTEM SET "_enable_dblink_reuse_connection" = 1;