Replication Scripts for Unix


(Zip file with scripts)

The scripts are doing after-image replication, i.e. they first copy full after-image (AI), if there are any, to special AI_TO_DR directory and mark them as empty. Then switch the current busy AI to a new one, copy it and mark as empty. This is done in aiswitch.sh script and it's child aiswitch2.sh.
aiswitchall.sh is just a wrapper in case you have more than 1 database to replicate.
The AI files are zipped before FTP and unzipped on the other end.
If the source database is down replication will not take place. Script checks db status before processing.
Also FTP is checking that the file got successfully FTPed. Otherwise it is not moved to AIBACKUP directory and will be reprocessed again.
File is FTPed as TMP_name instead of its real name and then renamed. That way roll forward script will not pick up a file while it is in process of FTP.
Files in backup directory AIBACKUP are stored for 2 days which is controlled by the last line in aiswitch.sh script -mtime +2. Same on the target box.

============= LIST OF SCRIPTS ====================

-- Start with aiswitchall.sh. It lists database directories and database names that need replication.

-- aiswitchall.sh, aiswitch.sh, aiswitch2..sh and aiftp.sh should run on the source box.

-- aiftp.sh is doing FTP so you need to fiill the target DR-server-name, user-name and password.

-- airollfwdall.sh and airollfwd.sh should run on the target (Disaster-Recovery) box.

-- On target box airollfwdall.sh lists dattabase directories and database names that are replicated.

============== CHANGES TO BE MADE ==============

Here is a list of directories, database names and other stuff specific to your system

aiswitchall.sh:
Main_replication_dir # Choose one with enough space if you intend to keep AI in $AIBACKUP
Database1-dir # Primary DB
Database1-name # Primary DB

aiswitch.sh:
REMOTE_DIR # Some dir on DR server. Same as LOCALAPPLYDIR in airollfwd.sh

aiftp.sh:
DR-server-name
user-name # if you set up user FTP without need to enter password on DR server
password # then you might skip it. Otherwise make sure aiftp.sh does not have read permissions for all.

airollfwdall.sh:
Main_replication_dir # does not have to be the same as in aiswitchall.sh
Database1-dir # Target DB
Database1-name # Target DB

airollfwd.sh:
LOCALAPPLYDIR # Some dir on DR server. Same as REMOTE_DIR in aiswitch.sh
STOREDIR # directory to store AI files on DR server