DDL-Oracle
view release on metacpan or search on metacpan
"fi\n\n";
}
$text .= "echo And so did $shell\n" .
"echo\n" .
"echo YAHOO!!\n" .
"echo\n" .
"exit 0\n\n";
print "\nAnd if you want a driver script for all of the above, it is:\n\n",
" $shell\n\n\n";
open SHELL, ">$shell" or die "Can't open $shell: $!\n";
write_header( \*SHELL, $shell, '# ' );
print SHELL $text . "# --- END OF FILE ---\n\n";
close SHELL or die "Can't close $shell: $!\n";
if ( $create_temp_ddl )
{
$gzip = "$expdir/$prefix${tblsp}_prttn.dmp.gz";
print "\n*** The following 2 scripts ARE FOR FALLBACK PURPOSES ONLY!!\n" .
"*** Use these scripts ONLY IF Shell #2 HAD ERRORS.\n\n";
$script = $shell . ++$i;
$text =
"# USE FOR FALLBACK PURPOSES ONLY\n\n" .
"# Use SQL*Plus to run $drop_temp_sql\n" .
"# which will drop the temp tables holding data for partitions " .
"in tablespace $tblsp\n\n" .
"sqlplus -s / << EOF\n\n" .
" SPOOL $drop_temp_log\n\n" .
" @ $drop_temp_sql\n\n" .
"EOF\n" .
check_sql_log( $script, $drop_temp_log );
create_shell( $script, $text );
$script = $shell . ++$i;
$text =
"# USE FOR FALLBACK PURPOSES ONLY\n\n" .
"#Import the tables back into the partitions in " .
"Tablespace $tblsp\n\n" .
"echo\n" .
"echo \"**************** NOTICE ***************\"\n" .
"echo\n" .
"echo Ignore warnings about missing partitions -- because not\n" .
"echo all partitions were exported, and thus not all partitions\n" .
"echo need be re-imported.\n" .
"echo The error to be ignored is:\n" .
"echo\n" .
"echo \" IMP-00057: Warning: Dump file may not contain data of all partitions...\"\n" .
"echo\n" .
"echo \"************ END OF NOTICE ************\"\n\n" .
"nohup gunzip -c $gzip \\\n" .
" > $pipefile &\n\n" .
"imp / parfile = $prttn_imp_par\n" .
check_imp_log( $script, $prttn_imp_log );
create_shell( $script, $text );
}
my @shells = glob( "$sqldir/$prefix$tblsp.sh*" );
chmod( 0754, @shells ) == @shells or die "\nCan't chmod some shells: $!\n";
print "\n$0 completed successfully\non ", scalar localtime,"\n\n";
exit 0;
#################### Subroutines (alphabetically) ######################
# sub check
#
# returns text for a shell script to check its LOG file for errors
#
sub check
{
my ($shell, $log ) = @_;
return
"then
echo
echo '*** ERRORS during'
echo $shell
echo
echo CHECK LOG $log
echo
exit 1
else
echo
echo $shell
echo completed successfully without errors.
echo on \` date \`
echo
fi
";
}
# sub check_exp_log
#
# returns text for a shell script to check its exp log file for errors
#
sub check_exp_log
{
my ( $shell, $log ) = @_;
return
"
cat $log
EXP=\` grep -c ^EXP- $log \`
ORA=\` grep -c ^ORA- $log \`
if [ \${ORA} -gt 0 -o \${EXP} -gt 0 ]
" .
check( @_ );
}
( run in 1.053 second using v1.01-cache-2.11-cpan-39bf76dae61 )