rtan
rtan

Reputation: 55

Cannot execute .sql with sqlplus (windows)

I have finally connected to sqlplus under windows with command:- sqlplus -S "dbname/dbpassword@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=)(Port=1521))(CONNECT_DATA=(SID=SID_OF_DB)))" (Can't connect with configuration file but command line works well for me.)

But I'm not able to execute sql file along with the command.

It is definitely possible to execute .sql file with directive << under linux, but how do I execute in windows?

I'm using sqlplus to generate csv within batch file and importing to mysql. Presently using login.sql as alternate.

Upvotes: 1

Views: 2526

Answers (2)

Pradhyoth
Pradhyoth

Reputation: 148

You can connect and execute using the '@' followed by your file name as mentioned by Chris. You can use it as follows.

sqlplus -S user/password@SID_OF_DB @oracle.sql

Upvotes: 3

ChrisProsser
ChrisProsser

Reputation: 13088

You should be able to run a SQL file by adding @filename onto the end of your command to open sqlplus. If the file is not in your current working directory you will need to include the path. Also if there are any spaces in the name or path then enclose the whole path within double quotes.

Some more info about the command line options can be found here.

Upvotes: 2

Related Questions