Dear Readers, Welcome to Memory Management Interview Questions and Answers have been designed specially to get you acquainted with the nature of questions you may encounter during your Job interview for the subject of Memory Management. These Memory Management Questions are very important for campus placement test and job interviews. As per my experience good interviewers hardly plan to ask any particular questions during your Job interview and these model questions are asked in the online technical test and interview of many IT companies.
We can plan the storage for a table as how much initial extents are required, how much can be extended next, how much % should leave free for managing row updations etc.
To manage the database level transactions such as modifications of the data dictionary table that record information about the free space usage.
Each block contains entries as follows
Fixed block header
Variable block header
Row Header,row date (multiple rows may exists)
PCTEREE (% of free space for row updation in future).
This is used to reserve certain amount of space in a block for expansion of rows.
To avoid the space wastage we use OPTIMAL parameter.
The Shared Pool environment contains both fixed and variable structures. The Fixed structures remain relatively the same size, whereas the variable structures grow and shrink based on user and program requirements.
Used To Store
Most Recently Executed SQL Statements
Most Recently used Data definitions
It Consists of two Key performance - related memory structures
Library Cache & Data Dictionary Cache
Shared Pool is sized by SHARED_POOL_SIZE
It is area in memory that is used by a Single Oracle User Process.
Data segment are the physical areas within a database block in which the data associated with tables and clusters are stored.
Due to insufficient Shared SQL pool size.
Monitor the ratio of the reloads takes place while executing SQL statements. If the ratio is greater than 1 then increase the SHARED_POOL_SIZE.
LOGICAL & PHYSICAL ARCHITECTURE OF DATABASE.
Database buffers are cache in the SGA used to hold the data blocks that are read from the data segments in the database such as tables, indexes and clusters DB_BLOCK_BUFFERS parameter in INIT.ORA decides the size.
Dictionary cache is information about the databse objects stored in a data dictionary table.
Row size also reduces no of rows per block.
A free extent is a collection of continuous free blocks in tablespace. When a segment is dropped its extents are reallocated and are marked as free.
For perticular transaction Alter system set rollback segment 'name';
For database, we can set in pfile. Rollback_segment='name' .
Store data in tablespaces to avoid disk contension.system tablespace-recursive callsuserdata-users objectsindex tablespace-for indexesrollback segmnets-undo tablespace or manual rollback segmentsplace application specific data in respective tablespaces.Place all these tablespaces in saperate disks.Try to implement raid-0 (striping) for better performance.
Export the user
Perform import using the command imp system/manager file=export.dmp indexfile=newrite.sql. This will create all definitions into newfile.sql.
Drop necessary objects.
Run the script newfile.sql after altering the tablespaces.
Import from the backup for the necessary objects.
Changes made to entries are written to the on-line redo log files. So that they can be used in roll forward operations during database recoveries. Before writing them into the redo log files, they will first brought to redo log buffers in SGA and LGWR will write into files frequently.
LOG_BUFFER parameter will decide the size.
Number of times processes repeatedly query the dictionary table is called recursive hints. It is due to the data dictionary cache is too small. By increasing the SHARED_POOL_SIZE parameter we can optimize the size of Data Dictionary Cache.
Limit the number of extents in the table
Separate Table from its indexes.
Allocate Sufficient temporary storage.
Calculate the total header size
Calculate the available dataspace per data block
Calculate the combined column lengths of the average row
Calculate the total average row size.
Calculate the average number rows that can fit in a block
Calculate the number of blocks and bytes required for the table.
After arriving the calculation, add 10 % additional space to calculate the initial extent size for a working table.
The advantages over file system files.
I/O will be improved because Oracle is bye-passing the kernnel which writing into disk.
Disk Corruption will be very less.
The Control File is a small binary file necessary for the database to start and operate successfully. Each Control file is associated with only one Oracle database. Before a database is opened, the control file is read to determine if the database is in a valid state to USE.
The Control file is not accessible, the database does not function properly.
By using dictionaray view's called v$rollstat,dba_rollback_segs.
This can be monitored in DB_data_files.
Due to syntax errors.
By correctly fixing optimal size.
create rollback segment roll1tablespace roll1.
When ever changes happend to the database previous change will be there in the rollback segment.
Hit Ratio is the ratio of shared SQL and PL/SQL items found in the Library Cache versus physical storage.It can also be defined in a mathematical expression as 1 - ((physical reads) / (db block gets + consistent reads)).
We should depend on export/import utility for backup/recovery (fully reliable) The tar command cannot be used for physical file backup, instead we can use dd command which is less flexible and has limited recoveries.
• Tell Your Friend
When a user updated a particular table (for example 100 rows) the old value will be retained in the roll back segments(Oracle 8) and now it is Undo segment (oracle 9i). If the user issue a rollback command the old value will be taken from the rollback segment(that too if undo_retention parameter set properly in the parameter file).
Shadow set of disks save as a backup in the event of disk failure. In most Operating System if any disk failure occurs it automatically switchover to place of failed disk.
Improved performance because most OS support volume shadowing can direct file I/O request to use the shadow set of files instead of the main set of files. This reduces I/O load on the main set of disks.
LGWR process wirtes all change vectors from theredo log buffer to online redo log file sequentially.
Multiplexing Redo log file called Mirroing. ( Keeping multiple copies in different disks)
1. Edit init.ora file set control_files parameter with multiple location
2. shutdown immediate
3. copy control file to multiple locations & confirm from init.ora contol_files parameter
4. start the database.
5. run this query for changes confirmation - select name from v$controlfile;
The System Global Area in a Oracle database is the area in memory to facilitates the transfer of information between users. It holds the most recently requested structural information between users. It holds the most recently requested structural information about the database. The structure is Database buffers, Dictionary cache, Redo Log Buffer and Shared SQL pool (ver 7.0 only) area.
The data dictionary cache is stored in an area in SGA called the Shared SQL Pool. This will allow sharing of parsed SQL statements among concurrent users.
It is area in memory that is used by a Single Oracle User Process.
The space used transaction entries and a deleted record does not become free immediately after completion due to delayed cleanout.
Trailing nulls and length bytes are not stored. Inserts of, updates to and deletes of rows as well as columns larger than a single datablock, can cause fragmentation and chained row pieces.
Full back - Complete database
Incremental - Only affected tables from last incremental date/full backup date.
Cumulative backup - Only affected table from the last cumulative date/full backup date.
Cold backup is taking backup of all physical files after normal shutdown of database. We need to take.
- All Data files.
- All Control files.
- All on-line redo log files.
- The init.ora file (Optional)
Logical backup involves reading a set of database records and writing them into a file. Export utility is used for taking backup and Import utility is used to recover from backup.
Taking backup of archive log files when database is open. For this the ARCHIVELOG mode should be enabled. The following files need to be backed up. All data files. All Archive log, redo log files. All control files.
To give the export file name.
A flag to indicate whether grants on databse objects will be exported or not. Value is 'Y' or 'N'.
A flag to indicate whether indexes on tables will be exported.
Flag to indicate whether table rows should be exported. If 'N' only DDL statements for the database objects will be created.
Name of the parameter file to be passed for export.
A flag to indicate whether statistical information about the exported objects should be written to export dump file.
A flag to indicate whether full databse export should be performed.
List of table accounts should be exported.
List of tables should be exported.
Record length in bytes.
Type export should be performed COMPLETE,CUMULATIVE,INCREMENTAL
For Incremental exports, the flag indirects whether a record will be stores data dictionary tables recording the export.
A flag to indicate whether rows should be imported. If this is set to 'N' then only DDL for database objects will be executed.
A flag to indicate whether import should import index on tables or not.
A flag to indicate whether grants on database objects will be imported.
A flag to indicate whether file content should be displayed or not.
The name of the file from which import should be performed.
The name of the file which log of the export will be written.