Thursday, May 08, 2008

EXP-00002: error in writing to export file

I've run the script to take a full export of my database and it has run successfully, however when I've included it in the crontab, it failed with the error below.

EXP-00002: error in writing to export file
EXP-00002: error in writing to export fileerror closing export file
EXP-00000: Export terminated unsuccessfully

When I've checked the size of the dump file, it was exactly 1.999 GB, which means that it has hit the file size limit of 2GB. Again, when I ran it manually, it did work.

It was because crontab did not know anything about the ulimits of user "Oracle". It was using the default ulimit value and when it hit the 2GB size limit, my export errored out. I've edited my crontab entry to use the .profile file to set the environment, before it ran my export and it worked fine.

The crontab entry was modified as below.

# +---------------------------------------------------------+------------------------+
# | Daily FULL database export for DB TEST1 | Daily at 12:00 AM |
# +---------------------------------------------------------+------------------------+
00 00 * * * (./home/oracle/.profile; /oracle/app/admin/scripts/daily_export.sh TEST1 >/tmp/export_TEST1.log 2>&1)



Hope this helps.

-- Vish.