CLEAN CONNECTION
Function
CLEAN CONNECTION clears database connections when a database is abnormal. You may use this statement to delete a specific user's connections to a specified database.
Precautions
None
Syntax
1 2 3 4 |
CLEAN CONNECTION TO { COORDINATOR ( nodename [, ... ] ) | NODE ( nodename [, ... ] )| ALL [ CHECK ] [ FORCE ] } [ FOR DATABASE dbname ] [ TO USER username ]; |
Parameter Description
- CHECK
This parameter can be specified only when the node list is specified as TO ALL. Setting this parameter will check whether a database is accessed by other sessions before its connections are cleared. If any sessions are detected before DROP DATABASE is executed, an error will be reported and the database will not be deleted.
- FORCE
This parameter can be specified only when the node list is specified as TO ALL. Setting this parameter will send SIGTERM signals to all the threads related to the specified dbname and username and forcibly shut them down.
- COORDINATOR ( nodename [, ... ] ) | NODE ( nodename [, ... ] ) | ALL
Deletes connections on a specified node. There are three scenarios:
- Deletes connections to a specified CN.
- Deletes connections to a specified DN.
- Deletes connections to all CNs and DNs.
Value range: nodename is an existing node name.
- dbname
Deletes connections to a specific database. If this parameter is not specified, connections to all databases will be deleted.
Value range: an existing database name
- username
Deletes connections of a specific user. If this parameter is not specified, connections of all users will be deleted.
Value range: an existing user name
Either dbname or username must be specified.
Examples
Delete the connections of database template1 on the cn_5001 and cn_5002 nodes.
1
|
CLEAN CONNECTION TO NODE (cn_5001, cn_5002) FOR DATABASE template1; |
Delete the connection of user jack to the cn_5001 node.
1
|
CLEAN CONNECTION TO NODE (cn_5001) TO USER jack; |
Delete all connections to the gaussdb database.
1
|
CLEAN CONNECTION TO ALL FORCE FOR DATABASE gaussdb; |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot