ALTER DATABASE LINK
Description
Modifies database link objects. For details about database links, see DATABASE LINK.
Precautions
Currently, only the username and password can be modified for database links.
Syntax
ALTER [PUBLIC] DATABASE LINK dblink_name [CONNECT TO 'user_name' IDENTIFIED BY 'password'];
Parameters
- dblink_name
Name of a connection.
- user_name
Username for connecting to a remote database.
- password
Password for connecting to a remote database.
- PUBLIC
Connection type. If PUBLIC is not specified, the database link is private by default.
Examples
-- Create an ORA-compatible data record. gaussdb=# CREATE DATABASE ora_test_db DBCOMPATIBILITY 'ORA'; -- Switch to another database. gaussdb=# \c ora_test_db -- Create a user with the system administrator permission. ora_test_db=# CREATE USER user01 WITH SYSADMIN PASSWORD '********'; ora_test_db=# SET ROLE user01 PASSWORD '********'; -- Create a public database link. ora_test_db=# CREATE PUBLIC DATABASE LINK public_dblink CONNECT TO 'user01' IDENTIFIED BY '********' USING (host '192.168.11.11',port '54399',dbname 'db01'); -- Create a common user. ora_test_db=# CREATE USER user2 PASSWORD '********'; -- Modify database link object information. ora_test_db=# ALTER PUBLIC DATABASE LINK public_dblink CONNECT TO 'user2' IDENTIFIED BY '********'; -- Delete a public database link. ora_test_db=# DROP PUBLIC DATABASE LINK public_dblink; -- Delete the user. ora_test_db=# RESET ROLE; ora_test_db=# DROP USER user01; ora_test_db=# DROP USER user2; -- 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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot