Oracle 10 DBA Interview questions and answers

1. Is the following SQL statement syntactically correct? If not, please rewrite it correctly.

SELECT col1 FROM tableA WHERE NOT IN (SELECT col1 FROM tableB);

Ans. SQL is incorrect.

Correct SQL : SELECT col1 FROM tableA WHERE col1 NOT IN (SELECT col1 FROM tableB);



2. What is a more efficient way to write this query, to archive the same set?


Ans: SELECT col1 from tableA minus SELECT col1 from tableB



3.How would you determine that the new query is more efficient than the original query?

Ans: Run explain plan on both query and see the result .



4.How can we find the location of the database trace files from within the data dictionary?

Ans: Generally trace file on the database server machine is located in one of two locations:

1. If you are using a dedicated server connection, the trace file will be generated in the directory specified by

the USER_DUMP_DEST parameter.
2.If you are using a shared server connection, the trace file will be generated in the directory specified by the

BACKGROUND_DUMP_DEST parameter.

you can run sqlplus>SHOW PARAMETER DUMP_DEST
or
select name, value
from v$parameter
where name like '%dump_dest%'


5. What is the correct syntax for a UNIX endless WHILE loop?

while :
do
commands
done



6. Write the SQL statement that will return the name and size of the largest datafile in the database.


SQL> select name,bytes from v$datafile where bytes=(select max(bytes) from v$datafile);


7. What are the proper steps to changing the Oracle database block size?

cold backup all data files and backup controlfile to trace, recreate your database
with the new block size using the backup control file, and restore. It may be easier
with rman. You can not change datbase block size on fly.




8. Using awk, write a script to print the 3rd field of every line.

Ans:

awk '{print }'

awk '{print $3}

awk '{print $3}


9.Under what conditions, is a nested loop better than a merge join?

Ans:

Optimizer uses nested loop when we are joining tables containing small number of rows with an efficient driving

condition.
It is important to have an index on column of inner join table as this table is probed every time for a new value

from outer table.

Optimizer may not use nested loop in case:

1. No of rows of both the table is quite high
2. Inner query always results in same set of records
3. The access path of inner table is independent of data coming from outer table.


merge join is used to join two independent data sources. They perform better than nested loop when the volume of

data is big in tables
but not as good as hash joins in general.



10.Which database views would you use to ascertain the number of commits a user's session has performed?

Joining V$SESSTAT ,V$STATNAME

select * from V$SESSTAT a ,V$STATNAME b where b.CLASS=a.STATISTIC# and b.NAME='user commits' and a.sid=



11.What does the #!bin/ksh at the beginning of a shell script do? Why should it be there?

Ans: On the first line of an interpreter script, the "#!", is the name of a program which should be used to

interpret the contents of the file.
For instance, if the first line contains "#! /bin/ksh", then the contents of the file are executed as a korn shell

script.




12.What command is used to find the status of Oracle 10g Clusterware (CRS) and the various components it manages

(ONS, VIP, listener, instances, etc.)?

Ans:

$ocrcheck


13.Describe a scenario in which a vendor clusterware is required, in addition to the Oracle 10g Clusterware.

If you choose external redundancy for the OCR and voting disk, then to enable redundancy, the disk subsystem must be configurable for RAID mirroring/vendor clusterware. Otherwise, your system may be vulnerable because the OCR and voting disk are single points of failure.



14.How would you find the interconnect IP address from any node within an Oracle 10g RAC configuration?

using oifcfg command.

se the oifcfg -help command to display online help for OIFCFG. The elements of OIFCFG commands, some of which are

optional depending on the command, are:

*nodename—Name of the Oracle Clusterware node as listed in the output from the olsnodes command
*if_name—Name by which the interface is configured in the system
*subnet—Subnet address of the interface
*if_type—Type of interface: public or cluster_interconnect

You can use OIFCFG to list the interface names and the subnets of all of the interfaces available on the local node

by executing the iflist keyword as shown in this example:

oifcfg iflist
hme0 139.185.141.0
qfe0 204.152.65.16


You can also retrieve specific OIFCFG information with a getif command using the following syntax:
oifcfg getif [ [-global | -node nodename] [-if if_name[/subnet]] [-type if_type] ]

To store a new interface use the setif keyword. For example, to store the interface hme0, with the subnet

139.185.141.0, as a global interface (to be used as an interconnect for all of the RAC instances in your cluster),

you would use the command:

oifcfg setif -global hme0/139.185.141.0:cluster_interconnect


For a cluster interconnect that exists between only two nodes, for example rac1 and rac2, you could create the cms0

interface with the following commands, assuming 139.185.142.0 is the subnet addresses for the interconnect on rac1

and rac2 respectively:

