
Installgen
Features and Benefits
Installgen
Demo Available for download...
Bookmark This Page

#! /usr/local/bin/perl
# script: prod3_controlfile_backup_to_trace_1.pl (renamed from 36_win_prod3_controlfile_backup_to_trace_1.pl)
# Features: This perl script backs up the control file to trace.
# Note: This script only needs scheduled if the same task has not
# been scheduled via an OEM job.
#
# Script Sequence#: 36
# Used By: run automatically via AT scheduler
# Usage:
# ******** Nightly backup of controlfile to trace at 11:51PM ********
# AT 23:51 /every:M,T,W,Th,F,S,Su c:\server_scripts\prod3_controlfile_backup_to_trace_1.pl
# Copyright 2001 by test customer
#
# ---------------------- Revision History ---------------
# Date By Changes
# 12-22-2001 dsimpson Initial Release
# 12-27-2001 dsimpson Added ORACLE_SID environment variable
# 07-29-2002 dsimpson Simplified "system" call code.
# This output file was created by Installgen version 1.38 on Thu Nov 14 17:16:25 2002. By .com Solutions Inc. www.dotcomsolutionsinc.net;
use strict;
# insure that environment variable is used by this perl script
$ENV{'ORACLE_SID'} = "PROD3";
my @proglist='';
my $tempsqlcode='';
my $temp_sql_filename="temp_sql.sql";
# back up the controlfile to a trace file in the c:\backup directory
my $tempsqlcode=<<"EOF";
connect / as SYSDBA
set echo on;
-- temporarily change the user dump dest so that
-- the text copy of the control file rebuilding sql commands
-- go into the c:\backup directory
ALTER SYSTEM SET USER_DUMP_DEST='c:\\backup';
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
ALTER SYSTEM SET USER_DUMP_DEST='c:\\u01\\udump';
exit;
EOF
open (FILE1,">$temp_sql_filename") || die ("Could not open output file $temp_sql_filename for writing. \n Does the full directory path exist?");
print FILE1 ($tempsqlcode);
# close the output file
close (FILE1);
system ("c:\\v901\\bin\\sqlplus.exe /nolog \@$temp_sql_filename");

