RelationalDBDesign 




DB Creation   «Prev  Next»
Lesson 11 The SPOOL Command
Objective Use Server Manager's SPOOL command.
The SPOOL command is used to echo Server Manager's output to a text file. Spooling output to a file is a good thing to do whenever you run a script, or any other command that produces a lot of output. It enables you to review the output later, without having to worry about it scrolling off the top of the screen.
To begin writing output to a file, use the SPOOL command followed by the name of the file to which you want to write the output. You can specify the full directory path of the file if you like. The following examples will work on Windows NT and UNIX respectively:
SPOOL c:\output.txt
SPOOL $HOME/output.txt
All the output will now be written to a file named output.txt in the root directory of your C drive (Windows NT), or to your home directory (UNIX). To stop spooling, use the following command:
SPOOL OFF


I use the SPOOL command whenever I run a critical script, or whenever I execute a critical set of commands, because it gives me a record that I can turn to later if I find out that something did not go as expected.
Spooling Results
Many times you will find it helpful to spool the results of you Server Manager session. We find it especially helpful to capture the output of the show parameters command; you can then use this output for your first attempt at customizing an initialization parameter file. By using the captured output as a starting point, you eliminate typing errors.
Note: A misspelled entry in the initialization parameter file will prevent the database from starting up.
To start recording your actions while in Server Manager, do the following:
  1. Enter the command spool file_name where the filename conforms to the rules of your computer.
    Oracle redisplays the SVRMGR> prompt after the spool file is opened.
  2. Go about your job in Server Manager, and then close the file by entering the spool off command; Oracle closes the output file and redisplays the Server Manager prompt.
Spool Command - Exercise
Click on the link below to attempt the [Spool Command Exercise].
Spool Command - Exercise