In this third part of a five-part series on Oracle Database XE administration, you will learn about initialization parameters and how to connect to the database. This article is excerpted from chapter 28 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 1590597702).
Now that you know the architecture of an Oracle database, your next task is to learn how to connect to the database. We’ll start with the command-line tool that has been around almost as long as the Oracle database itself: SQL*Plus. The Plus part of SQL*Plus defines the extra functionality beyond running a SQL statement and returning the results. Here are a few of the capabilities of SQL*Plus:
Define headers and footers for text-based reports
Rename columns for report output
Prompt users for a variable substitution when they run a script
Save query results to a file
Copy tables between databases using a single command
Retrieve column names from a table
Most of these SQL*Plus functions have long since been replaced by more elegant methods, as you will see throughout this chapter and the rest of the book. However, you never know when you might have to run a legacy SQL*Plus script that has not yet been rewritten for Oracle Database XE using Application Express.
We cover the other Oracle command-line and GUI utilities later in this chapter in the sections titled “Running SQL Commands Using the XE Home Page” and “Using Oracle-Supplied Utilities.” In this section, we show you how to run SQL*Plus from the command line in Linux and Windows as well as how to run SQL queries from the SQL Commands function accessible via the Oracle Database XE home page.
Since the SQL Commands functionality, available via the Oracle Database XE home page, automatically formats your SQL command output for a Web page, very few of the functions found in the SQL*Plus text-based tool remain in the SQL Commands tool. For example, you can still use theDESCRIBEcommand on a table (to display the columns and datatypes of a table), but you no longer have header and footer commands. For those situations where you want more precise control of your SQL output in a Web form, you use the Application Builder function from the Oracle Database XE home page.
Running SQL*Plus from the Command Line
Using SQL*Plus from the command line is slightly different depending on whether you’re using Linux or Windows. On Linux, you must define some environment variables using a login script or running a predefined script provided with your Oracle Database XE installation. In addition, we show you a couple different ways to start SQL*Plus in both the Linux and Windows environments.
Please check back next week for the fourth part of the series.