Pages

Tuesday, June 21, 2011

Oracle Script 1: gives me access to all of the v_$* views


Here is a script for example that I use to "recreateme" -- recreate my account,
for testing purposes.  It gives me access to all of the v_$* views:

@connect "/ as sysdba"
set echo on
drop user ops$tkyte cascade;
create user ops$tkyte identified externally;
grant connect, dba to ops$tkyte;
alter user ops$tkyte default tablespace users;

begin
    for x in ( select object_name from user_objects where object_type = 'VIEW' and
               object_name like 'V\_$%' escape '\' )
    loop
        execute immediate 'grant select on ' || x.object_name || ' to ops$tkyte';
    end loop;
end;
/                                                 
@connect /
 
Source: asktom.oracle.com

No comments:

Post a Comment