[oracle@slcm05adm04 cdb1]$ cat 1.pl
#!/usr/bin/perl
use strict;
use config_wgz;
my $config_file='config.cfg';
my $orahome = get_param_value($config_file,'orahome');
my $tns_admin=get_param_value($config_file,'tns_admin');
chomp $orahome;
chomp $tns_admin;
$ENV{ORACLE_HOME}=$orahome;
$ENV{TNS_ADMIN}=$tns_admin;
my $ret = `$orahome/bin/sqlplus -l -s /nolog <<"EOF";
connect sys/cdb1\@cdb1 as sysdba;
set head off;
set pagesize 0;
set sqlblanklines off;
set feedback off;
select * from dual;
exit;
EOF`;
print "$ret";
perl通过不调用sql文件的方式获取数据库数据的方法
最新推荐文章于 2022-07-14 17:45:57 发布