Skip Headers
Oracle® Database 2 Day DBA
11g Release 1 (11.1)

Part Number B28301-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

About SQL and SQL-Based Management Tools

Many of the operations performed by Oracle Enterprise Manager Database Control (Database Control) use structured query language (SQL) statements. SQL (pronounced like sequel) is an industry-standard English-like computer programming language for querying and updating databases.

The following is an example of a SQL query that lists information about countries in a countries table, which is owned by user hr:

SELECT COUNTRY_ID, COUNTRY_NAME FROM HR.COUNTRIES;

SQL is a powerful language that can also be used to perform a variety of database administration tasks. The following SQL statement creates the database user nick and assigns him the password firesign:

CREATE USER nick IDENTIFIED BY firesign;

When performing an administrative task in Database Control, you can click Show SQL to see the SQL statements being issued.

In addition to using the graphical management pages presented in Database Control, you can use other Oracle tools such as SQL Developer and SQL*Plus to issue SQL statements. These tools enable you to perform database management operations, and to query, insert, update, or delete data directly in the database.

Starting SQL*Plus and Connecting to the Database

SQL*Plus is a command-line program that you use to submit SQL and PL/SQL statements to an Oracle database. You can submit statements interactively or as SQL*Plus scripts. SQL*Plus is installed with the database and is located in your Oracle_home/bin directory.

You can start SQL*Plus from the command line, or on Microsoft Windows, from the Start menu.

To start SQL*Plus and connect to the database from the command line:

  1. Open a command window.

  2. (Linux and UNIX systems only) Set the required environment variables (ORACLE_HOME and ORACLE_SID) by running the script oraenv (for the Bourne, Korn, or Bash shell) or coraenv (for the C shell).

    These scripts are typically located in the /usr/local/bin directory. They may prompt you for the desired value of the ORACLE_SID environment variable. If so, supply the system ID (SID) that you chose when you installed Oracle Database. The default SID that the installer typically suggests is orcl.

  3. (Linux and UNIX systems only) Either ensure that the Oracle_home/bin directory is in your PATH environment variable, or change to the Oracle_home/bin directory.

  4. Enter the following command:

    sqlplus username/password [as sysdba]
    

    For username, you can use the SYS or SYSTEM administrative users and the password that you set up during installation. If you use the SYS user, you must include as sysdba in the command line.

    SQL*Plus starts and connects you to the default database instance (Microsoft Windows) or the database instance specified by the environment variables (Linux and UNIX systems).

To start SQL*Plus and connect to the database from the Start menu (Microsoft Windows):

  1. Click Start.

  2. From the Start menu, select Programs (or All Programs), then select Oracle_home, and then select Application Development.

  3. Select SQL*Plus.

  4. Enter values in the User Name and Password fields for the account you want to use to connect to the database. Then click OK.

    For the user name, you can use the SYS or SYSTEM administrative account, and you can use the password that you set up during installation. If you use the SYS account, enter the password in the Password field, then a space, and then the SQL clause as sysdba.

    When SQL*Plus loads, it issues the SQL prompt, which looks like this:

    SQL>
    
  5. At the SQL prompt, you can enter statements that perform administrative tasks such as shutting down the database or creating a new user, or you can query, insert, update, and delete data.

    You can enter a single SQL statement on multiple lines. You must end each statement with a semicolon (;).

About SQL Developer

SQL Developer is a graphical user interface for accessing your instance of Oracle Database. SQL Developer supports development in both the SQL and PL/SQL languages. It is available in the default installation of Oracle Database.

With SQL Developer, you can browse database objects, run SQL statements and SQL scripts, and edit and debug PL/SQL statements. You can also run any number of provided reports, as well as create and save your own.