You are on page 1of 40

Managing the Oracle Instance

Copyright © 2005, Oracle. All rights reserved.

4-2
shut down an Oracle Database 10g
instance
– Compare automatic and manual memory
management of the Shared Global Area (SGA)
Object
• Access the data dictionary
• Access databases with SQL*Plus and iSQL*Plus
ives
Copyright © 2005, Oracle. All rights reserved.

After
completing
this lesson,
you should
be able to do
the
following:

Administer
two
databases
by using
Enterprise
Manage
r
– Oracle Database 10g: Administration Workshop I 4-2

Modify
initializa
tion
paramet
ers
– Start
and stop
the
Oracle
listener
– Start
up and
Management Framework

The three components of the Oracle Database 10g


management framework are:
• Database instance
• Listener
• Management interface
– Database Control
– Management agent (when using Grid Control)

Management
-or-
agent
Database Listener
Control
Management interface

4-3 Copyright © 2005, Oracle. All rights reserved.

Management-cadru
Există trei componente majore ale bazei de date Oracle 10 g cadru de management:
•      Baza de date şi exemplu fiind gestionate
•      Un ascultător care permite conexiuni la baza de date
•      interfata de management. Aceasta poate fi fie un agent de management de conectare
acest server pentru a Oracle Enterprise Manager Grid Control sau Oracle stand-alone
Enterprise Manager Control baza de date.
Fiecare dintre aceste componente trebuie să fie în mod explicit a început înainte de a putea utiliza
serviciile de
componenta şi trebuie să fie închis curat atunci când închiderea server hosting
Oracle Database 10 g .
Prima componentă a fi început este interfaţa de gestionare. După ce acest serviciu este activat,
interfaţa de management poate fi folosit pentru a porni alte componente.

Oracle Database 10g: Administration Workshop I 4-3


Starting and Stopping Database Control

$ emctl start dbconsole


TZ set to US/Pacific
Oracle Enterprise Manager 10g Database Control Release 10.1.0.2.0
Copyright (c) 1996, 2004 Oracle Corporation. All rights reserved.
http://edrsr30p1.us.oracle.com:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control
...................... started.
------------------------------------------------------------------
Logs are generated in directory
/u01/app/oracle/product/10.1.0/db_1/edrsr30p1.us.oracle.com_orcl/s
ysman/log

$ emctl stop dbconsole


TZ set to US/Pacific
Oracle Enterprise Manager 10g Database Control Release 10.1.0.2.0
Copyright (c) 1996, 2004 Oracle Corporation. All rights reserved.
http://edrsr30p1.us.oracle.com:5500/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
... Stopped.

4-4 Copyright © 2005, Oracle. All rights reserved.

Starting and Stopping Database Control


Oracle provides a stand-alone management console called Database Control for
databases that are not connected to the Grid Control framework. Each database
managed with Database Control has a separate Database Control installation, and from
any one Database Control you can manage only one database. Database Control
requires that a dbconsole process be started before use. To start the dbconsole
process:
emctl start dbconsole
To stop the dbconsole process:
emctl stop dbconsole
To view the status of the dbconsole process:
emctl status dbconsole
Note: You may need to navigate to your $ORACLE_HOME/bin directory if this
directory is not in your OS path.
Database Control uses a server-side agent process. This agent process automatically
starts and stops when the dbconsole process is started or stopped.

Oracle Database 10g: Administration Workshop I 4-4


Accessing Oracle Enterprise Manager

TBD:
Update port
number in
notes for
second db

4-5 Copyright © 2005, Oracle. All rights reserved.

Accessing Oracle Enterprise Manager


Open your Web browser and enter the following URL:
http://hostname:portnumber/em
Dacă baza de date este de până, Enterprise Manager afişează pagina de date de control Login.
Log on la baza de date prin utilizarea unui nume de utilizator care este autorizat să acceseze baza de date
Control. Iniţial, aceasta este SYS , SYSMAN , sau SISTEM . Utilizaţi parola pe care ai specificat
pentru contul în timpul instalării bazei de date. În Connect Ca opţiune, selectaţi fie
SYSDBA sau SYSOPER să vă conectaţi la baza de date cu administrarea bazelor de date speciale
privilegii.
Dacă baza de date este în jos şi trebuie să fie pornite, Enterprise Manager afişează
Pornire / oprire şi de recuperare Perform pagina. Dacă aceasta este cazul, faceţi clic pe
Pornire / oprire buton. Vi se cere apoi pentru gazdă şi autentificare ţintă de baze de date
nume de utilizator şi parole, pe care trebuie să introduceţi. În clasă, utilizarea sistemului de operare
utilizatorul Oracle . Pentru
baza de date de utilizator şi parola, utilizarea SYS şi parola aţi specificat în timpul
de instalare. Faceţi clic pe OK pentru a porni baza de date. Pe pagina de confirmare, faceţi clic pe YES
pentru a
începe baza de date în modul deschis.
Notă: URL-ul foloseste portul implicit numărul de non-5501, deoarece, în clasă, acest lucru este dvs.
două baze de date.
Nota 2: Dacă aveţi probleme de pornire Enterprise Manager, asigură că un ascultător este pornit.
Database Home Page

