Enable or disable the recycle bin
In seekdb, the recycle bin can be enabled or disabled by using the system variable recyclebin. By default, the recycle bin is disabled. If the recycle bin is enabled, after you drop a database object, the object is moved to the recycle bin.
Background information
seekdb has global variables and session variables. When you enable or disable the recycle bin, you can choose the appropriate setting method based on your needs.
-
Global variables: These are modifications at the global level. Different users in the database share global variables. Global variable modifications do not become invalid when a session ends. Additionally, global variable modifications do not take effect on sessions that are already open. You need to establish a new session for the changes to take effect.
-
Session variables: These are modifications at the session level. After a client connects to the database, the database automatically generates session variables based on global variables. Session variable modifications only take effect on the current session.
Procedure
-
Log in to seekdb as the administrator user
root.The following example shows how to connect to the database. Please adjust the connection parameters based on your actual environment.
mysql -h127.0.0.1 -uroot -P2881 -
Execute the following statement to view the recycle bin status.
SHOW VARIABLES LIKE 'recyclebin';+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| recyclebin | ON |
+---------------+-------+
1 row in set -
Choose an appropriate method to enable or disable the recycle bin based on your business needs.
The variable
recyclebinis a Boolean variable, so it supports multiple values. Specifically:-
on、1ortrue: Enables the recycle bin. -
off、0orfalse: Disables the recycle bin. -
To enable or disable the recycle bin globally
Global settings take effect throughout the entire seekdb database. After the settings are applied, they do not take effect on the current session. You need to log in again to establish a new session for the changes to take effect.
The following statements are available:
SET GLOBAL recyclebin = on;SET GLOBAL recyclebin = off;or
SET GLOBAL recyclebin = 1;SET GLOBAL recyclebin = 0;or
SET GLOBAL recyclebin = true;SET GLOBAL recyclebin = false; -
To enable or disable the recycle bin for the current session
Session settings only take effect on the current session.
SET @@recyclebin = on;SET @@recyclebin = off;or
SET @@recyclebin = 1;SET @@recyclebin = 0;or
SET @@recyclebin = true;SET @@recyclebin = false;
-
References
For more information about the recycle bin, see the following topics: