Saturday, June 13, 2009

Perl Script Oracle Apps Clone CONTEXT_FILE

I was working on automating Rapid Clone for Oracle Apps 11.5 and need to script changes to CONTEXT_FILE. Here is the perl script I used.

$infile=$ENV{"CONTEXT_FILE"};
print "infile is $infile \n";
open(IN,"$infile") || die "cannot open $infile for reading: $!";
$outfile="$infile" . "_new";
print "outfile is $outfile \n";
open(OUT,">$outfile") || die "cannot open $outfile for writing: $!";
while () {
if (/AF_CLASSPATH/) {
s/appsborg/appsborg2/;
}
if (/\disabled/) {
s/disabled/enabled/;
}
if (/\disabled/) {
s/disabled/enabled/;
}
if (/\disabled/) {
s/disabled/enabled/;
}
if (/\disabled/) {
s/disabled/enabled/;
}
if (/\disabled/) {
s/disabled/enabled/;
}
print OUT $_;
}
close (IN);
close (OUT);
print "new context file is $outfile \n";

Here is the shell script I used a wrapper.
perl chgcontext.pl
diff $CONTEXT_FILE "$CONTEXT_FILE"_new
cp $CONTEXT_FILE "$CONTEXT_FILE"_old
cp "$CONTEXT_FILE"_new $CONTEXT_FILE
diff $CONTEXT_FILE "$CONTEXT_FILE"_new

No comments:

Post a Comment