Recreate Symbolic Links after Oracle Instance Refresh

After the non-Production instances (DEV, QA, TEST, etc) are refreshed, you may have noticed that the symbolic links, that are used for host program files, get overwritten by Production links and are still pointing to Production locations. To have the links work for that instance, you will have to delete the old symbolic links and recreate them.

Below is a bash shell script which can be run anywhere in UNIX. I would save the file as "xxrl_recreate_symlinks.sh" and execute as follow: 

%> ./xxrl_recreate_symlinks.sh

Note:

Please make sure the following are completed before you run the script:

1) File is executable:
%> chmod 777 xxrl_recreate_symlinks.sh

2) The .env file sets the $XX_TOP for that instance based on your company custom top.


#!/bin/sh

##*******************************************************************************************
## File Name         : xxrl_recreate_symlinks.sh
## File Location     : $XXRL_TOP/bin
## Created By        : Abul Mohsin
## Creation Date     : June 21, 2014
## Description       : This program deletes the old Symbolic Links that are copied over from
##                      PROD refresh, then recreates them for that instance. If no *.prog
##                      files found, the program simply exists.
##
## Program Language  : Shell Script
## Specific Module   : Generic for all modules
## Create SymLink    : %> chmod 755 xxrl_data_ldr.prog
##                     %> ln -s $FND_TOP/bin/fndcpesr xxrl_data_ldr
##
## Execute Command   : %> ./xxrl_recreate_symlinks.sh
##
##*******************************************************************************************
## Modification History :  (Date,  Version, Programmer, Change Description)
##-------------------------------------------------------------------------------------------
## 06/21/14   1.0   Abul Mohsin      Initial version
##
##*******************************************************************************************

##----------------------------------------------------
##-- set these variables based on user preference
##---------------------------------------------------- 
customTop=$XX_TOP         ##-- this is based on company's custom top

##----------------------------------------------------
##-- set these variables based on user preference
##----------------------------------------------------
fileExt="prog"            ##-- usually .prog file in Oracle
debugMode='N'             ##-- use 'Y' if you need to display everything

##----------------------------------------------------
##-- set up local variables based on previous ones
##----------------------------------------------------
binDir=${customTop}/bin
echo ' '
echo binDir=$binDir


##-- go to BIN directory first
cd $binDir

if [ "$debugMode" = 'Y' ]; then
  pwd
fi

##----------------------------------------------------
##-- get the number of symbolic link files from BIN dir
##----------------------------------------------------
fileListCnt=`ls *.${fileExt} | sed 's/\.[^.]*$//' | wc -l`

echo "${fileExt} File Count $fileListCnt"
echo ' '

##----------------------------------------------------
##-- if 1 or more files found in the BIN directory,
##-- then, get the symbolic link files from BIN directory
##----------------------------------------------------
if [ $fileListCnt -gt 0 ]; then

  fileList=`ls *.${fileExt} | sed 's/\.[^.]*$//'`

  for fileName in ${fileList};
  do
   
    ##----------------------------------------------------
    ##-- check if the file exists and is a symbolicLink
    ##----------------------------------------------------
    if [ $debugMode = 'Y' ]; then
      echo "SymbolicLink fileName="$fileName
    fi

    ##----------------------------------------------------
    ##-- check if the file exists and is a symbolicLink
    ##----------------------------------------------------
    if [[ -f "$fileName" && -L "$fileName" ]]; then
     
     
      ##----------------------------------------------------
      ##-- first, remove the SymbolicLink file
      ##----------------------------------------------------
      echo "  Deleting SymbolicLink $fileName"
     
      rm $fileName
     
      retCode=$?
     
      if [ $retCode != 0 ]; then
        echo "File $fileName was not removed. Please re-verify."
      fi

      ##----------------------------------------------------
      ##-- Recreating SymbolicLink file
      ##----------------------------------------------------
      echo "  Recreating SymbolicLink for $fileName.$fileExt"

      ln -s $FND_TOP/bin/fndcpesr $fileName

      retCode=$?

      if [ $retCode != 0 ]; then
        echo "SymbolicLink $fileName was not created. Please check the .prog file."
      fi

    ##----------------------------------------------------
    ##-- if the file is not a SymbolicLink, show err msg
    ##----------------------------------------------------
    else
      echo "  $fileName is NOT a symlink"
    fi
   
    echo ' '

  done

else
  echo "No SymbolicLink files found"
  echo "Exiting the program"
fi

exit

No comments:

Topics Covered

Purchasing Concurrent program INVENTORY MODULE Inventory Concepts Min-Max Puchasing Sales Order Supply Chain Management Xml Publisher dff Alert Creation Assembly Pull Assigning Approval Groups Assigning Item BOM Tables Backend Tables Base Tables Bills of Material Tables CATALOG TABLES CATEGORY TABLES Closed not Summarized Concurrent Programs Concurrent Request Consigned and VM Inventory Count (*) Customer Items Customer Items Architecture DDL DML Defining Line Type Defining Subinventories Drop Ship EBS EVEN NUMBERED Error: - APP-PER-50022 FND Tables FRM-40735 Fetch Item Information Flexfields Functional GENERIC DISPOSITIONS Hosting ITEM LOCATIONS TABLE Idle Session Timeout Important questions Introduction to Database Invalid Identifier Error Inventory Inventory Implementation Inventory Item master Inventory Transaction Item Attributes Item Cross Reference Item Defining Attributes Item Deletion Item Master Item Relationships Item Status Attributes Item Tables Java Setup for R12 Key Tables Location Creation Lot and Serial Manufacturer Items Move order Normalization ODD NUMBERED ORA-29273 ORDER MANAGEMENT Oracle Apps Oracle Instance Oracle Order Management PURCHASING MODULE Payable Table Payment Terms Procure to Pay Cycle Profile Categories Purchase - PO Revisions Purchase - Purchase Document Types Purchase Order Purchasing - Define Buyers Purchasing - Defining Approval Groups Purchasing - Invoice matching Purchasing Options Quotations Quote Analysis RFQ RICE Components Receipt Routings Receivables (AR) Tables Receiving Options Registration of a Report Requisition Templates Responsibility Query SALES ORDER TABLE SALES PERSON CREATION SCM Service Contract Sql Self Joins Subinventory Subinventory Transfer Supplier Lists Suppliers TEMP Tablespace Toad Value Sets Wildcard Workflow copy column find an PO details implementation inbound order to cash org_id out bound out of the box implementation vanilla implementation