Logging into SQL*Plus from the Command Line
If you prefer to use a command line environment, or if that is your only option, you can start up SQL*Plus in the command line mode.
On Windows, start up a command line window (MS-DOS prompt). On UNIX, start up a terminal window or get to the dollar($) prompt. Then follow these steps:
- Type
sqlplus
and press Enter. SQL*Plus starts up and prompts you for a valid username:
Enter user-name: PETSTORE
- Type a username and press Enter. The username for the sample user in this course is
PETSTORE
. If you do not know a username, use the default username, SCOTT
. SQL*Plus prompts you for a password:
Enter password:
- Type the password for the username that you typed and press Enter. The default username
SCOTT
has the password TIGER
. The password for the sample user in this course is GREATPETS
.
You will not see the password when you type it on the screen. SQL*Plus logs you into the database and signals that it is ready to accept your commands by displaying the SQL prompt:
SQL>
- Type in one or more lines of a query (or other SQL command). When done, press Enter until you see the
SQL>
prompt.
SQL> SELECT TABLE_NAME 2 FROM USER_TABLES 3 ORDER BY TABLE_NAME 4 SQL>
- Type a forward slash (/) and press Enter to execute the query.
SQL> / SQL*Plus executes the query and displays the results on the screen. Then another prompt is displayed signaling that SQL*Plus is ready for more input. TABLE_NAME ------------------------------ CUSTOMER CUSTOMER_SALE
PET_CARE_LOG PRODUCT SALE_ITEM SQL>
-
To exit, type EXIT and press Enter. SQL*Plus closes and returns you to your operating system.
SQL> EXIT