DROP DATABASE LINK
Description
Deletes database link objects.
Syntax
DROP [ PUBLIC ] DATABASE LINK [ IF EXISTS ] dblink_name;
Parameters
- dblink_name
Name of a connection object.
- IF EXISTS
Reports a notice instead of an error if the specified DATABASE LINK does not exist.
- PUBLIC
Specifies the connection type. If PUBLIC is not specified, the database link is private by default.
Examples
-- Create an ORA-compatible database. gaussdb=# CREATE DATABASE ora_test_db DBCOMPATIBILITY 'ORA'; -- Switch to another database. gaussdb=# \c ora_test_db -- Create a user with the SYSADMIN permission. ora_test_db=# CREATE USER user1 WITH SYSADMIN PASSWORD '********'; ora_test_db=# SET ROLE user1 PASSWORD '********'; -- Create a private database link. host can be an IPv6 address. ora_test_db=# CREATE DATABASE LINK private_dblink CONNECT TO 'user1' IDENTIFIED BY '********' USING (host '192.168.11.11',port '54399',dbname 'db01'); -- Drop the private database link. ora_test_db=# DROP DATABASE LINK private_dblink; -- Create a public database link. host can be an IPv6 address. ora_test_db=# CREATE PUBLIC DATABASE LINK public_dblink CONNECT TO 'user1' IDENTIFIED BY '********' USING (host '192.168.11.11',port '54399',dbname 'db01'); -- Drop the public database link. ora_test_db=# DROP PUBLIC DATABASE LINK public_dblink; -- Drop the created user. ora_test_db=# RESET ROLE; ora_test_db=# DROP USER user1; -- Switch back to the initial database and delete the test database. Replace postgres with the actual database name. ora_test_db=# \c postgres gaussdb=# DROP DATABASE ora_test_db;
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.