Property pages

4-6

Database Home Page

Copyright © 2005, Oracle. All rights reserved.

Pagina de Home Baza de date afişează starea curentă a bazei de date prin afişarea unui
serie de indicatori care să ilustreze starea generala de sanatate a bazei de date. Cu paginile de proprietate,
puteţi accesa de performanţă, administraţia şi întreţinere de pagini pentru gestionarea
baza de date.
Puteţi vizualiza performanţa şi următoarele informaţii despre starea bazei de date
exemplu pe pagina Home Baza de date:
•      Instanţă numele, versiunea bazei de date, Oracle Principala locaţie, mass-media opţiunile de
recuperare, şi alte date pertinente exemplu
•      curent exemplu disponibilitatea
•      alerte remarcabile
•      Sesiunea şi informaţii legate de performanţă-SQL
•      cheie de utilizare spaţiu metrici
•      -jos link-uri Drill (de exemplu, LISTENER_ < host_name > ), care asigură
creşterea nivelului de detaliu

Oracle Database 10g: Administration Workshop I 4-6


Starting and Stopping the Listener

4-7

Copyright © 2005, Oracle. All rights reserved.

Starting and Stopping the Oracle Listener


Pe de start, initiala Baza de date, faceţi clic pe numele ascultător pentru a deschide pagina de pornire
Listener.
Faceţi clic pe Stop pentru a opri ascultător dacă este în execuţie sau Start pentru a porni ascultătorului în
cazul în care nu este
rulează. Trebuie să vă conectaţi la gazdă ca un utilizator sistem de operare, dacă nu aţi făcut deja acest
lucru.
Acest lucru va fi utilizatorul de operare care porneşte sau opreşte ascultător.
Metoda de linie de comandă pentru pornire, oprire, şi văzând starea de ascultător este:
lsnrctl START [ listener_name ]
lsnrctl STOP [ listener_name ]
lsnrctl STATUS [ listener_name ]
în cazul în care listener_name este numele ascultătorului definite în listener.ora
fişier. Nu este necesar să se identifice ascultatorul dacă utilizaţi ascultătorului implicit numit
Ascultător .
The STATUS Comanda oferă informaţii de bază despre starea unui ascultător, inclusiv o
rezumat de setări de configurare ascultător, adresele ascultare protocol, precum şi o
rezumat de servicii înregistrate cu ascultatorul.
Oracle Database 10g: Administration Workshop I 4-7
Startup and Shutdown

4-8

Copyright © 2005, Oracle. All rights reserved.

Pornire şi de închidere, prin utilizarea Enterprise Manager


Când faceţi clic fie pornire sau de închidere, este posibil să vi se solicite acreditările de care
sunt folosite pentru logare pe atât gazdă (calculatorul pe care baza de date are reşedinţa)
şi baza de date în sine.
Aveţi posibilitatea să faceţi clic pe Opţiuni complexe pentru a modifica orice opţiuni de pornire sau
oprire modul cum este necesar. De asemenea, aveţi posibilitatea să faceţi clic pe Afişare SQL pentru a
vedea declaraţiile SQL care sunt utilizate
pentru pornire sau oprire.

Oracle Database 10g: Administration Workshop I 4-8


Starting Up an Oracle DB Instance:
NOMOUNT

OPEN
STARTUP

MOUNT

NOMOUNT

Instance
started
4-9 SHUTDOWN

Copyright © 2005, Oracle. All rights reserved.

Pornirea unei instanţe Oracle DB: NOMOUNT


La pornirea instanţă baza de date, selectaţi starea în care se începe.
Scenariile următoare descriu diferite stadii de a începe un exemplu.
Pornind de Primă Instanţă ( NOMOUNT )
Un exemplu este început în NOMOUNT etapa numai în timpul creării bazei de date sau re-
crearea de fişiere de control.
Pornind de o instanţă include următoarele sarcini:
•      Citirea fişier de iniţializare de la <oracle_home> / baza de date în
următoarea ordine:
-      În primul rând spfileSID.ora
-      În cazul în care nu a fost găsit, apoi spfile.ora
-      În cazul în care nu a fost găsit, apoi initSID.ora
Specificarea PFILE parametru cu STARTUP suprascrie comportamentul implicit.
•      Alocarea SGA
•      Începând cu fundal procese
•      Deschiderea alertSID.log fişier şi urmelor de fişiere
Oracle Database 10g: Administration Workshop I 4-9
Starting Up an Oracle DB Instance:
MOUNT

OPEN
STARTUP

MOUNT
Control file
opened for this
NOMOUNT instance

Instance
started
SHUTDOWN
SHUTDOWN

4-10 Copyright © 2005, Oracle. All rights reserved.

Pornirea unei instanţe Oracle DB: MOUNT


