首先需要给用户创建同义词权限:
SQL> grant create synonym to jhchen;
Grant succeeded.
创建同义词语法:
create synonym 名字 for 所有者.对象名
需要给用jhchen登陆
SQL> create synonym eos_kpi_usersalary for kpi.eos_kpi_usersalary;
Synonym created
批量更改同义词需要先在所有者那里查询:
SELECT ' create synonym ' || OBJECT_NAME || ' for kpi.' || OBJECT_NAME || ';'
FROM USER_OBJECTS
WHERE OBJECT_TYPE IN
('TABLE', 'VIEW', 'PROCEDURE', 'TRIGGER', 'FUNCTION', 'PACKAGE');
复制下面的语句在jhchen用户下面执行即可完成!