select 'drop tablespace ' || tablespace_name || ' including contents and datafiles cascade constraints;' from dba_tablespaces where tablespace_name like 'TS%';
drop tablespace TS01 including contents and datafiles cascade constraints; drop tablespace TS02 including contents and datafiles cascade constraints; drop tablespace TS03 including contents and datafiles cascade constraints; drop tablespace TS04 including contents and datafiles cascade constraints; drop tablespace TS07 including contents and datafiles cascade constraints; drop tablespace TS100 including contents and datafiles cascade constraints; drop tablespace TS200 including contents and datafiles cascade constraints;
select 'alter table hr.' || table_name || ' move tablespace hr_data_ts;' from dba_tables where owner = 'HR';
alter table hr.COUNTRIES move tablespace hr_data_ts; alter table hr.REGIONS move tablespace hr_data_ts; alter table hr.LOCATIONS move tablespace hr_data_ts; alter table hr.DEPARTMENTS move tablespace hr_data_ts; alter table hr.JOBS move tablespace hr_data_ts; alter table hr.EMPLOYEES move tablespace hr_data_ts; alter table hr.JOB_HISTORY move tablespace hr_data_ts;
select 'alter index hr.' || index_name || ' rebuild tablespace hr_index_ts;' from dba_indexes where owner = 'HR';
alter index hr.REG_ID_PK rebuild tablespace hr_index_ts; alter index hr.COUNTRY_C_ID_PK rebuild tablespace hr_index_ts; alter index hr.LOC_ID_PK rebuild tablespace hr_index_ts; alter index hr.LOC_CITY_IX rebuild tablespace hr_index_ts; alter index hr.LOC_STATE_PROVINCE_IX rebuild tablespace hr_index_ts; alter index hr.LOC_COUNTRY_IX rebuild tablespace hr_index_ts; alter index hr.DEPT_ID_PK rebuild tablespace hr_index_ts; alter index hr.DEPT_LOCATION_IX rebuild tablespace hr_index_ts; alter index hr.JOB_ID_PK rebuild tablespace hr_index_ts; alter index hr.EMP_EMAIL_UK rebuild tablespace hr_index_ts; alter index hr.EMP_EMP_ID_PK rebuild tablespace hr_index_ts; alter index hr.EMP_DEPARTMENT_IX rebuild tablespace hr_index_ts; alter index hr.EMP_JOB_IX rebuild tablespace hr_index_ts; alter index hr.EMP_MANAGER_IX rebuild tablespace hr_index_ts; alter index hr.EMP_NAME_IX rebuild tablespace hr_index_ts; alter index hr.JHIST_EMP_ID_ST_DATE_PK rebuild tablespace hr_index_ts; alter index hr.JHIST_JOB_IX rebuild tablespace hr_index_ts; alter index hr.JHIST_EMPLOYEE_IX rebuild tablespace hr_index_ts; alter index hr.JHIST_DEPARTMENT_IX rebuild tablespace hr_index_ts;
select table_name, tablespace_name from dba_tables where owner = 'HR';
select index_name, tablespace_name from dba_indexes where owner = 'HR';