This document will detail how to calculate database savings after archiving.
You have performed a lot of data archiving and now would like to determine how much space has been saved in the database after this corresponding data has been deleted from the database tables. The application data stored in the archive files is compressed up to five times (depends on the archive object and application data) and could differ from one customer to another. It is not possible to give a precise compression ratio for an archive object.
Two collection methods exist to calculate the database savings:
- DB02 Calculation Method
- Standard Log Method
As there is additional information contained in the files (header and and management information) it is not possible to provide a a simple formula for estimating the amount of data that is archived from the database.
DB02 Calculation Method
You can calculate the free space by using transaction DB02. The data will need to be refreshed in this DB02 transaction before archiving (in order to get the information beforehand) and also after archiving. It is also necessary to reorganize the tablespace before the data in transaction DB02 will show the correct freespace.
In addition, the space statistics option in transaction DB15 can be used to determine the free space in releases lower than the Enterprise release. The screenshot below shows this button:
Standard Log Method
The standard log involves the numbers and names of the archived ABAP dictionary structures. Multiply each structure with the ABAP dictionary length and you get the gross saved database space.
Use the function module DDIF_TABL_GET (parameter DD03P_TAB-LENG) to get the ABAP dictionary length for each structure. In the image below you can see that this function returned seven entries for the DDO3P_TAB table. Click on these entries and then scroll across to see the LENG field in this table for each of these entries.
Please note that from the R/3 Enterprise release, statistical data is collected during the write, delete, and reload phases. In addition to the runtimes of the archiving jobs and the number of processed data objects, the collected statistical data contains information about the physical disk space occupied by the archive and the storage space that data archiving may free up in the database. This analysis transaction can be called either directly from the initial archive administration screen or from the archive management, via statistics. You can also use transaction SAR_DA_STAT_ANALYSIS itself.
The ADK calculates the memory space on the basis of the relevant ABAP Dictionary object type. The width of the corresponding object is used for this. In the ABAP Dictionary, however, a constant length is allocated to fields of the LRAW or LCHR types while these fields are stored in a variable way in the database. This might therefore lead to considerable differences between the calculated statistics and the space that is actually available in the database. Therefore it is important to carefully evaluate statistic values of the data archiving for archiving objects that contain tables with LRAW or LCHR fields. For this reason the statistic values are not relevant for the BC_DBLOGS and IDOC archiving objects.
Ideally you should reorganise the database after archiving so that you can use this recently-freed storage space. This is because only data blocks whose contents have been deleted beyond a minimum limit are available for new data. If you want to use free space, within partially-deleted data blocks, immediately, then you will have to reorganise the database after data archiving.
If you want to create space for other tables you should carry out a reorganization for both the tablespace of the table and for the tablespace of the indices. The costs for a table reorganization are considerably higher than for an index reorganization. Therefore you should only perform a table reorganization in exceptional cases.
You should not carry out a reorganization if you expect the same data increase for the archived tables. However, if you archive data that is no longer required in the system, it is helpful to peform a reorganization. In this way you can immediately and completely use the space freed up by the archiving.
Related SAP Notes/KBAS:
SAP Note 53062 Database reorganization and data archiving
SAP Note 921206 Statistics: Tables with fields of type LRAW and LCHR