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

#! /usr/local/bin/perl
# script: prod3_rman_restore_db_1.pl (renamed from 30_win_920_prod3_rman_restore_db_1.pl)
# Features: This perl script performs an RMAN full database restore in the case
# where all datafiles have been lost.
#
# Script Sequence#: 30
# Used By: run manually by DBA
#
# Copyright 2002 by .com Solutions Inc.
#
# ---------------------- Revision History ---------------
# Date By Changes
# 12-21-2001 dsimpson Initial Release
# 12-27-2001 dsimpson Added ORACLE_SID environment variable
# 07-29-2002 dsimpson Corrected pathname separators.
# This output file was created by Installgen version 1.38 on Thu Nov 14 17:48:05 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 $tempsqlcode='';
my @proglist='';
my $temp_rman_filename="temp_rman.sql";
my $temp_sql_filename="temp_sql.sql";
my $tempsqlcode=<<"EOF";
connect / as SYSDBA
-- make sure database is shut down before starting
set echo on
set verify on
set feedback on
shutdown immediate;
EOF
open (FILE1,">$temp_rman_filename") || die ("Could not open output file $temp_rman_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");
# start the rman restore and recovery
my $tempsqlcode=<<"EOF";
connect / as SYSDBA
startup mount
restore database;
recover database;
alter database open;
quit
EOF
open (FILE1,">$temp_rman_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\\rman.exe target / \@$temp_sql_filename");

