Maximum Length of Command Line Argument That Can Be Passed to Sql*Plus

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

Try with: xargs --show-limits </dev/null

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).

Maximum string length that can be passed in command line argument?

I've changed your PHP program to use escapeshellarg as follows. I didn't test it, but my guess is that it will work

<?php
//sent has value "http://www.paulgraham.com/herd.html"
$url=$_POST['sent'];
$text = file_get_contents($url);
$temp=escapeshellarg(strip_tags($text));
$output=shell_exec("/home/technoworld/Videos/LinSocket/Modular/x " . $temp);
echo $output;
?>

How to get around the command line length limit?

If you want to drop files with respect of Windows Explorer, then you can implement your own Drop Handlers as a Shell Extension Handlers see:

  • How to Create Drop Handlers (Windows)
  • Creating Shell Extension Handlers

On The Complete Idiot's Guide to Writing Shell Extensions you will find a good introduction how to write such extensions.

The part VI gives an example of Drop Handler (for a little other use case, but it dose not matter).

With respect of Drop Shell Extension Handler your program will receive full information about all dropped files and you need not start a child program with all the files as command like parameters.

How do I pass arguments to a PL/SQL script on command line with SQLPLUS?

Firstly, you will need to invoke your script like so:

sqlplus.exe MYUSER/mypassword@HOST030 @refreshDataOnOracle.sql foo bar  

Instead of the OS redirection you will use the "@" symbol to indicate the file name to execute. You will also supply the script parameters on the command line. In the script you will refer to the parameters using &1, &2 etc.

update mytable set mycol = '&2' where myid = '&1';

which will translate into

update mytable set mycol = 'bar' where myid = 'foo';

Best practice for submitting long commands to LSF

There's no special limitation in LSF (that I know of) that will truncate an entire command line outright. There are a few things you might want to consider, however:

  1. The shell you run the bsub command in might impose a limit on the total length of the command you can submit. This is often controlled by an OS limit, there are many questions about it floating around the internet. Here is one example which shows a couple of ways to determine the limit on your system. In case of broken links, the top answer there recommends xargs --show-limits while another way is to check getconf ARG_MAX
  2. Certain bsub options that accept strings as inputs may have limits on the length of the string that can be passed to them. For example the -R option can accept strings of 512 characters -- for the most part I believe LSF will reject the job if the argument is too long (but I can't guarantee for sure if that's the case for all of them).

Argument list too long error for rm, cp, mv commands

The reason this occurs is because bash actually expands the asterisk to every matching file, producing a very long command line.

Try this:

find . -name "*.pdf" -print0 | xargs -0 rm

Warning: this is a recursive search and will find (and delete) files in subdirectories as well. Tack on -f to the rm command only if you are sure you don't want confirmation.

You can do the following to make the command non-recursive:

find . -maxdepth 1 -name "*.pdf" -print0 | xargs -0 rm

Another option is to use find's -delete flag:

find . -name "*.pdf" -delete


Related Topics



Leave a reply



Submit