The database link can not be dropped after changing the global_name

如果通过以下语句修改了global name,数据库链接将不能被删除,除非改回原来的global name.
ALTER DATABASE RENAME GLOBAL_NAME TO ;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
SQL> conn scott/scott
已连接。
SQL> create database link  link_test connect to strmadmin identified by oracle10g using 'db1.onlyring1.net';
 
数据库链接已创建。
 
SQL> drop database link link_test;
 
数据库链接已删除。
 
SQL> create database link  link_test connect to strmadmin identified by oracle10g using 'db1.onlyring1.net';
 
数据库链接已创建。
 
SQL> conn /as sysdba
已连接。
SQL> select global_name from global_name ;
 
GLOBAL_NAME
--------------------------------------------------------------------------------
ORA10GDB.MYCORP
 
SQL> alter database rename global_name to ORA10GDB.MYCORP.tests;
 
数据库已更改。
 
SQL>
SQL> conn scott/scott
已连接。
SQL> drop database link link_test;
drop database link link_test
                   *1 行出现错误:
ORA-02024: 未找到数据库链接
 
 
SQL> select global_name from global_name ;
 
GLOBAL_NAME
----------------------------
ORA10GDB.MYCORP.TESTS
 
SQL> sho user
USER 为 "SCOTT"
SQL> conn / as sysdba
已连接。
SQL> alter database rename global_name to ORA10GDB.MYCORP;
 
数据库已更改。
 
SQL> select global_name from global_name ;
 
GLOBAL_NAME
-------------------
ORA10GDB.MYCORP
 
SQL>  conn scott/scott
已连接。
SQL>  drop database link link_test;
 
数据库链接已删除。

如果过global name本来是不包含domain name的,那么利用:
ALETER 语句更改global name 将不能再使用该语句修改回原来的名字。

可以通过修改props$基本表的方法[Metalink DocDI 382994.1]:

1)Take a complete consistent backup of the database

2)Execute the following:

1
2
3
4
5
6
$sqlplus /nolog
connect / as sysdba
 
SQL> update props$ set value$ = '<globalname without domain>' where name ='GLOBAL_DB_NAME';
 
SQL>commit;

3)Then connect as the schema user that owns the DBLINK and try to drop it.

4)Once the database link is dropped, the global_name can be changed back to the
desired name containing domain part using the alter database rename global_name
statement

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*