Oracle 11g – SQL*Plus Command Line Options

Had a small typo and ended up with the command line options for Oracle 11g SQL*Plus.

Always handy to know…

C:\] sqlplus -H
 
SQL*Plus: Release 11.1.0.4.0 - Beta on Thu Jun 28 14:44:32 2007
 
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
 
 
SQL*Plus: Release 11.1.0.4.0 - Beta
 
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
 
Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements.
 
Usage 1: sqlplus -H | -V
 
    -H             Displays the SQL*Plus version and the
                   usage help.
    -V             Displays the SQL*Plus version.
 
Usage 2: sqlplus [ [[option]] [[logon]] [[start]] ]
 
  [option] is: [-C [version]] [-L] [-M "[options]"] [-R [level]] [-S]
 
    -C [version]   Sets the compatibility of affected commands to the
                   version specified by [version].  The version has
                   the form "x.y[.z]".  For example, -C 10.2.0
    -F             Enables the failover mode for a RAC environment.
    -L             Attempts to log on just once, instead of
                   reprompting on error.
    -M "[options]" Sets automatic HTML markup of output.  The options
                   have the form:
                   HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
                   [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] 
                    {ON|OFF}]
    -R [level]     Sets restricted mode to disable SQL*Plus commands
                   that interact with the file system.  The level can
                   be 1, 2 or 3.  The most restrictive is -R 3 which
                   disables all user commands interacting with the
                   file system.
    -S             Sets silent mode which suppresses the display of
                   the SQL*Plus banner, prompts, and echoing of
                   commands.
 
  [logon] is: ([username][/[password]][@[connect_identifier]] | /)
              [AS SYSDBA | AS SYSOPER | AS SYSASM] | /NOLOG | 
              [EDITION=value]
 
    Specifies the database account username, password and connect
    identifier for the database connection.  Without a connect
    identifier, SQL*Plus connects to the default database.
 
    The AS SYSDBA, AS SYSOPER and AS SYSASM  options are database
    administration privileges.
 
    [connect_identifier] can be in the form of Net Service Name
    or Easy Connect.
 
      @[[net_service_name] | [//]Host[:Port]/[service_name]]
 
        [net_service_name] is a simple name for a service that 
        resolves to a connect descriptor.
 
        Example: Connect to database using Net Service Name and the
                 database net service name is ORCL.
 
           sqlplus myusername/mypassword@ORCL
 
        Host specifies the host name or IP address of the database
        server computer.
 
        Port specifies the listening port on the database server.
 
        [service_name] specifies the service name of the database you
        want to access.
 
        Example: Connect to database using Easy Connect and the
                 Service name is ORCL.
 
           sqlplus myusername/mypassword@Host/ORCL
 
    The /NOLOG option starts SQL*Plus without connecting to a
    database.
 
    The EDITION specifies the value for Application
    Edition
 
  [start] is: @[URL]|[filename][.[ext]] [[parameter] ...]
 
    Runs the specified SQL*Plus script from a web server (URL) or the
    local file system (filename.ext) with specified parameters that
    will be assigned to substitution variables in the script.
 
When SQL*Plus starts, and after CONNECT commands, the site profile
(e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile
(e.g. login.sql in the working directory) are run.  The files may
contain SQL*Plus commands.
 
Refer to the SQL*Plus User's Guide and Reference for more information

M.

Disclaimer

The information demonstrated and shared here is based on Oracle beta software. The following is intended to outline Oracle’s general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Written by:

8 Comments

  1. parag
    6/26/2009

    it’s ok
    but when i enter username only and enter
    it display password now i enter password and press enter. it display scott account is locked.

    in another case specially in connection with vb.net it show tsn could not resolve connect identifier.

  2. hilmi
    7/6/2010

    who sintax, connect oracle11g connect in php?

  3. ravi
    11/22/2010

    when i use user name and pass word ass scott and tiger

    error: account is locked
    is there any solution for this

    • 11/26/2010

      Eh…? I guess you have found the solution by now. aka. alter user …. account unlock.

    • Dileep
      2/18/2012

      It works when u work as sysdba try this

      sqlplus / as sysdba

      alter user scott identified by tiger account unlock;

  4. star
    1/17/2012

    How do I view output in sqlplus 11g.

    • 1/18/2012

      You can do this for example via the SPOOL command, which spools your output to file or via TERM(inal) on/of commands or by setting a different editor tot make your SQLPlus client. If you use SHOW ALL in SQL*Plus, you will get an overview of all primary command statements.

      If you created a file output on disk via the SPOOL command, you can use, for example, “HOST CAT /tmp/myoutput.lis” or equivalent to see the generated output in SQL*Plus on Linux or UNIX (Windows would be something like “HOST type c:\temp\myoutput.lis”)

  5. Dileep
    2/18/2012

    U can try the below command

    set serveroutput on;

Comments are closed.