Please see my script and other file contents below.
What I´m trying to do is check whether the sqlnet.ora file in each directory it checks contains SQLNET.AUTHENTICATION_SERVICES!=(NONE) and get an error message for every file checked that either doesn´t contain this parameter, or its value is not (NONE). However, I have managed to set a condition if it matches, but I don´t know how to get around the rest. I want a message per file, not for each line that doesn´t contain this.
Can anybody suggest a good way of doing this?
Thanks in advance!
Teresa.
This is my script:
========================================================
#!/usr/bin/perl
my $oratab='/home/tmillan/oratab';
open(BIN, "<$oratab\n") or die "Couldn't open file for reading: $!n";
while (<BIN>) {
s/#.*//; #ignore comments
next if /^(\s)*$/; #ignore blank lines
chomp;
my ($orahome) = (split /:/)[1];
push @lines, "$orahome" ;
}
close BIN;
foreach (@lines) {
my $sqlnet="$_/network/admin/sqlnet.ora";
open (BIN2, "<$sqlnet\n") or die "cant open $sqlnet: $!";
while (<BIN2>) {
s/#*//; #ignore comments
next if /^(\s)*$/; #ignore blanks
chomp;
if ($_ =~ /AUTHENTICATION_SERVICES/i) {
my $message="$_. Set to (NONE)in $sqlnet to avoid connections where SYS password is not required.\n";
print "em_result:$message";}
}
chomp;
}
close BIN2;
exit;
This is my oratab file:
=====================================================
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
HELIO:/home/oracle10/oracle/product/10.2.0/db_1:Y
TUNEZ:/oracle/product/11g:N
======================================================
And this is my sqlnet.ora file:
=======================================================
# sqlnet.ora Network Configuration File: /u02/db102/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES=(Nft)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
prueba=borrame
=======================================================
What I´m trying to do is check whether the sqlnet.ora file in each directory it checks contains SQLNET.AUTHENTICATION_SERVICES!=(NONE) and get an error message for every file checked that either doesn´t contain this parameter, or its value is not (NONE). However, I have managed to set a condition if it matches, but I don´t know how to get around the rest. I want a message per file, not for each line that doesn´t contain this.
Can anybody suggest a good way of doing this?
Thanks in advance!
Teresa.
This is my script:
========================================================
#!/usr/bin/perl
my $oratab='/home/tmillan/oratab';
open(BIN, "<$oratab\n") or die "Couldn't open file for reading: $!n";
while (<BIN>) {
s/#.*//; #ignore comments
next if /^(\s)*$/; #ignore blank lines
chomp;
my ($orahome) = (split /:/)[1];
push @lines, "$orahome" ;
}
close BIN;
foreach (@lines) {
my $sqlnet="$_/network/admin/sqlnet.ora";
open (BIN2, "<$sqlnet\n") or die "cant open $sqlnet: $!";
while (<BIN2>) {
s/#*//; #ignore comments
next if /^(\s)*$/; #ignore blanks
chomp;
if ($_ =~ /AUTHENTICATION_SERVICES/i) {
my $message="$_. Set to (NONE)in $sqlnet to avoid connections where SYS password is not required.\n";
print "em_result:$message";}
}
chomp;
}
close BIN2;
exit;
This is my oratab file:
=====================================================
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
HELIO:/home/oracle10/oracle/product/10.2.0/db_1:Y
TUNEZ:/oracle/product/11g:N
======================================================
And this is my sqlnet.ora file:
=======================================================
# sqlnet.ora Network Configuration File: /u02/db102/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES=(Nft)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
prueba=borrame
=======================================================