Viewing file: targetdeploy.pl (3.55 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!E:/oracle/product/10.2.0/client_2/perl/bin/perl
#
# $Header: targetdeploy.pl.template 09-sep-2004.07:10:34 rahgupta Exp $
#
# targetdeploy.pl.template
#
# Copyright (c) 2002, 2004, Oracle. All rights reserved.
#
# NAME
# targetdeploy.pl - deploys targets.xml into different state directories
#
# DESCRIPTION
# <short description of component this file declares/defines>
#
# NOTES
# <other useful comments, qualifications, etc.>
#
# MODIFIED (MM/DD/YY)
# rahgupta 09/09/04 - remove 102sa build break workaround
# rahgupta 09/02/04 - This is temporary workaround, will be removed when
# txn merged in 10.1.0.4 is available 10.2SA
# rahgupta 08/25/04 - Change ORACLE_HOME marker to s_javapOracleHome
# clo 11/03/03 - Bug #3231639
# clo 09/16/03 - clo_emcp_build_files
# clo 09/15/03 - Transfer to EM view; extend argument list
# mwidjaja 05/08/03 - mwidjaja_emrac_cfg_tool_update
# mwidjaja 05/07/03 - Creation
#
use File::Copy;
use Getopt::Std;
$ORACLE_HOME="E:/oracle/product/10.2.0/client_2";
die "ORACLE_HOME var not set.\n" if( $ORACLE_HOME eq "") ;
$EMDROOT = $ORACLE_HOME;
if ($#ARGV < 2) {
print STDERR <<USAGE;
Usage: targetdeploy.pl [-l <listener>] [-t <listener target>] [-v <VIP>] [-s <asm-sid> -o <asm-oracle-home>] <deploy-dir> <hostname> <sid>
-l <listener>: listener name
-t <listener target>: listener target name
-v <VIP>: virtual IP
-s <asm-sid> : SID for the ASM instance
-o <asm-oracle-home> : ASM ORACLE_HOME
<deploy-dir> : Directory to create a state-only agent installation
<hostname> : Hostname where targets.xml needs to be deployed
<sid> : SID for the rac_database
USAGE
exit;
}
getopts('l:t:s:o:v:') or die "Aborted\n";
$EMHOME=$ARGV[0];
$HOST=$ARGV[1];
$SID=$ARGV[2];
if(defined($opt_l))
{
$LISTENER=$opt_l;
}
if(defined($opt_v))
{
$VIP=$opt_v;
}
if(defined($opt_s))
{
$ASMSID=$opt_s;
}
if(defined($opt_o))
{
$ASMOH=$opt_o;
}
if(defined($opt_t))
{
$TARGET=$opt_t;
}
print "Creating targets.xml in state directories...\n";
print "Source location: $EMDROOT\n";
print "Destination : $EMHOME\n\n";
# Create directory structure
# EMHOME = EMDROOT/nodex
# |
# `-------sysman
# |
# `-------emd
# |
# `-------targets.xml
print "Creating directories...\n";
-e "$EMHOME" or mkdir "$EMHOME" or die "Unable to create $EMHOME: $!\n";
-e "$EMHOME/sysman" or mkdir "$EMHOME/sysman" or die "Unable to create $EMHOME/sysman: $!\n";
-e "$EMHOME/sysman/emd" or mkdir "$EMHOME/sysman/emd" or die "Unable to create $EMHOME/sysman/emd: $!\n";
#
# Targets.xml original file under $EMDROOT/sysman/emd/
#
print "Creating targets.xml...\n";
open ORIGTARGET,"<$EMDROOT/sysman/emd/targets.xml" or die "Unable to open $EMDROOT/sysman/emd/targets/xml\n";
open TARGETSXML,">$EMHOME/sysman/emd/targets.xml" or die "Unable to create $EMHOME/sysman/emd/targets.xml\n";
while ( <ORIGTARGET> )
{
s/%HOSTNAME%/$HOST/g;
s/%EM_REPOS_SID%/$SID/g;
if(defined($opt_l))
{
s/%LISTENER%/$LISTENER/g;
}
if(defined($opt_v))
{
s/%VIP%/$VIP/g;
}
if(defined($opt_s))
{
s/%ASM_SID%/$ASMSID/g;
}
if(defined($opt_o))
{
s/%ORACLEHOME%/$ASMOH/g;
}
if(defined($opt_t))
{
s/%LISTENER_TARGET%/$TARGET/g;
}
print TARGETSXML;
}
print "Done.\n"; # copying targets.xml end
|