ITPUB??ì3
新一届的微软MVP评选已经开始,欢迎各位推荐!
ITPUB论坛 » Oracle开发 » DBLINK问题,当新创建一个dblink时,执行完成后,自己把dblink的名称修改了

标题: [PL/SQL] DBLINK问题,当新创建一个dblink时,执行完成后,自己把dblink的名称修改了
离线 louis_zhao
Louis


精华贴数 0
个人空间 0
技术积分 416 (4689)
社区积分 0 (1009538)
注册日期 2006-6-29
论坛徽章:1
授权会员     
      

发表于 2008-7-2 17:26 
DBLINK问题,当新创建一个dblink时,执行完成后,自己把dblink的名称修改了

create database link test1
  connect to cdb_0527 identified by cdb_0527
  using '1.145';


当执行完上边创建的dblink时,名称自动变成了TEST1.US.ORACLE.COM,而不是代码中的test1!但在不同的数据中创建时会出现不同的结果,有的数据中创建完成后,dblink名称跟创建时一样,保持不变,有的数据库中创建就变了.


__________________
努力了不成功!也不会后悔的!

louis
只看该作者    顶部
离线 guoq.lee
天凉了


来自 大连
精华贴数 0
个人空间 0
技术积分 661 (2888)
社区积分 40 (5450)
注册日期 2006-11-2
论坛徽章:18
2008北京奥运纪念徽章:跆拳道2008北京奥运纪念徽章:射箭2008北京奥运纪念徽章:曲棍球2008北京奥运纪念徽章:射箭2008北京奥运纪念徽章:排球2008北京奥运纪念徽章:篮球
2008北京奥运纪念徽章:游泳2008北京奥运纪念徽章:羽毛球2008北京奥运纪念徽章:羽毛球2008北京奥运纪念徽章:羽毛球2008北京奥运纪念徽章:花样游泳生肖徽章2007版:鸡

发表于 2008-7-2 17:43 
看看这个帖子

http://www.itpub.net/viewthread. ... mp;highlight=dblink

[ 本帖最后由 guoq.lee 于 2008-7-2 17:55 编辑 ]


__________________
I believe I can fly,I believe I can touch the sky,I believe!
只看该作者    顶部
离线 caizhuoyi
Oracle Stranger


精华贴数 2
个人空间 0
技术积分 1524 (1105)
社区积分 448 (1500)
注册日期 2006-3-1
论坛徽章:4
授权会员生肖徽章2007版:龙2008北京奥运纪念徽章:棒球数据库板块每日发贴之星  
      

发表于 2008-7-2 18:03 
还是看sql参考文档吧:

Creating Database Links
You create a database link with the statement CREATE DATABASE LINK . The statement lets you specify this information about the database link:

The name of the database link

The database connect string to access the remote database

The username and password to connect to the remote database

Oracle stores this information in the data dictionary.

Database Link Names
When you create a database link, you must specify its name. Database link names are different from names of other types of objects. They can be as long as 128 bytes and can contain periods (.) and the "at" sign (@).

The name that you give to a database link must correspond to the name of the database to which the database link refers and the location of that database in the hierarchy of database names. The following syntax diagram shows the form of the name of a database link:


dblink::=

Description of the illustration dblink.gif


where:

database should specify the name portion of the global name of the remote database to which the database link connects. This global name is stored in the data dictionary of the remote database; you can see this name in the GLOBAL_NAME data dictionary view.

domain should specify the domain portion of the global name of the remote database to which the database link connects. If you omit domain from the name of a database link, then Oracle qualifies the database link name with the domain of your local database as it currently exists in the data dictionary.

connect_descriptor lets you further qualify a database link. Using connect descriptors, you can create multiple database links to the same database. For example, you can use connect descriptors to create multiple database links to different instances of the Real Application Clusters that access the same database.

The combination database.domain is sometimes called the service name.


See Also:

