Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Programming PL SQL.doc
Скачиваний:
3
Добавлен:
01.07.2025
Размер:
5.06 Mб
Скачать

Figure 2-1. Sql*Plus in a console session

Usually, I prefer the console program because:

  • It tends to draw the screen faster, which can be significant for long queries

  • It has more complete command-line history (on Microsoft Windows platforms, at least)

  • It has a much easier way of changing visual characteristics such as font, color, and scroll buffer size

  • I'm just an old command-line guy anyway

That said, I am also rather fond of the way iSQL*Plus automatically formats query output into HTML tables. It's really useful when you're trying to display a lot of columns from the database; you'll see an example in the later section, Section 2.1.2.

2.1.1 Starting Up sql*Plus

To start the console version of SQL*Plus, you can simply type "sqlplus" at the operating system prompt (designated by "OS>").

OS> sqlplus

This works for both Unix-based and Microsoft operating systems. SQL*Plus should display a startup banner and then prompt you for a username and password.

SQL*Plus: Release 9.2.0.1.0 - Production on Thu Jun 20 10:41:17 2002

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Enter user-name: bob

Enter password: swordfish

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.1.0 - Production

SQL>

Seeing the "SQL>" prompt is your cue that your installation is set up properly. (The password, "swordfish" in this case, won't echo on the screen.)

You can also launch SQL*Plus with the username and password on the command line:

OS> sqlplus bob/swordfish

I do not recommend this, because some operating systems provide a way for other users to see your command-line arguments, which would allow them to break into your account.

You can use the /NOLOG option to start up SQL*Plus without connecting to the database, and supply the username and password via the CONNECT command.

OS> sqlplus /nolog

SQL*Plus: Release 9.2.0.1.0 - Production on Thu Jun 20 10:42:22 2002

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> CONNECT bob/swordfish

SQL> Connected.

If the computer where you're running SQL*Plus also has a properly configured Oracle Net[2] installation, and you have been authorized by the database administrator to connect to remote databases (that is, database servers running on other computers), you will be able to connect to these other databases from SQL*Plus.

[2] Oracle Net is the current name for the product previously known as Net8 or SQL*Net.

This requires knowing something called an Oracle Net connect identifier (also known as a service name) that you must supply along with your username and password. A connect identifier could look like this:

test01.ariel.datacraft.com

To use this identifier, you can append it to your username and password, separated by an at-sign (@) symbol:

SQL> CONNECT bob/swordfish@test01.ariel.datacraft.com

SQL> Connected.

When starting the pseudo-GUI version of SQL*Plus, supplying your credentials is straightforward, although it calls the connect identifier a "Host String" (see Figure 2-2). If you want to connect to a database server running on the local machine, just leave the "Host String" field blank.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]