This procedure explains how to delete data from the BW servers which are no longer useful. There are several reasons for doing that :
For reference, the cost of 1 Go (depends on the SLA level & decreases with time - Empty storage about 20% is not invoiced) :
Storage Cost €/Go | 2015 | 2016 |
|---|---|---|
L1 - WBP | 1.78 | 1.68 |
L2 - PQ1 / PQ2 / WBD | 0.99 | 0.94 |
L3 - WB1 / WBQ / SQ1 / SQ2 / DQ1 / DQ2 | 0.5 | 0.47 |
In this clean 4 main types of data :

1 - Business Data : The data used by the reports and users. It's all the data found in the info-providers and related objects.
2 - Statistics Data : All the logs and historical saved data that results of the usage and maintenance of BW.
3 - Meta Data : Basically the content created by the users. Queries, workbooks, bookmarks...
4 - Database Platform : All data generated by oracle and SAP internally (Usually not much we can do).
The full procedure should only be conducted once a year on each server and mainly on the production servers.
Full database and individual table sizes can be checked via DB02 transaction. In that transaction there are several functions that are useful.
You can have a look at the overall server size by going to the "Overview". Then select "History" and either days/weeks or months :

You can calculate the used space by simply doing : Size(Gb) - Free(Gb)
You can check the individual table sizes via the "Segments" section.
In "Overview" --> Top Sizes you have the top 100 largest tables : 
Note that in the Overview Top Sizes, it shows the size of the individual tables. This is not a very complete approach as many tables are actually much larger once you add indexes, logs and partitions |
To measure the real size of a table, it is not enough to check only the table itself. You may be underestimating the size.
To have the full picture, you need to check all objects relative to that table :
|
When you delete data in tables, the tables size do not always change. This depends on the configuration of the table.
Usually if a table is dropped (ie. completly deleted, not just emptied) then the change will be reflected in DB02 the next day.
But in most cases, there is no change. it is necessary to do a "Re-organisation" of the table in order to reflect the change.
The BW team cannot do this re-org so it is necessary to request it to the SAP technical team.
Before launching any of the following clean up actions, it is better if all the BW users accounts that have not been used for a long time (<6 months - Excluding IT & non-dialog users) be deleted from the system. This is because in some cases, data cannot be deleted if the user still exists.
In order to be able after the process to verify the changes of sizes, you need to take a snapshot of the database sizes before running the process.
1 - Go to DB02
2 - Select the "Segments" and "Detailed Analysis" options
3 - Extract the list of top largest tables sizes and save it

DB02 should be updated daily - If it is not up to date, contact the SAP Technical team and ask then to correct the scheduling of the job. |
This program deletes queries that have not been used for a long time (365days). Although this is not very large in terms of size, it allows to delete obsolete reports that no longer need to be maintained and also allows removal of all the test queries.
We do not delete all un-used queries : please check the specific page for all the exceptions.
| Main Parameter | Value |
|---|---|
| Last Use Date | current date - 365 |
This is to remove bookmarks that result from Web templates in SAP NetWeaver 7.0 format.
1 - Go to transaction Se38
2 - Run program RSRD_ADMIN_BOOKMARKS_3X (For old 3.x version bookmarks)

3 - Select All users. For Created Before/Last Access, put Current Date - 365
4 - Select All bookmarks and delete
You need to repeat the select all + delete several times if necessary as the initial screen only shows a few bookmarks |
RSRD_ADMIN_BOOKMARKS_3X can only delete 3.x version bookmarks. Program RSWR_BOOKMARK_REORG can be used to delete 7.x bookmarks but the problem is that you cannot know if it's still in use - So it's not included in this process. |
| References |
|---|
| Reorganization of Bookmarks |
Deleting bookmark IDs and view IDs that were created by the system for information broadcasting.
Bookmark IDs and view IDs that have been generated temporarily for the system to generate online links. The bookmark IDs or view IDs are no longer used in broadcast settings and do not form part of a URL for any sent online links.
Bookmark IDs and view IDs that are no longer being used in broadcast settings but have still been sent as a part of a URL for an online link. This means that the bookmark IDs and view IDs can only be deleted when they are no longer being used in a broadcast setting.
1 - Go to transaction SE38
2 - Run program RSRD_BOOKMARK_REORGANISATION
3 - Input "365" in Older Than Days
4 - Uncheck "Test Call (No Delete)" - Otherwise no real deletion will be done

| Main parameter | Value |
|---|---|
Temporary Bookmark ID Older than (In days) | 365 |
Bookmark IDs Old than (In days) | 365 |
| Test Call (No delete) | Uncheck |
| References |
|---|
| Reorganization of Bookmark IDs and View IDs |
This program is used to delete from the workbook storage (RSRWBSTORE) all the workbooks that are still stored but are no longer referenced in any favorites or roles. This happens for example for all the workbooks in the favorites of a user account that was deleted.
Note that the program also checks the existing workbooks that have no queries in it. This can happen for workbooks that are in fact simple documentations via excel. That is why those are not deleted (see process below).
1 - Go to transaction SE38
2 - Run program RSWB_ROLES_REORG
3 - Choose "Only Examine BW Roles"

