Sqlplus inside shell script writing to tmp file

Hi,
facing an issue while calling sqlplus inside shell script. It for some reason goes to tmp file to write something and i get error as permission denied as i dont have access there.
ANy idea why sqlplus writes in /tmp and how to change or stop this ?

The 1st thing to ask yourself is why doesn't every user on your system have permission to create files in /tmp?

Then you can look at your documentation for sqlplus. Is there an option to specify a different location for temp files?

Many UNIX and UNIX-like utilities that use non-trivial amounts of temporary file space will look for a TMPDIR environment variable. If $TMPDIR expands to the name of a directory and sqlplus uses the conventional meaning of TMPDIR, it will put temporary files in the directory named by $TMPDIR instead of in /tmp. So, you could try something like:

TMPDIR=/path/to/tmp_directory sqlplus args...

Thanks Don. Its on production so we dont have access on tmp. can we set diffrent location for specific shell ?