Oracle – Criação de Database Links
Exemplo de criação de um database link:
CREATE PUBLIC DATABASE LINK “nome_do_dblink” CONNECT TO “usuário_remoto” IDENTIFIED BY “password” USING ‘sid_do_banco’
Obs: Lembre-se de que você precisa possuir as entradas necessárias para conexão com o banco remoto no tnsnames.ora do servidor aonde você está tentando criar o Database Link.
Ex de Select: SELECT table_name, tablespace_name FROM user_tables@dblink;
Fechar: ALTER SESSION CLOSE DATABASE LINK <link_name>;
Dropar: (Standard e Public) DROP DATABASE LINK <link_name>; DROP PUBLIC DATABASE LINK <link_name>;
——————————————— Outros tipos para criar:
Connected User Link CREATE [SHARED] [PUBLIC] DATABASE LINK <link_name> CONNECT TO CURRENT_USER USING ‘<service_name>’;
Current User Link CREATE [PUBLIC] DATABASE LINK <link_name> CONNECT TO CURRENT_USER USING ‘<service_name>’;
Fixed User Link CREATE [PUBLIC] DATABASE LINK <link_name> CONNECT TO <user_name> IDENTIFIED BY <password> USING ‘<service_name>’;
Shared Link CREATE SHARED DATABASE LINK <link_name> AUTHENTICATED BY <schema_name> IDENTIFIED BY <password> USING ‘<service_name>’;
Public Link CREATE PUBLIC DATABASE LINK <link_name> USING ‘<service_name>’;