RelationalDBDesignRelationalDBDesign


Create Database   «Prev  Next»
Lesson 5 Executing the CREATE DATABASE command
Objective Create the COIN database.

Executing CREATE DATABASE command (Oracle)

Editing command file

You are now ready to execute the CREATE DATABASE command and create the COIN database. Hopefully, you have stored the command in an SQL file. Before you execute it, edit the file and add the commands shown here:
SET ECHO ON
SPOOL create_coin.lis
your CREATE DATABASE command should go here
SPOOL OFF
SET ECHO OFF
What do these commands do? The SET ECHO ON command causes commands from script files to be echoed to the screen when they are executed. Usually, when I create a database, I want to see the commands being executed in order to better interpret any error messages. Running the SPOOL command causes output to be logged to a file named create_coin.lis. Always do this so that you will have a record of the database being created. This becomes especially important if an error occurs, because that error will be logged to the file as well.

Executing the command File

After adding the commands shown above, you are ready to execute your command file and create your database. You execute your command file from Server Manager by running a command like this:
@create_coin

The ”@” symbol is the critical element because it tells Server Manager that whatever comes after the symbol is a filename. In this case, Server Manager will look for a file named create_coin.sql and it will execute all the commands contained in that file.

execute Create Database Command - Exercise

Click this Exercise link below to do an ordering exercise on the database creation process.
execute Create Database Command - Exercise
Exercise
Click this Exercise link below to perform this task for your own database. Create Database Command - Exercise