Вы находитесь на странице: 1из 12

http://careerguide.oracle-based.

com/interview_discuss/discuss/114/Oracle-11g-DBA-Interview-
Questions-and-Answers-For-Freshers/Which-file-is-accessed-first-when-Oracle-database-is-started?

SGA Details:

SGA (System Global Area) is a memory area allocated during an instance start up.

SGA is allocated as 40% of RAM size by default.

SGA size is controlled by DB_CACHE_SIZE parameter defined in initialization parameter file (init.ora file
or SPFILE).

PGA Details:

PGA (Program or Process Global Area) is a memory area that stores a user session specific information.

PGA is allocated as 10% of RAM size by default

What are the components of SGA?

SGA is used to store shared information across all database users.It mainly includes Library cache, Data
Dictionary cache, Database Buffer Cache, Redo log Buffer cache, Shared Pool.

Library cache - It is used to store Oracle statements.

Data Dictionary Cache - It contains the definition of Database objects and privileges granted to users.

Data Base buffer cache - It holds copies of data blocks which are frequently accessed so that they can be
retrieved faster for any future requests.

Redo log buffer cache - It records all changes made to the data files.

Which Tablespaces are created automatically when you create a database?


SYSTEM tablespace is created automatically during database creation. It will be always online when the
database is open.

Other Tablespaces include

SYSAUX tablespace

UNDO tablespace

TEMP tablespace

UNDO & TEMP tablespace are optional when you create a database.

Two types of storage systems are available:

Relational Database Management System (RDBMS) and Hierarchical Storage Management System
(HSM)

Most databases use RDBMS model, Oracle also uses RDBMS model.

Hierarchical Storage Management System (HSM)

Information Management System (IMS) from IBM.

Integrated Database Management System (IDMS) from CA.

What are advantages of using SPFILE over PFILE?

Parameters in SPFILE are changed dynamically.

You can’t make any changes to PFILE when the database is up.

SPFILE parameters changes are checked before they are accepted as it is maintained by Oracle server
thereby reducing the human typo errors

What is different between database and instance?


A database is a collection of three important files which include data files, control files and redo log files
which physically exist on a disk. A database may be mounted and opened by one or more instances
(using RAC).

An instance is a combination of oracle background process (SMON, PMON, DBWR, LGWR) and memory
structure (SGA, PGA). An instance can mount and open only a single database, ever.

What is System Change Number (SCN)?

SCN is a unique ID that Oracle creates for every committed transaction.

It is recorded for every change in the redo entry.

SCN is also generated for every checkpoint (CKPT) occurred.

It is an ever increasing number which is updated for every 3 seconds

You can get the SCN number by querying select SCN from a v$database from SQLPLUS.

What is Database Writer (DBWR) and when does DBWR write to the data file?

DBWR is a background process that writes data blocks information from Database buffer cache to
datafiles.

There are seven important situations when DBWR writes to data file:

Every 3 seconds.

Whenever a checkpoint occurs.

When server process needs free space in database buffer cache to read new blocks.

Whenever some blocks reaches a maximum value.

Timeout occurs.

RAC ping request is made.

When any tablespace is taken offline, read only, drop or truncated & when to begin the backup

How can you find out if the database is using PFILE or SPFILE?
You can query Dynamic performance view (v$parameter) to know your database is using PFILE or
SPFILE.

SQL> select value from V$parameter where name= ‘SPFILE’;

A non-null value indicates the database is using SPFILE.

A null value indicates database is using PFILE.

You can force a database to use a PFILE by issuing a startup command as

SQL> startup PFILE = ‘full path of Pfile location’;

Which file is accessed first when Oracle database is started?

Init<SID>.ora parameter file or SPFILE is accessed first( SID is instance name).Settings required for
starting a database are stored as parameters in this file.

Akshay Handa said: (Thu, Jun 16 2016 12:21:20 AM)

PFILE contains details for starting up an instance whereas SPFILE &#40;Server Parameter File&#41; is for
starting up a database.PFILE is accessed first and then SPFILE

What is archive log file?

In archive log mode, the database will makes archive of all redo log files that are filled, called as archived
redo logs or archive log files.

- By default your database runs in NO ARCHIVE LOG mode, so we can’t perform online backup’s (HOT
backup).

- You must shut down database to perform offline backup (COLD backup) and recovery can be done to
the previous backup state.

- Archive log files are stored in a default location called FRA (Flash Recovery Area).

- We can also define our own backup location by setting LOG_ARCHIVE_DEST parameter.
What is the difference between SPFILE and PFILE?

SPFILE is by default created during database creation whereas PFILE should be created from SPFILE.

PFILE is client side text file whereas SPFILE is server side binary file.

SPFILE is a binary file (it can’t be opened) whereas PFILE is a text file we can edit it and set parameter
values.

Changes made in SPFILE are dynamically effected with running database whereas PFILE changes are
effected after bouncing the database.

We can backup SPFILE using RMAN.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
https://community.oracle.com/thread/904540?start=0&tstart=0

SGA (System Global Area) is an area of memory (RAM) allocated when an Oracle Instance starts up. The
SGA's size and function are controlled by initialization (INIT.ORA or SPFILE) parameters.

Contents

In general, the SGA consists of the following sub-components, as can be verified by querying the
V$SGAINFO:

SELECT * FROM v$sgainfo;

The common components are:

* Data buffer cache - cache data and index blocks for faster access.

* Shared pool - cache parsed SQL and PL/SQL statements.

* Dictionary Cache - information about data dictionary objects.

* Redo Log Buffer - committed transactions that are not yet written to the redo log files.

