Less04 Instance TB3
Less04 Instance TB3
Objectives
After completing this lesson, you should be able to do the following: Start and stop the Oracle database and components Use Enterprise Manager (EM) Access a database with SQL*Plus and iSQL*Plus Modify database initialization parameters Describe the stages of database startup Describe the database shutdown options View the alert log Access dynamic performance views
4-2
Management Framework
The three components of the Oracle Database 10g management framework are: Database instance Listener Management interface
> Components SQL*Plus Init Params DB Startup DB Shutdown Alert Log Perf Views
-or-
Listener
$ emctl stop dbconsole TZ set to US/Pacific Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved. http://edrsr9p1.us.oracle.com:1158/em/console/aboutApplication Stopping Oracle Enterprise Manager 10g Database Control ... ... Stopped.
4-4
4-5
4-6
Property pages
4-7
SQL*Plus and iSQL*Plus provide additional interfaces to your database to: Perform database management operations Execute SQL commands to query, insert, update, and delete data in your database
Components > SQL*Plus Init Params DB Startup DB Shutdown Alert Log Perf Views
4-8
Using iSQL*Plus
1
4-9
4-10
Using SQL*Plus
SQL*Plus is: A command-line tool Used interactively or in batch mode
$ sqlplus hr/hr SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 25 12:37:21 2005 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> select last_name from employees; LAST_NAME ------------------------Abel Ande Atkinson
4-12
Output
4-13
Output
$ sqlplus hr/hr @script.sql SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 25 12:57:02 2005 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID ------------- ------------------------------ ---------- ----------60 IT 103 1400 Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options $
4-14
Components SQL*Plus > Init Params DB Startup DB Shutdown Alert Log Perf Views
spfileorcl.ora
4-15
Basic
Advanced
4-16
4-18
Components SQL*Plus Init Params > DB Startup DB Shutdown Alert Log Perf Views
or
4-19
4-20
NOMOUNT
Instance started
SHUTDOWN
4-21
NOMOUNT
Instance started
SHUTDOWN
4-22
NOMOUNT
Instance started
SHUTDOWN
4-23
Components SQL*Plus Init Params DB Startup > DB Shutdown Alert Log Perf Views
4-24
Shutdown Modes
Shutdown Mode Allows new connections Waits until current sessions end Waits until current transactions end A No No No I No No No T No No Yes N No Yes Yes
No
Yes Yes
Yes
SHUTDOWN Options
On the way down: Uncommitted changes rolled back, for IMMEDIATE Database buffer cache written to data files Resources released
During SHUTDOWN NORMAL or SHUTDOWN TRANSACTIONAL or SHUTDOWN IMMEDIATE
SHUTDOWN Options
On the way down: Modified buffers not written to data files Uncommitted changes not rolled back On the way up: Online redo SHUTDOWN ABORT log files used or to reapply Instance failure changes or STARTUP FORCE Undo segments used to roll back uncommitted changes Resources Inconsistent database released (dirty database)
During
4-28
4-29
Database Home page > Related Links region > Alert Log Content
Components SQL*Plus Init Params DB Startup DB Shutdown > Alert Log Perf Views
4-30
4-31
Components SQL*Plus Init Params DB Startup DB Shutdown Alert Log > Perf Views
Session data Wait events Memory allocations Running SQL UNDO usage Open cursors Redo log usage And so on
Oracle instance
4-32
SQL> SELECT sql_text, executions FROM v$sql WHERE cpu_time > 200000;
SQL> SELECT * FROM v$session WHERE machine = 'EDRSR9P1' and logon_time > SYSDATE - 1;
4-33
You can query V$FIXED_TABLE to see all the view names. These views are often referred to as v-dollar views. Read consistency is not guaranteed on these views because the data is dynamic.
4-34
Summary
In this lesson, you should have learned how to: Start and stop the Oracle database and components Use Enterprise Manager and describe its highlevel functionality Access a database with SQL*Plus and iSQL*Plus Modify database initialization parameters Describe the stages of database startup Describe the database shutdown options View the alert log Access dynamic performance views
4-35
4-36