Saturday, May 12, 2018

Some useful queries


è To get the max value occupied by column’s

SELECT peid,emp_id, LENGTH(TRIM(e1.emp_id )) FROM app_ehr_location.em_employee_employment e1 where  LENGTH(TRIM(e1.emp_id ))>15

à Moving Index and table to different tablespace

      alter index sys.SOURCE$ rebuild tablespace users;
   ALTER TABLE sys.TRIGGER$ MOVE TABLESPACE users

è Killing the pumping jobs

      drop table system.SYS_EXPORT_SCHEMA_01
select job_name, state from dba_datapump_jobs;

à Select space each Table OR Index

select *
  from (select owner, segment_name, bytes / 1024 / 1024 MG
          from dba_segments
         where segment_type = 'TABLE' and owner like'SYS%' and tablespace_name='SYSTEM'
         order by bytes / 1024 / 1024 desc)
 where rownum <= 50;


No comments:

Post a Comment