Linux 可以传递给 SQL*Plus 的命令行参数的最大长度?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6846263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 05:18:15  来源:igfitidea点击:

Maximum length of command line argument that can be passed to SQL*Plus?

linuxcommand-line-argumentssqlpluscsh

提问by Umber Ferrule

I am calling SQL*Plus from Linux C Shell:

我从 Linux C Shell 调用 SQL*Plus:

sqlplus username/password @file.sql var1 var2 var3

sqlplus username/password @file.sql var1 var2 var3

If I pass a string as var1, how long can this string be?

如果我传递一个字符串 as var1,这个字符串可以有多长?

Is it governed by the OS? In this case:

它是由操作系统管理的吗?在这种情况下:

Linux version 2.6.9-100.ELsmp ([email protected]) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)) #1 SMP Tue Feb 1 12:17:32 EST 2011

Linux version 2.6.9-100.ELsmp ([email protected]) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)) #1 SMP Tue Feb 1 12:17:32 EST 2011

Update:Empirical testing yielded the following results:

更新:实证测试产生以下结果:

  • A command line argument of 5200 characters gave the error, "Word too long."
  • 1300 characters then produced the SQL*Plus error, "string beginning "(000796384..." is too long. maximum size is 239 characters."
  • As soon as I got under 239 chars all was well.
  • 5200 个字符的命令行参数给出了错误“Word 太长”。
  • 1300 个字符然后产生 SQL*Plus 错误,“字符串开头“(000796384...”太长。最大大小为 239 个字符。)
  • 一旦我低于 239 个字符,一切都很好。

I think I'll use sqlldrto overcome this.

我想我会用它sqlldr来克服这个问题。

采纳答案by Pablo Castellazzi

Try with: xargs --show-limits

尝试: xargs --show-limits

Your environment variables take up 2446 bytes
POSIX upper limit on argument length (this system): 2092658
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2090212
Size of command buffer we are actually using: 131072

There is no limit per argument, but a total for the whole command line length. In my system (Fedora 15/zsh) its closer to 2Mb. (line 4).

每个参数没有限制,而是整个命令行长度的总数。在我的系统 (Fedora 15/zsh) 中,它更接近 2Mb。(第 4 行)。

回答by Umber Ferrule

I came across "How long an argument list your kernel can take on the command line before it chokes?":

我遇到了“您的内核在窒息之前可以在命令行上使用多长时间的参数列表?”:

getconf ARG_MAX

which gives the following on my system:

这在我的系统上给出了以下内容:

131072