📜  oracle list dblink - SQL (1)

📅  最后修改于: 2023-12-03 14:44:55.545000             🧑  作者: Mango

Oracle List DBLINK - SQL

Introduction

In Oracle, DBLINK (database link) is a feature that allows you to access objects in a remote database as if they were local. It enables you to perform queries, updates, and other operations between multiple databases. The LIST DBLINK command in SQL is used to retrieve information about the existing database links in Oracle.

Syntax

The syntax for the LIST DBLINK command is as follows:

SELECT DB_LINK, OWNER, USERNAME, HOST, CREATED
FROM ALL_DB_LINKS;
Explanation

The LIST DBLINK command retrieves the following information about each database link:

  • DB_LINK: The name of the database link.
  • OWNER: The owner of the database link.
  • USERNAME: The username used to establish the connection.
  • HOST: The hostname of the remote database.
  • CREATED: The creation timestamp of the database link.

The information is obtained from the ALL_DB_LINKS view, which contains metadata about all database links accessible to the current user.

Example

Here is an example usage of the LIST DBLINK command:

SELECT DB_LINK, OWNER, USERNAME, HOST, CREATED
FROM ALL_DB_LINKS;

This query will retrieve the information about all the existing database links in the Oracle database.

Output

The output of the LIST DBLINK command will be a table with the columns DB_LINK, OWNER, USERNAME, HOST, and CREATED. The values will be filled with the corresponding information retrieved from the ALL_DB_LINKS view.

Here is an example output in markdown format:

| DB_LINK | OWNER | USERNAME | HOST | CREATED | |------------|---------|------------|-------------------|---------------------| | DBLINK1 | SCOTT | USER1 | remote_host1 | 2022-01-01 10:00:00 | | DBLINK2 | HR | USER2 | remote_host2 | 2022-02-15 14:30:00 | | DBLINK3 | SYS | USER3 | remote_host3 | 2022-03-20 09:45:00 |

This table shows the DB link names, their owners, connection usernames, remote hosts, and creation timestamps for each database link.

Note: The output will vary depending on the actual database links present in your Oracle database.