How to create and drop db link

create public database link HISTORYDB connect to pihist identified by pihist using ‘pihist’;
create public database link
  mylink
connect to
  remote_username
identified by
  mypassword
using ‘tns_service_name’;

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Drop database link pidb
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SQL> select OWNER,DB_LINK from dba_db_links;
OWNER                                         DB_LINK
——————————————— ———————————————
PUBLIC                                        TESTING
PIDB                                          HISTORYDB
SQL> connect pidb/pidb
Connected.
SQL> drop database link HISTORYDB
  2  ;
Database link dropped.
SQL> connect / as sysdba
Connected.
SQL> connect / as sysdba;
Connected.
SQL> select OWNER,DB_LINK from dba_db_links;
OWNER                                         DB_LINK
——————————————— ———————————————
PUBLIC                                        TESTING
SQL> drop PUBLIC database link TESTING;
Database link dropped.
SQL> select OWNER,DB_LINK from dba_db_links;
no rows selected
SQL> create public database link HISTORYDB connect to pihist identified by pihist using ‘pihist’;
Database link created.
SQL> connect pidb/pidb
Connected.

No comments:

ORA-06512: at "SYS.DBMS_ISCHED"

Database -  Oracle Database 23AI Cause:   An attempt was made to perform a scheduler operation without the required privileges. Action:  Ask...