oifcfg setif -global cms0/139.185.142.0:cluster_interconnect


Use the OIFCFG delif command to delete the stored configuration for global or node-specific interfaces. A specific

node-specific or global interface can be deleted by supplying the interface name, with an optional subnet, on the

command line. Without the -node or -global options, the delif keyword deletes either the given interface or all of

the global and node-specific interfaces on all of the nodes in the cluster. For example, the following command

deletes the global interface named qfe0 for the subnet 204.152.65.0:

oifcfg delif -global qfe0/204.152.65.0


On the other hand, the next command deletes all of the global interfaces stored with OIFCFG:

oifcfg delif -global



15.What is the Purpose of the voting disk in Oracle 10g Clusterware?

Voting disk record node membership information. Oracle Clusterware uses the voting disk to determine which instances are members of a cluster. The voting disk must reside on a shared disk. For high availability, Oracle recommends that you have a minimum of three voting disks. If you configure a single voting disk, then you should use external mirroring to provide redundancy. You can have up to 32 voting disks in your cluster.


16.What is the purpose of the OCR in Oracle 10g Clusterware?

Ans: Oracle Cluster Registry (OCR) is a component in 10g RAC used to store the cluster configuration information. It is a shared disk component, typically located in a shared raw volume that must be accessible to all nodes in the cluster.

The daemon OCSSd manages the configuration info in OCR and maintains the changes to cluster in the registry.



17. In Oracle Streams archived log downstream capture, which database view can be used to determine which archived

logs are no longer needed by the capture process?

Ans: V$ARCHIVE_DEST_STATUS

Thursday, September 18, 2008

Quick DBA Test - Oracle 10g

As a database administrator, you are required to implement a backup plan that has been documented as follows:

a) Full backups every Saturday night
b) Cumulative backups every Wednesday to back up everything since the last full backup
C) Daily incremental backups for the rest of the days of the week

The database has to be available 24 hours a day, 7 days a week, and can therefore not be shutdown at any time.

Referring to the scenario above, how do you implement this backup plan using RMAN?

a.) 1. Saturdays - Level 0 Backups2. Wednesdays - Level 1 Backups3. Sundays, Mondays, Tuesdays, Thursdays, Fridays - Level 2 Backups
b.) 1. Saturdays - Level 1 Backups2. Wednesdays - Level 2 Backups3. Sundays, Mondays, Tuesdays, Thursdays, Fridays - Level 3 Backups
c.) 1. Saturdays - Level 2 Backups2. Wednesdays - Level 1 Backups3. Sundays, Mondays, Tuesdays, Thursdays, Fridays - Level 0 Backups
d.) 1. Saturdays - Cold Backups2. Wednesdays - Level 1 Backups3. Sundays, Mondays, Tuesdays, Thursdays, Fridays - Level 2 Backups
e.) 1. Saturdays - Level 0 Backups2. Wednesdays - Level 1 Backups3. Sundays, Mondays, Tuesdays, Thursdays, Fridays - Level 1 Backups


Rob has been asked to look into the execution plans from an application which is working very slowly.

Based on the scenario above, at which one of the following does Rob first look when performing SQL statement tuning?

a.) Outer joins
b.) Inner joins
c.) Index range scans
d.) Full table scans
e.) Hash joins

Which one of the following do you execute to ensure that the control file is automatically backed up using Recovery Manager?

a.) CONFIGURE CONTROLFILE AUTOBACKUP ON;
b.) CONFIGURE CONTROLFILE BACKUP AUTO;
c.) CONFIGURE CONTROL FILE AUTOBACKUP;
d.) CONFIGURE CONTROL BACKUP AUTO;
e.) CONFIGURE CONTROL AUTO BACKUP;

Which one of the following background processes coordinates the rebalancing of disks in Automatic Storage Management?

a.) J000
b.) ORB1
c.) RECO
d.) RBAL
e.) CJQ0

You want to have the same statistics in your TEST database as the ones in your PRODUCTION database.

Referring to the above, how do you accomplish the requirements stated above?

a.) Run the GATHER_SCHEMA_STATS on TEST and PRODUCTION at the same time.
b.) Run the GATHER_DATABASE_STATS on TEST and PRODUCTION at the same time.
c.) EXPORT statistics from PRODUCTION and IMPORT to TEST using the DBMS_STATS package procedures.
d.) RESTORE statistics from PRODUCTION to TEST using the DBMS_STATS package procedures.
e.) RESTORE the PRODUCTION tables and data on TEST.

1. In Oracle 10g, how is the scheduler implemented?