Montarea bazei de date ( MOUNT )
Pentru a efectua operaţiuni specifice de întreţinere, de a începe o instanţă şi montarea unei baze de date
dar nu deschide baza de date.
De exemplu, baza de date trebuie să fie montate, dar nu trebuie să fie deschise în timpul
următoarele sarcini:
•      Redenumirea fişierelor de date (fişiere de date pentru un tablespace offline pot fi redenumite atunci
când
Baza de date este deschisă)
•      Activarea şi dezactivarea online redo log dosar opţiuni de arhivare
•      baza de date completă de recuperare Performing
Montarea unei baze de date cuprinde următoarele sarcini:
•      Asocierea unei baze de date cu un început anterior instanţă
•      Localizarea şi deschiderea fişierelor de control specificat în fişierul de parametru
•      Citirea de control al dosarelor pentru obtinerea numele şi statutul de fişiere de date şi online
redo log fişiere. Cu toate acestea, nu sunt efectuate controale pentru a verifica existenţa
fişierele de date şi fişierele redo log online în acest moment.

Oracle Database 10g: Administration Workshop I 4-10


Starting Up an Oracle DB Instance:
OPEN
OPEN
STARTUP All files opened as
described by the control
MOUNT file for this instance

Control file
opened for this
NOMOUNT instance

Instance
started
SHUTDOWN
SHUTDOWN

4-11 Copyright © 2005, Oracle. All rights reserved.

Starting Up an Oracle DB Instance: OPEN


Deschiderea bazei de date (OPEN)
Funcţionare normală bază de date înseamnă că o instanţă este pornit şi baza de date este montat
şi deschis. Cu operarea bazei de date normal, orice utilizator valid se poate conecta la baza de date
şi de a efectua operaţiuni de date tipice de acces.
Deschiderea bazei de date cuprinde următoarele sarcini:
•      Deschiderea fişierelor de date online
•      Deschiderea redo log fişiere online
Dacă oricare dintre fişiere de date sau fişiere online redo log nu sunt prezente, atunci când încercaţi să
deschideţi baza de date, serverul Oracle returnează o eroare.
În această etapă finală, serverul Oracle verifică toate fişierele de date on-line şi refaceţi
fişierele log pot fi deschise şi verifică consistenţa bazei de date. Dacă este necesar,
SMON proces de fundal exemplu iniţiază de recuperare.
Puteţi începe o instanţă DB în mod restricţionat, astfel că este disponibil pentru utilizatorii cu
privilegii administrative numai. Pentru a porni un exemplu în modul restricţionat, utilizare:
startup restrict

Oracle Database 10g: Administration Workshop I 4-11


Shutting Down an Oracle DB Instance

Shutdown mode A I T N

Allow new connections. No No No No

Wait until current sessions end. No No No Yes

Wait until current transactions end. No No Yes Yes

Force a checkpoint and close files. No Yes Yes Yes

Shutdown mode:
• A = ABORT
• I = IMMEDIATE
• T = TRANSACTIONAL
• N = NORMAL

4-12 Copyright © 2005, Oracle. All rights reserved.

Închiderea unei instanţe DB Oracle

Trebuie să opriţi instanţă DB curat şi în mod constant pentru a face de operare


sistem de backup-offline a tuturor structurilor fizice şi a au modificat statice
parametri de initializare produce efecte din momentul repornit.
Pentru a închide un exemplu, trebuie să vă conectaţi ca SYSOPER sau SYSDBA şi utilizarea
următoarea comandă:
Shutdown [NORMAL | ABORT Tranzactionala | | PRIMAR]
Aceasta este comanda care este generată atunci când faceţi clic Shutdown şi confirma
intenţia de pe pagina următoare.

Oracle Database 10g: Administration Workshop I 4-12


SHUTDOWN Options

On the way down: During On the way up:


• Database • No
buffer cache SHUTDOWN instance
written to NORMAL
recovery
or
the data files SHUTDOWN
• Uncommitted TRANSACTIONAL
changes rolled or
SHUTDOWN
back IMMEDIATE
• Resources
released

4-13

SHUTDOWN Options
Normal este modul implicit de închidere. Normal veniturile închidere bază de date cu
următoarele condiţii:
•      Nu noi conexiuni pot fi făcute.
•      Serverul Oracle asteapta pentru toţi utilizatorii să deconectaţi înainte de a termina
închidere.
•      Baza de date şi refaceţi tampoane sunt scrise pe disc.
•      procesele de fundal sunt oprite şi SGA este eliminată din memorie.
•      Serverul Oracle se închide şi descaleca baza de date înainte de închiderea
instanţă.
•      pornire următoare nu are nevoie de o instanţă de recuperare.
Shutdown Tranzacţională
O închidere tranzacţional previne clienti din pierderea de date, inclusiv rezultatele de la
activitatea lor curentă. Un veniturile tranzactionale închidere bază de date cu următoarele
condiţii:
•      Nici un client poate începe o nouă operaţiune în acest caz particular.
•      Un client este deconectat atunci când clientul se încheie tranzacţia, care este în curs de desfăşurare.

