Oracle, running command line scripts

In Oracle on 12/03/2010 by pier0w Tagged: ,

The Oracle command line tool is called sqlplus. To run an SQL script with this tool the syntax is as follows:

sqlplus -S <user>/<password>@<database url>:<database port>/<sid> @<path to sql script>

The -S argument is used to get sqlplus to run in silent mode. This means that sqlplus will only output the result of the SQL commands and nothing else.


sqlplus -S test_user/ @/tmp/test.sql

Here is an example SQL script, notice that the script ends with a ‘/’ character. This character must be used to terminate all SQL scripts that are used with sqlplus.

CREATE TABLE test_table ( test_value VARCHAR2(20) NULL );


Comments Off on Oracle, running command line scripts