Database links enable cross-database queries in Oracle. Let’s analyze each option with extensive detail:
A. A public database link can be created only by SYS.
Explanation:False. Any user with the CREATE PUBLIC DATABASE LINK privilege (not just SYS) can create a public link (e.g., CREATE PUBLIC DATABASE LINK remote_db CONNECT TO scott IDENTIFIED BY tiger USING 'orcl'). While SYS typically has this privilege, it’s not exclusive to SYS.
Mechanics:Privilege is granted via GRANT CREATE PUBLIC DATABASE LINK TO user;. Public links are accessible to all users in the local DB.
Why Incorrect:Overly restrictive; Oracle’s security model allows delegation.
B. A database link can be created only between two Oracle databases.
Explanation:False. Database links can connect to non-Oracle databases using Oracle Heterogeneous Services or gateways (e.g., ODBC or JDBC drivers), such as linking to SQL Server. Example: CREATE DATABASE LINK mssql_link USING 'hsodbc';.
Mechanics:Requires configuration of hs_ parameters in init.ora and a gateway listener.
Historical Note:Heterogeneous links were introduced in 8i, expanded in 23ai for cloud integration.
C. A database link created in a database allows a connection from that database's instance to the target database's instance, but not vice versa.
Explanation:True. A database link is unidirectional; it enables queries from the local instance to the remote instance (e.g., SELECT * FROM emp@remote_db), but the remote instance can’t use it to query back unless a separate link is created there.
Mechanics:Stored in DBA_DB_LINKS, the link defines a one-way connection via a TNS alias or connect string.
Practical Use:Ensures controlled access; bidirectional access requires explicit configuration.
Edge Case:Loops are prevented unless explicitly designed with mutual links.
D. A public database link can be used by a user connected to the local database instance to connect to any schema in the remote database instance.
Explanation:False. Public links allow all local users to use them, but access to remote schemas depends on the link’s credentials (e.g., CONNECT TO scott) and the user’s remote privileges. “Any schema” overstates it; access is limited to what the link’s user can see.
Why Incorrect:Misrepresents privilege scope; remote schema access isn’t universal.
E. Private database link creation requires the same user to exist in both the local and the remote databases.
Explanation:False. A private link (e.g., CREATE DATABASE LINK my_linkCONNECT TO scott IDENTIFIED BY tiger USING 'orcl') requires the remote user (scott) to exist, but the local creator (e.g., HR) need not match. The link is owned locally and authenticated remotely.
Mechanics:Only the CREATE DATABASE LINK privilege is needed locally.