分别创建2个db link,1个private db link,1个public link
SQL> create database link tps connect to scott identified by tiger using 'orcl';
Database link created.
SQL> create public database link pps connect to scott identified by tiger using 'orcl';
Database link created.
SQL> select * from dba_db_links;
OWNER DB_LINK USERNAME HOST CREATED
--------------- -------------------- -------------------- -------------------------------------------------------------------------------- -------------------
PUBLIC PPS SCOTT orcl 2014-11-24 16:43:54
PPA TPS SCOTT orcl 2014-11-24 16:43:39
现在开始来修改密码,可以选择删除dbalink后重建db link的方式。也可以直接修改。
修改public db link密码,在sys用户下执行:
SQL> alter public database link pps connect to scott identified by oracle;
Database link altered.
SQL> select count(*) from tab@pps;
COUNT(*)
----------
4
修改private db link的密码
SQL> alter database link tps connect to scott identified by oracle;
alter database link tps connect to scott identified by oracle
*
ERROR at line 1:
ORA-01031: insufficient privileges
权限不足的,因此授予权限,登陆dba用户
SQL> grant alter database link to ppa;
Grant succeeded.
SQL> alter database link tps connect to scott identified by oracle;
Database link altered.
SQL> select count(*) from tab@tps;
COUNT(*)
----------
4
完成。