Reorganize Tables (ttaad4225m000)
Use this session to rebuild indices and/or to check and rebuild the referential integrity.
- A super user.
- A normal user, with sufficient session authorization, who has the Data Admin Role as specified in the AMS Parameters (ttams0100m000) session. See Table reconfiguration by normal users.
If a normal user does not have the data admin role, the session is not started and an error message is displayed.
Check and rebuild the referential integrity
A table field may have a reference to another table. For example, the "Invoice-from Business Partner" (ifbp) field in the Material Costs (tpppc211) table refers to the Business Partners (tccom100) table. If you try to delete a business partner, the system checks whether the business partner is used in other tables. This is done by checking the reference counter for that business partner. If the reference counter is zero, the record is not used anymore and can be deleted. In this session, you can repair these reference counters, check referential integrity and nullify undefined references. Refer to the field help for details.
You must repair the reference counters, for example, after running the Create Table from Sequential Dump (ttaad4227m000) session with the Ignore Referential Integrity Constraints check box selected. The import process sets the reference counters of all imported records to 0. This is a wrong situation, because now you can delete records, even if they are used in other tables. To repair the counters, you must run the current session with the Repair Reference Counter check box selected.
Executables
Internally the session uses the following executables:
- bdbreconfig6.2 (-Z option): to rebuild data and indices
- refint6.2: to check and rebuild the referential integrity
Field Information
- Selection Range
-
- Company, Package, Table
-
Specify a range where you want to reorganize the tables for.
- Options
-
- Drop and recreate Indices Only
-
Recreates all existing indices of the selected tables. Also creates any missing indices.
- Create Missing Indices Only
-
If this check box is selected, only missing indices are created. Existing indices are not recreated.
Note: If Drop and recreate Indices Only is selected while Create Missing Indices Only is cleared, these limitations apply:- For tenants in Online mode: You can run this reorganization only when selecting a single table (across one or more companies).
- For tenants in Admin Only mode: You can run this reorganization for any selection, regardless of the number of tables. However, if the selection includes more than 1,000 tables per company, you are prompted to confirm whether you want to continue.
- Exclude Logical Tables
-
If this check box is selected, indices of logical tables are not recreated.
- Reference Integrity
-
- Check Validity of Reference
-
If this check box is selected, the Check Validity of Reference is checked. You can specify the output file in the File for undefined references field.
- Repair Reference Counter
-
To guarantee referential integrity, the LN database stores reference counters, which indicate how many times a record is used in a parent child relation. The parent record can only be deleted if the reference counter is zero. (Reference counters are only applicable if the Delete Mode or Update Mode in the relation is Restricted (with counter) .
It is essential to repair these reference counters:
- After you have changed the logical table structure through the Logical Tables (ttaad4120m000) session.
- After you have run the Create Table from Sequential Dump (ttaad4227m000) session or the Convert / Recover Tables (ttaad4228m000) session, with the Ignore Referential Integrity Constraints check box selected.
- Repair Reference of Parent Only
-
If this check box is selected, the session repairs only the reference counters of tables in the selection range: for each record in a parent table, the session counts the corresponding records in the related child tables, and subsequently updates the reference counter in the parent table.
If this check box is cleared, the session repairs the reference counters for more tables than the ones that are specified in the selection range: counters are repaired for all tables being referred by the child tables of the tables in the selection range. For example: the selection range consists of (parent) table A only. A is referred by the child table B. B however also refers to another parent table C. The session repairs the reference counters for parent tables A and C. For more details, refer to the example below.
Example
The tttxt001 table has a lot of child tables. One of them is the Material Costs (tpppc211) table. The Material Costs table contains references to multiple tables: not only to tttxt001 (Language Independent Text Data), but also to various other tables, for example to tccom100 (Business Partners).
- If the selection range is tttxt001 – tttxt001, and the Repair only reference of parent check box is selected, the session only repairs the reference counters for the tttxtt001 table.
- If the selection range is tttxt001 – tttxt001, and the Repair only reference of parent check box is cleared, the session repairs the reference counters for tttxt001 and for all other tables that are referred by the child tables of tttxt001. Counters are repaired, for example, for tccom100, because tccom100 is referred by tpppc211, which is a child table of tttxt001.
Note:- Many LN tables contain references to multiple parent tables, which in turn also contain references to multiple parent tables, and so on. Therefore, repairing the counters with this check box cleared can be very time consuming.
- If this check box is selected, while the Repair Reference Counter check box is cleared, the session only checks the validity of reference for the specified parent tables to their direct child tables. Relations from these child tables to other parent tables are not checked.
- If this check box is cleared, while the Repair Reference Counter check box is cleared, the session checks the validity of reference for the specified parent tables to their direct child tables. The session also checks relations from these child tables to other parent tables.
- Include Tables without Reference
-
If this check box is selected, reference counters of all tables under the selection are set to 0 if the tables are not referenced.
When a parent table does not have child tables referencing it, the Refint process must set the parent table’s reference counters to 0. However, this does not always occur, which can prevent record deletion and lead to 605 errors due to incorrect reference counter values. The current check box is used as a repair mechanism, forcing Refint to set the reference counters of unreferenced tables to 0. It is an additional setting for the session’s Repair Reference Counter functionality, and can only be selected if the Repair Reference Counter check box is also selected.
Note: Recalculating reference counters for all selected tables may take considerable time. A warning message is displayed if the selection includes more than 10 tables. - File for Undefined References
-
If this check box is selected, undefined references are logged in a file. You must specify the file name in the next field.
- File for Undefined References
-
The name of the file in where the session stores the undefined references. You must specify the ${BSE}/appdata folder when working in the cloud.
- Soft Delete
-
If this check box is selected,'soft deleted' data is purged. You must specify a date and time in the next field.
For details on 'soft deleted' records, see Table Timestamp and Soft Delete Definitions (ttadv4136m000).
- Purge data before
-
Specify a date and time. Only records that were 'soft deleted' before the specified timestamp are purged.