The next startup does not require an instance recovery.Oracle Database 10g:
Administration Workshop I 4-13
SHUTDOWN Options (continued)
SHUTDOWN IMMEDIATE
Imediat încasările închidere bază de date cu următoarele condiţii:
•      curent declaraţii SQL sunt prelucrate de către baza de date Oracle nu sunt finalizate.
•      Serverul Oracle nu aşteptaţi pentru utilizatori, care sunt în prezent conectate la
baze de date, pentru a deconecta.
•      Serverul Oracle rulouri înapoi tranzacţiilor active şi deconectează toţi utilizatorii conectaţi.
•      Serverul Oracle se închide şi descaleca baza de date înainte de închiderea
instanţă.
•      The pornire următoare nu are nevoie de o instanţă de recuperare.
 
 

Oracle Database 10g: Administration Workshop I 4-14


SHUTDOWN Options

On the way down: During On the way up:


• Modified • Online redo
buffers SHUTDOWN ABORT log files used
not written to or to reapply
Instance Failure
the data files or changes
• Uncommitted STARTUP FORCE • Undo
changes not segments
rolled back used to roll
back
uncommitted
changes
• Resources
Inconsistent database released
(dirty database)

4-15 Copyright © 2005, Oracle. All rights reserved.

SHUTDOWN Options (continued)


SHUTDOWN ABORT
În cazul în care NORMAL şi PRIMAR opţiuni shutdown nu funcţionează, puteţi abandona
curent de baze de date exemplu. Abandonează un încasările exemplu, cu următoarele condiţii:
•      curent declaraţii SQL sunt prelucrate de către serverul de Oracle sunt imediat
încheiată.
•      Serverul Oracle nu aşteptaţi pentru utilizatori în prezent, conectat la baza de date a
deconectaţi.
•      Baza de date şi refaceţi tampoane, nu sunt scrise pe disc.
•      tranzacţii neangajate nu sunt rulate înapoi.
•      exemplu este încheiată fără a închide fişierele.
•      Baza de date nu este închis sau demontat.
•      The pornire următoare necesită recuperare exemplu, care are loc în mod automat.
Notă: Nu este recomandabil să susţină o bază de date care este într-o stare inconsistentă.

Oracle Database 10g: Administration Workshop I 4-15


Initialization Parameter Files

SPFILEMTG.ORA

4-16

Copyright © 2005, Oracle. All rights reserved.

Parametru Initializarea Fişiere


Când începe exemplu, un parametru fisier de initializare este citit. Există două tipuri de
parametru de fişiere:
•      fişier Server parametru: Acesta este tipul de fişier preferat parametru de initializare. Ea
este un fişier binar care poate fi scrisă şi citită de serverul de baze de date şi nu trebuie să
fi editat manual . Acesta se află în server Oracle care se executa pe, şi este
persistente în întreaga închidere şi de pornire. Acest lucru este adesea menţionată ca un SPFILE.
•      Text fişier de iniţializare parametru: Acest tip de fişier parametru de initializare poate
fi citit de către serverul de baze de date, dar nu este scris de server.
Setările de iniţializare parametru trebuie să fie stabilite şi modificate manual prin utilizarea unui
text editor, astfel încât acestea sunt persistente peste închidere şi de pornire.
Este recomandat să vă creaţi un fişier parametru server (SPFILE), ca un mijloc dinamic
de a menţine parametrii de initializare. Prin utilizarea unui fişier parametru server, aveţi posibilitatea să
stocaţi şi de a gestiona parametrii de initializare persistent într-un fişier disc server-side.

Oracle Database 10g: Administration Workshop I 4-16


Viewing and Modifying
Initialization Parameters

4-17

Copyright © 2005, Oracle. All rights reserved.

Vizualizarea şi modificarea parametrilor de initializare


Baza de date Oracle oferă mai multi parametri de initializare pentru optimizarea funcţionării sale
în diverse medii. parametrilor de initializare sunt împărţite în două grupe: de bază şi
avansate. În majoritatea cazurilor, este necesar să se stabilească şi ton doar de bază
parametri pentru a obţine performanţe rezonabile. Există 28 de parametri de bază. Numai câteva dintre
acestor parametri trebuie să fie stabilite în mod explicit că valorile implicite sunt adecvate în
marea majoritate a cazurilor.
În situaţii rare, modificarea parametrilor de avansate pot fi necesare pentru optimă
de performanţă. Parametrii avansate sunt păstrate pentru a permite DBAs expert să se adapteze
Comportamentul bazei de date Oracle pentru a satisface cerinţele unice.

Oracle Database 10g: Administration Workshop I 4-17


Quiescing the Database

• The database is put into a partially available state.


• No ongoing non-DBA transactions, queries, or
PL/SQL statements are permitted.
• Maintenance operations can be performed without
forcing a shutdown.
• This state is achieved by blocking new
transactions.

4-18

Copyright © 2005, Oracle. All rights reserved.

Quiescing Baza de date


