You are on page 1of 3

Housekeeping Unused or Old Tablespace - SAP on Oracle - SCN Wiki Page 1 of 3

Getting Started Store

Community WIKI SAP Community Welcome, Guest Login Register Search the Community

SAP on Oracle / … / How To

Housekeeping Unused or Old Tablespace


Created by Ivy Toh, last modified on Jun 16, 2016

Problem
This article will show you what to do in case you want to perform a housekeeping on the unused or old tablespace to regain the freespace at disk level.

Example:
• In the DB02 -> Tablespaces -> Overview or DBACOCKPIT -> Space -> Tablespaces -> Overview, there is unused or old tablespace with 0% used existing in your database.
• After system upgrade, old tablespaces with the old release name, example PSAP<SID>620 and PSAP<SID>700 exist at the database.

Solution

Please refer the following flowchart for more details.

1. Check if the tablespace is empty using the following queries. If return 0, it means the tablespace is empty.

• SQL> select count(*) from dba_segments where tablespace_name = '<tablespace_name>';


• SQL> select count(*) from dba_extents where tablespace_name = '<tablespace_name>';
• SQL> select count(*) from dba_objects do, sys.sys_objects so where do.object_id = so.object_id and so.ts_number = ( select ts# from v$tablespace where name = '<tablespace_name>');

If the tablespace is NOT empty, please list out what are the objects under this tablespace using the following queries.

• SQL> select owner, segment_name, segment_type from dba_segments where tablespace_name = '<tablespace_name>'; OR
• SQL> select owner, segment_name, segment_type from dba_extents where tablespace_name = '<tablespace_name>'; OR
• SQL> select do.owner, do.object_name, do.object_type from dba_objects do, sys.sys_objects so where do.object_id = so.object_id and so.ts_number = ( select ts# from v$tablespace where name =
'<tablespace_name>');

2. Drop the unused tablespace using BRtools or DB command.

https://wiki.scn.sap.com/wiki/display/ORA/Housekeeping+Unused+or+Old+Tablespace 7/10/2019
Housekeeping Unused or Old Tablespace - SAP on Oracle - SCN Wiki Page 2 of 3

• BRTools:
brspace -u / -f tsdrop -t <TABLESPACE>
• DB Command:
drop tablespace <tablespace_name>;

Note:

It is recommended to drop the tablespace using the brtools as it will check if any objects still existing in the tablespace before drop it.

The warning or error as below occurs if the tablespace is not empty. You need to use option force to delete the tablespace immediately if you confirm that the existing objects are not required for
application.

Caution: Do not delete objects that are still using by the SAP system. Please perform point 3 and point 4 before drop it.

3. Check which tablespace that the existing objects belong to?

i) Check which data class that is mapped to existing objects using SE11 -> Technical attributes".

Example: T000 table belongs to the APPL2 data class

ii) Check which tablespace that is mapped to the data class using SE16 -> TAORA and IAORA tables by searching on the TABART (data class).

Example: APPL2 data class is assigned to PSAPSR3.

Note:

In R/3, the tablespaces contain objects in accordance with the technical attributes of the data classes.

Tables are mapping to certain data classes (TABART) in transaction SE11. The indexes belonging to a table are mapping to the same data class automatically. The TAORA (tables) or IAORA
(indexes) tables are used to assign the tablespaces to the individual data classes.

https://wiki.scn.sap.com/wiki/display/ORA/Housekeeping+Unused+or+Old+Tablespace 7/10/2019
Housekeeping Unused or Old Tablespace - SAP on Oracle - SCN Wiki Page 3 of 3

• The TSORA table contains the 'table tablespace -> index tablespace' assignment.
• The TAORA (tables) or IAORA (indexes) tables contain the ' data class (TABART) -> tablespace (TABSPACE)' assignment.
• The DD09L table contains data class (TABART) for all objects (TABNAME) with technical settings.

4. Perform the table reorganization using the brtools as per SAP Note 646681.

Reorganizing tables into the correct tablespace


---------------------------------------------------------
brspace -u / -f tbreorg -s <reorg_tsp> -t "<table_name>" -n <new_tsp> [-p <par_degree>]

Related articles
SAP Notes
2154498 - Unable to drop empty tablespace

1833552 - Old Oracle tablespace still being used after a system upgrade

1715052 - Tablespace cannot be deleted after upgrade

1819182 - Tables (TTREE*) remain in old exchange tablespace

646681 - Reorganization of tables with BRSPACE

541538 - FAQ: Reorganization

666061 - FAQ: Database objects, segments, and extents


No labels

Contact Us SAP Help Portal


Privacy Terms of Use Legal Disclosure Copyright Cookie Preferences
Follow SCN

https://wiki.scn.sap.com/wiki/display/ORA/Housekeeping+Unused+or+Old+Tablespace 7/10/2019

You might also like