Escolar Documentos
Profissional Documentos
Cultura Documentos
A database is collection of data files plus programs that manipulate those data files Two types of information are stored in an Oracle database User data, relevant to a particular application and System data, that the database needs to manage itself
Database files contain all database data Control files contain info to access and manipulate the data Redo Logs record all the transactions on the database Tablespaces logical divisions of a database Segments set of database blocks Extents allocation of contiguous space on disk exp in bytes
An Oracle database consists of one or more database files. These files contain data that can be accessed with the help of SQL. A file can be associated with one and only one tablespace. The database when created initially, has only one physical file. The maximum number of files that can be opened at a time are 32 by default. One or more physical files form a logical unit called tablespace.
A databases overall physical architecture is maintained by its control files. These record control information about all the files within the database. A control file is associated with a single database Control files are automatically modified by Oracle; a user cannot edit them. They are used to maintain internal consistency and guide recovery operations
A Redo Log contains all the transactions that have occurred against the database No activity in the database can take place without being recorded in Redo Logs The Redo Logs are necessary to protect against data loss Redo Logs are also called transaction logs Every database requires a minimum of two Redo Logs These are used in recovery operations to restore lost or damaged files
A database is divided into logical divisions called tablespaces A database may have one or more tablespaces Each logical tablespace corresponds to one or more physical database files
The typical tablespace present in an Oracle database are : SYSTEM stores all information needed to manage itself TEMP stores all temporary tables TOOLS stores database objects needed to support different tools USER information about users is stored DATA & INDEX holds the actual data and the indexes ROLLBACK where all undo information is stored
An Oracle database server consists of an Oracle database and an Oracle instance. Every time a database is started, a system global area (SGA) is allocated and Oracle background processes are started. The combination of the background processes and memory buffers is called an Oracle instance.
The System Global Area (SGA) is a shared memory region that contains data and control information for one Oracle instance. Users currently connected to an Oracle database share the data in the SGA. The SGA contains the following memory structures :
PGA is a memory buffer that contains data and control information for a server process. A server process is a process that services a clients requests. A PGA is created by oracle when a server process is started. The information in a PGA depends on the oracle configuration. The PGA area is a non-shared area of memory created by oracle when a server process is started.
The basic difference between SGA and PGA is that PGA cannot be shared between multiple processes in the sense that it is used only for requirements of a particular process whereas the SGA is used for the whole instance and it is shared.
An Oracle database uses memory structures and processes to manage and access the database. All memory structures exist in the main memory of the computers that constitute the database system. Processes are jobs that work in the memory of these computers.
Oracle creates a set of background processes for each instance. The background processes consolidate functions that would otherwise be handled by multiple Oracle programs running for each user process. They asynchronously perform I/O and monitor other Oracle processes to provide increased parallelism for better performance and reliability. The most common background processes are :
This database background process performs instance recovery at the start of the database. SMON also cleans up temporary segments that are no longer in use and recovers dead transactions skipped during crash and instance recovery because of file-read or offline errors. It coalesces i.e. combines contiguous free extents into larger free extents.
ICS034 Database Administration
This database background process cleans up failed user processes. PMON is responsible for releasing the lock i.e. cleaning up the cache and freeing resources that the process was using. Its effect can be seen when a process holding a lock is killed.
This background process is responsible for managing the contents of the data block buffer cache and dictionary cache. DBWR performs batch writes of changed block. Since Oracle uses write-ahead logging, DBWR does not need to write blocks when a transaction commits. In the most common case, DBWR writes only when more data needs to be read into the system global area and too few database buffers are free. The least recently used data is written to the datafiles first. Although there is only one SMON and one PMON process running per database instance, one can have multiple DBWR processes running at the same time. Note the number of DBWR processes running is set via the DB_WRITER_PROCESSES.
Archiver - ARCH
The Archiver process reads the redo log files once Oracle has filled them and writes a copy of the used redo log files to the specified archive log destination(s). Actually, for most databases, ARCH has no effect on the overall system performance. On some large database sites, however, archiving can have an impact on system performance.
Checkpoint - CKPT
All modified information in database buffer in the SGA is written to the datafiles by a database write process (DBWR). This event indicates a checkpoint. The checkpoint process is responsible for signaling DBWR at checkpoints and updating all of the datafiles and control files of the database.
Recover - RECO
Job queue processes are used for batch processing. They run user jobs. They can be viewed as a scheduler service that can be used to schedule jobs as PL/SQL statements or procedures on an Oracle instance. Given a start date and an interval, the job queue processes try to run the job at the next occurrence of the interval.
If the database must be up and running 24 hours a day, seven days a week, then you have no choice but to perform inconsistent backups of the whole database. A backup of online datafiles is called an online backup. This requires that you run your database in ARCHIVELOG mode. Advantage : Database remains open during backup Disadvantage : Large databases may have performance impact during backup, recovery takes longer and is slightly more complex
A group of privileges is called a role. User privileges : Object privileges are privileges granted on specific objects within a schema to other schemas. Column privileges are column privileges granted on specific columns within a schema to other schemas. These are INSERT, UPDATE , and REFERENCES privileges on specific columns in a table.
Role privileges Roles are collections of various privileges. Role privileges are privileges granted to a user through roles. Privileges can be granted to roles, and roles can in turn be granted to other roles or to users. For example, all DBA users can be granted the DBA role.
System privileges System privileges are granted to enable users to create schema objects in their schema or in other schemas. A system privilege is the right to perform a particular action, or to perform an action on any schema objects of a particular type. For example, the privileges to create tablespaces and to delete the rows of any table in a database are system privileges.
Privileges are granted by using the GRANT command. If a system privilege is granted with ADMIN OPTION, then it can be passed on by the grantee. If an object privilege is granted with GRANT OPTION, then it can be passed on.
Defining the tablespaces and data files Use the CREATE TABLESPACE statement to create a tablespace A permanent tablespace contains persistent schema objects. Objects in permanent tablespaces are stored in datafiles. An undo tablespace is a type of permanent tablespace used by Oracle Database to manage undo data if you are running your database in automatic undo management mode. Oracle strongly recommends that you use automatic undo management mode rather than using rollback segments for undo. A temporary tablespace contains schema objects only for the duration of a session. Objects in temporary tablespaces are stored in tempfiles.
When you create a tablespace, it is initially a read/write tablespace. You can subsequently use the ALTER TABLESPACE statement to take the tablespace offline or online, add datafiles or tempfiles to it, or make it a read-only tablespace