Cu această caracteristică, puteţi pune sistemul intr-o quiesced de stat, ceea ce înseamnă că non-
tranzacţiile DBA, interogări, sau PL / SQL sunt blocate de la început. Acest
vă permite să efectuaţi următoarele acţiuni care nu pot fi în siguranţă atunci când face
sistemul nu este quiesced:
•      Acţiunile care pot eşua, eventual, dacă există utilizator tranzacţii concurente sau interogări.
De exemplu, o încercare de a schimba schema de un tabel de baze de date poate eşua dacă un
tranzacţie concurente este accesarea acelaşi tabel.
•      Acţiunile ale căror efecte nedorite pot fi văzute de către utilizator tranzacţii concurente sau
interogări. De exemplu, schimba schema de un tabel de baze de date şi actualizează o PL / SQL
Procedura de la o versiune nouă care utilizează această schemă nouă din tabelul bazei de date. Acest
inconsistenţă poate fi văzut de utilizatorii care executa procedura în acelaşi timp.
Fără această funcţie, s-ar putea fi obligat să închidă baza de date şi redeschideţi-l în
modul restricţionat-o restricţie gravă pentru 24 / 7 sisteme. The quiesce Caracteristica de date
vă permite să efectuaţi aceste acţiuni în condiţii de siguranţă, fără a închide baza de date. Când
va executa o comandă pentru a quiesce baza de date, toate tranzacţiile curente de utilizator şi
interogări complet, eliberând lacate si alte resurse, deşi utilizatorii rămân
conectat. Baza de date devine quiesced şi puteţi efectua sarcinile administrative
fără interferenţe.
Notă: În discuţia de quiesced baze de date, un DBA este definită ca utilizatorii SYS şi
SYSTEM. Oracle Database 10g: Administration Workshop I 4-18
Changing the State of the Database

• Placing the database into a quiesced state:

SQL> ALTER SYSTEM QUIESCE RESTRICTED;

• Returning the database to its normal state:

SQL> ALTER SYSTEM UNQUIESCE;

Both of these commands affect all instances with


the database open.

4-
19
Copyright © 2005, Oracle. All rights reserved.

Schimbarea de stat a Bazei de date


The ALTER SYSTEM QUIESCE RESTRICTED comanda pune toate cazurile de
bază de date în quiesced de stat. S-ar putea fi sesiuni de active non-DBA executarea unei
interogare sau de executare o tranzacţie atunci când un ALTER SYSTEM QUIESCE RESTRICTED
comanda este executata. Aceste sesiuni pot continua până când acestea devin inactive (care este,
tranzacţie sau interogarea completează).ALTER SYSTEM QUIESCE
RESTRICŢIONATE revine comanda control numai după ce toate aceste sesiuni devin inactive.
În plus, după ALTER SYSTEM QUIESCE RESTRICTED comanda a fost
executat, orice încercare de a aduce o sesiune inactiv non-DBA la o stare activă de către
a executa o comanda SQL sau începe o nouă interogare în care sesiunea este blocat. În
sesiunea utilizatorului, acesta va apărea ca şi cum comanda este ungur.
Această abordare în două ori asigură că, după ALTER SYSTEM QUIESCE
RESTRICŢIONATE revine comanda control pentru utilizator, sistemul este în stare quiesced
şi administratorul bazei de date este complet izolat de la acţiuni simultane non-DBA.
ALTER SYSTEM UNQUIESCE comanda pune toate cazurile înapoi în modul normal
astfel încât toate acţiunile blocate pot continua.
În cazul în instanţă este oprit în timp ce quiesced, atunci când este pornit din nou, aceasta va fi în
normale de stat.

Oracle Database 10g: Administration Workshop I 4-19


Managing Memory Components

• Automatic Shared Memory Management:


– Is recommended to simplify management
– Enables you to specify the total SGA memory
through one initialization parameter
– Enables the Oracle server to manage the amount of
memory allocated to the shared pool, Java pool,
buffer cache, and the large pool
• Manually setting shared memory management
– Sizes the components through multiple individual
initialization parameters
– Uses the Memory Advisor to make
recommendations
4-20

Copyright © 2005, Oracle. All rights reserved.

Managing Memory Components


The SGA comprises several components. The size of many of these components can be
managed by the Oracle server through the use of the Automatic Shared Memory
Management (ASMM) feature to simplify memory management.
Alternatively, you can manage the size of the components manually by setting other
multiple initialization parameters. If, at a later time, the Oracle server notifies you of a
performance problem that is related to the size of the SGA or PGA, you can use the
Memory Advisor to determine appropriate new settings. The Memory Advisor can
model the effect of parameter changes. You can also specify that the Oracle server
automatically tune the important memory parameters as conditions change. Automatic
tuning is recommended.

Oracle Database 10g: Administration Workshop I 4-20


Enabling Automatic Shared
Memory Management

Click Enable to enable


Automatic Shared
Memory Management.

4-21

Copyright © 2005, Oracle. All rights reserved.

Enabling Automatic Shared Memory Management


If you did not enable this feature when you configured your database, then you can
enable it by performing the following steps:
1. Click Memory Parameters in the Instance region of the Administration page.
2. Click Enable.
The Enable Automatic Shared Memory Management page appears.
3. Specify the total SGA size. Click OK.
You can increase the total SGA size at a later time by increasing the value of the
SGA_TARGET initialization parameter. For more information, refer to the Oracle
Database Administrator’s Guide.

