|
Home >> FAQs/Tutorials >> Oracle DBA FAQ
Oracle DBA FAQ - Introduction to Command-Line SQL*Plus Client Tool
By: FYIcenter.com
Part:
1
2
3
4
5
6
7
8
9
(Continued from previous part...)
How Run SQL*Plus Commands That Are Stored in a Local File?
If you have a group of commands that you need to run them repeatedly every day,
you can save those commands in a file (called SQL script file), and using the "@fileName" command
to run them in SQL*Plus. If you want to try this, create a file called \temp\input.sql with:
SELECT 'Welcome to' FROM DUAL;
SELECT 'FYIcenter.com!' FROM DUAL;
Then run the "@" command in SQL*Plus as:
SQL> connect HR/retneciyf
SQL> @\temp\input.sql
'WELCOMETO
----------
Welcome to
'FYICENTER.COM
--------------
FYIcenter.com!
How To Use SQL*Plus Built-in Timers?
If you don't have a stopwatch/timer and want to measure elapsed periods of time,
you can SQL*Plus Built-in Timers with the following commands:
- TIMING - Displays number of timers.
- TIMING START [name] - Starts a new timer with or without a name.
- TIMING SHOW [name] - Shows the current time of the named or not-named timer.
- TIMING STOP [name] - Stops the named or not-named timer.
The following tutorial exercise shows you a good example of using SQL*Plus built-in timers:
SQL> TIMING START timer_1
(some seconds later)
SQL> TIMING START timer_2
(some seconds later)
SQL> TIMING START timer_3
(some seconds later)
SQL> TIMING SHOW timer_1
timing for: timer_2
Elapsed: 00:00:19.43
(some seconds later)
SQL> TIMING STOP timer_2
timing for: timer_2
Elapsed: 00:00:36.32
SQL> TIMING
2 timing elements in use
What Is Oracle Server Autotrace?
Autotrace is Oracle server feature that generates two statement execution reports very
useful for performance tuning:
- Statement execution path - Shows you the execution loop logic of a DML statement.
- Statement execution statistics - Shows you various execution statistics of a DML statement.
To turn on the autotrace feature, the Oracle server DBA need to:
- Create a special table called PLAN_TABLE.
- Create a special security role called PLUSTRACE.
- Grant PLUSTRACE role your user account.
(Continued on next part...)
Part:
1
2
3
4
5
6
7
8
9
|