登录到远程服务器上的结果:
net97>show parameters global_name
name type value
global_names boolean false
net97>
net97>drop database link jinhua;
数据库链接已丢弃。
net97>create database link jinhua
2 connect to username identified by password
3 using 'jinhua';
数据库链接已创建。
net97>select * from so@jinhua;
select * from so@jinhua
*
error 位于第 1 行:
ora-12154: tns:不能分解服务名称.
net97>conn username/password@jinhua;
已连接。
net97>
///////////////////////////////////////////////////
登录到本地的ntserver 上面的oracle816数据库:
本地的tnsnames.ora文件里边有jinhua这个连接串的描述。
//////////////////////////////////////////////////////////////
global_name=true的时候的情况:
sql> show parameters global
name type value
------------------------------------ ------- ------------------------------
global_names boolean true
sql>
svrmgr> create database link jinhua
2> connect to spgroup identified by spgroup
3> using 'jinhua';
语句已处理。
svrmgr> select count(*) from spgroup.so@jinhua;
select count(*) from spgroup.so@jinhua
*
ora-02085: ?????jinhua.world?orcl.world???
svrmgr> drop database link jinhua;
语句已处理。
svrmgr> create database link jinhua.world
2> connect to username identified by password
3> using 'jinhua';
语句已处理。
svrmgr> select count(*) from username.so@jinhua.world;
select count(*) from username.so@jinhua.world
*
ora-02085: ?????jinhua.world?orcl.world???
svrmgr> drop database link jinhua.world;
语句已处理。
sql> conn chaos/chaos
已连接。
sql> create database link orcl.world
2 connect to spgroup identified by spgroup
3 using 'jinhua';
数据库链接已创建。
sql> select count(*) from spgroup.so@orcl.world;
count(*)
----------
6800
sql>
///////////////////////////////////////////////////////////////////
global_name=false时候的情况:
sql> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
oracle 例程已经关闭。
sql> startup
oracle 例程已经启动。
total system global area 16930844 bytes
fixed size 75804 bytes
variable size 8388608 bytes
database buffers 8388608 bytes
redo buffers 77824 bytes
数据库装载完毕。
数据库已经打开。
sql> show parameter global_name
name type value
global_names boolean false
sql>
sql> create database link jinhua
2 connect to spgroup identified by spgroup
3 using 'jinhua';
数据库链接已创建。
sql> select count(*) from so@jinhua;
count(*)
----------
6800
//////////////////////////////////////////////////////////////////
数据库连接串的密码存放在user_db_links里边的password字段里边。
to facilitate application requests in a distributed database system, oracle
uses
database links. a database link defines a one-way communication path from an
oracle database to another database.
database links are essentially transparent to the users of an oracle
distributed database system, because the name of a database link is the same as the global name
of the database to which the link points. for example, the following sql statement creates a database link in the local database that describes a path to the remote
sales.us.americas.acme_auto.com database.
create database link sales.us.americas.acme_auto.com ... ;
after creating a database link, applications connected to the local database can access data in the remote sales.us.americas.acme_auto.com database. the next section explains how applications can reference remote schema objects in a distributed database and includes examples of how sql statements use database links.
additional information: oracle supports several different types of database links. for more information, see oracle8i distributed
database systems.