a.) As a separate daemon which runs under root privileges
b.) As a separate thread under the SMON daemon which wakes up at a pre-defined interval to check for job schedules
c.) As a collection of functions and procedures in the DBMS_SCHEDULER package
d.) As a collection of functions, procedures, and packages in the DBMS_JOB_SCHEDULER package
e.) As a command-line tool named "schedjob" which interfaces with the OS scheduler

2. Which one of the following is a valid DDL statement to create a Bigfile tablespace?

a.) CREATE BIGFILE TABLESPACE tbs_bf_fct_001DATAFILE 'tbs_bf_fct_001.dbf'SIZE 6G EXTENT MANAGEMENT DICTIONARY;
b.) CREATE BIGFILE TABLESPACE tbs_bf_fct_001DATAFILE 'tbs_bf_fct_001.dbf'SIZE 6G;
c.) CREATE BIGFILE TABLESPACE tbs_bf_fct_001DATAFILE 'tbs_bf_fct_001.dbf'SIZE 6G SEGMENT SPACE MANAGEMENT MANUAL;
d.) CREATE BIGFILE TABLESPACE tbs_bf_fct_001DATAFILE 'tbs_bf_fct_001.dbf'SIZE 6G SEGMENT SPACE MANAGEMENT MANUAL EXTENT MANAGEMENT DICTIONARY;
e.) CREATE BIGFILE TABLESPACE tbs_bf_fct_001DATAFILE 'tbs_bf_fct_001.dbf' SIZE 3GB, 'tbs_bf_fct_002.dbf' SIZE 3G;

3. Which one of the following do you query in order to access fine-grained audit information?

a.) DBA_FGA_AUDIT_INFO
b.) DBA_FGA_AUDIT_TRAIL
c.) DBA_FGA_AUDIT
d.) V$FGA_AUDIT_TRAIL
e.) V$FGA_AUDIT_INFO


4. Which one of the following describes the "Reset database to incarnation" command used by Recovery Manager?
a.) It performs point-in-time recovery when using Recovery Manager.
b.) It is used to undo the effect of a resetlogs operation by restoring backups of a prior incarnation of the database.
c.) It restores the database to a save point as defined by the version control number or incarnation number of the database.
d.) It restores the database to the initial state in which it was found when first backing it up via Recovery Manager.
e.) It performs a resynchronization of online redo logs to a given archive log system change number (SCN).


5.You have a multi-master replication setup. You need to add a DATE type column to the table GL_ENTRY.

Referring to the scenario above, which one of the following Oracle packages do you execute to ensure that this change is replicated to all the other sites?

a.) DBMS_REPCAT.ALTER_MASTER_OBJECT
b.) DBMS_REPCAT.EXECUTE_MASTER_DDL
c.) DBMS_REPCAT.ALTER_MASTER_DDL
d.) DBMS_REPCAT.REPLICATE_OBJECT_DDL
e.) DBMS_REPCAT.ALTER_MASTER_REPOBJECT



6. How many levels of CPU percentage can be specified when creating a resource plan directive for Database Resource Manager?
a.) 2
b.) 4
c.) 8
d.) 16
e.) 32


7. Which one of the following procedures do you use to analyze a single SQL statement?

a.) DBMS_ADVISOR.ADD_SQLWKLD_REF
b.) DBMS_ADVISOR.ADD_SQLWKLD_STATEMENT *
c.) DBMS_ADVISOR.QUICK_TUNE
d.) DBMS_ADVISOR.CREATE_TASK
e.) DBMS_ADVISOR.CREATE_SQLWKLD

8. Which one of the following components of Data Guard pulls archived redo logs from the primary site?

a.) MRP*
b.) FAL client
c.) FAL server
d.) ARCn
e.) LGWR


9.Which one of the following is a valid Data Availability Mode within Data Guard?

a.) Guaranteed protection mode
b.) Instant protection mode
c.) Rapid protection mode
d.) Maximum protection mode
e.) Delayed protection mode




10. Which one of the following do you access to find out what benefit you can expect to the system after a recommendation is carried out?

a.) DBA_ADVISOR
b.) DBA_ADVISOR_TASKS *
c.) DBA_ADVISOR_FINDINGS
d.) DBA_ADVISOR_RECOMMENDATIONS
e.) DBA_ADVISOR_LOG


11. Which one of the following is the default type of materialized view?

a.) Primary Key Materialized View*
b.) Object Materialized View
c.) ROWID Materialized View
d.) Complex Materialized View
e.) Hash Materialized View


12. One of your database developers is concerned about optimizer execution plan changes when other changes are made to the database.

Referring to the scenario above, how do you prevent this from occurring?

a.) Make no structural changes to the database.
b.) Use hints.
c.) Use optimizer plan stability.
d.) Set the optimizer mode to RULE.
e.) Set the optimizer mode to ALL_ROWS

No comments:

Blog Archive