Salesforce

How to activate a Primary Index

« Go Back

Information

 
TitleHow to activate a Primary Index
URL Nameactivate-a-Primary-Index-000082871
Article Number000125039
EnvironmentProduct: OpenEdge
Version: 10.2B, 11.x
OS: All supported platforms
Question/Problem Description
How to activate a Primary Index
How to drop an inactive PRIMARY index
How to rebuild active indexes online like IDXBUILD
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
When marking a Primary Index inactive, first mark another of the active indexes as the Primary Index. This can be achieved through the Data Dictionary or by loading a .df through Data Administration as outlined in Step 1 and 3 below.

Since OpenEdge 11, when the Primary Index has already been marked inactive, without first marking another of the active indexes as the Primary Index, it cannot be dropped. It can only be made active again with an offline IDXBUILD or an offline IDXACTIVATE provided another active index is available. PSC00364675 / OCTA-4030 has been raised to allow this in OpenEdge 11 but has not been implemented to data (11.7.5)

The following outlines use of the Database Administration utility to load .df files online in OpenEdge 10.2B or earlier:
  1. Temporarily make another active index the primary index, if there is a Logical Index this is the smallest index to use
  2. Drop the previous primary index
  3. Add the previous primary index back
  4. Make this index the primary index again
This is best explained through the sports2000 database Customer Table:
  • Customer.CustNum is the PRIMARY index, which is currently INACTIVE
  • Customer.Name is another index on the Customer Table which is currently ACTIVE
1. Temporarily make another index primary,
2. Drop this previous primary index
  
UPDATE PRIMARY INDEX "Name" ON "Customer"
DROP INDEX "CustNum" ON "Customer"

Result: CustNum index no longer exits, Name is the Primary index and is still Active
Note: In OpenEdge 11 this step will fail if CustNum was previously marked inactive with error 997:
Primary index CustNum must be active to make the requested changes. (997)

3. Add the previous Primary Index back
  
ADD INDEX "CustNum" ON "Customer"
AREA "Cust_Index"
UNIQUE
INDEX-FIELD "CustNum" DESCENDING

UPDATE PRIMARY INDEX "CustNum" ON "Customer"

Result: CustNum Index is added back and is now the Primary Unique Active Index

The index now needs to be rebuilt:

An online method to build a Primary (or any) ACTIVE index is to move it to another area (then back again as an Optional Step):
  
$   proutil dbname -C idxmove Customer.CustNum "Misc"
$   proutil dbname  -C idxmove Customer.CustNum "Cust_Index"

Otherwise, the .df loaded in Step 3 could be split:
  • First add the index back as inactive.
  • Then use IDXACTIVATE to build and activate the index
  • Finally load a .df to make this index the Primary Index again
ADD INDEX "CustNum" ON "Customer"
AREA "Cust_Index"
UNIQUE
INACTIVE
INDEX-FIELD "CustNum" DESCENDING
   
$   proutil dbname -C idxactivate Customer.CustNum
   
UPDATE PRIMARY INDEX "CustNum" ON "Customer"

There's nothing 'preventing' schema changes online for a replication enabled source database vs a non replication enabled database (the rules are the same) and the schema change is replicated to the target database.
The only factor in a replication environment is that a schema lock first needs to be granted, which is why setting schema-Lock-Action=force as opposed to "wait" in the repl.properties configuration is advised. For further information refer to Article  Can't update schema while OpenEdge Replication is active   
Workaround
Notes
Keyword Phrase
Last Modified Date2/22/2023 7:44 PM

Powered by