Oracle Enterprise Manager Administrator's Guide | ![]() Library |
![]() Product |
![]() Contents |
![]() Index |
Starting a SQL Worksheet
You can start a SQL Worksheet from the Enterprise Manager Console window by choosing SQL Worksheet from the Tools menu. The new worksheet is connected to the database you have selected in the Navigator tree list or in the Map window.
If you connect as INTERNAL to a database that is currently shut down, the following error message appears in the SQL Worksheet output pane upon startup: Cannot obtain ORACLE version number. This message is caused by a minor system interface discrepancy and will not affect SQL Worksheet operation or the database connection. Using the SQL Worksheet
A SQL Worksheet window consists of the following elements:
Output Pane
Input Pane
Split Bar
Output Pane Toolbar
Input Pane Toolbar
Creates a new worksheet.
Imports the contents of an existing SQL script.
Saves the contents of the input pane to a file
Executes the command in the input pane. See Executing Commands in the SQL Worksheet on page 13-6 for information about executing commands in a SQL Worksheet.
Displays the Command History dialog box, which displays previously executed commands. See Using the Command History on page 13-9 for information about using the command history.
File Menu
The File menu items are described below:
Displays the Connect dialog box to connect to an instance. To connect to multiple databases concurrently, you need to launch the application multiple times from the console.
Clears the contents of the input pane. You are prompted to save your existing work.
Displays the Open Worksheet dialog box to allows you to open an existing .SQL or ascii text file. The contents of the file appear in the input pane.
Saves the contents of the input pane to the current file.
Saves the contents of the input pane to a file other than the one that is currently open.
Prints the contents of the input pane.
Saves the contents of the output pane to a file.
Prints the contents of the output pane.
Displays the Print Setup dialog box allowing you to set print parameters and choose a local printer.
Quits the SQL Worksheet. Edit Menu
The Edit menu items are described below:
Cuts selected text.
Copies selected text.
Pastes selected text at the location of the cursor.
Selects all the text in a document or selects all objects in a list.
Clears all text in a window pane. Worksheet Menu
The Worksheet menu items are described below:
Executes the commands in the input pane. Equivalent to the Execute button or the Enter key.
Run Script
Allows you to select and execute a script. See Running Scripts from the SQL Worksheet on page 13-13 for information about running scripts from a SQL Worksheet.
Spool
Writes output to a specified file. See Saving Your Work on page 13-12 for information about spooling the output of a SQL Worksheet.
Command History
Displays the Command History dialog box, which displays previously executed commands. Equivalent to the Command History button. See Using the Command History on page 13-9 for information about using the command history.
Previous Command
Retrieves the previous command from the command history and enters it in the input pane. The retrieved command replaces the entire contents of the input pane.
Retrieves the next command from the command history and enters it in the input pane. The retrieved command replaces the entire contents of the input pane.
Use the keyboard shortcuts to quickly access and execute commands from the command history. Executing Commands in the SQL Worksheet
Enterprise Manager executes commands you have entered in the input pane of a SQL Worksheet. Entering Commands in the Input Pane
You can enter SQL, PL/SQL, and Server Manager DBA commands in the input pane of a SQL Worksheet. A command entered in the input pane can contain tabs or carriage returns. Executing Commands in the Input Pane
To execute the command you have entered in the input pane, click the Execute icon in the input pane toolbar. You can also execute the command by choosing Execute from the Worksheet menu.
The following figure illustrates executing a SQL statement in a worksheet.
Figure 13-2: Executing a Command in the SQL Worksheet
After you execute a command, the command remains in the input pane, but is selected, as shown in Figure 13-2: Executing a Command in the SQL Worksheet. You can then type in the next command, and it replaces the previous command.
Executing Server Manager DBA Commands
In a SQL Worksheet you can execute the Server Manager DBA commands described in Appendix B, DBA Command Reference. Some of these commands behave differently when executed in a SQL Worksheet than when executed in line mode. These commands are summarized below:
CONNECT
Displays the Connect dialog box when you issue the CONNECT command without specifying complete connect information. For information about connecting to an instance of a database, see Connecting to an Instance on page 1-17.
RECOVER
If recovery is needed, displays the Recover dialog box when you issue the RECOVER command without arguments. Otherwise, an error message is generated.
Closes the worksheet.
The line mode command HOST is not available in the SQL Worksheet. Connecting from a Worksheet
When you start a SQL Worksheet from the Enterprise Manager console, you are automatically connected to the same database as the console. You can change this connection by issuing the CONNECT command from the input pane of the worksheet. The title of the SQL Worksheet window also changes to reflect your new connection.
Performing Recovery from the SQL Worksheet
When you issue the RECOVER command from a SQL Worksheet, the Recovery dialog box appears, if recovery is needed. The following figure illustrates the Recovery dialog box.
Figure 13-3: Recovery Dialog Box
From the Recovery dialog box, you can apply the next log file, apply all the log files, or cancel recovery. You can specify the name of the log file to apply or apply the default. Using the Command History
A SQL Worksheet maintains a history of the last 20 command executions you have issued in that worksheet. To bring up the Command History dialog box, click Command History or choose Command History from the Worksheet menu.
Command executions larger than 50K are not recorded in the Command History.
Figure 13-4: Command History Dialog Box
The Command History dialog box is described below:
Displays an abbreviated list of the last 20 command exectutions. Explicit SQL commands associated with each command execution are displayed in the Command Text pane.
Displays all SQL commands associated with the selected entry in the Command List.
Closes the dialog box without retrieving any text.
Retrieves the selected item in the Command List command. See Retrieving a Selection from the Command History on page 13-11 for more information about retrieving commands.
Help
Displays help information for the Command History dialog box. Retrieving a Selection from the Command History
To retrieve a command from the Command History dialog box, select the desired command execution entry in the Command List. All SQL commands associated with this entry are displayed in the Command Text pane. Click Get. The contents of the Command Text pane appear in the input pane replacing any existing text. Retrieving a Command Using the Worksheet Menu
You can also retrieve command executions without using the Command History dialog box. The Previous Command and Next Command menu items and input toolbar icons retrieve commands from the command history and enter them in the input pane, completely replacing the existing contents of the input pane. For more information on the Previous Command and Next Command menu items, see Worksheet Menu on page 13-5.
Saving Your Work
The Spool menu item, Save Output As icon, and Save Worksheet As icon allow you to save the work you have performed in a SQL Worksheet. Each of these Worksheet menu commands displays the standard file selection dialog box, which you can use to specify the file in which to save your work.
The SQL Worksheet appends a file extension, such as .log or .txt, to the name of each file created by the Spool, Save Output As, and Save Worksheet As commands. Running Scripts from the SQL Worksheet
From a SQL Worksheet, you can run any script that contains SQL, PL/SQL, or Server Manager DBA commands. There are four ways to run scripts from a SQL Worksheet:
Selecting the Run Script menu item also displays the Run Script dialog box. Select the desired script and click OK. The Server Manager DBA @ command appears with the full path and filename of the selected script in the input pane. The script is run automatically.
To drag and drop scripts from the Windows file manager, select the desired script in the file manager and drop it into the input pane. The content of the script appears in the input pane. Click the Execute icon to run the script.
You can also run a script from the input pane of a worksheet by entering an @ command followed by the script name. The following figure illustrates running a script from the input pane of a worksheet.
Note:
![]() ![]() Prev Next |
![]() Copyright © 1996 Oracle Corporation. All Rights Reserved. |
![]() Library |
![]() Product |
![]() Contents |
![]() Index |