Informix Error -806: Cannot open file for unload.
Cause and resolution
Cannot open file for unload.
The output file that is specified in this UNLOAD statement could not be opened. Check the accompanying ISAM error code for more information. Possibly a more complete pathname is needed; the file exists, but your account does not have write permission for it; or the disk is full.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-806 is the mirror image of -805: it fires when UNLOAD's output file can't be opened — per
the official guidance, three possibilities: an incomplete pathname, a permissions problem on a
file that already exists, or a full disk.
- A relative pathname that resolves differently server-side than expected, per the official guidance's "more complete pathname" note — the same server-side path-resolution issue as -805.
- The output file already existing without write permission for the server's OS user, per the official guidance.
- A full disk in the filesystem holding the output path, per the official guidance.
Solutions / Resolution
- Check the accompanying ISAM error code, per the official guidance, for the specific underlying reason.
- Use a complete (absolute) pathname, per the official guidance, for the output file.
- Check write permission on the target path, per the official guidance, if a file already exists there.
- Check free disk space at the target location, per the official guidance:
df -h /path/to/output/directory
Examples
Checking disk space before a large unload
$ df -h /path/to/output/directory
Using an absolute path
UNLOAD TO '/full/path/to/orders_export.unl' SELECT * FROM orders;
Diagnostic Checks
- Check the accompanying ISAM error code first, per the official guidance.
- Check write permission on the target path and free disk space, using an absolute path to avoid server-side working-directory ambiguity.
Related Errors / Related Topics
- -805 — "Cannot open file for load." The mirror-image error, for
LOAD's input file rather thanUNLOAD's output file.
The mirror image of -805 — use an absolute path, and check write permission and free disk space at the target.