I
I
Igor Petrov2011-07-09 02:10:46
Oracle
Igor Petrov, 2011-07-09 02:10:46

Correct batch file configuration?

Good day!
In the process of "playing" with the database, you often have to restore the contents. To do this, I created two sql scripts - for creating tables and filling.
Therefore, there is a need to create a batch file that simplifies the work. You must enter a sequence of commands:
1. sqlplus login/password
2. @.\db_create.sql
3. @.\db_insert.sql
4. exit
So far, only the first two commands have been combined. The rest are either ignored or "forgotten".
There is an option to combine the contents of both scripts in one file and finally add exit, but this is somehow not entirely aesthetically pleasing, and besides, it will not hurt to find out such subtleties once again.
Thank you in advance for your response.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Laplace, 2011-07-09
@KriegeR

can sqlplus read stdin correctly? echo db_create.sql | sqlplus login/password
or sqlplus login/password < commands.txt where commands.txt are lines 2..4

S
sl_bug, 2011-07-09
@sl_bug

mysql --user=username --password=pass db_name <script.sql

won't go?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question