Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3570

Re: Oracle Database - Shrink Tablespace

$
0
0

Hello João

 

You cannot shrink a tablespace by itself, , but you can shrink it's datafiles

 

Real Life: Shrinking or Removing Oracle Datafiles

 

In your case I think you could just drop a tablespace... as one of them should only contain few segments. This sometimes happens during upgrades.

1715052 - Tablespace cannot be deleted after upgrade

 

Check segment left in the almost empty tablespace

 

Select count(1), TABLESPACE_NAME  from dba_segments where owner like 'SAP%' and TABLESPACE_NAME like 'PSAPSR3702%' group by TABLESPACE_NAME;

  COUNT(1) TABLESPACE_NAME

---------- ---------------

        19 PSAPSR3702

       991 PSAPSR3702X

 

You could move these segments to the appropriate tablespace using the result from these commands

 

SELECT 'ALTER TABLE "' || OWNER ||'"."' || SEGMENT_NAME ||'" MOVE TABLESPACE '||' PSAPSR3702X;'

FROM dba_segments

WHERE TABLESPACE_NAME = 'PSAPSR3702'

AND SEGMENT_TYPE = 'TABLE'

/

 

SELECT 'ALTER INDEX "' || OWNER ||'"."' || SEGMENT_NAME || '" REBUILD TABLESPACE PSAPSR3702X ;'

FROM dba_segments

WHERE TABLESPACE_NAME = 'PSAPSR3702'

AND SEGMENT_TYPE = 'INDEX'

/

 

And then you can drop the tablespace

 

drop tablespace PSAPSR3702 including contents and datafiles;

 

 

 

Best regards


Viewing all articles
Browse latest Browse all 3570


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>