Oracle Database 10g: Administration Workshop I 4-21


Manually Setting Shared
Memory Management

4-22

Copyright © 2005, Oracle. All rights reserved.

Manually Setting Shared Memory Management


If you do not use Automatic Shared Memory Management, you must provide values for
each component of the SGA on installation and database creation.
• Access the Memory Parameters page by clicking the Memory Parameters link in
the Instance region of the Administration page.
• Invoke any of the memory advisors by clicking Advice.
• Click Help to view the online Help for additional information about how the
Memory Advisor works.

Oracle Database 10g: Administration Workshop I 4-22


Viewing the Alert Log

Database Home page > Related Links region > Alert


Log Content

4-
23

Copyright © 2005, Oracle. All rights reserved.

Viewing the Alert Log


Each database has an alert_<sid>.log file. The file is on the server with the
database and is stored in the directory specified with the background_dump_dest
initialization parameter. The alert file of a database is a chronological log of messages
and errors, including the following:
• All internal errors (ORA-600), block corruption errors (ORA-1578), and
deadlock errors (ORA-60) that occurred
• Administrative operations such as: the SQL statements CREATE, ALTER, DROP
DATABASE, TABLESPACE, and ROLLBACK SEGMENT, and the Enterprise
Manager or SQL*Plus statements STARTUP, SHUTDOWN, ARCHIVE LOG, and
RECOVER
• Several messages and errors relating to the functions of shared server and
dispatcher processes
• Errors during the automatic refresh of a materialized view
Enterprise Manager monitors the alert log file and notifies you of critical errors. You
can also view the log to see noncritical error and informative messages. The file can
grow to an unmanageable size. You can occasionally back up the alert file and delete
the current alert file. When the database attempts to write to the alert file again, it re-
creates a new one.
Oracle Database 10g: Administration Workshop I 4-23
Viewing the Alert History

4-24

Copyright © 2005, Oracle. All rights reserved.

Viewing the Alert History


The Alert History page displays a chart that shows the alert history of the current
database in segments of time, which you designate. An alert indicates a potential
problem, either a warning or critical threshold for a monitored metric, or that a target is
no longer available.

Oracle Database 10g: Administration Workshop I 4-24


Using SQL*Plus and iSQL*Plus to
Access Your Database

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

4-
25

Copyright © 2005, Oracle. All rights reserved.

Using SQL*Plus and iSQL*Plus to Access Your Database


In addition to Enterprise Manager, you can use other Oracle tools, such as SQL*Plus
and iSQL*Plus, to issue SQL statements. These tools enable you to perform many of the
database management operations, as well as to select, insert, update, or delete data in
the database.

Oracle Database 10g: Administration Workshop I 4-25


Using iSQL*Plus

4-26

Using iSQL*Plus
Copyright © 2005, Oracle. All rights reserved.

iSQL*Plus is a browser-based interface to an Oracle database. It is a component of the


SQL*Plus product. iSQL*Plus has a server-side listener process that must be started
before you can connect with a browser. To start this server process, use:
isqlplusctl start
After the server process is started, perform the following steps to connect to iSQL*Plus:
1. Connect to the Internet or your intranet, and start your Web browser.
2. Enter your iSQL*Plus URL. The iSQL*Plus URL looks like the following:
http://hostname:port/isqlplus
The port number used by iSQL*Plus is usually 5560 unless the Oracle Universal
Installer (OUI) detects that something is already using that port. Check
$ORACLE_HOME/install/portlist.ini to find the port used by iSQL*Plus.

Oracle Database 10g: Administration Workshop I 4-26


Using iSQL*Plus

4-27

Copyright © 2005, Oracle. All rights reserved.

Using iSQL*Plus (continued)


3. The iSQL*Plus Connection Role page appears. Notice that the SYSOPER and
SYSDBA roles require special setup and authentication for security reasons. Select
Normal and click Continue.
4. The iSQL*Plus Login page appears.
Enter your Oracle username and password in the Username and Password fields.
In class, enter hr as Username and Password, and orcl as Connect Identifier,
and click Login.
5. The iSQL*Plus Workspace page is displayed on your Web browser.

Oracle Database 10g: Administration Workshop I 4-27


Using SQL*Plus

What is SQL*Plus?
• Command-line tool
• Used interactively or in batch mode

4-
28

Copyright © 2005, Oracle. All rights reserved.

Using SQL*Plus
You can use the command-line interface to SQL*Plus to write SQL*Plus, SQL, and
PL/SQL commands to:
• Enter, edit, run store, retrieve, and save SQL commands and PL/SQL blocks
• Format, calculate, store, and print query results
• List column definitions for any table
• Send messages to and accept responses from an end user
• Perform database administration
Perform the following steps to start SQL*Plus:
1. Open a terminal window.
2. At the command-line prompt, enter the SQL*Plus command in the form:
$ sqlplus /nolog
3. Enter connect followed by the user you want to connect as.
4. When prompted, enter the user’s password.
5. SQL*Plus starts and connects to the default database.

