Sqlplus script example
- how to execute sql file in sqlplus
- how to run .sql file in sqlplus command line
- how to execute multiple sql files in sqlplus
- how to run sql script in sqlplus
How to run sql script in sqlplus command line in windows
Sqlplus -s option in shell script.
In Oracle, use @ to run a script file after starting SQL Plus.
SQL Plus can be started from any directory where the user is given the access to.
How to run sql file in oracle command lineThe user account needs privilege to run sqlplus which is usually in the $ORACLE_HOME/bin folder. The following is the format to run a script in SQL Plus in the Linux environment:
SQL > @script.sql
SQL > @/path/script.sql
If the path is not specified, SQL Plus look for the script file in the directory where the current user account is at.
You can use cd to change the directory to the location where the script is put, and then run SQL Plus. Otherwise, you can specify the path of the script in the @ command.
Examples
We need to run “DGPhyStby_script_v3.sql” which is provided by Oracle for Data Guard diagnostics.
First, we download the script and upload it to our Oracle server (Linux) in the /oracle_staging
- how to run sql script in sqlplus command line
- how to run sql script in sqlplus command line in linux