在真正的linux环境测试: SCOTT@book> @ ver1

来源:这里教程网 时间:2026-03-03 16:30:22 作者:

1.环境: SCOTT@test01p> @ ver1 PORT_STRING                    VERSION        BANNER                                                                               CON_ID ------------------------------ -------------- -------------------------------------------------------------------------------- ---------- IBMPC/WIN_NT64-9.1.0           12.2.0.1.0     Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production              0 2.测试例子: --//家里环境使用Cygwin64 Terminal在windows下: seq 4| xargs -I {} -P 4 sqlplus -s -l scott/btbtms@test01p <<EOF select sysdate from dual; quit; EOF $ seq 4| xargs -I {} -P 4 sqlplus -s -l scott/btbtms@test01p <<EOF > select sysdate from dual ; > quit; > EOF --//没有任何输出!! $ seq 4| xargs -I {} -P 4 sqlplus -s -l scott/btbtms@test01p <<EOF^Jselect sysdate from dual ;^Jquit;^JEOF^J --//没有任何输出!! --//注:^J,在linux下,ctrl+v,ctrl+J --//可以发现xargs+here doc不能正常工作. 3.测试: --//使用bash -c调用看看。 $ seq 4 | xargs -IQ bash -c "sqlplus -s -l  scott/btbtms@test01p <<EOF^Jselect sysdate from dual ;^Jquit^JEOF^J" SYSDATE ------------------- 2021-02-11 20:00:19 SYSDATE ------------------- 2021-02-11 20:00:19 SYSDATE ------------------- 2021-02-11 20:00:20 SYSDATE ------------------- 2021-02-11 20:00:21 --//必须调用bash -c通过引号包裹起来.上班在真正的linux环境测试看看. 3.在真正的linux环境测试: SCOTT@book> @ ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- -------------------------------------------------------------------------------- x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production $ seq 2| xargs -I {} -P 2 sqlplus -s -l scott/book <<EOF > select sysdate from dual ; > quit; > EOF $ seq 2| xargs -I {} -P 2 bash -c "sqlplus -s -l scott/book <<EOF > select sysdate from dual ; > quit; > EOF > " SYSDATE ------------------- 2021-02-18 08:31:11 SYSDATE

相关推荐