This report has several sections :
| Section | Explanation | Action |
|---|---|---|
| Incorrect References from Workbooks in Roles | References from workbooks in roles that do not exist in workbook storage | Delete all |
| Workbooks without Query Assignment | References to workbooks in roles that do not have a query assignment | DO NOT DELETE |
| Incorrect References from Workbooks in Favorites | References from workbooks in favorites that do not exist in workbook storage | Delete all |
| References from workbooks in favorites that do not exist in workbook storage | References to workbooks in favorites that do not have a query assignment | DO NOT DELETE |
| Unused Workbooks | Workbooks in workbook storage that are not referenced in roles or favorites | Delete all |
| Main tables cleaned |
|---|
| RSRWBSTORE AGR_HIER AGR_HIERT RSRWORKBOOK SMEN_BUFFC RSRWBINDEX RSRWBINDEXT |
1 - Go to RSRD_ADMIN
2 - Click on Settings
3 - Remove any values in Created By.
4 - In Last Executed On, select 01.01.2000 to Current Date - 365

5 - Select the settings & delete

| Main parameter | Value |
|---|---|
Last Executed On | 01.01.2000 to Current Date - 365 |
This operation should only be done if temporary tables are taking a lot of space. Check in DB02 all tables starting with "/BI0/0" |
The BW System uses different temporary objects for queries and other processes.
/BI0/01* Temporary Table
/BI0/02* External hierarchies
/BI0/03* Not used any longer.
/BI0/04* Only relevant for BW3x: 04 are names of stored procedures
/BI0/05* Names of triggers that are used while the system compresses requests
1 - Go transaction Se38
2 - Run program SAP_DROP_TMPTABLES

| Main tables cleaned |
|---|
| /BI0/0* |
| References |
|---|
SAP Note 1106393 |
The DTP error log can be analysed via program RSB_ANALYZE_ERRORLOG.
To delete the DTP error log :
1 - Go to transaction SE38
2 - Run program RSBM_ERRORLOG_DELETE
3 - Input "30 days" in the "but always older than ... days" parameter
4 - Check "Delete log"
5 - Run - If large, run in Background

| Main parameter | Value |
|---|---|
but always older than ... days | 30 |
| delete log | Checked |
| Main tables cleaned |
|---|
| RSBERRORLOG (+ indexes) |
| References |
|---|
SAP Note 1139396 SAP Note 1106393 |
1 - Go to transaction SE38
2 - Run program RSDDSTAT_DATA_DELETE
3 - Select all checkboxes for data to be deleted
4 - Free Date selection : Current Date - 365
5 - In the Date up until which data is to be deleted, select "Date Selection" and then enter Current date - 365 in the "Up to Day (Incl.)" field.
| Main parameter | Value |
|---|---|
Up to day (Inc) | Current Date - 365 |
| Main tables cleaned |
|---|
All RSDDSTAT* : RSDDSTATLOGGING (+Indexes) |
Corresponding tables cleaned by option :
Option | Tables |
Query Statistics Tables | RSDDSTATHEADER, RSDDSTATDM, RSDDSTATEVDATA, RSDDSTATAGGRDEF, RSDDSTATINFO. |
Statistic Loggin Tables | RSDDSTATLOGGING |
Aggregates/BIA Index Process | RSDDSTATAGGR, RSDDSTATTREXSERV, RSDDSTATTREX, |
InfoCube Statistics (Delete, Compress) | RSDDSTATDELE, RSDDSTATCOND |

| Main tables cleaned |
|---|
RSBATCHDATA RSBACTHHEADER |
1 - Go to transaction SE38
2 - Run program RSTT_TRACE_DELETE

| Main parameter | Value |
|---|---|
Ignore Number of Last Days | 100 |
| Application Area | BW_BEX |
| Main tables cleaned |
|---|
RSTT_CALLSTACK |
1 - Go to transaction SE38
2 - Run program RSDQ_DYNP_GP_CLEANUP
3 - Check the PDOIT
4 - Execute the program
| Main tables cleaned |
|---|
DYNPSOURCE + corresponding LOB segments |
1 - Go to transaction SE38
2 - Run program RSSODFRE
3 - Select Minimum Age (Days) = 60
4 - Check the 2 delete boxes
5 - Uncheck Test Mode
6 - Execute the program
| Main parameter | Value |
|---|---|
Minimum Age (Days) | 30 |
| Test Mode | Unchecked |
| Delete documents linked | Checked |
| Delete unsent documents | Checked |
| Main tables cleaned |
|---|
SOFFCONT1 BCST_CAM BCST_RE BCST_SR SOC3 SOCS SOES SOFM SOOD SOOS SOST |
1 - Go to transaction Se38
2 - Run program : RSSO_DELETE_PRIVATE
3 - Select all types of messages (Inbox to Private Trash)
4 - For Inbox, check “All” instead of “Viewed”
5 - Uncheck Test Mode
6 - Run the program
| Main parameter | Value |
|---|---|
Minimum Age (Days) | 60 |
| Inbox | All |
| Test Mode | Unchecked |
| Delete unsent documents | Checked |
1 - Go to SE38
2 - Run program RSBCS_REORG
3 - Select "Specify Age (in Days)" and select from 60 to 9999.
4 - Uncheck the "Test Mode"

