0

I just wanted to know is there any way to pass the arguments in perl script (adcfgclone.pl) during compilation time (i.e., the values should not be asked during script run time)

Below is an example that i am passing the values after running the script.

Provide the values required for creation of the new APPL_TOP Context file.

Target System Hostname (virtual or normal) [proddb] :
Target Instance is RAC (y/n) [n] : n    
Target System Database SID : proddb1    
Target System Base Directory : /d06/oravis    
Target System utl_file_dir Directory List : /usr/tmp    
Number of DATA_TOP's on the Target System [1] : 1    
Target System DATA_TOP Directory 1 [/d01/oravsn12/db/apps_st/data] : /d06/oravis/db/apps_st/data    
Target System RDBMS ORACLE_HOME Directory [/d06/oravis/db/tech_st/10.2.0] : /d06/oravis/db/tech_st/10.2.0    
Do you want to preserve the Display [null] (y/n) ? : n    
Target System Display [sharkap:0.0] :    
Target System Port Pool [0-99] : 34

Note: I am entering all the above values during the script run time, so i just pass those all arguments in one file and just run the adcfgclone.pl script.

3
  • I am running below one : perl /d06/oravis/db/tech_st/10.2.0/appsutil/clone/bin/adcfgclone.pl dbTier /d06/oravis/db/tech_st/10.2.0/appsutil/CLONE3_sharkap.xml \ show progress \
    – Maheswar
    May 30, 2017 at 8:08
  • This does not seem to have anything to do with linux-kernel. Quick googling suggests the tag oracle-database as at least roughly correct; but please review and, if possible, add context.
    – tripleee
    May 30, 2017 at 15:11
  • The tool seems to accept a "context file" with values for it to run with. You could create a simple script which generates such a file with some parameters provided by the user as command-line arguments; is this what you are trying to ask?
    – tripleee
    May 30, 2017 at 15:13

2 Answers 2

0

Perfectly honest, I don't know if this is exactly what you want. That whole perl compile time/run time thing is a little confusing to me.

You can try autoexpect (included in the expect package). Initially, you have to run your perl app through autoexpect, answering the inputs. But after that, you only need to run the output script generated by autoexpect, which fills in all of the inputs.

cat expect-test.pl

#!/bin/perl

use warnings;
use strict;

print "Enter your input: ";
my $input = <STDIN>;
chomp $input;
print "You typed: $input\n";

autoexpect -f expect-test.exp ./expect-test.pl
autoexpect started, file is expect-test.exp
Enter your input: bob 
You typed: bob
autoexpect done, file is expect-test.exp

./expect-test.exp
spawn ./expect-test.pl
Enter your input: bob 
You typed: bob

Or more simply, you can also try redirecting your input file into your perl script:

cat input.text 
bart

./expect-test.pl < input.text 
Enter your input: You typed: bart
3
  • Thanks for the help... its working now... And now i am getting PORT issue..
    – Maheswar
    May 31, 2017 at 9:45
  • $ cat db_args.txt | perl /d06/oravis/db/tech_st/10.2.0/appsutil/clone/bin/adcfgclone.pl dbTier Target System Port Pool [0-99] : RC-00201: Error: Not a valid port pool number ======== $ cat db_args.txt apps n prodtest /u01/oraprod /usr/tmp 1 /u01/oraprod/db/apps_st/data /u01/oraprod/db/tech_st/11.1.0 n apps:0.0 30
    – Maheswar
    May 31, 2017 at 10:08
  • I extended my test perl script to read in all of those values and it consumed them without issue. (1) I would examine the adcfgclone.pl script and see how they are accepting the input, especially at the pool number spot. (2) Make sure there is a newline after the port number and that each input is on it's own line (3) Try the expect route.
    – Jim
    May 31, 2017 at 13:40
0

Probably a bit late for the OP, but still relevant if someone else has the same question.  Basically all the answers to these questions are in a file called the context file. Once you set the Apps environment, the context file is in ${CONTEXT_FILE}. So by running:

perl adcfgclone.pl appsTier "$CONTEXT_FILE"

you will only be asked for the Apps password.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .