Monday, February 10, 2020

Informatica Housekeeping or Move or Archive Files Which are Older than 30 days

Informatica Housekeeping or Move or Archive files which are older than 30 days

As a admin you have to do housekeeping activity frequently and which is tedious. In fact developers runs thousands of Informatica jobs every day and each jobs are creating lots log files like sessions logs and workflow logs and many other logs files.

We need to clean these logs files regularly and cleaning of these log file manually is time taking and need lots efforts.

This blogs explain you how smartly you can do this housekeeping activity.

Below the shell script which will do Housekeeping or Move or Archive files which are older than 30 days.

ods_archive.sh #!/bin/ksh
#===============================================================================================#
# Name          : ods_archive.sh                                                                #
# Written by    : Mallik                                                                        #
# Purpose       : Move files which are older than 30 days                                       #
# Pending       : NONE                                                                          #
# Creation Date : 09-FEB-2019                                                                   #
# Version       : 1                                                                             #
# ==============================================================================================#
TODAY_DATE=`date +%d%m%Y_%H%M%S`

ARCHIVE=/u01/Informatica/10.2.0/server/infa_shared/Archive

BACKUP=/u01/Informatica/10.2.0/server/infa_shared/Backup
BAD_FILES=/u01/Informatica/10.2.0/server/infa_shared/BadFiles
LKP_FILES=/u01/Informatica/10.2.0/server/infa_shared/LkpFiles
LOG=/u01/Informatica/10.2.0/server/infa_shared/log
SESS_LOGS=/u01/Informatica/10.2.0/server/infa_shared/SessLogs
SRC_FILES=/u01/Informatica/10.2.0/server/infa_shared/SrcFiles
STRORAGE=/u01/Informatica/10.2.0/server/infa_shared/Storage
TEMP=/u01/Informatica/10.2.0/server/infa_shared/Temp
TGT_FILES=/u01/Informatica/10.2.0/server/infa_shared/TgtFiles
WORKFLOW_LOGS=/u01/Informatica/10.2.0/server/infa_shared/WorkflowLogs
RECON_DATA=/u01/Informatica/10.2.0/server/infa_shared/SrcFiles/Recon_Data
REF_DATA=/u01/Informatica/10.2.0/server/infa_shared/SrcFiles/Ref_Data
INVALID=/u01/Informatica/10.2.0/server/infa_shared/SrcFiles/Ref_Data/Invalid
PROCESSED=/u01/Informatica/10.2.0/server/infa_shared/SrcFiles/Ref_Data/Processed

find $BACKUP -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $BAD_FILES -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $LKP_FILES -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $LOG -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $SESS_LOGS -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $SRC_FILES -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $STRORAGE -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $TEMP -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $TGT_FILES -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $WORKFLOW_LOGS -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $RECON_DATA -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $REF_DATA -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $INVALID -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;
find $PROCESSED -type f -mtime +30 -exec mv '{}' $ARCHIVE/ \;


Regards,
Mallik

No comments:

Post a Comment

Query taking more time?  1. DML Query (Insert, Update,) Cause: locks / deadlocks  Fix/Solution: kill / Ask user to do commit/rollback   2. S...