Formating Output : =====================================>
set lines 200 pages 100
col username format a16
col ACCOUNT_STATUS format a20
select USERNAME, ACCOUNT_STATUS, LOCK_DATE,EXPIRY_DATE, PROFILE from DBA_USERS;
col object_name for a30;
col object_type format a20
col object_name format a30
select object_type,object_name from user_objects where status='INVALID' group by object_type,object_name ;
select object_type, count(0) from user_objects where status='INVALID' group by rollup(object_type);
select object_type,object_name from user_objects where status='INVALID' group by rollup(object_type,object_name);
select 'exec DBMS_MVIEW.refresh ('||''''||object_name||''''||','||''''||'C'||''''||');' MVQuery from user_objects where object_type = 'MATERIALIZED VIEW'
'GRANT SELECT ON '||table_name||' TO <read_only_user>;' from user_tables
select 'GRANT EXECUTE ON '||object_name||' TO campread;' from user_objects where object_type in ('FUNCTION','PACKAGE','PACKAGE BODY');
select 'exec DBMS_MVIEW.refresh ('||''''||object_name||''''||','||''''||'C'||''''||');' MVQuery from user_objects where object_type = 'MATERIALIZED VIEW'
Enable and Disable Constraints. : =====================================>
select 'alter table ' || table_name || ' disable constraint ' || constraint_name || ' ; 'from user_constraints where constraint_type = 'R';
select 'alter table ' || table_name || ' enable constraint ' || constraint_name || ' ; 'from user_constraints where constraint_type = 'R';
set lines 200 pages 100
col username format a16
col ACCOUNT_STATUS format a20
select USERNAME, ACCOUNT_STATUS, LOCK_DATE,EXPIRY_DATE, PROFILE from DBA_USERS;
col object_name for a30;
col object_type format a20
col object_name format a30
select object_type,object_name from user_objects where status='INVALID' group by object_type,object_name ;
select object_type, count(0) from user_objects where status='INVALID' group by rollup(object_type);
select object_type,object_name from user_objects where status='INVALID' group by rollup(object_type,object_name);
select 'exec DBMS_MVIEW.refresh ('||''''||object_name||''''||','||''''||'C'||''''||');' MVQuery from user_objects where object_type = 'MATERIALIZED VIEW'
'GRANT SELECT ON '||table_name||' TO <read_only_user>;' from user_tables
select 'GRANT EXECUTE ON '||object_name||' TO campread;' from user_objects where object_type in ('FUNCTION','PACKAGE','PACKAGE BODY');
select 'exec DBMS_MVIEW.refresh ('||''''||object_name||''''||','||''''||'C'||''''||');' MVQuery from user_objects where object_type = 'MATERIALIZED VIEW'
Enable and Disable Constraints. : =====================================>
select 'alter table ' || table_name || ' disable constraint ' || constraint_name || ' ; 'from user_constraints where constraint_type = 'R';
select 'alter table ' || table_name || ' enable constraint ' || constraint_name || ' ; 'from user_constraints where constraint_type = 'R';
No comments:
Post a Comment