My note

select * From gv$session_longops where time_remaining <> 0

select 'grant ' ||privilege||' '|| 'to ' || grantee || ';'from dba_sys_privs ;
select 'grant ' ||privilege||' '|| 'ON ' || owner||'.'||table_name|| ' to ' || grantee || ';'from dba_tab_privs ;
select 'grant '||granted_role||' to '|| Grantee || decode(ADMIN_OPTION, 'YES', ' WITH ADMIN OPTION')||';' from sys.dba_role_privs ;
select 'alter user '|| username ||' quota '|| decode(max_bytes, -1, 'UNLIMITED', max_bytes)|| ' on '||tablespace_name||';'  from   sys.dba_ts_quotas ;

Select name,password from sys.user$ where name in ('BETA','ALPHA')

set timing on
SPOOL EMP.OUT
alter session force parallel query;
EXEC DBMS_STATS.gather_database_stats;


Flush cache.

select sql_id, child_number, plan_hash_value plan_hash, executions execs, elapsed_time/1000000 etime,
(elapsed_time/1000000)/decode(nvl(executions,0),0,1,executions) avg_etime, u.username,
sql_text
from gv$sql s, dba_users u
where upper(sql_text) like upper(nvl('&sql_text',sql_text))
and sql_text not like '%from v$sql where sql_text like nvl(%'
and sql_id like nvl('&sql_id',sql_id)
and u.user_id = s.parsing_user_id
/  
DECLARE
  name varchar2(50);
  version varchar2(3);
BEGIN
  select regexp_replace(version,'\..*') into version from v$instance;
  if version = '10' then
    execute immediate
      q'[alter session set events '5614566 trace name context forever']'; -- bug fix for 10.2.0.4 backport
  end if;
  select address||','||hash_value into name
  from v$sqlarea
  where sql_id like '&sql_id';
  sys.dbms_shared_pool.purge(name,'C',1);
END;
/

select plan_table_output  from table(dbms_xplan.display);
 SELECT *  FROM TABLE(DBMS_XPLAN.display_sql_plan_baseline(plan_name=>'SQL_PLAN_2uj9jpmrhayan546e57bf'));


exec SYS.DBMS_STATS.GATHER_TABLE_STATS(OwnName=>'SYS ADM' ,TabName=>'Table Name Here' ,method_opt=>'FOR ALL COLUMNS SIZE 75' ,ESTIMATE_PERCEBT=>100,DEGREE=>4,CASCADE=> TRUE):


Gather Status:-

BEGIN
  SYS.DBMS_STATS.GATHER_TABLE_STATS (
     OwnName           => 'BI'
    ,TabName           => 'F_CLM'
    ,Estimate_Percent  => 10
    ,Method_Opt        => 'FOR ALL COLUMNS SIZE 1'
    ,Degree            => 80
    ,Cascade           => TRUE);
END;
/
select plan_table_output  from table(dbms_xplan.display);

Comments

Popular Posts