Privileges - Compare all privileges between two instance for a specific user
--
--  Compuser_privs.sql    
--
--  Compare all privileges between two instance for a specific user:
--		1. Roles granted
--		2. System privileges granted
-- 	3. Object privileges granted
--  Usage: @Compuser_privs username instance1 instance2
--

-- Compare Roles granted
select * from DBA_ROLE_PRIVS@&&2 where grantee = upper('&&1')
minus
select * from DBA_ROLE_PRIVS@&&3 where grantee = upper('&&1')
;
 
select * from DBA_ROLE_PRIVS@&&3 where grantee = upper('&&1')
minus
select * from DBA_ROLE_PRIVS@&&2 where grantee = upper('&&1')
;

-- Compare System privileges granted
select * from DBA_SYS_PRIVS@&&2 where grantee = upper('&&1')
minus
select * from DBA_SYS_PRIVS@&&3 where grantee = upper('&&1')
;
 
select * from DBA_SYS_PRIVS@&&3 where grantee = upper('&&1')
minus
select * from DBA_SYS_PRIVS@&&2 where grantee = upper('&&1')
;

-- Compare Object privileges granted
select * from DBA_TAB_PRIVS@&&2 where grantee = upper('&&1')
minus
select * from DBA_TAB_PRIVS@&&3 where grantee = upper('&&1')
;
 
select * from DBA_TAB_PRIVS@&&3 where grantee = upper('&&1')
minus
select * from DBA_TAB_PRIVS@&&2 where grantee = upper('&&1')
;