As a user of the ORCL database, you establish a database link to the remote HQ database such
that all users in the ORCL database may access tables only from the SCOTT schema in the HQ
database. SCOTT’s password is TIGER. The service mane “HQ” is used to connect to the remote
HQ database.
Which command would you execute to create the database link?
A.
CREATE DATABASE LINK HQ USING ‘HQ’;
B.
CREATE DATABASE LINK HQ CONNECT TO CXJRRENT_USER USING HQ’ S
C.
CREATE PUBLIC DATABASE LINK HQ CONNECT TO scott IDENTIFIED BY tiger USING
‘HQ’;
D.
CREATE DATABASE LINK HQ CONNECT TO scott IDENTIFIED BY tiger USING ‘HQ’;
Explanation:
D is the one.
Answer=C
Since all users in orcl database has to access the DB link, hence public DB has to be created
Database links are either private or public. If they are private, then only the user who created the link has access; if they are public, then all database users have access.
According to question it should be public which can be accessed by all users.
Since all users are connected as scott, so it should be a fixed user link.
Then I think C is more reasonable.
C is correct
I agree that B is wrong for two reasons:
1.) Liz Statement is correct an private db-link does NOT fullfill the requirements ‘scuh that all users’. => onnly C can be right.
2.) If you use current_user than “The current user must be a global user with a valid account on the remote database.” But there is no Information that this user is a global user. on the contrary: ‘as a user of the orcl database’. => B is for sure wrong and C must be right.
C
The Oracle docs note the syntax for creating an Oracle dblink as follows:
CREATE [ SHARED ] [ PUBLIC ] DATABASE LINK dblink
[ CONNECT TO
{ CURRENT_USER
| user IDENTIFIED BY password
[ dblink_authentication ]
}
| dblink_authentication
]
[ USING ‘connect_string’ ] ;
C is correct
C
The CONNECT TO clause specifies the username and password to connect to the remote
database. This is known as a fixed user database link. The user_name and password portion
may be omitted in order to use the same credentials that were used to connect to the
local database to connect to the remote database. This type of dblink is called connected
user database link. The database link privileges depend on the user connecting to the
remote database.
then… maybe is A
C is the correct answer.
we have to remember that public is a squema too, the question said “..only from the SCOTT schema”, option D is the right
ORCL is the source database and targets HQ.
Only SCOTT schema refers to target database. All users should access the db link in source database therefore public db link is needed
The answer is B.
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm#i2143859
The question “all users in the ORCL database may access tables only from the SCOTT schema” not from public link.
CURRENT_USER Clause
Specify CURRENT_USER to create a current user database link. The current user must be a global user (AKA active directory user) with a valid account on the remote database.
If the database link is used directly, that is, not from within a stored object, then the current user is the same as the connected user.
When executing a stored object (such as a procedure, view, or trigger) that initiates a database link, CURRENT_USER is the username that owns the stored object, and not the username that called the object. For example, if the database link appears inside procedure scott.p (created by scott), and user jane calls procedure scott.p, the current user is scott.
Option C is Correct, cause if we don´t specify public no one can use de DB LINK except the user that create the DB LINK.
CREATE PUBLIC DATABASE LINK HQ CONNECT TO scott IDENTIFIED BY tiger USING
‘HQ’;
“C” is correct.