Table/index movement using pl/sql procedure
Table/index movement using pl/sql procedure
1 2 |
CREATE TABLESPACE AWS_DATA01 DATAFILE '+DATA' size 10G ##################### PRE-VALIDATIONS ################## |
1) Gather all below data into a SQL log file for future validations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
spool TABLE_INDEX_REORG_REBUILD_PREVALIDATIONS.log set echo on set linesize 300 col index_name for a30 col degree for a10 col status for a10 col table_name for a30 col owner for a30 col object_type for a20 col constraint_type for a20 col constraint_name for a30 col validated for a20 col degree for a10 set pagesize 100 select owner,object_type,status,count(*) from dba_objects where status <> 'VALID' and owner='SCOTT' group by owner,object_type,status order by owner; select owner,index_name,status from dba_indexes where TABLE_OWNER='SCOTT' and status<>'VALID'; select index_name,status from dba_ind_partitions where status <> 'USABLE'; select CONSTRAINT_TYPE,STATUS,count(1) from dba_constraints where owner='SCOTT' group by CONSTRAINT_TYPE,STATUS; set linesize 300 col index_name for a30 col degree for a10 col status for a10 select TABLE_NAME,INDEX_NAME,DEGREE,status from dba_indexes where OWNER='SCOTT' and degree not in (0,1); select object_type , count(*),status from dba_objects where owner=upper('SCOTT') group by object_type,status order by object_type; select table_name,index_name,logging from dba_indexes where OWNER='SCOTT' and logging = 'NO'; select distinct STATUS from v$datafile; select constraint_name,constraint_type,table_name,status,validated from dba_constraints where owner='SCOTT' and status <> 'ENABLED'; select distinct owner from dba_segments where tablespace_name='&tablespace_name'; select distinct owner from dba_tables where tablespace_name='&tablespace_name'; select distinct owner from dba_indexes where tablespace_name='&tablespace_name'; select distinct table_owner from dba_tab_partitions where tablespace_name='&tablespace_name'; select distinct table_owner from dba_tab_subpartitions where tablespace_name='&tablespace_name'; select distinct index_owner from dba_ind_partitions where tablespace_name='&tablespace_name'; select distinct index_owner from dba_ind_subpartitions where tablespace_name='&tablespace_name'; select distinct STATUS from v$datafile; select * from v$recover_file; select distinct segment_type from dba_segments where tablespace_name='&tablespace_name'; select distinct status from dba_indexes; select distinct status from dba_ind_partitions; select distinct status from dba_ind_subpartitions; spool off |
2) Export respective schema and whole DB as part of prechecks. 3) Create a Guaranteed Restore point and drop before dropping tablespace if everything is… Read More