What is Sqlplus in shell script?

My #1 Oracle DBA tool is sqlplus – I use it to automate DBA tasks directly on the Oracle Server from shell scripts. I often put the output of sqlplus -s in a shell variable and use it for further processing. sqlplus /nolog. sqlplus / as sysdba.

How do I run Sqlplus on Linux?

Do the following steps to start SQL*Plus and connect to the default database:

  1. Open a UNIX terminal.
  2. At the command-line prompt, enter the SQL*Plus command in the form: $> sqlplus.
  3. When prompted, enter your Oracle9i username and password.
  4. SQL*Plus starts and connects to the default database.

How do I know if Sqlplus is installed?

In Windows. Check the Inst_loc entry value which will be the software installed location. You can use command prompt or you can navigate/explore to the oracle home location and then cd to bin directory to lauch sqlplus which will give you the client version information.

How do I run a sqlplus script from the command line?

To run a script as you start SQL*Plus, use one of the following options:

  1. Follow the SQLPLUS command with your username, a slash, a space, @, and the name of the file: SQLPLUS HR @SALES. SQL*Plus starts, prompts for your password and runs the script.
  2. Include your username as the first line of the file.

How do I start Oracle database in Linux?

On Windows: Click Start, point to Programs (or All Programs), point to Oracle Database 11g Express Edition, and then select Start Database. On Linux with Gnome: In the Applications menu, point to Oracle Database 11g Express Edition, and then select Start Database.

Where is Sqlplus path in Linux?

Start by a cd to the $ORACLE_HOME/bin and see if it works . . . If this works, you need to set your PATH to include your $ORACLE_HOME/bin directory. Next, we start SQL*Plus with the sqlplus command. When starting SQL*Plus include the user name that you wish to connect to.

How do I run a Sqlplus script from the command-line?

How do I run a Sqlplus file?

Answer: To execute a script file in SQLPlus, type @ and then the file name. The above command assumes that the file is in the current directory. (ie: the current directory is usually the directory that you were located in before you launched SQLPlus.) This command would run a script file called script.

Is it possible to trap SP2 errors in sqlplus 11g?

It is possible to trap the sp2 errors in SQLPLUS 11g using the error logging facility. Please have a look at for more information.

What does the -s flag do in sqlplus?

After all – there would be no reason to make that initial connection only to have the script reconnect again. The -s flag tells sqlplus to be banner silent and not prompt for any input such as username/password or variable substitution.

What does /nolog do in sqlplus?

The /nolog tells sqlplus to skip the login and go directly to the sqlplus prompt where you can make a connection. I use this when calling sqlplus from a shell script directly on the Oracle database server because it allows me make a connection using connect / as sysdba and then pass sqlplus some quick commands to process.

What is the difference between SYSDBA and /sqlplus?

The / tells sqlplus to use OS level authentication and the as sysdba tells sqlplus that you want to gain access to the Oracle server with the sysdba privileges. If we were to rewrite the previous example using this annotation here’s what it would look like:

You Might Also Like