you would have to maintain a list of what you wanted created and what you wanted to have dropped when you grant/revoke a role.
instead of granting the role, you would run a procedure, this procedure (which you will code) will not only grant the role, but would also issue the create synonym commands.
similar to:
ops$tkyte%ORA10GR2> create table t1 as select 'this is ops$tkyte.t1' data from dual;
Table created.
ops$tkyte%ORA10GR2> create table t2 as select 'this is ops$tkyte.t2' data from dual;
Table created.
ops$tkyte%ORA10GR2>
ops$tkyte%ORA10GR2> create role my_role;
Role created.
ops$tkyte%ORA10GR2> grant select on t1 to my_role;
Grant succeeded.
ops$tkyte%ORA10GR2> grant select on t2 to my_role;
Grant succeeded.
ops$tkyte%ORA10GR2>
ops$tkyte%ORA10GR2> create or replace procedure grant_role( p_role in varchar2, p_to in varchar2 )
2 as
3 l_str long;
4 l_role dba_roles.role%type;
5 begin
6 select role into l_role from dba_roles where role = p_role;
7 l_str := 'grant ' || l_role || ' to ' || dbms_assert.schema_name( p_to );
8 execute immediate l_str;
9 dbms_output.put_line( l_str );
10
11 for x in ( select owner, table_name
12 from dba_tab_privs
13 where grantee = l_role )
14 loop
15 l_str :=
16 'create or replace synonym ' ||
17 p_to || '.' || x.table_name ||
18 ' for "' || x.owner || '"."' || x.table_name || '"';
19 execute immediate l_str;
20 dbms_output.put_line( l_str );
21 end loop;
22 end;
23 /
Procedure created.
ops$tkyte%ORA10GR2>
ops$tkyte%ORA10GR2> exec grant_role( 'MY_ROLE', 'SCOTT' );
grant MY_ROLE to SCOTT
create or replace synonym SCOTT.T2 for "OPS$TKYTE"."T2"
create or replace synonym SCOTT.T1 for "OPS$TKYTE"."T1"
PL/SQL procedure successfully completed.
be sure to see
http://asktom.oracle.com/tkyte/Misc/RolesAndProcedures.html you'll need create ANY synonym granted directly to the owner of this procedure (which means of course, that you will need a code review and a half of the finished code - ANY privileges are powerful and should not be taken lightly)
And then the reverse when the role is revoked.
Of course - you have the problem of "what to do if we create a new table and grant select on it to a role" - you'll need to maintain this yourself as well (eg: you have lots of code to write)
I'm not sure I'd do this actually, there is NO NEED for the synonyms. None. There is NOTHING wrong with using schema.object in SQL - in fact, it is highly recommended.