Documente Academic
Documente Profesional
Documente Cultură
Page 1 of 63
Index
Architecture 1
3-4
Architecture 2
5-6
Architecture 3
7-8
Database Creation
9-10
11-12
Storage Parameters
13-14
User Management
15-17
Undo Management
18-18
Flashback Technology
19-20
Networking
21-21
22-23
Redolog,control file
Management
24-26
27-27
Logical Backups
28-29
Physical Backups
30-31
Rman
32-33
Performance Tuning
34-36
Page 2 of 63
Application Tuning
37-38
Database Tuning
39-40
Memory Tuning
41-42
Network Tuning
43-44
Installation
45-46
47-48
Dataguard
49-51
Partitioning
52-53
Indexes
54-55
56-57
Log Miner
58-59
60-61
Automatic Storage
Management
62-63
Page 3 of 63
1. Architecture - 1
1. Why do we need to maintain our data in database?
As we all know Database has a availability of a storage system, the most obvious of these
being persistence. To sum it up, we can identify the following reasons for wanting a Database
Management Systems short for DBMS:
We need to share data of all kinds between users (except for very small systems), between
tools working on them, and usually between different computers. All should be able to work with
the same set of data.
We need persistent storage and storage must be reliable.
Several users and/or several tools must be able to safely access the same data concurrently.
A DBMS may provide more efficient access to large amounts of data, through indexing and
other optimizations.
A DBMS and its data model provides an abstraction; we do not need to care about the physical
storage format.
A DBMS may also be used for communication between different users or applications.
Page 4 of 63
ability to work well with other people. The DBA who talks about the technical challenges of the
job and difficulties administering and maintaining the database may not be ideally suited for a
position where contact for the development staff is critical. On the other hand, the DBA who
speaks openly of the challenges associated with getting the developers fast answers and
accurate information might be a better consideration.
5. How do you perceive the relationship between the DBA and the development
staff?
DBAs by virtue of their high pay and product-specific knowledge, tend to think of developers as
underlings, in some cases, DBAs view developers with outright contempt, believing their queries
to be naive. On the other hand, DBAs with the proper attitude will respond to this question by
talking about the developers as clients to whom they provide data services essential to the
application. In some shops, the DBAs may be responsible for code, reviewing SQL queries, or
DML statements written by developers; so, a good relationship is vital.
Page 5 of 63
2. Architecture - 2
1. What is the basic element of Base configuration of an oracle Database?
It consists of one or more data files. One or more control files. Two or more redo log groups.
The Database contains multiple users/schemas one or more rollback segments
one or more tablespaces Data dictionary tables User objects (table,indexes,views etc.,) The
server that access the database consists of SGA (Database buffer cache,Shared pool ,Redo log
buffer)
SMON (System monitor)
PMON (Process MONitor)
LGWR (LoG Write)
DBWR (Data Base Write)
ARCH (ARCHiver)
CKPT (Check Point)
RECO
Dispatcher
User Process with associated PGA.
Page 6 of 63
The dictionary cache stores metadata (data about your tables and indexes) and its also
known as the row cache. It is used to cache data dictionary related information in RAM for quick
access. The dictionary cache is like the buffer cache, except its for Oracle data dictionary
information instead of user information.
14. Name the process which carries the request to the memory components,And
also fetches from disk to buffer?
Server Process
Page 7 of 63
3. Architecture - 3
1. Which background process write dirty blocks from database buffer cache to
data files?
Database writer (DBWR)
2. Which background process writes data from log buffer to redo log files?
Log writer (LGWR)
Page 8 of 63
12. List the Optional Flexible Architecture (OFA) of Oracle database? How can we
organize the tablespaces in Oracle database to have maximum performance?
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
Page 9 of 63
4. Database Creation
1. What are the steps involved in Database Startup?
Start an instance, Mount the Database and Open the Database.
5. While creating database can you specify the size of control files?
No
7. After mounting a database using command STARTP MOUNT can you open
your database in RESTRICTED MODE. Using command alter database open
restrict;
No.
8. While creating database can you specify more than one datafile for SYSTEM
Tablespace?
Yes
10. What are the minimum parameters should exist in the parameter file (init.ora)?
DB NAME - Must set to a text string of no more than 8 characters and it will be stored inside the
datafiles, redo log files and control files and control file while database creation.
DB_DOMAIN - It is string that specifies the network domain where the database is created. The
global database name is identified by setting these parameters
(DB_NAME & DB_DOMAIN) CONTORL FILES - List of control filenames of the database. If
name is not mentioned then default name will be used.
Page 10 of 63
11. How do you get the create syntax of a table or index or function or procedure?
Select dbms_metadata.get_ddl('TABLE','EMP','SCOTT') from dual;
13. What are the different modes of mounting a Database with the Parallel Server?
Exclusive Mode If the first instance that mounts a database does so in exclusive mode, only that
Instance can mount the database. Parallel Mode If the first instance that mounts a database is
started in parallel mode, other instances that are started in parallel mode can also mount the
database.
16. How many redo logs should you have and how should they be configured for
maximum recoverability?
You should have at least three groups of two redo logs with the two logs each on a separate
disk spindle (mirrored by Oracle).
Page 11 of 63
5. Tablespace Management
1. What is a Tablespace?
A database is divided into Logical Storage Unit called tablespaces.A tablespace is used to
grouped related logical structures together
read-only
No
Page 12 of 63
Transportable Tablespaces (TTS) allows you to copy a set of datafiles for a tablespace on one
database and plug that tablespace into a different database.As we noted, you cannot transport
a single partition of a table without transporting the entire table. Therefore, we will need to
exchange the partition with a stand-alone table temporarily, so that the partition becomes its
own table.
Page 13 of 63
6. Storage Parameters
1. What is an Extent?
An Extent is a specific number of contiguous data blocks, obtained in a single allocation, and
used to store a specific type of information.
2. What is a Segment?
It is a space demanding object created by user. A segment is a set of extents allocated for a
certain logical structure.
3. What is the package and procedure name to conver dmts to lmts and vice
versa?
Exec dbms_space_admin.tablespace_migrate_from_local(TS1)
Exec dbms_space_admin.tablespace_migrate_to_local(TS1)
4. What is the value for the storage clause pctincrease when the tablespace
extent management is local (uniform)?
0%
Page 14 of 63
Page 15 of 63
7. User Management
1. Can objects of the same Schema reside in different tablespaces?
Yes.
3. Is CONNECT a system privilege or a role? If the answer is 'a role', what system
privileges are assigned to this role by default?
It is a role .create session.
Page 16 of 63
21. What are the roles and user accounts created automatically with the
database?
20 roles are created, 7 user accounts are created when database is created manually
Page 17 of 63
27. How do you get you demo files get created in your user?
$ORACLE_HOME/rdbms/admin/utlsampl.sql, edit and execute this script
8. Undo Management
Page 18 of 63
1. Tell me about ORA 1555 and how do you address if you get this error?
It usually occurs after queries or batch processes have been running for a long time, which
means you can lose many hours of processing when the error crops up.There are three
situations that can cause the ORA-01555 error:
A. An active database with an insufficient number of small-sized rollback segments
B.A rollback segment corruption that prevents a consistent read requested by the query
C.A fetch across commits while your cursor is open
3. What is the view to see UNDO for how much data flushed out and how much
data it having now.how many active blocks, expired blocks?
V$undostat
6. What are the init parameters you have to set to make use of undo
management?
undo_tablespace= undotbs1
undo_management= auto
undo_retention= time in minutes
comment rollback_segment
9. Flashback Technology
Page 19 of 63
6. Can any user present in dictionary managed tablespace use recycle bin?
No
Page 20 of 63
10. Networking
Page 21 of 63
2. What is the default location for tnsnames.ora and sqlnet.ora files and if you
don't find them there, where do you look?
$ORACLE_HOME/network/admin/samples
Page 22 of 63
7. What is snapshot?
Snapshot is an object used to dynamically replicate data between distribute database at
specified time intervals.
Page 23 of 63
Page 24 of 63
5. What happens when archive log destination becomes 100% full when the
database is running in ARCHIVELOG mode? How do you recover?
The database gets shutdown. We should move old archives to different location and startup the
database.
7. What is a stale?
The redolog file which has not been used yet
8. How many maximum control files you can create in Oracle database?
What is the error number you get if u tries to create more than 8?
8, ora 208
11. If you want to maintain one more archive destination which parameter you
have to set?
Its a dynamic parameter you have to set log_archive_dest_1=
Page 25 of 63
14. What is the parameter allows you to create max no. of groups?
In controlfile recreation script , maxlogfiles=
19. How to implement the multiple control files for an existing database?
Shutdown the database
Copy one of the existing control file to new location
Edit init.ora file by adding new control filename
Restart the database.
Page 26 of 63
Page 27 of 63
3. Which parameters are to by set in parameter file to create database for OMF?
db_create_file_dest =
db_create_online_log_dest_1 =
8. Can we start database with pfile when both spfile and pfile present in dbs
directory?
Yes, Startup pfile=$ORACLE_HOME/dbs/init$ORACLE_SID.ora
11. What is the difference between the values DEFERRED and IMMEDIATE?
DEFERRED means changes reflected from next connecting session .IMMEDIATE means
changes reflected to all connected as well as connecting sessions.
Page 28 of 63
EXPDP itself will now compress all metadata written to the dump file and IMPDP will
decompress it automaticallyno more messing around at the operating system level.
Give Compress=Y in the parameter file of export file.
Page 29 of 63
19. If you have exported full database using EXP utility and while importing can I
import only one table from full exported file?
Yes
Page 30 of 63
3. How do you restore and recover a datafile while the database is up and
running?
Make the datafile offline, restore and recover datafile, make the datafile online;
Page 31 of 63
14. Explain the difference between a hot backup and a cold backup and the
benefits associated with each.
A hot backup is basically taking a backup of the database while it is still up and running and it
must be in archive log mode. A cold backup is taking a backup of the database while it is shut
down and does not require being in archive log mode. The benefit of taking a hot backup is that
the database is still available for use while the backup is occurring and you can recover the
database to any point in time. The benefit of taking a cold backup is that it is typically easier to
administer the backup and recovery process. In addition, since you are taking cold backups the
database does not require being in archive log mode and thus there will be a slight performance
gain as the database is not cutting archive logs to disk.
15. You have just had to restore from backup and do not have any control files.
How would you go about bringing up this database?
I would create a text based backup control file, stipulating where on disk all the data files where
and then issue the recover command with the using backup control file clause.
Page 32 of 63
16. RMAN
1. Which role you grant to rman user while configuring rman user
Recovery_catalog_owner role.
2. Temporarily recovery catalog database (for RMAN) is down. Can you still run a
backup? How?
Yes, using no catalog mode
3. You have run a backup of database using RMAN nocatalog. How do you sync
the recovery catalog with the metadata about the backup that was taken?
Resync catalog
6. We have rman backup. can we restore it without using rman and run the
Db?
No
11. How do u set crontab to delete 5 days old trace files at daily 10'0 clock?
crontab e 0 10 * * * /usr/bin/find /disk2/oradata/prod/diag/rdbms/prod/prod/trace -name "*.trc"
-mtime +5 -exec rm -rf {} \; save and exit (wq!)
12. From RMAN, how do you check if an archive log file is backedup to tape or
not?
Report need backup;
Page 33 of 63
Page 34 of 63
5. What are the values that can be specified for OPTIMIZER MODE Parameter?
All_rows,rule,first_rows_1000,first_rows_100,first_rows_10,first_rows_1,choose,first_rows.
6. When you enable tracing for a SQL statement, where do you look for the trace
files?
Page 35 of 63
9. What are the values that can be specified for OPTIMIZER MODE Parameter?
All_rows and rule.
14. How do you check the locks in the database and determine if there is any
deadlock issue?
Transaction deadlocks occur when two or more transactions are attempting to access an object
with incompatible lock modes. The following script can be used to identify deadlocks in the
database. The query depends upon objects that are created by the script
ORACLE_HOME/rdbms/admin/dbmslock.sql. Log on as SYS or with SYSDBA authority and run
this script in all databases
Page 36 of 63
1.uptime cmd
2.top
3.who -b
Page 37 of 63
7. When 100 users connect to database,Hw u see which statement is taking long
time and which statement is doing physical reading in Performance Tuning?
By using explain plan or TKPROF
Page 38 of 63
9. What is the cache hit ratio, what impact does it have on performance of an
Oracle database?
For the buffer cache hit ratio, it calculates how often a requested block has been found in the
buffer cache without requiring disk access. This ratio is computed using data selected from the
dynamic performance view V$SYSSTAT. The buffer cache hit ratio can be used to verify the
physical I/O as predicted by V$DB_CACHE_ADVICE.
12. What would you do to increasing the buffer cache hit ratio?
If the hit ratio is below 90%, and the dictionary cache has been tuned, increase the init.ora
parameter DB_CACHE_SIZE to increase the buffer.
Page 39 of 63
3. How do you find the files whose are more than 500k?
fnd . -name "*" -size +500k
6. What is PGA?
A PGA is a memory region that contains data and control information for a server process. It is
nonshared memory created by Oracle Database when a server process is started. Access to
the PGA is exclusive to the server process. There is one PGA for each server process.
Background processes also allocate their own PGAs. The total memory used by all individual
PGAs is known as the total instance PGA memory, and the collection of individual PGAs is
referred to as the total instance PGA, or just instance PGA.
Page 40 of 63
usage, the use of system resources to inspect, identify and solve problems.
(2). Every space on the expansion of the database objects, data growth monitoring, health
checks done on the database, the state of the database objects for check-ups.
(3). Monthly tables and indexes, etc. Analyze, check the list of space debris, looking for
opportunities for performance tuning the database, the database performance tuning, space
management plan proposed by the next step. ORACLE database on the state to conduct a
comprehensive inspection.
Daily work
(1). Make sure all the INSTANCE state normal landing to all databases or routine testing
ORACLE background process:
$ Ps-ef | grep ora
(2). Check the file system using the (free space). If the file system free space is less than 20%,
need to delete unused files to free space. $ Df-k
(3). Check the log files and trace files record alert and trace files for errors.
(4). Check the validity of the database using rman utility .
(5). Check the state of the record data file is not "online" data file and do recovery.
Select file_name from dba_data_files where status = 'OFFLINE'
(6). Monitor database performance running bstat / estat report generation system or use
statspack to collect statistical data
(7). Inspection database performance, records database, cpu use, IO, buffer hit ratio, etc. to use
vmstat, iostat, glance, top, etc. command
Page 41 of 63
Undo
8K
2. Where can one find the high water mark for a table?
There is no single system table which contains the high water mark (HWM) for a table. A table's
HWM can be calculated using the results from the following SQL statements:
SELECT BLOCKS FROM DBA_SEGMENTS
WHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);
ANALYZE TABLE owner.table ESTIMATE STATISTICS;
SELECT EMPTY_BLOCKS
FROM DBA_TABLES
WHERE OWNER=UPPER(owner) AND TABLE_NAME = UPPER(table);
Thus, the tables' HWM = (query result 1) - (query result 2) - 1
4. You have 4 instances running on the same UNIX box. How can you determine
which shared memory and semaphores are associated with which instance?
Ipcs
SQL> oradebug setmypid
SQL> oradebug ipc
SQL>oradebug tracfile_name
5. When looking at v$sysstat you see that sorts (disk) is high. Is this bad or
good? If bad -How do you correct it?
If you get excessive disk sorts this is bad. This indicates you need to tune the sort area
parameters in the initialization files. The major sort are parameter is the SORT_AREA_SIZE
parameter.
Page 42 of 63
the buffer cache, Stream pool, Java pool size, Shared pool size and large pool are managed by
Oracle.
SGA_MAX is the Maximum possible size of SGA allowed when you enable ASMM. SGA_MAX
cannot be changed dynamically. If you raise the SGA_target to more that SGA_MAX you will
get error.
Page 43 of 63
3. If you want to configure shared servers which three parameters you need to
specify in init.ora file?
LOCAL_LISTENER, SHARED_SERVERS ,DISPATCHERS.
Page 44 of 63
DISPATCHER configures dispatcher processes in the shared server architecture. The parsing
software supports a name-value syntax to enable the specification of attributes in a positionindependent, case-insensitive manner.
22. Installation
1. What is SHMMAX in /etc/system file of Solaris?
Set shmsys:seminfo_shmmax=4294967295
Page 45 of 63
3. Can one user install different oracle software versions like 8i,9i,10g?
Yes
6. Can you create multiple databases using one operating system login id?
Yes
7. What is difference between 32-bit and 64-bit O/S?
The terms 32-bit and 64-bit refer to the way a computer's processor (also called a CPU),
handles information. The 64-bit version of Windows handles large amounts of random access
memory (RAM) more effectively than a 32-bit system.
8. Compatible parameter using for oracle version .it is giving in parameter file?
This parameter allows you to use a new release, while at the same time guaranteeing
backward compatibility with an earlier release (in case it becomes necessary to revert to the
earlier release).it is given in pfile.
12. How do you check the Solaris Server configuration like amount of physical
memory, number of CPUs?
Prtdiag
13. If our $O_H filled up with core files,what actions we will take?
Remove all old core files and create space in the filesystem.
Page 46 of 63
14. Where do you get to know the version of your oracle software and what is
your version?
From v$version(field is banner) and the version is 9.2.0.1.0
16. Where all oracle homes and oracle sid information available?
/etc/oratab
17. What are Smaphores?
A semaphore is a value in a designated place in operating system (or kernel) storage that each
process can check and then change. Depending on the value that is found, the process can use
the resource or will find that it is already in use and must wait for some period before trying
again. Semaphones can be binary (0 or 1) or counting.
Page 47 of 63
1. What is Assm?
Automatic segment space management (ASSM) is a simpler and more efficient way of
managing space within a segment. It completely eliminates any need to specify and tune the
pctused, freelists, and freelist groups storage parameters for schema objects created in the
tablespace. If any of these attributes are specified, they are ignored.
2. What is Asmm?
ASMM (Automatic Shared Memory Management) is the collective name for the dynamic
memory allocation technologies added in Oracle 9i and improved with each subsequent release.
This reduces the amount of manual configuration required and allows the database to adapt to
workload changes.
Page 48 of 63
Prior to Oracle Database 10g, the tools available for monitoring and setting up notifications
regularly polled the database to monitor its space usage. Querying space usage information
requires collecting data about the state of the database state that is constantly changing in a
production system. Because such queries are inherently expensive, the space monitoring tools
typically run them infrequently, once a day or once every couple of hours. When they are run,
the queries steal CPU, IO and memory (especially the buffer cache) resources away from
critical business activity in the production system. Its a health check that is either late or hurts
the health of the system or worse, both!
Page 49 of 63
1. How do you findout the most recent log applied to physical standby?
SELECT SEQUENCE#, APPLIED FROM V$ARCHIVED_LOG;
5. How do you troubleshoot if you suspect any problems with archive log
shipping to standby database?
Check for network configuration and standby archive location specified in primary init.ora
Page 50 of 63
Shut immediate
Startup mount
Alter database open resetlogs;
Alter database start logical standby apply immediate;
Page 51 of 63
16. How do you perform the switch over from primary to standby and standby to
primary?
Prod>>select switchover_status from v$database; To_standby
Prod>>alter database commit to switchover to standby;
Standby>>alter database commit to switchover to primary;
Standby>>alter database open;
17. Give me the Top 5 init parameters which need to be setup in the target db in
the physical standby config?
Fal_server=to_stand #tns service of prod
Fal_client=to_prod #tns service of standby
Log_archive_dest_1=location=/disk2/oradata/prod/arch #archive log dest of production
Log_archive_dest_1=service=to_stand lgwr sync affirm reopen=10
Standby_file_management=auto
Standby_archive_dest=/disk2/oradata/prod/arch
18. What is Failover and Switchover?
Switchover: The switchover feature provides you with the ability to switch the role of the
primary database to one of the available standby databases. The chosen standby database
becomes the primary database, and the original primary database then becomes a standby
database.
Failover: You invoke a failover operation when a catastrophic failure occurs on the primary
database and there is no possibility of recovering the primary database in a timely manner.
During a failover operation, the failed primary database is removed from the Data Guard
environment, and a standby database assumes the primary database role. You invoke the
failover operation on the standby database that you want to fail over to the primary role.
25. Partitioning
Page 52 of 63
2. How do you check the status of the table whether monitoring or not?
Select table_name, monitoring from dba_table where owner='scott;
3. In which table records of monitoring will be stored?
dba_tab_modificaitons
8. How to move the partition from one TS to other TS? Using Command?
Alter table<tablename> move partition <partition name> tablespace <tablesapce name>
Page 53 of 63
13. How to creating a local index on a range partitioned table using command.
Create Index <indexname> on table <deptno> local;
Indexes
Page 54 of 63
1. What is an Index?
An Index is an optional structure associated with a table to have direct access to rows, which
can be created to increase the performance of data retrieval. Index can be created on one or
more columns of a table.
Page 55 of 63
Applications often have to be modified without being able to bring the complete application
offline. Create invisible indexes temporarily for specialized non-standard operations, such as
online application upgrades, without affecting the behavior of any existing application.
Furthermore, invisible indexes can be used to test the removal of an index without dropping it
right away, thus enabling a grace period for testing in production environments.
Page 56 of 63
Page 57 of 63
Page 58 of 63
5. From where we can get archivelog contents which logminer has digged?
Query the V$LOGMNR_CONTENTS view.
6. What is the usage of mine_value? The following usage rules apply to the
MINE_VALUE and COLUMN_PRESENT functions:
1. They can only be used within a Log Miner session.
2. They must be invoked in the context of a select operation from the V$LOGMNR_CONTENTS
view.
3. They do not support LONG, LONG RAW, CLOB, BLOB, NCLOB, ADT, or COLLECTION
datatypes.
Page 59 of 63
There are three basic objects in a Log Miner configuration that you should be familiar
with: the source database, the Log Miner dictionary, and the redo log files containing
the data of interest:
The source database is the database that produces all the redo log files that you want
Log Miner to analyze.
The Log Miner dictionary allows Log Miner to provide table and column names,
instead of internal object IDs, when it presents the redo log data that you request.
Log Miner uses the dictionary to translate internal object identifiers and datatypes to
object names and external data formats. Without a dictionary, Log Miner returns internal
object IDs and presents data as binary data.
9. What are Log Miner dictionary options?
Using the Online Catalog: Oracle recommends that you use this option when you will have
access to the source database from which the redo log files were created and when no changes
to the column definitions in the tables of interest are anticipated. This is the most efficient and
easy-to-use option.
Extracting a Log Miner Dictionary to the Redo Log Files: Oracle recommends that you use
this option when you do not expect to have access to the source database from which the redo
log files were created, or if you anticipate that changes will be made to the column definitions in
the tables of interest.
Extracting the LogMiner Dictionary to a Flat File:This option is maintained for backward
compatibility with previous releases. This option does not guarantee transactional consistency.
Oracle recommends that you use either the online catalog or extract the dictionary from redo log
files instead.
Page 60 of 63
3. A table deleted by a user, how u come to know which user was deleted?
If he deleted alert log file also how u come to know?
By using AUDITING.
4. What are the different Levels of Auditing?
Statement Auditing, Privilege Auditing and Object Auditing.
5. What is Statement Auditing?
Statement auditing is the auditing of the powerful system privileges without regard to specifically
named objects
Page 61 of 63
most difficult security problems remaining today, protecting against insider threat and meeting
regulatory compliance requirements.
13. A file consists of 10 records. How can you load 5th and 6th records.
Sqlloader control=<controlfilename> skip=4 load=2
15. Can you insert some records for a non empty table?
No. It is not possible to insert the table should be empty
Page 62 of 63
4. It is possible to use raw devices as data files and what are the advantages over
file system files?
Yes. The advantages over file system files. I/O will be improved and database performance will
increase.
Page 63 of 63