community.borland.com

Article #25153: Next transaction older than oldest active transaction[266].

Problem:
Can not attach to, gbak, restore, or  ready the database 
due to a bug in 3.x

Note: This information pertains to v3.3 ONLY.

Solution:
Explanation:
	
		OIT/OAT - Oldest (Interesting/Active) Transaction
		NT	- Next Transaction
		T	- Transaction
		
		TRANSACTION: A transaction is an atomic unit of work
		 made up of one or more operations against the data in a
		 database(s). The scope of the transaction is defined by 
		the user/programmer when they START a transaction and
		then end it with a COMMIT or ROLLBACK.
		
		OIT/OAT: The Oldest Interesting Transaction (OIT) is the first 
		transaction in a state other than committed in the database's 
		Transaction Inventory Pages (TIP). The TIP is a set of pages 
		that log each transaction's information (transaction number and
		current state) in the database since the last time the database
		was created or last backed up and restored.  The Oldest Active 
		Transaction (OAT) is the first transaction marked as active in 
		the TIP pages. 
		
		   The way to find out the values of the OIT and OAT is 
		   to run GSTAT -h locally against the database in question.
		   
		   (ex. GSTAT -h employee.gdb)
		   
		   NOTE:
		 This will not work on your bad database because 
		GSTAT attempts to connect to the database.  It will only work
		on valid databases.
		   
		NT: The Next Transaction is the value read by calling the start
		transaction function.  It is read from the header page of the
		database, incremented and then the header page is written back
		to the database.
	
	Files Needed: 		set_trans.exe
			
	Example:
	1) Type: "SET_TRANS -t "#" -s bad.gdb -d new.gdb"
                
                   What needs to happen is to set (-t #) > than the OIT and AT 
                   value.  Since you cannot attach to the database you must
                   guess at the value until you get one that works.
                
                	NOTE: This process DOES NOT fix the old database, 
                	      it creates a new version of the old one. 
                	      (ie. new.gdb)
                
          	2) GBAK -b -t new.gdb the_new.gdb
          
          	   This is very important and CAN NOT be skipped. You MUST 
          	   perfom a BACKUP and RESTORE immediately after running the 
          	   SET_TRANS program.
          	   
        Prevention:
        
        	This problem can be avoided by performing a GFIX -(s)weep at
	regular intervals.  This problem has been fixed in InterBase 
	version 4.x but, DOES NOT mean that performing regular sweeps
	should be eliminated.

	NOTE:
	
		- SET_TRANS is for InterBase 3.3x only.
		- Running SET_TRANS against a V4.x database will
		  corrupt it.

Last Modified: 29-SEP-00