Oracle Net Services Administrator's Guide


Username and Password
Oracle uses the username and password to connect to the remote database. The username and password for a database link are optional.

Database Connect String
The database connect string is the specification used by Oracle Net to access the remote database. For information on writing database connect strings, see the Oracle Net documentation for your specific network protocol. The database string for a database link is optional.

Referring to Database Links
Database links are available only if you are using Oracle distributed functionality. When you issue a SQL statement that contains a database link, you can specify the database link name in one of these forms:

The complete database link name as stored in the data dictionary, including the database, domain, and optional connect_descriptor components.

The partial database link name is the database and optional connect_descriptor components, but not the domain component.

Oracle performs these tasks before connecting to the remote database:

If the database link name specified in the statement is partial, then Oracle expands the name to contain the domain of the local database as found in the global database name stored in the data dictionary. (You can see the current global database name in the GLOBAL_NAME data dictionary view.)

Oracle first searches for a private database link in your own schema with the same name as the database link in the statement. Then, if necessary, it searches for a public database link with the same name.

Oracle always determines the username and password from the first matching database link (either private or public). If the first matching database link has an associated username and password, then Oracle uses it. If it does not have an associated username and password, then Oracle uses your current username and password.

If the first matching database link has an associated database string, then Oracle uses it. Otherwise Oracle searches for the next matching (public) database link. If no matching database link is found, or if no matching link has an associated database string, then Oracle returns an error.

Oracle uses the database string to access the remote database. After accessing the remote database, if the value of the GLOBAL_NAMES parameter is true, then Oracle verifies that the database.domain portion of the database link name matches the complete global name of the remote database. If this condition is true, then Oracle proceeds with the connection, using the username and password chosen in Step 2. If not, Oracle returns an error.

If the connection using the database string, username, and password is successful, then Oracle attempts to access the specified object on the remote database using the rules for resolving object references and referring to objects in other schemas discussed earlier in this section.

You can disable the requirement that the database.domain portion of the database link name must match the complete global name of the remote database by setting to false the initialization parameter GLOBAL_NAMES or the GLOBAL_NAMES parameter of the ALTER SYSTEM or ALTER SESSION statement.


__________________
我不在江湖,但江湖中有我的传说;
我身在江湖,江湖里却没有我的传说。
只看该作者    顶部
离线 louis_zhao
Louis


精华贴数 0
个人空间 0
技术积分 416 (4689)
社区积分 0 (1009538)
注册日期 2006-6-29
论坛徽章:1
授权会员     
      

发表于 2008-7-3 09:50 
SQL> show parameters global_names;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
global_names                         boolean     FALSE


还是不行呀!请高手再指点指点


__________________
努力了不成功!也不会后悔的!

louis
只看该作者    顶部
离线 guoq.lee
天凉了


来自 大连
精华贴数 0
个人空间 0
技术积分 661 (2888)
社区积分 40 (5450)
注册日期 2006-11-2
论坛徽章:18
2008北京奥运纪念徽章:跆拳道2008北京奥运纪念徽章:射箭2008北京奥运纪念徽章:曲棍球2008北京奥运纪念徽章:射箭2008北京奥运纪念徽章:排球2008北京奥运纪念徽章:篮球
2008北京奥运纪念徽章:游泳2008北京奥运纪念徽章:羽毛球2008北京奥运纪念徽章:羽毛球2008北京奥运纪念徽章:羽毛球2008北京奥运纪念徽章:花样游泳生肖徽章2007版:鸡

发表于 2008-7-3 11:42 


QUOTE:
原帖由 louis_zhao 于 2008-7-3 09:50 发表
SQL> show parameters global_names;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
global_names                         boolean     FALSE


还是不行呀!请高手再指点指点

select * from global_name

update global_name set global_name=your db_name


__________________
I believe I can fly,I believe I can touch the sky,I believe!
只看该作者    顶部
 
    

相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问