HP 3000 Manuals

SQLUtil STOREONLINE and Associated Restore Commands [ ALLBASE/Replicate User's Guide ] MPE/iX 5.0 Documentation


ALLBASE/Replicate User's Guide

SQLUtil STOREONLINE and Associated Restore Commands 

Use the SQLUtil STOREONLINE command to store the image of a master
DBEnvironment while that DBEnvironment continues to be in use.  SCR
information is preserved automatically because STOREONLINE stores the
image of the DBECon file during the store.

STOREONLINE is used only if you are using archive mode logging and have
TURBO STORE software on MPE/iX.

Because STOREONLINE allows you to store the image of the DBEnvironment
while it is in use, you must also store all the log files that were in
use during the store.  On the slave, you must later reapply those same
log files so that all changes that occurred to the DBEnvironment during
the store are applied to the new DBEnvironment.

The advantage of STOREONLINE is that you do not have to take the master
DBEnvironment out of service while the store is being done.  In addition,
STOREONLINE stores the DBECon file, and thus the SCR array, so that you
do not have to get the SCR information separately.

Storing the Entire Master DBEnvironment Using STOREONLINE 

For example, if you need to hard resynchronize the entire PartsDBE
DBEnvironment from a master to a slave while the master DBEnvironment
remains in operation, the steps for the store could be as follows:

   1.  Open a window on the master and go to the group where you normally
       invoke ISQL to connect to the master DBEnvironment.  This is
       window A.

   2.  Open another window and go to the group that contains the DBECon
       file for the master DBEnvironment.  This is window B.

   3.  From window B, terminate the ALLBASE/Replicate application.  You
       can use the BREAK of ABORTJOB commands to do this.  Leave the
       master DBEnvironment in operation so that users can continue to
       access it while the STOREONLINE is taking place.

   4.  From window B, use the SQLUtil SHOWLOG command to examine the
       status of the current log files.  You need at least one additional
       log file to switch to during the STOREONLINE process.  Create
       additional log files using the SQLUtil ADDLOG command.

            :SQLUTIL >>
            SHOWLOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance WordReturn 
            Connect (y/n)? (opt):Return 
            :
            >> ADDLOG 
            :

   5.  Place the tape on the tape drive.

   6.  Use the STOREONLINE command to perform a dynamic backup of the
       DBEnvironment.  This will also convert the DBEnvironment from
       non-archive to archive mode if it is not already in archive mode.
       Users may continue to access the DBEnvironment while the backup is
       in progress.

       From window B, execute the following:

            >> STOREONLINE 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            To File Name: TAPE 
            :
            DBEnvironment stored.
            Begin Archive Log Sequence Number:       4
            End Archive Log Sequence Number:         4

       Record the Begin Archive Log Sequence Number and the End Archive
       Log Sequence Number.  The log files with log sequence numbers
       contained in this range must be stored as soon as the STOREONLINE
       is complete because they contain all the changes made to the
       DBEnvironment while the store was in progress.  The same log files
       must be reapplied to the slave DBEnvironment, as soon as the
       DBEnvironment is restored to the slave, and before operation is
       resumed.  (Otherwise, the slave DBEnvironment will be inconsistent
       and will lack the changes made while the store was taking place.)

   7.  From window B, prepare to backup the appropriate log files.  Use
       the SHOWLOG command to display the log file status.  Check to see
       that the specified log files show a log backup status of "Ready
       for Backup."

       The most recently used log file (whose log sequence number is
       shown in the entry "Current Log Sequence Number") will probably
       still have a log backup status of "Not Ready for Backup." In this
       case, you must use the CHANGELOG command to switch the current log
       file to a new log file so you can store the current log file.

       From window B, execute the following:

            >> SHOWLOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Connect (y/n)? (opt): Return 
            :
            Current Log Sequence Number:  4
            :
            Log Identifier is: 3
            Log Sequence Number: 4
            Log Backup Status: Not Ready For Backup
            :

            >> SHOWLOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Connect (y/n)? (opt): Return 
            :
            Current Log Sequence Number:  5
            :
            Log Identifier is: 3
            Log Sequence Number:  4
            Log Backup Status: Ready For Backup

       The log identifier numbers for the log files that need to be
       stored will be needed for use with the STORELOG command.

   8.  Mount another tape.

   9.  From window B, back up the log files using the SQLUtil STORELOG
       command.  Use the log identifier number associated with each log
       that is "ready for backup," and has a log sequence number included
       in the range starting with the Begin Archive Log Sequence Number 
       and ending with the End Archive Log Sequence Number, inclusive.

       In this example, the log file with Log Sequence Number 4 and
       having Log Identifier Number 3 needs to be backed up.  Enter the
       following commands:

            >> STORELOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Log Identifier (opt): 3 
            To File Name: TAPE 
            Static Store (y/n)? N 
            Store Log file (y/n)? Y 
            :
            Log File 'PTSLGA3.DATA.PARTSDBE' with Sequence Number 4 was Stored.

            >> EXIT 

  10.  Label the tapes for the stored DBEFiles and the stored log files.
       Include the Log Sequence Number.  Transport the tapes for
       installation on the slave DBEnvironment, or transfer the files by
       other appropriate means.

  11.  Only if you are running both the master DBEnvironment and the 
       slave DBEnvironment on the same machine, this additional step is
       needed.

       To avoid a conflict over shared memory that prevents you from
       restoring the image of the master on the slave, temporarily shut
       down the master DBEnvironment and then restart it immediately.
       The master will release the shared memory location it currently
       holds and obtain shared memory at another address.  Because the
       shared memory address is stored during the STOREONLINE, the slave
       would try to obtain shared memory at the same address used by the
       master if this technique is not employed.  The conflict over
       shared memory would prohibit you from bringing up the slave
       DBEnvironment.  This is not an issue if the DBEnvironments are
       located on different machines.

       From window A, execute the following:

            isql=> STOP DBE; 
            isql=> EXIT; 
            :ISQL 
            isql=> START DBE 'PARTSDBE' MULTI; 

Restoring to the Slave Using Dynamic Restore Commands 

The steps for restoring the entire master DBEnvironment to the slave
using the restore statements associated with the SQLUtil STOREONLINE
command could be as follows:

   1.  Open a window on the slave and go to the group where you normally
       invoke ISQL to connect to the slave DBEnvironment.  This is window
       X.

   2.  Open another window and go to the group that contains the DBECon
       file for the slave DBEnvironment.  This is window Y.

   3.  From window Y, make sure no ALLBASE/Replicate application is
       running against the DBEnvironment to be hard resynchronized.
       Verify that the DBEnvironment is no longer in operation.  Stop the
       DBEnvironment if necessary.  Be sure to use both STOP DBE and
       EXIT.

   4.  From window Y, remove the old DBEnvironment using the SQLUtil
       PURGEALL command because this is the transfer of an entire
       DBEnvironment image to the slave.  This will remove the old
       DBEnvironment and its associated log files.  If the DBECon file is
       not accessible, PURGEALL will not work, and you will have to use
       the PURGEFILE command to remove each file individually.

       From window Y, execute the following:

            : SQLUTIL 
            >> PURGEALL 
            DBEnvironment Name: PARTSDBE 
            Purge DBEnvironment and Log Files (y/n)?Y 

            DBEnvironment and Log Files purged.

       _________________________________________________________________ 

       NOTE  Any log files created prior to the execution of the most
             recent START DBE NEWLOG statement will still be present
             because they are no longer recorded in the DBECon file.  If
             any such files remain, remove them before proceeding.

       _________________________________________________________________ 

   5.  Mount the appropriate tape, or transfer the files by other
       appropriate means to the group containing the DBECon file.

   6.  From window Y, restore the DBEnvironment from the backup using the
       SQLUtil RESTORE command.  Enter the following commands:

            >> RESTORE 
            DBEnvironment Name: PARTSDBE 
            From File Name: TAPE 
            :

             DBEnvironment restored.

   7.  From window Y, use the SQLUtil SHOWLOG command to verify the
       "First Log Sequence Number Needed for Recovery," the "Log Sequence
       Number Containing Most Recent Archive Checkpoint," and the "Log
       Mode." Also have available your notes containing the "Begin
       Archive Log Sequence Number," and the "End Archive Log Sequence
       Number" that you recorded during the STOREONLINE of the
       DBEnvironment.

       When prompted whether or not to connect, answer n for no, because
       the DBEnvironment has not been brought into a consistent state.
       All you need is the static information stored in the DBECon file.

       From window Y, execute the following:

            >> SHOWLOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Connect (y/n)? (opt) N 
            :
            Log Sequence Number Containing Most Recent Archive Checkpoint: 4
            Current Log Sequence Number: 4
            First Log Sequence Number Needed For Recovery: 4
            Log Mode is: Dual
            :

   8.  From window Y, initiate recovery using the SQLUtil SETUPRECOVERY
       command.  Specify the new temporary log file name and log mode to
       be used after the DBEnvironment has been recovered.  The log file
       will be changed, again, when you use the START DBE NEWLOG
       statement to set ALLBASE/Replicate parameters when the
       DBEnvironment is started.  Execute the following:

            >> SETUPRECOVERY 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Recover to (mm/dd/yy/hh/mm/ss) (opt): Return 
            New Log Mode(Single/Dual) (opt): DUAL 
            Enter New Log File Name(s) Separated by a Blank? TMPLGA1 TMPLGB1 
            New Log File Size? 1000 
            Setup Recovery? (y/n)? Y 

            Recovery Has Been Setup.

            Next Log Sequence Number is     4.

   9.  From window Y, restore each log file needed for recovery from tape
       to disk, using the SQLUtil RESTORELOG command.  Specify a new name
       for each log file at the "Rename...Log File to:" prompt.  It is a
       good idea to specify a name that indicates the log sequence number
       of the log file.  For example, specify Log4 for the log file with
       log sequence number 4.  For the example, assume that only one log
       file needs to be applied, and it has a log sequence number of 4.
       You would use RESTORELOG multiple times if you had several log
       files to apply.

  10.  Mount the tape containing the log file to be restored, or transfer
       the tape by other appropriate means to the group containing the
       DBECon file.  From window Y, execute the following command:

            >> RESTORELOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Input device: TAPE 
            Local (y/n) (opt): Y 
            Rename PTSLGA3 Log File To: LOG4 
            Restore the Log File (y/n)? Y 

            Log File LOG4 Was Restored.

       RESTORELOG transfers the log file from tape to disk, but it does
       not apply the log to the DBEnvironment.  That is done in the next
       step.

  11.  From window Y, apply each log file in sequence using the
       RECOVERLOG command.  This performs a rollforward recovery of all
       committed transactions that were executed against the
       DBEnvironment while the STOREONLINE was taking place.

       From window Y, execute the following:

            >> RECOVERLOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Next Log File to Recover LOG4 
            Recover Log File (y/n)? Y 

            Log File Recovered.

            Next Possible Log Sequence Number is           5.

       If you have more than one log file to restore, repeat the mount
       tape, RESTORELOG, and RECOVERLOG sequence for each log file to be
       restored.

  12.  From window Y, terminate the recovery process using the SQLUtil
       ENDRECOVERY command, after the log files are restored and
       recovered.  Execute the following:

            >> ENDRECOVERY 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            End Recovery (y/n)? Y 

            Recovery Has Terminated.

            >> EXIT 

       Although recovery is essentially complete, you must still reset
       some ALLBASE/Replicate parameters before opening the DBEnvironment
       for production use.  That is done in the next step.

  13.  From Window X, start the DBEnvironment with a new log file, with a
       unique AUDIT NAME, and with the AUDIT LOG option specified in
       START DBE NEWLOG to preserve the SCR information.  If necessary,
       change the AUDIT ELEMENTS at this time.  If you plan to modify the
       association between partitions and tables, start in single-user
       mode.  If you plan to retain the partition scheme from the source,
       you can start in multiuser mode.  For this example assume the
       retention of the source partition scheme.

       _________________________________________________________________ 

       WARNING  Include these elements in the START DBE NEWLOG statement:

                   a.  AUDIT LOG clause, or you will lose all SCR
                       information and have to do another hard
                       resynchronization.

                   b.  ARCHIVE LOG clause, if you want the DBEnvironment
                       to remain in archive mode.

                   c.  DUAL LOG clause, if you want to retain dual
                       logging on the slave.

       _________________________________________________________________ 

       From window X, execute the following:

            :ISQL 
            isql=> START DBE 'PARTSDBE' MULTI NEWLOG 
                 > ARCHIVE LOG, 
                 > DUAL LOG, 
                 > AUDIT LOG, 
                 > AUDIT NAME = 'SLDBE1', 
                 > CHECKPOINT COMMENT DATA AUDIT ELEMENTS, 
                 > LOG DBEFILE PTSLGA1 AND PTSLGB1 
                 > WITH PAGES = 1000, 
                 > NAME = 'PTSLGA1' AND 'PTSLGB1'; 

            isql=> EXIT; 

  14.  From window Y, add at least one additional log file using the
       SQLUtil ADDLOG command.

            : SQLUTIL 
            >> ADDLOG 

            :

       Remove any log files that existed prior to issuing the START DBE
       NEWLOG command.

  15.  From window Y, verify that the DBEnvironment has been properly
       configured using the SQLUtil SHOWDBE ALL and SHOWLOG commands:

            >> SHOWDBE 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Output File Name (opt): Return 
            ->ALL 
            :
            ->// 

            >> SHOWLOG 
            DBEnvironment Name: PARTSDBE 
            Maintenance Word: Return 
            Connect (y/n) opt? Y 
            :
            Continue (y/n) opt? Y 
            >> EXIT 

Starting the Application on the Slave 

Now you are ready to restart the target and source ALLBASE/Replicate
applications.  If the hard resynchronization has not taken too long, the
slave will be able to catch up on the transactions committed on the
master while hard resynchronization has taken place on the slave.

   1.  From window Y, start the ALLBASE/Replicate application on the
       slave.  For this example, assume you wish to replicate partitions
       1 (DEFAULT), 2 (COMMENT), 10, and all the partitions used to
       replicate DDL activity.  Use the following command:

            :RUN REPSLAVE.PUB.SYS 

            Enter Slave DBE Name >> PARTSDBE 
            Enter Partition Number (RETURN to finish): 1 
            Enter Partition Number (RETURN to finish): 2 
            Enter Partition Number (RETURN to finish): 10 
            Enter Partition Number (RETURN to finish): -2 
            Enter Partition Number (RETURN to finish): -3 
            Enter Partition Number (RETURN to finish): -4 
            Enter Partition Number (RETURN to finish): -5 
            Enter Partition Number (RETURN to finish):
            Enter the Socket Name you wish to use (max 16 chars) >> MA1TOSL1 

Starting the Application on the Master 

   1.  From window B, start the ALLBASE/Replicate application on the
       master with the following command:

            :RUN REPMAST.PUB.SYS 

            Enter Master DBE Name >> PARTSDBE 
            Enter the Socket Name you wish to use >> MA1TOSL1 
            Enter the Node Name of the Slave DBE >> CALVIN 

Backing up the Slave DBEnvironment and Log Files 


WARNING You must do a STOREONLINE of the slave DBEnvironment. Otherwise, you will be unable later to do either a full or partial rollforward recovery.
1. Use SQLUtil STOREONLINE to store the Slave DBEnvironment. Remember to back up the log files that were active during the STOREONLINE. To carry out the STOREONLINE, repeat steps 4 through 10 from the previous section, "Storing the Entire Master DBEnvironment Using STOREONLINE," but apply them to the slave DBEnvironment, not the master. Testing the Applications 1. Test the ALLBASE/Replicate environment to verify that transactions committed on the master are replicated on the slave. 2. Remove the test transactions from the master and verify that they have been removed from the slave, if you do not want them to become permanent. Remember to commit work at each step on both the master and the slave.


MPE/iX 5.0 Documentation