<?xml version="1.0" encoding="utf-8"?>
<Session ID="/baanerp/tt/aad/ttaad4225m000" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Reorganize Tables (ttaad4225m000)</Title>
	</Header>
	<HelpTopic xml:lang="en"><AimSection><Paragraph class="Default">
                                 Use this session to rebuild data and indices and/or to check and rebuild the referential integrity.</Paragraph>
		</AimSection>
		<GeneralSection><SectionTitle>Rebuild data and indices</SectionTitle>
			<Paragraph class="Default">Rebuilding data and indices is useful for tables on which many delete actions are performed. To use this option, you must select the <GUIRef href="/baanerp/tt/aad/ttaad4225m000#dataind.yeno" role="manual">Data and Indices</GUIRef> check box. The data will be temporarily stored in a sequential dump file. Subsequently the data and indices will be rebuilt.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Check and rebuild the referential integrity</SectionTitle>
			<Paragraph class="Default">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.</Paragraph>
			<Paragraph class="Default">You must repair the reference counters, for example, after running the <GUIRef href="/baanerp/tt/aad/ttaad4227m000" role="session">Create Table from Sequential Dump (ttaad4227m000)</GUIRef> session with the <GUIRef href="/baanerp/tt/aad/ttaad4227m000#igri.yeno" role="manual">Ignore Referential Integrity Constraints</GUIRef> 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 <GUIRef href="/baanerp/tt/aad/ttaad4225m000#rcnt.yeno" role="manual">Repair Reference Counter</GUIRef> check box selected.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Executables</SectionTitle>
			<List><ListIntro>Internally the session uses the following executables:</ListIntro>
				<ListItem>bdbreconfig6.2 (-Z option): to rebuild data and indices</ListItem>
				<ListItem>refint6.2: to check and rebuild the referential integrity</ListItem>
			</List>
			<Paragraph class="Default">For more information on these executables, refer to the <DocRef>Infor Enterprise Server 8.5 Technical Manual (U8172 US)</DocRef>.</Paragraph>
		</GeneralSection>
		<RelatedTopics><SectionTitle>
                                 Related topics
                              </SectionTitle>
			<RelTopic><Link href="/baanerp/basictasks/000005" role="manual">To use a details session</Link>
			</RelTopic>
		</RelatedTopics>
	</HelpTopic>
	<Fields><FieldGroup><Title>Selection Range</Title>
			<FieldHelp><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Company, Package, Table</Title>
				</Header>
				<FuncDesc>Fill in a range where you want to reorganize the tables for. It is also possible to fill in one company number or one table.</FuncDesc>
				<RelatedTopics><SectionTitle>
                                       Related topics
                                    </SectionTitle>
					<RelTopic><Link href="/baanerp/basictasks/000006" role="manual">To use From and To fields</Link>
					</RelTopic>
				</RelatedTopics>
			</FieldHelp>
		</FieldGroup>
		<FieldGroup><Title>Options</Title>
			<FieldHelp ID="dataind.yeno"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Data and Indices</Title>
				</Header>
				<FuncDesc>Select this check box to rebuild the data and indices of the selected tables. This is useful for tables on which many delete actions are performed.</FuncDesc>
			</FieldHelp>
			<FieldHelp ID="dumpdir.yeno"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Path Dumps</Title>
				</Header>
				<FuncDesc>
                                    If this check box is selected, you can specify a directory where the session stores its temporary dumpfiles. By default $BSE/tmp is used.</FuncDesc>
			</FieldHelp>
			<FieldHelp ID="dumpdir.path"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Path Dumps</Title>
				</Header>
				<FuncDesc>The directory where the session stores its temporary dumpfiles. By default $BSE/tmp is used.</FuncDesc>
			</FieldHelp>
			<FieldHelp ID="reconfig.report"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Print results (bdbreconfig)</Title>
				</Header>
				<FuncDesc>
                                    If this check box is selected, the session prints a report that describes, for each table and company, the result of the reconfiguration.</FuncDesc>
				<SimpleSection><Paragraph class="Default">Each line in the report has the following form:</Paragraph>
					<Paragraph class="Default">&lt;tablename&gt;&lt;compnr&gt;&lt;space&gt;&lt;status code&gt;&lt;space&gt;&lt;error&gt;&lt;space&gt;&lt;message text&gt;&lt;newline&gt;</Paragraph>
					<Paragraph class="Default">The following table lists the possible status codes:</Paragraph>
					<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><THEAD><TR><TD rowspan="1" colspan="1">Status Code</TD>
								<TD rowspan="1" colspan="1">Description</TD>
							</TR>
						</THEAD>
						<TBODY><TR><TD rowspan="1" colspan="1">R0</TD>
								<TD rowspan="1" colspan="1">The table is reconfigured successfully. The Error field contains the value 0, or contains error code 506 if the table does not exist.</TD>
							</TR>
							<TR><TD rowspan="1" colspan="1">R1</TD>
								<TD rowspan="1" colspan="1">The reconfiguration has failed. The Error field will contain the code of the error that caused the failure.</TD>
							</TR>
							<TR><TD rowspan="1" colspan="1">R2</TD>
								<TD rowspan="1" colspan="1">The table is reconfigured successfully, but one or more indexes could not be created. The Error field will contain error code 114.</TD>
							</TR>
						</TBODY>
					</TABLE>
					<Paragraph class="Default">For more information on error codes, refer to Chapter 6 "Error Codes" in the <DocRef>Infor Enterprise Server 8.5 Technical Manual (U8172 US)</DocRef>.</Paragraph>
					<Paragraph class="Default"><GUIRef href="" role="manual">Note</GUIRef>
					</Paragraph>
					<Paragraph class="Default">You can only access this field if the <GUIRef href="/baanerp/tt/aad/ttaad4225m000#dataind.yeno" role="manual">Data and Indices</GUIRef> check box is selected.</Paragraph>
				</SimpleSection>
			</FieldHelp>
			<FieldHelp><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Repair Indices Only</Title>
				</Header>
				<FuncDesc>Recreates the indexes of the selected tables by dropping and creating them again. The Package Combination of the selected Companies must be the same as the current Package Combination. Only one of the checkboxes “Data and Indices” and “Repair Indices only” can be selected.</FuncDesc>
				<SimpleSection><Paragraph class="Default">Logging can be found in the logfile: <Code>${BSE}/log/log.ttaad4225</Code>
					</Paragraph>
				</SimpleSection>
			</FieldHelp>
		</FieldGroup>
		<FieldGroup><Title>Reference Integrity</Title>
			<FieldHelp ID="vref.yeno"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Check Validity of Reference</Title>
				</Header>
				<FuncDesc>
                                    If this check box is selected, the Check Validity of Reference is checked. You can specify the output file in the <GUIRef href="/baanerp/tt/aad/ttaad4225m000#urep" role="manual">File for undefined references</GUIRef> field.</FuncDesc>
			</FieldHelp>
			<FieldHelp ID="rcnt.yeno"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Repair Reference Counter</Title>
				</Header>
				<FuncDesc>To guarantee referential integrity, the ERP 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 <GUIRef href="/baanerp/tt/adv/ttadv4122s000#ttadv422.rfde" role="manual">Delete Mode</GUIRef> or <GUIRef href="/baanerp/tt/adv/ttadv4122s000#ttadv422.rfup" role="manual">Update Mode</GUIRef> in the relation is <GUIRef href="/baanerp/tt/domains/adv.rfde#restricted" role="option">Restricted (with counter)</GUIRef>.</FuncDesc>
				<SimpleSection><List><ListIntro>It is essential to repair these reference counters:</ListIntro>
						<ListItem>after you have changed the logical table structure through the <GUIRef href="/baanerp/tt/aad/ttaad4120m000" role="session">Logical Tables (ttaad4120m000)</GUIRef> session.</ListItem>
						<ListItem>after you have run the <GUIRef href="/baanerp/tt/aad/ttaad4227m000" role="session">Create Table from Sequential Dump (ttaad4227m000)</GUIRef> session or the <GUIRef href="/baanerp/tt/aad/ttaad4228m000" role="session">Convert / Recover Tables (ttaad4228m000)</GUIRef> session, with the <GUIRef href="/baanerp/tt/aad/ttaad4227m000#igri.yeno" role="manual">Ignore Referential Integrity Constraints</GUIRef> check box selected.</ListItem>
					</List>
				</SimpleSection>
			</FieldHelp>
			<FieldHelp ID="parent.yeno"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Repair only reference of parent</Title>
				</Header>
				<FuncDesc>
                                    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.</FuncDesc>
				<SimpleSection><Paragraph class="Default">
                                       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.</Paragraph>
					<Paragraph class="Default"><GUIRef href="" role="manual">Example</GUIRef>
					</Paragraph>
					<List><ListIntro>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, e.g. to tccom100 (Business Partners).</ListIntro>
						<ListItem>If the selection range is tttxt001 – tttxt001, and the <GUIRef href="" role="manual">Repair only reference of parent</GUIRef> check box is selected, the session only repairs the reference counters for the tttxtt001 table.</ListItem>
						<ListItem>If the selection range is tttxt001 – tttxt001, and the <GUIRef href="" role="manual">Repair only reference of parent</GUIRef> 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.</ListItem>
					</List>
					<Paragraph class="Default"><GUIRef href="" role="manual">Notes</GUIRef>
					</Paragraph>
					<Paragraph class="Default">Many ERP 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.</Paragraph>
					<Paragraph class="Default">You can only access this field if the <GUIRef href="/baanerp/tt/aad/ttaad4225m000#rcnt.yeno" role="manual">Repair Reference Counter</GUIRef> check box is selected.</Paragraph>
				</SimpleSection>
			</FieldHelp>
			<FieldHelp ID="urep.yeno"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">File for undefined references</Title>
				</Header>
				<FuncDesc>
                                    If this check box is selected, undefined references are logged in a file. You must specify the file name in the following field.</FuncDesc>
			</FieldHelp>
			<FieldHelp ID="urep"><Header>
					<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">File for undefined references</Title>
				</Header>
				<FuncDesc>The name of the file in where the session stores the undefined references.</FuncDesc>
			</FieldHelp>
		</FieldGroup>
	</Fields>
</Session>
