Connected User This link always connects as the currently connected user. This requires the user using the link to have an ID in both databases. When using a connected user link, your access is in the remote database is defined by the privileges of that ID in the remote database. Syntax :
CREATE DATABASE LINK <linkname> USING '<remote_database>';
Current User Current User uses a global user; that is, a user authenticated externally via a directory service. If using a current user link within a non-stored object (i.e. from SQL*Plus, Pro*C or JDBC), a current user link will use the login credentials of the logged in user. So if BOB create a current user link and TOM uses that link, TOM's credentials in the remote database will be used. That means that BOB and TOM must both be globally defined in, and have access to, the local and remote databases. If using a current user link in a stored object (i.e. a view or stored procedure), the link will use the login credentials of the user who compiled the object unless the object uses invoker rights. This method is very secure and is part of Oracle Advanced Security. This allows a less privileged user to run a remote procedure with a more privileged users access. Syntax :
CREATE DATABASE LINK <linkname>
CONNECT TO CURRENT_USER
USING '<remote_database>';
Fixed User Fixed user is probably the most common type of link. A fixed user link connects via specific credentials. Every time the link connects it connects with the same user ID and password. The fixed user ID must be defined in the remote database but does not need to exist in the local database.
Syntax :
CREATE DATABASE LINK <linkname>
CONNECT TO <username>
IDENTIFIED BY <password>
USING '<remote_database>';
Public A public link is one of the above links created with the PUBLIC keyword. PUBLIC links are viewable by anyone. Non-public links are private links and can only be accessed by the schema that created it.
Shared A shared link is not really a different kind of link. It defines the way Oracle manages the physical connections to the remote database. A shared connection can reuse connections. Shared is useful in appropriate circumstances but is not appropriate for all circumstances.
Global A global link creates a network-wide link. If you are using a directory server and your databases are identified by net names, you can create global database links. Every database identified by your server will get the link. This makes managing the links easier for administrators. |