Professional Documents
Culture Documents
1. How many databases you support. What is the platform? Are you familiar
with windows environment?
Two databases I support and size is 400 GB, Linux / oracle 9i. Yes, I am
familiar with windows environment.
I will give the path (URL), so that some users are connected to Node A and
similarly some users are connected to Node B.
5. I have a redo log that is corrupted and how will I get repair / rectify the redo
log?
I will rollback to a previous transaction. I will create a redo log of bigger size
and I will do log switch and when the present redo becomes deactive and the
new redo log becomes active then I will delete the old redo log.
If the redo log is corrupted then I will not be able to do a log switch. In such
scenario, I have to rollback the old redo log to a previous transaction.
6. There are certain blocks that are corrupted? How will I rectify the corrupted
blocks?
I will use this view V$block_corruption and then I will come to know which
blocks are corrupted and then I will rectify the corrupted blocks.
This is the rman setup that you talking about, if rman setup is not there, how
you will rectify the corrupted blocks.
7. Are you familiar with ITIL certification? Are you aware with the concepts?
1
8. One client has got the problem the computer is working slowly? How will you
rectify the problem?
I will login through remotely through remote desktop connection- I will delete
cookies, fragmentation wizard – data is consolidated at one location.
Wait event queue – It means that certain processes that are running are time
consuming. Processes are waiting for certain resources to get free.
3. The result of v$ views that you get where it is stored and from where it is
fetched from?
The result of V$ views is stored and retrieved from Data Dictionary views.
You need to support the client on 24x7 basis. Databases you have to support
will be in 9i/10g /Linux/windows environment. The client gets registered and locks
a compliant and will be issued a ticket no. The client’s problem you have to
rectify on ticket basis.
• Tell about your qualification and current project that you are working.
WHO ERP is being rolled out and implemented in WHO SEARO region.
The platform is in oracle and ERP is being developed by satyam
computers. My present profile involves training of personnel’s, monitoring
of oracle database 24x7 support , resolving user’s queries and maintaining
Oracle database. Development of MIS. (In-house development of
application)
2
• Are you working on production environment / application support?
PCTfree is the no of blocks that are free in the data file and pctused is the
no of blocks that are being used in the datafile. Suppose I have a upper
limit that when the PCTused become 80% then I have to increase the size
of datafile or add another datafile. Datafile is the physical structure and
tablespace, segment, extent, oracle blocks; OS blocks are logical unit of
database.
• How you will calculate the database size? What command I will run
to find it?
• The CPU is being utilized 90% or above 90%? What measures I will
take to improve the performance of database?
3
• How you will check the connectivity status?
• If I change the block size then how it will affect the performance of
database?
If I change the default block size then it will badly affect the performance
of database badly.
8 OS blocks = 1 Oracle block
8 Oracle Block = 1 extent
8 extent = 1 segment
8 segment = 1 tablespace
1 tablespace is a logical unit, 1 data file is physical unit
In a database there can be maximum 1024 tablespace and 1024 data file
Init.ora is the file where initial parameters are defined. Spfile is the
dynamic parameter file and pfile is the static parameter file. I can make
changes to the pfile and then apply the alter command and make the
changes implemented to the database dynamically through spfile.
4
3. How you will resolve user queries?
6. If you have to upgrade the client database how you will do it.
I will send the link to the client by email. The client will click on the link; the
database upgrade will start automatically.
7. In past six months, you have encountered any problem and how you
resolve it.
List out differences between Oracle Server 9i and Oracle Server 10g.
10 G supports grid computing ASM (Automatic storage management) and
Memory management.
Oracle 10g is higher version of 9i Oracle 10g has added a following features
5
Support for bigfile tablespaces that is up to 8 Exabytes in size
Data Pump - faster data movement with expdp and impdp.
List out differences between Oracle Server 9i and Oracle Server 10g.
Network Management
• Back Up Directory Naming Entries to Local Naming File.
• Dynamic Connection Manager Configuration.
• Easy Connect Naming Method.
• Improved Network Outage Detection.
• Automatic LDAP Discovery for Clients.
• Improved Connection Manager Access Rules.
• Automatic Shared Server Configuration.
• Simplified Shared Server Configuration Parameters.
Manageability Infrastructure
• Database Features Usage Tracking.
• Enhanced Database Time Model.
• End-to-End Application Tracing.
• JDBC: End-to-End Tracing.
• SYSAUX Tablespace.
• Automatic Routine Administration Tasks.
• Server-Generated Alerts.
• Automatic Workload Repository.
• Enhanced Wait Model.
• Threshold-Based Alerts.
Storage Management
• Multiple Default Temporary Tablespace Support for SQL Operations.
• Automatic Storage Management.
• Rename Tablespace.
6
• Eliminate Duplicated Columns in Index on an Index-Organized Table.
• Configurable TCP/IP Send and Receive Buffer Size.
• Single-Set Aggregates in DML Returning Clause.
• High-Speed Infiniband Network Support.
• Sorted Hash Clusters.
• Windows Fiber Support.
• Optimized 64-bit Database.
• SQL Tuning Advisor.
• SQL Access Advisor.
• Materialized View Tuning API.
• Automatic Optimizer Statistics Collection.
Improved Administration
• DML Support in FGA.
• Communication over SASL.
• Unified User Model.
• Easy Database Registration.
• Extended and Uniform Audit Trail.
• Oracle Label Security Directory Integration.
7
• Support Vector Machines (SVM).
DB1 DBII
Node 1 Node II
$ top (top command will tell each user particular process, how much time is used
by a particular process). I delete / kill the process that is consuming 60% of
memory.
$ df –h
Df – disk file
The command shows / tells the DBA how much space is available in the data file
or not.
8
III Command to kill a particular process
$ kill -9 process no
VI I use to clear the archive log through OEM. 1 week archive log I use to
maintain – username/password
OEM login – username/password
Server name files gets listed.
Q In alert log, what problem you face & how you resolve it.
Information
Oracle application-SRM, SUN, ERP
ITIL –email task & data center (how to manage)
9
Q. Information Technology Infrastructure library (ITIL)
Q. How you will decide the spacing requirement of your database if your
database size is 400GB and it is growing at the rate of 10 gb per month.
How you will decide the future spacing requirement.
10
Alter Database
Datafile ‘/u01/oradata/userdata02.dbf.dbf’ resize 5M;135
6. What is PGA_Aggregate_Target
V$instance
11. I have created a database that has no pfile, I what to view system
parameters.
12. Tell me any situation in which your database has faced any problem.
11
14. OEM / Sql prompt from where you work.
Emp
Name DOB
Xyz 1-dec-1979
100 records are appearing. HR whats to celebrate bday of those
employees whose bday falls on todays date.
Select name
From emp
Where trunc to_year(‘sysdate’) = trunc to_year(‘DOB’);
Check this query.
Your query will display list of employees who born on today. Drop year portion
RRRR in your query to display list of employees whose birthday falls on todays
date.
select * from emp where to_char(dob,'ddmm')=to_char(sysdate,'ddmm');
Hot backups are when database is up and running you take backup(DB has to be
in archive log mode in order to do that.) Cold backups are shutdown the
database and copy data files, control files and save them some place safer(on a
different server) Good dba should do that at least once a month. When you rman
backups benefit is that it only backup blocks that have been used, empty data
block does not get backed up. This is very efficient as far as space issues go.
12
6. How will you tune SQL?
I will tune my SQL through Query Analyzer.
10. Explain all Codd rule.(ACID Properties). 9i & 10 G how many rules are
satisfied.
11.5 rules are satisfied in 9i & 10G.
1. How many servers do you have in your company. What is the Server
Configuration. How many CPUs you have. What kind is the kind of setup.
Whether it is Client Server, Internet Based.
I have 2 servers & I have 30 CPUs The setup is Internet Based.
2. How you spend a day as a DBA. (DBA activities)
3. Whether you have done any backup /recovery.
4. When was your last database was shutdown. Why it was shutdown. (due
to maintenance work) What kind of maintenance work.
Daily my Database gets shutdown. I have an 8 hrs shift. I take incremental
backup daily.
5. For errors which file you look (alert log). Tell me any errors you encounter
and what precautionary step you took.
6. When you take backup. (Evening 6 O’clock). What is your backup strategy
(daily, weekly, monthly).
The backup strategy is daily.
13
10. What is a failover Server? What kind of setup you have in your company.
Server configured: hardware clusters, Active/ passive, RAC implemented.
12. Whether you take backup on servers or Disk/ tape. Whether there is enough
space on servers.
(I take backup on tape. The is rewritable.)
14
TCS
Veritas
4. Question relating to 1115 error.
5. Question relating to 257 error.
6. What is simple replication and advance replication. Difference between
the two. How can we do simple replication.
7. What are snapshots / materialized views.
8. What are different types of materialized views.
(Refreshing, Force)
9. What are triggers. What are different types of triggers.
10. What is a mutating error? How can we overcome this error.
(Developer Section)
11. I have configured sqlnet file. Which file I will configure on client machine.
(tnsnames.ora)
12. I have a control file that is corrupted. The Junior corrupted the control file
while playing this command: alter system copy control file. DBA was
informed that all my copies of control files are corrupted. Now how will you
recover the lost control file.
Ans. I will recover from trace file. I will copy the trace file. I will shutdown the
database & then start the database.
10. I have two redo logs. How can I increase the size of redo log.
Ans. I will create the redo logs (new) of bigger size. I will make a log switch (alter
system switch log file;), when present redo log become inactive. I will delete the
old redo log. Now the new bigger redo log will become active.
11. How will I look for system statistics(at OS level & Database level) and how
will I get to know how many instances are up. (V$instances, V$Database)
12. Which parameter info I will look for in order to know my system statistics.
V$sgastat.
15
13. The ratio of disk (sort) is high. Whether it is good or bad. Why. How will I
reduce disk(sort).
Ans. The disk sort is bad.
14. I have increased the SGA size. The users are connected online. There is
heavy load. The database performance is terrific. How will I overcome this
problem?
15. I am taking a hot backup of database. I have not started the archiving. The
database is not in archive log mode. What problem I will encounter. The redo
logs are not being archived.
Ans. I can’t take hot backup my database until I will start archiving of database. I
have to put my database in archive log mode.
16. To see what are the initialization parameters. Which file I will look for.
Parameter file and init.ora
17. I have encountered some errors. Which file I will refer for errors (alert log). If I
have to look for detailed information about particular error, which file I will look
for.
Ans. For background Processes refer trace file of each process for detailed
information.
Others Questions
Info: The Hot backup is online backup. When I will start rman I have to start
archiving. Rman does’t work without being in archivelog mode. So we can’t take
hot backup without starting archiving. Current redo logs need to be archived. So
it has to be in archivelog mode.
In user managed backup, I have to take database in mount state. Then only I can
take offline backup(Cold Backup).
16
The current redo logs, I can’t increase the size of online redo logs. I have to do
log switch(alter system switch logfile). Stop archiving and then create new redo
logs with increased size.
I can increase the size of redo logs that our offline. It means that they are not
current. If we have more than 2 redo logs, in that case we can increase the size.
Telephonic Round
1. What is Oracle. What is the difference between Oracle/SQL Server. SQL also
provides security features. What is the key difference between the two.
4. Whether I can take hot backup while my database is not in archivelog mode.
(No, We have to start archivelog, inorder to take hot backup. Online backup is
only possible while my database is in archivelog mode and I have started
RMAN.)
17
tuned my SQL Queries then 70% of my performance tuning is done. (I should
avoid using HAVING/ BETWEEN clauses. It slows down my database
performance.) I monitor my database through various V$ views Like V$instance,
V$database, V$sgastats. How much CPU space is consumed by different
database objects. I generate Stats pack report. I look for errors in the alert log
file. It actually reflects the health of database.
Ques: Show one instance one you have encountered an error in alert log and
you overcome that error. What actions you took to overcome that error.
Ques. Tell me any instance when your database encountered any problem. How
you dealt with that problem.
18
DBMS_meta_data Parameter
DBMS_meta_data. This parameter is very usefull. What you infer from this
parameter. What info you will find in that. explain in detail.
What is a flash back query? This feature is also available in 9i. whats the
difference between 9i and 10g (related to flash back query).
Oracle 10g offers significant enhancements that help insure the high availability
of any Oracle database, as well as improvements in the database disaster
recovery arena. This paper explores one of the most intriguing new features of
Oracle 10g: Flashback Backup and Recovery. Oracle 9i provided the capability to
"Flash back" to a prior view of the database via queries performed against
specific logical entities. This capability was limited, of course, by the amount of
UNDO data retained in the database's UNDO segments and bounded by the time
frame specified by the UNDO_RETENTION initialization parameter. Oracle 10g
expands these logical flashback capabilities significantly.
You have a database. You have a datafile and some blocks are corrupted in the
datafile. What statement will you issue to know how many blocks are corrupted?
You can check the "V_$DATABASE_BLOCK_CORRUPTION" view to
determine the corrupted blocks
• If you have RAC and data guard concept that will be better for your
selection. Because all need same requirements. At least take a basic concept
of same topic.
19
General questions
What is the difference apps dba and core dba? What applications are
managed by application dba?
App DBA means you have to knowledge about application like PL-SQL, and
oracle application but in core DBA you have to manage only oracle database.
which is better apps dba / core dba. Which has higher demand.
Both are better. Apps DBA is good. App DBA + Core DBA = App DBA. It has
a dual advantage. If you will give interview of Apps DBA then they will ask lots
of things related to application.
I have a table emp and it has 150 associated child table. I have to drop the
emp table with all associated child table in a single syntax. (It means that
there are associated child records in the base table that would not allow you
to delete the base /primary table.)
I have applied indexes on views and can I save the result of the view that is
retrieved.
Read this concept for HWM :- just create a table with 1,000,000 rows (or
create any table with a large number of rows), and then execute a SELECT
COUNT(*) from this table. Now, DELETE every row in it and you will find that
the SELECT COUNT(*) takes just as long (or longer, if you need to clean out
the block! Refer to the 'Block Cleanout' section of Chapter 9) to count 0 rows
as it did to count 1,000,000. This is because Oracle is busy reading all of the
20
blocks below the HWM to see if they contain data. You should compare this
to what happens if you used TRUNCATE on the table instead of deleting
each individual row. TRUNCATE will reset the HWM of a table back to 'zero'
and will truncate the associated indexes on the table as well. If you plan on
deleting every row in a table, TRUNCATE. There is a good concept in DB1 for
HWM- High Water Mark.
A query is run on 2-3 tables, & data is retrieved from 2-3 tables. Earlier the
query use to run 15 seconds, but now it takes 1 hour to run. As a DBA what
all appropriate steps you will take? Why such a thing happen. What are the
reasons behind it?
What is default optimizer mode in 10 G.? If you use CHOOSE parameter it
will also use CBO as default optimizer. RBO is almost obsolete parameter
now.
Some blocks are corrupted. How will I find that which blocks are corrupted
V$block_corruption, how will I rectify those blocks. If block is corrupted then I
will not be able to retrieve the data. How will I repair corrupted blocks. What
are steps involved in that. I will retrieve corrupted block no. and I will retrieve
data from redo log and archive log.
I have made use of explain plan. Where is the analyses report stored and
from where it is retrieved. Plan_table syntax that is being used. I can fetch the
statistics report from table_analysis.
DBA will analyze the table. It is a routine analysis that is being done as a part
of dba activity. There are some reasons behind it. Why dba analyze the table
on routine basis. In production environment table_analysis is a part of dba
activity.
May be HWM is the cause of same issue. So as to resolve same issue. Move
the table and rebuild then it will not take much time.
21
Oracle India 18 June 2010
What are the different types of pool in 9i SGA. Which is the biggest pool in
SGA you think?
1 MB redo is generated
1/3 of redo log buffer is full
Before DBWR writes to data file
LGWR will write to redo log file then DBWR will write to data file. Once a
transaction is committed then it can’t be rolled back.
What is automatic_Undo_Management?
Data file, control file, redo log file, Alter Log, Password file, Pfile (static
init.ora), SP file (dynamic), trace file.
22
In Oracle is it essential to take backup through RMAN? Whether I can take
incremental backup of the DB through user managed backup?
No, it is not essential to take backup through RMAN. I can take user managed
backup also. But RMAN provides facility through which I can take incremental
backup of the DB.
No, I can not take incremental backup of the DB through user managed
backup.
Incremental backup of the database means that I have taken full backup of
DB today and tomorrow when I will take backup of DB then I can take
incremental backup of the database ie only those blocks will be updated on
which some changes have been performed. It is less time consuming.
How you take backup on disk / tape? You can take backup of DB directly on
disk & no need to configure the software.
I take backup on rewritable tape. You can not take backup directly on tape
through RMAN, MML has to be configured?
It is mandatory to configure MML. Software provided by VERITAS, Tivoli, has
to configured with database. What is the name of software?
Level zero backup is the complete backup of the DB. Level 1 backup is the
incremental backup of DB when changes have taken place from the time level
zero to till the time I am taking level 1 backup only those blocks will be
updated in the database. Similarly is the concept hold true for level 2 backup.
PT
The db is running slowly now you will do as a dba?
I will go the alert log file. Where is the alert log file? Alert log file will be
situated in background dump destination. Alert log only provide info about the
events and not about transactions.
I can also refer trace file for additional info.
Where is the trace file located specify destination.
First of all you need to activate the trace file. Auto_trace_on = true. I will make
changes in pfile / spfile. The trace file grows too big in a short span of time
and it is difficult to manage. Trace file have to be converted into readable
format.
23
What is stats pack report? What is the first thing you will look for in statspack
report?
I will look for the load profile information. What is the load on the server, when
the transactions are fired on the DB?
The alert log file consists of chronological log of messages and errors.
• Check the alert log regularly to:
o Detect internal errors (ORA-600) and block corruption errors
o Monitor database operations
o View the non default initialization parameters
• Remove or trim the file regularly after checking
Each oracle instance has an alert log. If not already created, it is created during
instance startup. The alert log file must be managed by the DBA. It continues to
grow while the database continues to work. The alert log file should be the first
place you look when diagnosing day to day operations / errors. The alert log file
also contains pointers to trace files for more detailed information.
24
• The start up of background processes
• The thread being used by the instance.
• The log sequence no LGWR is writing to
• Information regarding a log switch
• Creation of tablespace and undo segments
• Alter statements that have been issued
• Info regarding error messages such as ORA-600 and extent errors.
• The alert_SID.log location is defined by the BACKGROUND_DUMP_DEST
initialization parameter.
There are about 290 wait events in the oracle server including:
• Free Buffer wait
• Latch free
• Buffer Busy Waits
• DB file sequential read
• DB file scattered read
• DB file parallel write
• Undo segment Tx slot – Transaction –Tx
• Undo segment Extension
Buffer busy wait event – The buffer busy wait event records waits for a buffer
to become available. This wait indicates that there are some buffers in the
buffer cache that multiple processes are attempting to access concurrently.
25
• File# and Block#: These parameters identify the block no in the data file
that is identified by the file number for the block for which the server
needs to wait.
• ID: The buffer busy wait event is called from different places in the
session. Each place in the kernel points to a different reason. ID refers to
the place in the session calling this event.
The log file switch (checkpoint incomplete) event- The log file switch
(checkpoint Incomplete) waits for a long switch because the session can
‘t wrap into the next log. Wrapping can’t be performed because the
checkpoint for that log has not completed. This event has no parameter.
• V$Session_event: Waits for an event for each session that had to wait.
• V$Session_wait - Waits for an event for current active sessions that are
waiting.
• V$System_event -Total waits for an event all sessions together.
Tasks of a DBA
Materialized views
Dbms_mview.refresh.refresh_all_views;
Refresh all materialized views that are due to be refreshed.
26
Dbms_mview.refresh(‘cust_sales’,parallelism=>10);
• Explain_mview
• Explain_rewrite
• Refresh
• Refresh_all_mviews
Views are database objects whose contents are derived from another table.
• A view contains no data of its own.
• The command for creating a view is CREATE VIEW command.
• The changes in the table are automatically reflected in the VIEWS.
When the create VIEW command is executed the SELECT statement which
follows AS is not executed; instead the definition is simply stored in the data
dictionary. A VIEW is queried just like querying a table. Most of the operations
on a table can also be carried out with VIEWS with some restrictions.
Any updations of rows in the table will automatically reflect in the VIEWS. A
user can not distinguish between a table and a VIEW.
The syntax for creating a view is
1. Views restrict access to the database. SELECTING from a view can display a
restricted portion of the database.
2. As a VIEW does not store any data, the redundancy does not arise.
27
3. Critical data in the base table is safeguarded as access to such data can be
controlled using VIEWS by not selecting those columns during the creation of
a VIEW.
4. A VIEW allows users to make simple queries to retrieve the results from
complicated queries. For eg: Views allow users to select info from multiple
tables without knowing how to perform a JOIN.
5. Views provide data independence for adhoc users and application programs.
One view can be used to transparently retrieve data from several tables. Also
views allow the same data to be seen by different users in different ways.
Eg: create a view for the employees belonging to department 20:
Q. Explain all CODD rules (ACID properties) In 9i & 10G how many rules are
satisfied. (11.5 rules are satisfied in 9i and 10 g).
28
12. Integrity Rule
E.F. Codd formulated 12 rules for RDBMS in 1970. In addition to the 12 rules,
there exits a rule, called rule zero, which states-
Q. Difference between CBO (Cost Based Optimizer) and RBO (Rule Based
Optimizer)?
Optimzer Modes
There are two types of optimizer modes:
Rule Based
Uses a ranking system
Syntax and data dictionary driven
RBO
In this mode, the server process chooses its access path to the data by
examining the query. This optimizer has a complete set of rules for ranking
access paths. The RBO is syntax driven, in that it uses the stmt syntax in
combination with data dictionary information about the data structures to
determine which execution plan to use. This optimizer mode is supported for
backward compatibility.
CBO
Chooses the path with lowest cost
Statistics driven
29
In this mode, the optimizer examines each statement and identifies all possible
access paths to the data. The resource cost of each access path is calculated
and the least expensive one is chosen. The cost is based mainly on the no. of
logical reads. The CBO is statistics driven in that it uses statistics generated for
the objects involved in the SQL statement to determine the most effective
execution plan you should use this optimizer mode for new applications,
particularly if they use the parallel query feature, bitmap indexes or bitmap join
indexes.
The default value is choose. This means that the optimizer uses the Cost
Based mode (All_rows) if statistics are available for at least one of the tables
involved. Otherwise it uses Rule Based optimization. The other possible
values are Rule, First _rows, First_rows_n, and All_rows. The first one forces
rule based optimization regardless of the existence of any statistics. The last
two represent different ways of using cost based optimization.
30
The OPTIMIZER_MODE at the session level
You can use the OEM console to maintain stored outlines on a database.
From this manager you can create, drop / modify stored outlines.
Stats pack
Explain Plan
SQL Trace & TKPROF
SQL * Plus auto trace feature
Oracle SQL Analyze (Oracle Expert purchase separate)
Numerous diagnostics tools are available for evaluating the performance of SQL
statements and PL/SQL modules. Each tool provides a developer or DBA with a
varying degree of information.
1. Stats pack
This utility collects info regarding database statistics and SQL statements.
2. Explain Plan
This is executed within a session for a SQL statement.
3. SQL Trace
This utility provides detailed info regarding the execution of SQL Statements.
4. TKPROF
This is an OS utility that takes the output from a SQL Trace Session and
formats it into a readable format.
5. Auto trace
This is a SQL*plus feature. Auto trace generates an execution plan for a
SQL statement and provides statistics relative to the processing of that
statement.
31
1. SQL ordered by Gets (lookup)
2. SQL ordered by Reads
3. SQL ordered by Executions
4. SQL ordered by Parse calls
Statspack give four different views based on SQL statements stored in the
shared pool at the time of either the beginning of snapshot or the ending
snapshot. The report provides these statements in four different sessions.
These reports can be examined to which SQL statements are having the most
impact on the performance of the database. These are the best SQL statements
to tune because tuning them is most likely to improve performance dramatically.
TKPROF Statistics
SQL*plus Autotrace
SQL> @$ORACLE_HOME/sqlplus/admin/plustrce.sql
SQL>Grant plustrace to Scott;
Autotrace syntax
Fast_start_MTTR_Target=600(sec)
Alter system checkpoint;
32
Adding online redo log file group
33
34
35
36
Relocating or renaming online redo log files
1. SQL>SHUTDOWN
2. Copy online redo log files to new location
3. SQL>CONNECT / as sysdba
SQL>STARTUP MOUNT
37
Clearing online redo log files
DB_CREATE_ONLINE_LOG_DEST_1
DB_CREATE_ONLINE_LOG_DEST_2
A group can be added with number file specification
Information about group and its members can be obtained by averaging the following
views:
V$log
V$logfile
Information about archived logs can be obtained from V$Instance
38
Locally Managed Tablespace (LMT)
DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL(‘S
YSTEM’);
UNDO TABLESPACE
39
Alter database
Default temporary tablespace default temp2;
3. How you will rate yourself for Data guard on a scale of 1 to 10.
4. How you will rate yourself for oracle DBA on a scale of 1 to 10.
7. How you will rate yourself in backup and recovery on a scale of 1 to 10.
40
hrs DB got crashed due to h/w electric failure. Now how you will do
point in recovery. Tell me command to do point in time recovery.
The offline backup complete Db till 8 am and I will recover through this
and then I will apply archive logs for 2 hrs. This way I will do point in
time recovery.
9. During hotbackup of DB, why more archive logs are generated than
RMAN.
10.While hot backup was going on DB got crashed. Now how will I start
the DB.
6. In oracle 10g how a data pumped by oracle export / Import utility. How
data is moved explain complete concept. There is a 300 mb of data that
needs to be moved from /to oracle DB.
41
Exp / Imp utility works at OS level.
8. DB size is 60 GB. You have created a new DB 60GB. How you will set the
sga size.
42
This section defines the top five database architectures that address various high
availability business needs. The architectures described are:
43
Text description of the illustration maxav032.gif
The following sections describe each architecture and their advantages in more detail:
Oracle provides HA features that can be used in any of the database architectures. These
features make the standalone database on a single machine attractive and available. These
features are described in Table 4-1. Chapter 9, "Recovering from Outages" describes
when to use these features to resolve different outages, while Chapter 10, "Detailed
Recovery Steps" contains details about how to use the features to recover.
Feature Description
Reduced downtime for • One-step cloning of database objects for faster
application and Oracle online redefinition during upgrades
upgrades • Eliminates PL/SQL package invalidation after
changes to underlying objects
44
Feature Description
and historical data for a specific transaction or for
all transactions within a specific time interval
• Flashback Table recovers a table to its state at a
previous point in time
• Flashback Drop recovers a dropped table
45
Feature Description
Fast-start recovery during Fast-start checkpointing can be used to reduce instance
startup recovery time
Simple and integrated • Easy GUI for installation, set-up, and
management framework with configuration
Oracle Enterprise Manager
• Integrated monitoring and management practices
"RAC only" architecture uses Real Application Clusters and is an inherently high
availability system.The clusters that are typical of RAC environments can provide
continuous service for both planned and unplanned outages. RAC build higher levels of
availability on top of the standard Oracle features. All single instance HA features, such
as flashback technologies and online reorganization, apply to RAC as well.
In addition to the standard Oracle features, RAC exploits the redundancy that is provided
by clustering to deliver availability with n - 1 node failures in an n-node cluster. All users
have access to all as long as there is one available node in the cluster.
46
Text description of the illustration maxav015.gif
Data Guard provides a rich set of HA solutions and addresses the requirements of the
business community for a disaster recovery solution. Data Guard supports Data Guard
Redo Apply and Data Guard SQL Apply technologies to enable two distinct kinds of
standby databases: physical standby database and logical standby database.
47
processing to relieve the load on the production database. The logical standby database
can also be targeted for switchovers, failovers, and rolling database upgrades.
In addition to disaster recovery and data protection, logical standby databases provide the
following benefits:
• Enable the standby database to be open for normal operations with both read-only
and read/write accessibility
• Enable additional objects to be built and maintained
• Enable rolling database upgrades of the production database
A recommended configuration for many cases includes both physical and logical standby
databases. They can reside on the same database machine or cluster, but they should be
remote from the production database. The physical standby database can be reserved for
failovers in case of disaster, and the logical standby database can continue to be used for
reporting. The physical standby database provides a faster apply technology because redo
logs do not have to be converted to SQL.
Figure 4-3 shows the production database at the primary site and the standby databases at
the secondary site.
Figure 4-3 "Data Guard Only" Architecture on Primary and Secondary Sites
48
Text description of the illustration maxav020.gif
See Also:
RAC and Data Guard provide the basis of the database MAA solution. MAA provides the
most comprehensive architecture for reducing downtime for scheduled outages and
preventing, detecting, and recovering from unscheduled outages. The recommended
MAA has two identical sites. The primary site contains the RAC database, and the
secondary site contains both a physical standby database and a logical standby database
on RAC.
49
Identical site configuration is recommended to ensure that performance is not sacrificed
after a failover or switchover. Symmetric sites also enable processes and procedures to be
kept the same between sites, making operational tasks easier to maintain and execute.
Streams Architecture
Streams is meant for information sharing and distribution. It can also provide an efficient
and highly available architecture.
Streams provides granularity and control over what is replicated and how it is replicated.
It supports bidirectional replication, data transformations, subsetting, custom apply
functions, and heterogeneous platforms. It also gives users complete control over the
routing of change records from the primary database to a replica database. This enables
users to build hub and spoke network configurations that can support hundreds of replica
databases.
Streams should be evaluated if one or more of the following conditions are true:
50
• A full active/active site configuration is required including bidirectional changes
• Site configurations are on heterogeneous platforms
• Fine control of information and data sharing are required
• More investment to build an integrated HA solution is available
For disaster recovery, Data Guard is Oracle's recommended disaster recovery solution.
51
Table 4-2 summarizes the advantages of the five basic HA architectures described in this
chapter.
52
Database HA Architecture Advantages
"RAC only" and "Data Guard only" are the most common Oracle HA architectures, and
each provides very significant HA advantages. MAA provides the most redundant and
robust HA architecture. It prevents, detects, and recovers from different outages within a
small mean time to recover (MTTR), as well as preventing or minimizing downtime for
maintenance. The Streams architecture is an alternative high availability solution, but it
requires more customization and may not be as transparent to the application.
You must consider your service level agreements in your decision about which HA
architecture to implement. To decide whether to implement an Oracle HA architecture
that includes RAC or Data Guard, consider the following questions about your service
level agreements:
1. Does your production system need to be available 24 hours each day, 7 days each
week, 365 days each year?
Table 4-3 shows the recommended architecture for each set of answers to the questions.
Answer 1 Answer 3
(Local Site Answer 2 (Rolling (Disaster Recommended
HA) Maintenance) Recovery) Architecture
No No No Database only
Yes No No RAC only
No Yes No Data Guard only
No No Yes Data Guard only
53
Answer 1 Answer 3
(Local Site Answer 2 (Rolling (Disaster Recommended
HA) Maintenance) Recovery) Architecture
Yes Yes No MAA
Yes No Yes MAA
No Yes Yes Data Guard only
Yes Yes Yes MAA
If your business requires any of the following, then you should evaluate Oracle Streams
in more depth:
Alternative Recommended
Architecture Disadvantages Solutions
Primary site: Oracle No RAC HA capability 1. RAC
database on hardware
cluster No Data Guard capability 2. MAA
54
Alternative Recommended
Architecture Disadvantages Solutions
Customization required
55
This is a collection of 17 FAQs for Oracle DBA on fundamental concepts. The clear
answers and sample scripts provided can be used as learning tutorials or interview
preparation guides. Topics included in this FAQ are:
1. What Is Oracle?
2. What Is an Oracle Database?
3. What Is an Oracle Instance?
4. What Is a Parameter File?
5. What Is a Server Parameter File?
6. What Is a Initialization Parameter File?
7. What is System Global Area (SGA)?
8. What is Program Global Area (PGA)?
9. What Is a User Account?
10. What Is the Relation of a User Account and a Schema?
11. What Is a User Role?
12. What is a Database Schema?
13. What Is a Static Data Dictionary?
14. What Is a Dynamic Performance View?
15. What Is SQL*Plus?
16. What Is What Is Transport Network Substrate (TNS)?
17. What Is Open Database Communication (ODBC)?
Descriptions of some key concepts are based on Oracle documentations.
What Is Oracle?
Oracle is a company. Oracle is also a database server, which manages data in a very
structured way. It allows users to store and retrieve related data in a multiuser
environment so that many users can concurrently access the same data. All this is
accomplished while delivering high performance. A database server also prevents
unauthorized access and provides efficient solutions for failure recovery.
56
• Server Parameter Files - Binary version. Persistent.
• Initialization Parameter Files - Text version. Not persistent.
57
so on) that the user creates. The schema name is the same as the user name,
and can be used to unambiguously refer to objects owned by the user.
58
What Is a Static Data Dictionary?
Data dictionary tables are not directly accessible, but you can access
information in them through data dictionary views. To list the data dictionary
views available to you, query the view DICTIONARY. Many data dictionary
tables have three corresponding views:
• An ALL_ view displays all the information accessible to the current user,
including information from the current user's schema as well as
information from objects in other schemas, if the current user has access
to those objects by way of grants of privileges or roles.
• A DBA_ view displays all relevant information in the entire database.
DBA_ views are intended only for administrators. They can be accessed
only by users with the SELECT ANY TABLE privilege. This privilege is
assigned to the DBA role when the system is initially installed.
• A USER_ view displays all the information from the schema of the current
user. No special privileges are required to query these views.
(Continued on next part...)
Continued from previous part...)
What Is SQL*Plus?
SQL*Plus is an interactive and batch query tool that is installed with every
Oracle Database Server or Client installation. It has a command-line user
interface, a Windows Graphical User Interface (GUI) and the iSQL*Plus web-
based user interface.
59
TNS, Transport Network Substrate, is a foundation technology, built into the
Oracle Net foundation layer that works with any standard network transport
protocol.
Part: 1 2 3 4
This is a collection of FAQ for Oracle DBA on Oracle 10g Express
Edition with installation and basic introduction. The clear answers and sample scripts
provided can be used as learning tutorials or interview preparation guides. Topics
included in this FAQ are:
1. What is Oracle Database 10g Express Edition?
2. What Are the Limitations Oracle Database 10g XE?
3. What Operating Systems Are Supported by Oracle Database 10g XE?
4. How To Download Oracle Database 10g XE?
5. How To Install Oracle Database 10g XE?
6. How To Check Your Oracle Database 10g XE Installation?
7. How To Shutdown Your 10g XE Server?
8. How To Start Your 10g XE Server?
9. How Much Memory Your 10g XE Server Is Using?
10. How To Start Your 10g XE Server from Command Line?
11. How To Shutdown Your 10g XE Server from Command Line?
12. How To Unlock the Sample User Account?
13. How To Change System Global Area (SGA)?
14. How To Change Program Global Area (PGA)?
15. What Happens If You Set the SGA Too Low?
16. What To Do If the StartBD.bat Failed to Start the XE Instance?
17. How To Login to the Server without an Instance?
18. How To Use "startup" Command to Start Default Instance?
19. Where Are the Settings Stored for Each Instance?
20. What To Do If the Binary SPFile Is Wrong for the Default Instance?
21. How To Check the Server Version?
60
Based on Oracle Web site: Oracle Database 10g Express Edition (Oracle Database
XE) is an entry-level, small-footprint database based on the Oracle Database 10g
Release 2 code base that's free to develop, deploy, and distribute; fast to download;
and simple to administer. Oracle Database XE is a great starter database for:
• Developers working on PHP, Java, .NET, and Open Source applications
• DBAs who need a free, starter database for training and deployment
• Independent Software Vendors (ISVs) and hardware vendors who want a starter
database to distribute free of charge
• Educational institutions and students who need a free database for their
curriculum
61
• MS Transaction Server port: 2030.
• The directory where 10g XE is installed: \oraclexe\
• Hard disk space taken: 1655MB.
62
@oradim -startup -sid XE -starttype inst > nul 2>&1
63
Let's you made a mistake and changed to SGA to 16MB from the SYSTEM admin
home page. When you run the batch file StartDB.bat, it will return a message saying
server stated. However, if you try to connect to your server home page:
http://localhost:8080/apex/, you will get no response. Why? Your server is running, but
the default instance XE was not started.
If you go the Control Panel and Services, you will see service OracleServiceXE is
listed not in the running status.
(Continued on next part...)
64
Log in as SYSDBA is very useful for performing DBA tasks.
SQL> startup
ORA-00821: Specified value of sga_target 16M is too small,
needs to be at least 20M
Now the server is telling you more details about the memory problem on your default
instance: your SGA setting of 16MB is too small. It must be increased to at least
20MB.
SQL> startup
PFILE=$ORACLE_HOME\config\scripts\initXETemp.ora;
65
Variable Size 58724276 bytes
Database Buffers 83886080 bytes
Redo Buffers 2904064 bytes
Database mounted.
Database opened.
As you can see, 10g XE is distributed with a backup copy of the parameter file for the
default instance XE. The "startup" can take an option called PFILE to let you use a
SPFILE from any location. The default instance is running correctly now.
(Continued on next part...)
(Continued from previous part...)
66
Oracle DBA FAQ - Managing Oracle Tablespaces and Data Files
By: FYIcenter.com
Part: 1 2 3 4
A collection of 19 FAQs on creating and managing tablespaces
and data files. Clear answers are provided with tutorial exercises on creating
and dropping tablespaces; listing available tablespaces; creating and dropping
data files; setting tablespaces and data files offline; removing corrupted data
files. Topics included in this FAQ are:
1. What Is an Oracle Tablespace?
2. What Is an Oracle Data File?
3. How a Tablespace Is Related to Data Files?
4. How a Database Is Related to Tablespaces?
5. How To View the Tablespaces in the Current Database?
6. What Are the Predefined Tablespaces in a Database?
7. How To View the Data Files in the Current Database?
8. How To Create a new Oracle Data File?
9. How To Create a New Tablespace?
10. How To Rename a Tablespace?
11. How To Drop a Tablespace?
12. What Happens to the Data Files If a Tablespace Is Dropped?
13. How To Create a Table in a Specific Tablespace?
14. How To See Free Space of Each Tablespace?
15. How To Bring a Tablespace Offline?
16. How To Bring a Tablespace Online?
17. How To Add Another Datafile to a Tablespace?
18. What Happens If You Lost a Data File?
19. How Remove Data Files befor opening a Database?
Sample scripts used in this FAQ assumes that you are connected to the server
with the SYSTEM user account on the default database instance XE. See other
FAQ collections on how to connect to the server.
67
An Oracle data file is a big unit of physical storage in the OS file system. One or
many Oracle data files are organized together to provide physical storage to a
single Oracle tablespace.
68
• UNDO Tablespace - UNDO tablespaces are special tablespaces used
solely for storing undo information. You cannot create any other segment
types (for example, tables or indexes) in undo tablespaces. Each
database contains zero or more undo tablespaces. In automatic undo
management mode, each Oracle instance is assigned one (and only one)
undo tablespace. Undo data is managed within an undo tablespace using
undo segments that are automatically created and maintained by Oracle.
• TEMP Tablespace - When the SYSTEM tablespace is locally managed,
you must define at least one default temporary tablespace when creating
a database. A locally managed SYSTEM tablespace cannot be used for
default temporary storage.
69
SQL> SELECT TABLESPACE_NAME, STATUS, CONTENTS
2 FROM USER_TABLESPACES;
TABLESPACE_NAME STATUS CONTENTS
---------------- --------------- ---------
SYSTEM ONLINE PERMANENT
UNDO ONLINE UNDO
SYSAUX ONLINE PERMANENT
TEMP ONLINE TEMPORARY
USERS ONLINE PERMANENT
MY_SPACE ONLINE PERMANENT
70
How To Drop a Tablespace?
If you have an existing tablespace and you don't want it anymore. You can delete a
tablespace by using the DROP TABLESPACE statement as shown in the example
below:
SQL> CREATE TABLESPACE my_space
2 DATAFILE '/temp/my_space.dbf' SIZE 10M;
Tablespace created.
71
SQL> CREATE TABLE my_team TABLESPACE my_space
2 AS SELECT * FROM employees;
Table created.
72
• USERS has one big free extent of 100MB, and many small free extents of 64KB.
...
73
SQL> SELECT TABLESPACE_NAME, FILE_NAME, BYTES
2 FROM DBA_DATA_FILES;
TABLESPACE_NAME FILE_NAME BYTES
--------------- --------------------------------- ---------
USERS C:\ORACLEXE\ORADATA\XE\USERS.DBF 104857600
SYSAUX C:\ORACLEXE\ORADATA\XE\SYSAUX.DBF 461373440
UNDO C:\ORACLEXE\ORADATA\XE\UNDO.DBF 94371840
SYSTEM C:\ORACLEXE\ORADATA\XE\SYSTEM.DBF 356515840
MY_SPACE C:\TEMP\MY_SPACE.DBF 10485760
MY_SPACE C:\TEMP\MY_SPACE_2.DBF 5242880
SQL> STARTUP
ORACLE instance started.
SQL> SHUTDOWN;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
74
How Remove Data Files befor opening a Database?
Let's say you have a corrupted data file or lost a data file. Oracle can mount the database. But
it will not open the database. What you can do is to set the bad data file as offline befor opening
the database. The tutorial exercise shows you how to set two data files offline and open the
database without them:
>sqlplus /nolog
75
In order to check client connection - $lsnrctl is correct is correct or not?
ravi: no..it not correct ?what is meaning of client connection?
Sent at 11:26 AM on Thursday
ravi: 1. where is the client install...in same unix server or different unix server?
Sent at 11:28 AM on Thursday
me: if it is on same unix server
Sent at 11:33 AM on Thursday
ravi: yes..1. check database availability..
2. check listener status..
3. then u can check tnsping command..
4. you can also check. tns entry
me: if the client is connected on different UNIX server
Sent at 11:42 AM on Thursday
ravi: simple...1) check database availability 2) tnsping command ex:- tnsping
database1
me: right
If I change the block size then how it will affect the performance of database?
Sent at 11:48 AM on Thursday
ravi: why we want change..every thing depend on which server is using? no it
will not affect...
Sent at 11:52 AM on Thursday
me: if i want to change the block size so that database will perform better and
also to calculate the future database spacing requirement
ravi: there you have also look into os block size..
there is a big concept of pagging and swapping..
it is a work of senior DBA..
? not as a 4 yrs exp..
me: he asked me this question yesterday at 4 yrs exp
he was also talking about os block size also
Sent at 12:00 PM on Thursday
ravi: that...right..we can't change the DB block size..but before changing you
have to look OS block size first..
Sent at 12:01 PM on Thursday
ravi: if your OS block size is 8 k then you can set your DB block size as equal of
OS block size or multiple of OS block size..
Sent at 12:02 PM on Thursday
ravi: any query..
?
Sent at 12:05 PM on Thursday
me: what is the concept of pageing and swapping
76
ravi ranjan to me
show details 5:20 PM (23 hours ago)
2:20 PM me: hi
important
what is the difference apps dba and core dba
2:21 PM what applications are managed by application dba and they are
managed
2:22 PM ravi: ok..App DBA means .you have to knowledge about application like
PL-SQL , and oracle application ...but in core DBA ..you have to managed only
oracle database..
2:23 PM me: oracle application like
ravi: Application menas they managed Oracle application and database also..so
Application DBA demands to much package..
You can se front end that use oracle database..
2:24 PM me: which is better apps dba / core dba.which has higher demand
ravi: Both are better..Apps DBA is good.
2:25 PM me: ok
thank you
i ahve technical round with Accenture for apps dba
ravi: Core DBA ---(1)
me: 2.30 pm
2:26 PM ravi: App DBA + Core DBA = App DBA
me: it has a dual advantage.
ravi: If you will give interview of Apps DBA then they will asl lots of things related
to application
2:27 PM yes..that why .they demands 12+ package
me: but i have told that i am working as core dba
but ready to shift to apps dba
2:28 PM what all is expected from an apps dba-related to application like PL/SQL
/what applications D2K
2:30 PM ravi: every thing like Oracle developer
it is a combination og Developer +DBA
2:31 PM me: ok
16 minutes
2:47 PM me: hi
you have solved the quessionare
2:48 PM when you plan to solve and give it to me
77
12 minutes
3:00 PM ravi: currently I am very busy as I told, one Sr DBA has been left. if i will
free then i will solve that paper
40 minutes
45 minutes
4:26 PM me: i have a table emp and it has 150 child table. i have to drop the emp
table with all child table in one sysntax.
4:27 PM drop table emp inclusive child tables
what is the correct syntax
ravi: sorry..I don't have idea about child table...
4:28 PM me: what are different types of indexes/constraints/tables
good
4:29 PM it means that there are associated child records in the base table that
would't allow you to delete the base /primary table.
4:30 PM on what data structures i can apply indexes. tables, views, metviews.
Can i apply indexes on views? Yes/no
4:35 PM ravi: yes..
7 minutes
4:42 PM me: I have applied indexes on views and can i save the result of the
view that is retrieved
4:43 PM applied with index
4:44 PM what is the concept of high water mark
Difference between DDL/DML/Drop statements
4:45 PM * whether the data & structure both will be deleted and what i can recall
data / structure.
4:47 PM *a query is run on 2-3 tables, & data is retrieved from 2-3 tables. Earlier
the query use to run 15 seconds, but now it takes 1 hour to run. As a DBA what
all appropriate steps you will take? why such a thing happen.
4:48 PM What is default optimzer mode in 10G.If you choose parameter it will
also use CBO as default optimizer.
RBO is almost obslete paramer now.
4:50 PM ravi: All are nice question but if you will give interview as a senior DBA..
4:51 PM HWM :- there isnice concept in oracle...
we have to learn saome basic thing
me: *some blocks are corrupted. How will i find that which blocks are corrupted
V$block_corruption, how will i rectify those blocks. If block is corrupted then i will
not be able to retrieve the data. How will i repair corrupted blocks. What are
78
steps involved in that. I will retrieve corrupted block no. and i will retrieve data
from redo log and archive log
4:52 PM ravi: Read this concept for HWM :- just create a table with 1,000,000
rows (or create any table with a large number of rows), and then execute a
SELECT COUNT(*) from this table. Now, DELETE every row in it and you will
find that the SELECT COUNT(*) takes just as long (or longer, if you need to
clean out the block! Refer to the 'Block Cleanout' section of Chapter 9) to count 0
rows as it did to count 1,000,000. This is because Oracle is busy reading all of
the blocks below the HWM to see if they contain data. You should compare this
to what happens if you used TRUNCATE on the table instead of deleting each
individual row. TRUNCATE will reset the HWM of a table back to 'zero' and will
truncate the associated indexes on the table as well. If you plan on deleting every
row in a table, TRUNCATE.
4:54 PM there is a good concept in DB1 for HWH
HWM
4:56 PM me: HWH full form
4:57 PM ravi: High Water Mark
HWM
5:00 PM me: *I have made use of expalin plan. Where is the analyses report
stored and from where it is retrieved. Plan_table syntax that is being used.I can
fetech the statistics report from table_ analysis.
5:02 PM *DBA will analyze the table It is a routine analysis that is being done as
a part of dba activity. There are some reasons behind it. Why dba analyze the
table on rotine basis. In production environment table_analysis is a part of dba
activity.
5:04 PM *whether you have worked on rebuilding of indexes. Suppose 31 jan
query retrieve 1 min but the client experienced told to rebuild indexes. Now it is
taking 3 mins. What you will do as a dba.
5:06 PM ravi: May be HWM is the caused of same issue
so to resolve same issue ..move the table and rebuild ..
then it will not take much time..
5 minutes
5:12 PM me: answer - the query that is written is optimized. Explain plan is used.
Index rebuild. Choose- CBO will be the default optimizer mode. When the query
is runned again, it will rewrite the analysis based upon recent changes.
6 minutes
5:18 PM ravi: it a documented steps not a real environments work..yes you can
do all above step if you will give interview after 5 or 6 yrs experience..
How many experience you are giving as a DBA?
5:19 PM me: 4 years
5:20 PM if you have answers to my questions do provide it
79
ravi: ok...how many yrs you have worked as a DBA..on real environments..
ok..sure..
5:21 PM me: oracle dba knowledge i have try to update it
5:22 PM ravi: never use 4+..bcoz it will be very tough
5:23 PM one of the friend joined wipro on 4+ yrs ..before..
80
81
82
83
84
85