dba 001
TRANSCRIPT
![Page 1: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/1.jpg)
DBADatabase Administration
![Page 2: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/2.jpg)
Oracle Products
• Server Technologies– Oracle Database– Oracle Application Server– Oracle Enterprise Manager
• Development Tools– Languages– Oracle Developer Suite
• Applications– Oracle E-Business Suite– Oracle Collaboration Suite
![Page 3: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/3.jpg)
Server Technologies
• Database Server– Repository of data without effective limit of data
• Application Server– a platform for developing, deploying, and
managing web applications. (Three tier applications)
![Page 4: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/4.jpg)
Server Technologies
• Enterprise Manager– Database Control: A graphical tool for managing one
database.• It facilitates real-time management and monitoring for
scheduled jobs like backup operations
– Application Server Control• Graphical tool for managing one application server
instance or group of instances
– Grid Control• A management repository to manage all the databases
and application servers wherever they may be.
![Page 5: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/5.jpg)
Role of an Oracle DBA
• Each database requires at least one database administrator (DBA) to administer it. – Installing and upgrading the Oracle server and application
tools– Allocating system storage and planning future storage
requirements for the database system– Creating primary database storage structures (tablespaces)
after application developers have designed an application– Creating primary objects (tables, views, indexes) once
application developers have designed an application– Modifying the database structure, as necessary, from
information given by application developers
![Page 6: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/6.jpg)
Role of an Oracle DBA
– Enrolling users and maintaining system security– Ensuring compliance with your Oracle license agreement– Controlling and monitoring user access to the database– Monitoring and optimizing the performance of the
database– Planning for backup and recovery of database information– Maintaining archived data on tape– Backing up and restoring the database– Contacting Oracle Corporation for technical support
![Page 7: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/7.jpg)
Oracle Architecture
Oracle architecture consists on two entities• Database– collection of data and supporting files on storage
disks on host computer• Instance– collection computer processes of one database in
memory – area of memory shared by these processes
![Page 8: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/8.jpg)
Oracle Instance vs Other DBs Instance
• Oracle instance is different from other DBs like MS SQL Server, MySQL or IBM DB2– Collection of databases in one instance that shares
common memory– One-to-Many relationship between instance and
database• Relationship between instance and DB in oracle is
either – One-to-one OR– Many-to-one
![Page 9: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/9.jpg)
Oracle Instance Relationship
• One-to-one– One instance per database
• Many-to-one– Real Application Clusters (RAC)– Database lives on shared disks– Instance on multiple computers attach to the db.
![Page 10: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/10.jpg)
Instance
• The instance consists of memory and processes.
• Instance exists in RAM• The life time of instance as long as it exists in
the memory
![Page 11: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/11.jpg)
Instance
• Memory– System Global Area (SGA): Shared memory
segments provided by operating systems– Program Global Area (PGA): Non-shared memory
area associated with server processes.• Processes– Background: The processes that make up the
instance called background processes– Foreground: The server processes
![Page 12: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/12.jpg)
User & Oracle Interaction
![Page 13: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/13.jpg)
• A user interacts with a user process.• A user process interacts with a server process.• A server process interacts with an instance.• An instance interacts with a database.
User & Oracle Interaction
![Page 14: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/14.jpg)
System Global Area (SGA)
• The memory structures, which are implemented in shared memory segments provided by the operating system,
• Allocated at instance startup and released at instance shutdown.
• It is divided in• Buffer cache• Shared pool• Log buffer
![Page 15: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/15.jpg)
Buffer Cache
• Largest portion of SGA• Working area of oracle to execute SQL.• User’s session don’t directly update data on disk
– Required data in blocks is first brought to buffer cache– Changes are applied on the data in buffer cache– Retrieving the data also goes via buffer cache
• Data is first accessed from buffer cache if not found than it has to be searched into the disk
• A buffer storing a block whose image is different from the block at disk will be called dirty buffer
• Clean buffer where block at buffer and block at disk have identical image
![Page 16: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/16.jpg)
Log Buffer
• A small, short-term memory area for change vectors before they are written to redo log files on disk.
• A change vector is an update/modification applied to data.
• Redo log is the database guarantee that data will never be lost.
![Page 17: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/17.jpg)
Log Buffer
• Redo is written directly to the redo log files by session server process
• If written to the disk directly sessions would wait for disk I/O.
• Redo log is written to redo log buffer in memory area first which is faster than disk writing
• Log buffer may containing the change vectors of many transactions will eventually write the redo log file
![Page 18: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/18.jpg)
Log Buffer
• Size of log buffer is not very big, a big size log buffer will have a bad effect on performance
• Log buffer size can be increased, but cannot be decreased less than the default value.
• Default value ranges from 5 to 32 MB depending upon the SGA size, CPU and operating system
• Log buffer is allocated at the startup of instance and it cannot be changed without restarting instance
![Page 19: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/19.jpg)
Shared pool
• Most complex structure of SAG• Shard pool components– The Library Cache– The data dictionary cache– The PL/SQL area– SQL Query and PL/SQL Function result cache
• The shared pool size is dynamic and can be automatically managed.
![Page 20: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/20.jpg)
The Library Cache
• The library cache is a memory area for storing recently executed code, in its parsed form.
• Parsing is the conversion of code written by programmers into something executable.
• Parsing SQL code takes time– SELECT * FROM employees where first_name =
‘Shahbaz’• Before this statement can be executed, the Oracle
server has to work out what it means, and how to execute it.
![Page 21: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/21.jpg)
The Library Cache
• To begin with, – what is employees? Is it a table, or a view? – Does it even exist? – Then the “*”—what are the columns that make up the
employees table– Does the user have permission to see the table– After statement understanding the server has to decide out
how best to execute it• The purpose of the Library Cache of the shared pool is
to store statements in their parsed.• Ready for execution
![Page 22: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/22.jpg)
Foreground Process
• Started when a user connects to the database– Foreground Process checks user’s permission • to access data• generating query• Retrieving data blocks into buffer cache and modifying
them
– Before modifying creates copy of data for undo– Creates entries for undo/redo log– It terminates when a user session is terminated
![Page 23: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/23.jpg)
Background Process
• It lives from database startup to shut down– The Database Writer (DBWR) process is
responsible transferring modified data blocks to data files.
– Multiple DBWR can be created to share the load– The Log Writer (LGWR) transfers all the undo/redo
entries in the log buffer to the redo log files– The Archiver (ARCH) makes copies of redo log files
when they fill up
![Page 24: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/24.jpg)
Background Process
• Check point process – Change block are not immediately transferred to
the data files– Changes are copied in batches– After a frequent intervals data is synchronized with
data files to store any modified data remaining any modified data into disk
– System Change Number (SCN) is maintained to record the change or update
– This is called check point
![Page 25: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/25.jpg)
• The Process Monitor (PMON) – Watches the progress of database connection– In case of disconnection it initiates necessary roll
back• The System Monitor (SMON)– Perform any clean up activities in case of database
abnormal shut down– It uses redo log to perform clean activities
Background Process
![Page 26: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/26.jpg)
Oracle Database
• Software– Server Side– Client Side
• Configuration Files– pfile (text file)– spfile (binary file)
• Data Files• Temporary Files• Redo Log Files
![Page 27: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/27.jpg)
Data Files• Every Oracle database has one or more physical datafiles, which
contain all the database data like table & indexes.• The biggest component of Oracle Files
– Data files are grouped in logical space called tablesapce • Tablespaces should be only for the purpose indicated by its name• Some of tablespaces are
– System– SYSAUX– Data– Index– UNDO– Temp
![Page 28: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/28.jpg)
Control File
• Used while starting of the DB• Contains following information about DB– Name & location of data files– Name & location of archived redo log files– Time stamp of database creation
• It is also a very critical file• Oracle keeps multiple copies of this file in
perfect synchronization• A control file is also used in database recovery.
![Page 29: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/29.jpg)
Configuration/Parameter Files
• Settings for database startup– pfile (text) referred as init.ora– Spfile (binary)
• Listener.ora– Controls the operation of the listener– A process when user starts a DB connection
• Tnsnames.ora contains location of DB.
![Page 30: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/30.jpg)
Temporary Files
• Oracle process uses a private work area called Program Global Area (PGA)
• PGA to hold intermediate results (i.e.) data sorting
• Temporary files are used to store intermediate results
![Page 31: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/31.jpg)
Redo Log Files
• For transaction durability oracle stores– UNDO and REDO information
• Log Writer (LGWR) process writes the UNDO and REDO information to the log file.
• Size of REDO log file is decided by the DBA• REDO Log files are very important and must be
backed up.• A mirror of REDO log files is referred as REDO
Log Group
![Page 32: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/32.jpg)
Archived Redo Log Files
• Redo File fills up, Archiver makes one or more copies of it locations specified by the DBA
• Copies enables Oracle to redo/undo data from the past history or even if the current redo file is damaged
![Page 33: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/33.jpg)
Event Logs
• Oracle keeps log of important events– Start up– Shut down– DDL operations– User session creation– Errors
• Some log files used by oracle– Alert log stores DDL operation, start up, shutdown– Listener log stores user session– Trace file to log erros
![Page 34: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/34.jpg)
Database Backup
• Backup files contain the backup of original data
• Backup copies are called flashback recovery area
![Page 35: Dba 001](https://reader036.vdocuments.net/reader036/viewer/2022062308/55b3902ebb61eb6a3a8b45a7/html5/thumbnails/35.jpg)
Oracle Database
• Archived Redo Log Files• Control File• Event Logs• Database Backups