登录到远程服务器上的结果:
net97show parameters global_name
NAME TYPE VALUE
global_names boolean FALSE
net97
net97drop database link jinhua;
数据库链接已丢弃。
net97create database link jinhua
2 connect to username identified by password
3 using 'jinhua';
数据库链接已创建。
net97select * from so@jinhua;
select * from so@jinhua
*
ERROR 位于第 1 行:
ORA-12154: TNS:不能分解服务名称.
net97conn 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.