Oracle Database 10g: Administration Workshop I 4-28


Data Dictionary: Overview

The data dictionary consists of:


• Static views of objects in the database
• Dynamic views of performance-related data
Per SchUsVieexeles
Tab

ws s
Ind

ers
as
etcnceure
em

Das
ta
ced
Pro
ma
for

4-
29

Copyright © 2005, Oracle. All rights reserved.

The Data Dictionary


Oracle's data dictionary is the description of an instance and database. It contains the
names and attributes of all objects in the database. The creation of modification of any
object causes an update to the data dictionary, to reflect the changes made. This is the
static data dictionary, since it only changes when objects are changed in some way.
The data dictionary also contains dynamic data: information about the database and the
instance that is constantly maintained while the system runs. This includes execution
timing, locking information, status of running jobs, and many other things. There are
approximately 400 of these views.
Note: See Oracle Database Reference 10g Release 2 for the complete list and definition
of each view in the data dictionary.

Oracle Database 10g: Administration Workshop I 4-29


Static Data Dictionary Views

DBA's view of User's view of User's view of


all information granted information own information

DBA_* ALL_* USER_*

4-30 Copyright © 2005, Oracle. All rights reserved.

Static Data Dictionary Views


Access to the metadata about objects in the database is referred to static data dictionary
views. These views document the tables, views, procedures, and users, among many
other things. There are three sets of these views, that filter out different kinds of data.
Views with the DBA_ prefix are an unfiltered look at the metadata. The ALL_ prefixed
views are filtered down a bit, and finally, those views with the USER_ prefix are most
filtered, showing the fewest rows and columns about the database objects.

Oracle Database 10g: Administration Workshop I 4-30


Static Data Dictionary Views

Who can Contents Subset Notes


query of
DBA_ DBA Everything N/A May have additional
columns meant for DBA
use only
ALL_ Everyone Everything DBA_ Includes user's own
user has views objects
privileges to
see
USER_ Everyone Everything ALL_ Usually same as ALL_
user owns views except for missing OWNER
column. Some views have
abbreviated names as
Public synonyms.

4-31 Copyright © 2005, Oracle. All rights reserved.

Data Dictionary Views


The view prefixes make implication of what user can see what data. The global view of
everything is accessed only by users with DBA privileges, using the DBA_ prefix. The
next level of privilege is at the ALL_ prefix level, which represents all objects that the
querying user is privileged to see, whether he owns it or not. For example, if a USER_A
has been granted access to a table owned by USER_B, then USER_A will see that table
listed in any ALL_ view dealing with table names. The USER_ prefix represents the
smallest scope of visibility. This shows only those objects that the querying user owns,
that is, is present in his own schema.
General each view set is a subset of the higher-privileged view set, row-wise and
column-wise. Not all views ina given view set have a corresponding view in the other
view sets. This is dependant on the nature of the information in the view. For example,
there is a DBA_LOCK view, but there is no ALL_LOCK view. This is because only a
DBA would have interest in data about locks.

Oracle Database 10g: Administration Workshop I 4-31


Static Data Dictionary Views:
Purpose and Usage
The Data Dictionary is:
• Used by the Oracle database server to find
information about users, objects, constraints, and
storage
• Maintained by the Oracle database server as Data
Definition Language (DDL) statements are issued
that modify objects.
• Available for use by any user to query information
about the database

4-
32

Copyright © 2005, Oracle. All rights reserved.

Static Data Dictionary Purpose and Usage


The data dictionary views are available for any user to serve the purpose of determining
existence of or attributes of objects. You should be certain to choose the appropriate
view set to meet the need that you have. If you have the privilege to access the DBA
views, you still may want to only query the USER version of the view, because you
know that it is something you own and you don't want other objects being added to your
result set.

Oracle Database 10g: Administration Workshop I 4-32


Static Data Dictionary: Usage Examples
1

SQL> SELECT table_name, tablespace_name FROM


user_tables;
2

SQL> SELECT sequence_name, min_value,


max_value, increment_by FROM all_sequences
WHERE sequence_owner IN ('MDSYS','XDB');
3

SQL> SELECT USERNAME, ACCOUNT_STATUS FROM


dba_users WHERE ACCOUNT_STATUS = 'OPEN';

4-33

Copyright © 2005, Oracle. All rights reserved.

Static Data Dictionary Usage Examples


These examples show queries that answer these questions:
1. What are the names of the tables, along with the tablespace where they reside, that
have been created in my schema?
2. What is the significant information about any sequences in the database that I have
access to.
3. What users in this database are currently able to login?

Oracle Database 10g: Administration Workshop I 4-33


Static Data Dictionary: Considerations

• The views are owned by user SYS


• You should implement Data Dictionary Protection
to ensure only users who are logged in as SYS or
with the role SYSDBA can access the DBA_ views.
• The views are based on tables in the SYS schema.
• Never modify a table or view in the SYS schema.
• Most of its contents are cached in the Dictionary
Cache.

4-34

Copyright © 2005, Oracle. All rights reserved.

Static Data Dictionary: Considerations