| Main parameter | Value |
|---|---|
Age in days | 60 to 9999 |
| Test Mode | Unchecked |
1 - Go to SE38
2 - Run program RSPC_INSTANCE_CLEANUP
3 - In Older than : current date - 365

| Main parameter | Value |
|---|---|
Older Than | Current Date - 365 |
| Delete Logs | Checked |
| Main tables cleaned |
|---|
RSPCINSTANCE RSPCINSTANCET |
1 - Go to SE38
2 - Run program RSPC_LOG_DELETE
3 - In the "Up to and including date" enter current date - 365

| Main parameter | Value |
|---|---|
Up to and including date | Current Date - 365 |
| Main tables cleaned |
|---|
RSPCLOGCHAIN RSPCPROCESSLOG |
This is already scheduled automatically (at least on WBP) |
1 - Go to SE38
2 - Run program RSBTCDEL2
3 - Run with default values and "Test Run" unchecked

| Main tables cleaned |
|---|
TBTCO |
1 - Go to transaction SE38
2 - Run program SBAL_DELETE
3 - Select Expiry Date "and logs which can be deleted before the expiry date"
4 - In from (date/time) to (date/time) select "01.01.1900" and current date - 730 days

| Main parameter | Value |
|---|---|
Expiry Date | and logs which can be deleted before the expiry date |
| from (date/time) | 01.01.1900 |
| to (date/time) | current date - 730 days |
| Main tables cleaned |
|---|
BALHDR BALDAT |
1 - Go to SE38
2 - Run program RSETESTD
The BW team doesn't have the access to run this report - It is necessary to request it from the SAP Technical Team |
| Main tables cleaned |
|---|
EDI40 EDIDC EDIDS |




Note:
For each of the largest partitioned cubes, this can be run to delete useless partitions. This is particularly important after data was deleted from the cubes.
1 - Go to SE38 transaction
2 - Run program SAP_DROP_EMPTY_FPARTITIONS
3 - Input in CUBENAME the name of the cube you want to clean
4 - Execute once with the "Show Option"

5 - Check the result of the analysis

6 - Depending on the result, re-execute the program with "DO_DROP" checked and either "DEL_CNT" or "DEL_DIM"

How to
As this program run's individually for each infocube, it cannot be launched for all. You need to identify the info-providers with the largest table dimensions and then apply the program to those cubes.
1 - Go to DB02
2 - Double click on "BW Analysis" on the left menu :

3 - Double click on the "Cubes & related objects - Dimension" line

4 - Sort the results by "Size". This provides the largest dimensions in BW. You can then run the program on those infocubes.

5 - Go to transaction RSRV
6 - Select the test "Unused entries in InfoCube dimension" and double click to add it to the tests to run
7 - Double click on the right side "Unused entries in InfoCube dimension" and enter the name of the infocube you want to clean
8 - Click on Execute

Note that function module RSDDCVER_DIM_UNUSED can also be used for this. But it will not provide any logs. |
9 - Once the check is finished, go back, select the test line (on the right) and then "Correct Error" - Then select YES for Carry out Repairs.


1 - Go to RSA1 transaction
2 - In the left menu, click on Administration --> Monitors --> Aggregates

3 - Analyse each aggregate to see if it is useful

To know if the aggregate can be deleted :
4 - To delete the aggregate, for each cube selected, go to RSA1
5 - Select the cube and right click --> Manage
6 - Go to the Rollup tab and click on "Aggregates"

7 - Select the aggregate, right click and delete






| References |
|---|
| How to Delete Error PSA |
When you copy an ODS, the indexes are also copied ! Think about remove them if not needed in the new ODS. It is most of the time useless to create indexes with fields that are already all in the ODS KEY |
Secondary indexes improve performances in a few cases :
First step is to find the largest secondary indexes
1 - Go to transaction DB02
2 - Select Detailed Analysis

3 - Input the following values (<> *0 will exclude the primary indexes).

4 - Sort by size(MB). You now have the list of the largest secondary indexes in the system

Now for each of the large Secondary Indexes, you need to check if it is still useful.
Checking what is in the index
1 - Go to RSA1 transaction
2 - Select the DSO/ODS, right click and display
3 - You can see in the "Index" group the existing indexes and which characteristics are included

Checking if the index is still useful
Now that you know what is inside the index, you need to conduct several checks to see if it is useful.
If any of these conditions is fulfilled then do not delete the index :
If none of these conditions are fulfilled, then the ODS Secondary Index can be deleted.
You can delete it from the RSA1 ODS modification view.
Note that a transport order is needed.