Monday, May 18, 2015

SP2-0768: Illegal SPOOL command

SP2-0768: Illegal SPOOL command
Usage: SPOOL { | OFF | OUT }
where is file_name[.ext] [CRE[ATE]|REP[LACE]|APP[END]]



This error came when you are trying to create log file from SQL* loader using SPOOL command.

reason:
This error came because of two reason
1. Wrong path for spool file
2. @*.sql file contain invalid characters

Solve:

1. In my case i am trying to set spool file at path

spool C:\Users\******\Desktop\New folder\extract.log

It throws error because of "New folder" Folder name contain space
so Correct syntax to write the command either remove the space from folder name or enclosed the path in single quotes

2. If you are tring to execute the @*.sql file which contain the spool command can cause error
because some times in linux file contains
invalid characters like ^M

In that case you need to remove the invalid chars from file.

7 comments:

  1. It worked for the first time... however if i tried to give a different path next time it dose not work.

    ReplyDelete
  2. Thank you, it worked.

    ReplyDelete
  3. Thank you for your comment regarding enclosing the file path in single quotes...newbie mistake on my part!

    ReplyDelete
  4. I received this error without having any spaces in my file path. Drove me nuts until I found that I had an extra space in the "spool off" command. Just didn't see that extra space, which made the spool command throw this error.

    ReplyDelete

web stats