create PUBLIC database link link_101 connect to SYSTEM identified by "123456" using '(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.11)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mydb)
)
)';
create database link link_102 connect to SYSTEM identified by "123456" using '(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.11)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mydb)
)
)';
sys@ORCL>select * from dual@link_101;
DUM
---
X
sys@ORCL>select * from dual@link_102;
DUM
---
X
修改远端数据库密码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
SQL> alter user system identified by "654321";
User altered.
sys@ORCL>select * from dual@link_101;
select * from dual@link_101
*
ERROR at line 1:
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from LINK_101
sys@ORCL>select * from dual@link_102;
select * from dual@link_102
*
ERROR at line 1:
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from LINK_102
sys@ORCL>select * from dual@link_101;
select * from dual@link_101
*
ERROR at line 1:
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from LINK_101
sys@ORCL>select * from dual@link_102;
select * from dual@link_102
*
ERROR at line 1:
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from LINK_102
sys@ORCL>alter public database link link_101 connect to system identified by "654321";
Database link altered.
sys@ORCL>alter database link link_102 connect to system identified by "654321";
Database link altered.
sys@ORCL>select * from dual@link_101;
DUM
---
X
sys@ORCL>select * from dual@link_102;
DUM
---
X
方法二如果提示ORA-01031: insufficient privileges,则赋权grant alter database link to zx;