When a user references the HQ service name, the host name is HQ_MW and the service name is
LOC. The SERVICE_NAME can be the instance name of the remote database. It is specified by the
initialization parameter SERVICE_NAMES, and it can include several services. The default value
for SERVICE_NAME is DB_UNIQUE_NAME.DB_DOMAIN. In a RAC database environment, each
node can have additional service names in addition to the service name. A service specified by
SERVICE_NAMES can run on several (or all, or just one) of the RAC instances. You would specify
INSTANCE_NAME in tnsnames.ora instead of SERVICE_NAME if you want a specific database
instance.
This tnsnames.ora uses parameters for the TCP/IP protocol; other protocols may use different
keywords, but their usage is the same. The tnsnames.ora entries provide transparency for the
server and instance names.
The HR_LINK database link created via the code given earlier in this section will provide
transparency for the first two parts of the global object name. But what if the data moves from the
HR schema, or the HR account??™s password changes? The database link would have to be dropped
and re-created. The same would be true if account-level security were required; you may need to
create and maintain multiple database links.
To resolve the transparency of the schema portion of the global object name, you can modify
the database link syntax. Consider the database link in the following listing:
create public database link HR_LINK
connect to current_user
using 'hq';
606 Oracle Database 11g DBA Handbook
This database link uses the connect to current_user clause.
Pages:
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888