* JAVA pool - caching parsed Java programs.

* Streams pool - cache Oracle Streams objects.

* Large pool - used for backups, UGAs, etc.

SQL> SHOW SGA

Total System Global Area 638670568 bytes

Fixed Size 456424 bytes


Variable Size 503316480 bytes

Database Buffers 134217728 bytes

Redo Buffers 679936 bytes

SQL> SELECT * FROM v$sga;

NAME VALUE

-------------------- ----------

Fixed Size 456424

Variable Size 503316480

Database Buffers 134217728

Redo Buffers 679936

The size of the SGA is controlled by the DB_CACHE_SIZE parameter.

PGA (Program or Process Global Area) is a memory area (RAM) that stores data and control information
for a single process. For example, it typically contains a sort area, hash area, session cursor cache, etc.

[edit] Auto tuning

PGA areas can be sized manually by setting parameters like hash_area_size, sort_area_size etc.

To allow Oracle to auto tune the PGA areas, set the WORKAREA_SIZE_POLICY parameter to AUTO and
the PGA_AGGREGATE_TARGET to the size of memory that can be used for PGA. This feature was
introduced in Oracle 9i.

PGA usage statistics:

select * from v$pgastat;

Determine a good setting for pga_aggregate_target:

select * from v$pga_target_advice order by pga_target_for_estimate;


Show the maximum PGA usage per process:

select max(pga_used_mem), max(pga_alloc_mem), max(pga_max_mem) from v$process;

****************************************************************************8

SGA : A group of shared memory structures that contain data and control information for one Oracle
database instance. If multiple users are concurrently connected to the same instance, then the data in
the instance's SGA is shared among the users. Consequently, the SGA is sometimes referred to as the
shared global area.

PGA : A memory buffer that contains data and control information for a server process. A PGA is created
by Oracle when a server process is started. The information in a PGA depends on the Oracle
configuration.

OR

System Global Area (SGA)

The SGA is a read/write memory area that stores information shared by all database processes and by all
users of the database (sometimes it is called theShared Global Area).

This information includes both organizational data and control information used by the Oracle Server.

The SGA is allocated in memory and virtual memory.

The size of the SGA can be established by a DBA by assigning a value to the parameter SGA_MAX_SIZE
in the parameter file—this is an optional parameter.

The SGA is allocated when an Oracle instance (database) is started up based on values specified in the
initialization parameter file (either PFILE or SPFILE).
The SGA has the following mandatory memory structures:

Database Buffer Cache

Redo Log Buffer

Java Pool

Streams Pool

Shared Pool – includes two components:

o Library Cache

o Data Dictionary Cache

Other structures (for example, lock and latch management, statistical data)

Additional optional memory structures in the SGA include:

Large Pool

Program Global Area (PGA)


A PGA is a nonshared memory region that contains data and control information exclusively for use by
an Oracle process.

A PGA is created by Oracle Database when an Oracle process is started.

One PGA exists for each Server Process and each Background Process. It stores data and control
information for a single Server Process or a single Background Process.

It is allocated when a process is created and the memory is scavenged by the operating system

when the process terminates. This is NOT a shared part of memory – one PGA to each process

only.

The collection of individual PGAs is the total instance PGA, or instance PGA.

Database initialization parameters set the size of the instance PGA, not individual PGAs.

The Program Global Area is also termed the Process Global Area (PGA) and is a part of memory

Allocated that is outside of the Oracle Instance.

*******************************************************************************8

http://dbaforums.org/oracle/index.php?showtopic=2465

OR

A "database" made up of a set of controlfiles, logfiles, and datafiles. This is ultimately

where all your data is stored.


An "instance" is a collection of processes that facilitate connection to a database and

all the memory segments that said processes allocate. An instance may or may not

have a database mounted (meaning controlfile is opened), and if it's mounted, it may

also open said database (all datafiles are online, instance is ready to accept user

connections).

SGA - "shared global area" or "system global area". This is the shared memory that's

allocated from the O/S at instance startup. It is SHARED. That is, all oracle server

processes have access to it. It contains many components which must be shared

among all users, the most popular examples being the buffer cache (Oracle's in-memory

image of datafile blocks), log buffer (Oracle's in-memory image of logfile blocks (well,

sort of, close enough, for now)), and the shared pool, (made up primarily of all the

shared SQL statements).

PGA - "program global area" or "private global area". This is private, non-shared program

memory which only an individual server process has access to. It is mostly made up

of the process state object, which is a memory image of the work that's currently in

progress by that server process. (The process state object contains pointers to all

the other state objects that are currently being used by the process, such as session

state object, cursor state objects, session cursor cache, etc.)

There are also things called the UGA and CGA, but I don't want to go too far. Keeping

it simple....;-)

Hope that helps clarify these concepts. If you still have any question about the basic

functions of these components, read the Concepts Manual, read the Concepts Manual,

read the Concepts Manual. And, once you done that you should, that's right you guessed

it, read the Concepts Manual.


If you'd like to go more in-depth into these components and how they are used,

read the Steve Adams book, Oracle 8i Internals! Don't be put off by the 8i reference

in the name, it's an *excellent* book, and in the area of internal database architecture,

while things have changed a bit, the fundamentals are still very much the same!

Hope that helps

I have a question like how data is written in to datafiles and redo log files.

DBWR is the only background process can write into datafiles.

DBWR is used to write dirty buffers from DBBC to Datafiles.

LGWR is the only background process can write into logfiles.

LGWR is used to write redo logs from RLBC to Online Redo Log Files.

Вам также может понравиться