User SYS owns all data dictionary views. In that regard, there is a set of privileges
prefixed with the ANY keyword that allow operations on any object in the database,
regardless of owner. Data dictionary protection is a feature that prevents such users
from performing operations on SYS owner objects. You should activate this protection
by setting the 07_DICTIONARY_ACCESIBILITY init.ora parameter to false. This
is the default.
While updates are made to the underlying dictionary tables by the database server, you
should not manually modify these tables, either by using the tables or the views. Doing
so could compromise the integrity or functionality of the database.
The contents of the data dictionary are accessed very frequently by activities such as:
• Permission checks
• SQL parsing, which requires knowledge of what columns are in what tables
• Modifications to object definitions
• Type checking
Consequently, for performance reasons, most of the data dictionary is kept in a cache
called the Dictionary Cache, reducing disk access when these and other operations are
done.
Oracle Database 10g: Administration Workshop I 4-34
Dynamic Data Dictionary Views

Dynamic views contain information about changing


states and conditions in the database.
doen inglloctsata

Per Sch Vieexeles


UNnnry a en d

Tab
ns
curus SQatio
ven

ers s
Ru it sio

Ind
Pro Us ws
Me Ses

ageL
Wa

as
etcnceure
macedem
etc ussor
mo

ta
Das
ages
ReOp DO

log

for
Dynamic views Static views

4-35 Copyright © 2005, Oracle. All rights reserved.

Dynamic Data Dictionary Views


The Oracle Database server also maintains a more dynamic set of data about the
operation of performance of the database instance. These dynamic views are maintained
at a much higher frequency, simply by the nature of the data.

Oracle Database 10g: Administration Workshop I 4-35


Dynamic Data Dictionary Views

Dynamic data dictionary views, also called dynamic


performance views, include information about:
• Sessions
• File states
• Progress of jobs and tasks
• Locks
• Backup status
• Memory usage and allocation
• System and session parameters
• SQL execution
4-
36

Copyright © 2005, Oracle. All rights reserved.

Dynamic Data Dictionary Views


For the most part, these views are in some way related to performance metrics: timings,
locking statistics, file usage, and frequency of various events are some of the pieces of
data found here. It is an every-changing representation of the current state of the
processes, memory structures, and storage devices that make up the entire system.

Oracle Database 10g: Administration Workshop I 4-36


Dynamic Data Dictionary Views:
1
Usage Examples

SQL> SELECT sql_text, executions FROM v$sql


WHERE cpu_time > 200000;
2

SQL> SELECT * FROM v$session WHERE machine =


'EDRSR9P1' and logon_time > SYSDATE - 1;
3

SQL> SELECT sid, ctime FROM v$lock WHERE block


> 0;

4-37

Copyright © 2005, Oracle. All rights reserved.

Dynamic Data Dictionary Views: Usage Examples


A frequent user of these views is Enterprise Manager, but users can also query these
views as needed. The three examples shown answer the following questions:
1. What are the SQL statements and their associated number of executions where the
CPU time consumed was greater than 200000 microseconds.
2. What sessions logged in from machine EDRSR9P1 within the last day?
3. What are the session IDs of any sessions that are currently holding a lock that is
blocking another user, and how long has that lock been held?

Oracle Database 10g: Administration Workshop I 4-37


Dynamic Data Dictionary: Considerations

• These views are based on tables owned by SYS.


• Different views are available at different times:
– The instance has been started.
– The database is mounted.
– The database is open.
• You can query v$fixed_table to see all of the
view names.
• These views are often referred to as "v-dollar
views".
• Read consistency is not guaranteed on these
4-38
views because the data is dynamic.

Copyright © 2005, Oracle. All rights reserved.

Dynamic Data Dictionary: Considerations


Some dynamic views contain data that is not applicable to all states of an instance or
database. For example, if an instance has just been started, but no database is mounted,
then you can query v$bgprocess to see the list of background processes running, but
you could not query v$datafile to see the status of database datafiles, because it is
the mounting of a database that reads the control file to find out about the datafiles
associated with a database.

Oracle Database 10g: Administration Workshop I 4-38


Summary

In this lesson, you should have learned how to:


• Administer two databases by using Enterprise
Manager:
– Modify initialization parameters
– Start and stop the Oracle listener
– Start up and shut down an Oracle Database
10g instance
– Compare automatic and manual memory
management of the SGA
– View the alert log
• Use information in the data dictionary
4-
• Access databases with SQL*Plus and iSQL*Plus
39

Copyright © 2005, Oracle. All rights reserved.

Oracle Database 10g: Administration Workshop I 4-39


Practice Overview:
Managing the Oracle Instance

This practice covers the following topics:


• Navigating in Enterprise Manager
• Stopping and starting the Oracle listener
• Viewing and modifying initialization parameters
• Stopping and starting the database instance
• Viewing the alert log
• Connecting to the database by using SQL*Plus
and iSQL*Plus
• Using the data dictionary

4-40 Copyright © 2005, Oracle. All rights reserved.

Practice Overview
Answer the questions in this practice.

Oracle Database 10g: Administration Workshop I 4-40

You might also like