Aug 24, 2006

Oracle 10g RAC On Linux or Windows 2003 Using VMware Server

For the newbies sometimes it is diffcult to get the test database/box/server to practice Oracle 10G RAC installation on Linux/Windows 2003.

Here, Now with this it will be reduceing your difficulties to some extent.

Oracle 10g RAC On Linux Using VMware Server


Oracle 10g RAC On Windows 2003 Using VMware Server


Hope you like it...

Aug 23, 2006

What is the COST?

If you use the Cost Based Optimizer (CBO) in your Oracle database, you may be surprised to know that decreasing the ‘COST’ of a query does not necessarily mean increased performance.

The following is a summary of a long thread on AskTom about this topic:

The ‘COST’ of a query is Oracle’s estimate of the completion time for a query. But the estimate for the completion time is based on Oracle’s statistical guesses about your data (which may be wrong), the model that Oracle uses for your hardware resource availability (which may be wrong) and the assumptions that Oracle makes about the actions of the run-time execution (which, surprisingly, may be wrong). Consequently, the predicted cost is not always a good estimate of the execution time of the query. Just to add a little confusion, the unit of measurement used is not seconds (or centi-seconds), but an abstract unit equivalent to the assumed time to perform a single block read on your platform.

So, The cost number can/will flucuate depending on parameters we can modify directly (e.g. optimizer_index_cost_adj) or the parameters we can modify indirectly (e.g. gather recent statistics). In some cases when the cost decreases the query will run faster (be more efficient), in other cases it may not. So just because I can decrease the cost, doesn’t mean I’m decreasing work (PIO). And just because one query may have a lower cost then another doesn’t mean it works less. But what was true yesterday isn’t true today, and what’s true today won’t be true tomorrow; with each new release the cost becomes a better indicator of work to be done, but today it isn’t perfect enough to rely on exclusively.

Aug 22, 2006

Oracle 1z0-032: Oracle 9i Database Fundamentals-II #5

QUESTION NO: 21

Which two statements are true regarding the use of UTF-16 encoding? (Choose two)

A. Enables easier loading of multinational data.
B. Uses a fixed-width Multibyte encoding sequence.
C. Asian characters are represented in three characters.
D. Used a variable-width Multibyte encoding sequence.
E. European characters are represented on one or two bytes.

Answer: A, B

Explanation:

AL16UTF16 is a 2-byte, fixed-width Unicode character set, which is also referred to as UTF16 or UCS2. The ASCII English character set is assigned the first 128 values from 0 (0X00) through 127 (oX7F) in Unicode, which translates to 1 byte. Even though AL16UTF16 uses one more byte than UTF8 for ASCII character representation, it is still faster because it uses fixed-width encoding as opposed to UTF8, which uses variable-width encoding. UTF-16 encoding enables easier loading of multinational data. It uses a fixed-width multibyte encoding sequence.

Incorrect Answers

C: Asian characters are represented in two characters because UTF16 is a 2-byte, fixed-width Unicode character set.
D: It uses a fixed-width multibyte encoding sequence.
E: European characters are represented in two bytes because UTF16 is a 2-byte, fixed-width Unicode character set.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 266-278
Chapter 5: Language Enhancements
Oracle 9i New Features, Robert Freeman, p. 139-146
Chapter 5: Miscellaneous Oracle9i Features and Enhancements

QUESTION NO: 22

The Oracle Shared Server architecture reduces memory usage by reducing the number of server processes required. To process a request for a server process, the following tasks are performed:
1. A shared server picks up the request from the request queue and processes the request.
2. The dispatcher retrieves the response from the response queue.
3. A user sends a request to its dispatcher.
4. The dispatcher returns the response to the user.
5. The shared sever places the response on the calling dispatcher’s response queue.
6. The dispatcher places the request into the request queue in the SGA.

Put the above task in the order in which they are performed.

A. 3, 1, 6, 2, 5, 4
B. 3, 6, 1, 5, 2, 4
C. 3, 1, 2, 3, 4, 5
D. 6, 1, 3, 5, 2, 4
E. 6, 3, 1, 2, 4, 5
F. 6, 3, 1, 2, 5, 4

Answer: B

Explanation:

When the user process arrives, the listener examines the request and determines whether the user process can use a shared server process. If so, the listener returns the address of the dispatcher process that is currently handling the least number of requests. Then the user process connects to the dispatcher directly. The dispatcher process then directs multiple client requests to a common queue. The idle shared server processes pick up the virtual circuit from the common request queue on a first-in-first-out (FIFO) basis and make all necessary calls to the database to complete that request. When the server process completes the request, it places the response on the calling dispatcher response queue. The dispatcher then returns the completed request to the appropriate user process.

Incorrect Answers

A: The dispatcher places the request into the request queue in the SGA before a shared server picks up the request from the request queue and processes the request..
C: After user sent a request to its dispatcher the dispatcher places the request into the request queue in the SGA.
D: A user sends a request to its dispatcher. This is first step of the procedure.
E: A user sends a request to its dispatcher. This is first step of the procedure.
F: A user sends a request to its dispatcher. This is first step of the procedure.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 100-102
Chapter 5: Usage and Configuration of the Oracle Shared Server

QUESTION NO: 23

You issue this RMAN command:
RMAN> create script Level0Backup {
backup
incremental level 0
format ‘/u01/db01/backup/%d_%_Sp’
fileperset 5
(database include current controlfile);
sql ‘alter database archive log current’;
}

Which three statements are true about the Level0 Backup script you just created?
(Choose three)

A. The script is stored only in the control file.
B. The script is stored only in the recover catalog.
C. The script can be executed only by using the RMAN RUN command.
D. The commands of the script can be displayed with the LIST command.
E. The commands of the script can be displayed with the PRINT command.
F. The commands of the script can be displayed with the REPORT command.

Answer: B, C, E

Explanation:

A stored script is a sequence of RMAN commands stored within the recovery catalog repository. To execute a stored script, you must use the EXECUTE SCRIPT command in a RUN block, as shown in the following code. The commands of the script can be displayed with the PRINT command.

Incorrect Answers

A: The script is stored only in the recover catalog, not in the control file.
D: The LIST command queries the repository and generates a list of all the backup sets and image copies recorded in the RMAN’s metadata that are specific to a database.
F: The REPORT command performs detailed analysis of the information stored in the repository and displays detailed outputs on backup sets or image copies.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 400-407
Chapter 17: Recovery Catalog Creation and Maintenance

QUESTION NO: 24

Which RMAN command do you use to verify that the RMAN repository information is synchronized with the actual files that exist on disk?

A. LIST
B. CHANGE
C. CATALOG
D. CROSSCHECK

Answer: D

Explanation:

RMAN command CROSSCHECK enables you to crosscheck the availability of the backup sets by verifying the information stored in its repository with the backup sets that are physically available in the designated storage medium.

Incorrect Answers

A: The LIST command queries the repository and generates a list of all the backup sets and image copies recorded in the RMAN’s metadata that are specific to a database.
B: The CHANGE command can be used with UNCATALOG clause: it removes the records of the specified backup sets and image copies from the catalog and updates the control file records status as DELETED. Also it can be run with AVAILABLE or UNAVAILABLE clauses: RMAN would then update the repository to reflect the respective backup files as either available or unavailable.
C: The copies of files generated using O/S commands and utilities are similar to RMAN image copies. But these are not recognized by RMAN until you catalog the file copies by executing the RMAN CATALOG command.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 269-270
Chapter 11: RMAN Backups

QUESTION NO: 25

A web browser can connect directly to an Oracle server using which two? (Choose two)

A. HTTP
B. IIOP
C. TCP/IP
D. Named Pipes
E. TCP/IP with SSL

Answer: A, B

Explanation:

The clients forward the requests using HTTP, which provides the language that enables Web browsers and application Web servers to communicate. Also web clients can access the Oracle database directly – for example, by using a Java applet. In addition to regular
connections, the database can be configured to accept HTTP and Internet Inter-ORB Protocol (IIOP) connections.

Incorrect Answers

C: A web browser can connect directly to an Oracle server just using TCP/IP.
D: Names Pipes are not used to connect a web browser directly to an Oracle server.
E: TCP/IP with SSL is not used to connect a web browser directly to an Oracle server.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 34-36
Chapter 2: Basic Oracle Net Architecture

Prevention, Detection and Repair of Database Corruption Part-2

Types of Corruption

Physical or structural corruption can be defined as damage to internal data structures which do not allow Oracle software to find user data within the database.

Logical corruption involves Oracle being able to find the data, but the data values are incorrect as far as the end user is concerned.

Physical corruption due to hardware or software can occur in two general places -- in memory (including various IO buffers and the Oracle buffer cache) or on disk. Operator error such as overwriting a file can also be defined as a physical corruption.

Logical corruption on the other hand is usually due to end-user error or non-robust(?) application design. A small physical corruption such as a single bit flip may be mistaken for a logical error. In general, for purposes of the paper we will categorize corruption under three general areas and give best practices for prevention, detection and repair for each:

· Memory corruption
· Media corruption
· Logical corruption


In Depth in the forthcoming comments....

Aug 21, 2006

17 tips from Oracle9i Performance Tuning Avoiding Problematic Queries

1. Avoid Cartesian products
2. Avoid full table scans on large tables
3. Use SQL standards and conventions to reduce parsing
4. Lack of indexes on columns contained in the WHERE clause
5. Avoid joining too many tables
6. Monitor V$SESSION_LONGOPS to detect long running operations
7. Use hints as appropriate
8. Use the SHARED_CURSOR parameter
9. Use the Rule-based optimizer if I is better than the Cost-based optimizer
10. Avoid unnecessary sorting
11. Monitor index browning (due to deletions; rebuild as necessary)
12. Use compound indexes with care (Do not repeat columns)
13. Monitor query statistics
14. Use different tablespaces for tables and indexes (as a general rule; but the main point is reduce I/O contention)
15. Use table partitioning (and local indexes) when appropriate (partitioning is an extra cost feature)
16. Use literals in the WHERE clause (use bind variables)
17. Keep statistics up to date

Prevention, Detection and Repair of Database Corruption Part-1

Corruption can be defined as an inconsistency in the data block structures or memory structures as a result of disparate problems. Corruption can be the result of human error (including software, firmware, and hardware bugs) or the environment (component failure).

Lets first define Prevention, Detection, and Repair.

Prevention :

Prevention can be defined as a set of steps that can be taken to anticipate and stop corruption from happening in a production environment. In general, the most common cause of corruption is user error. While we cannot completely prevent corruption, the risk of corrupting the production environments can be greatly reduced by improving the operational infrastructure.

Examples of prevention by improving operational infrastructure include the following:
· Having redundant hardware such as mirrored disks.
· Defining and enforcing strict security procedures.
· Strict change control with proper testing practices.

Detection :

Detection can be defined as a method to determine the existence of a problem. In the context, detection can be defined as the ways to discover the presence of a corruption in the database. In particular, detecting a corruption must encompass detecting anomalies in the hardware, disks, memory, database and application data.

The following are some examples of detecting corruption:
· Monitoring the System logs
· Monitoring the Oracle trace files
· Monitoring any application logs
· Monitor audit trails for any security violations

Repair :

Repair can be defined as a method of restoring the system to a healthy state. In the context, repair can be defined as the steps taken to bring a database back to a consistent state. Interestingly, the way Oracle software defines a consistent state may differ from what the business needs are. For example, in some environments, some data loss is acceptable. The method of repair will vary due to the extent of the corruption and the business needs. For this reason, the scope will focus on quickly repairing damage to Oracle database objects.

More in next comments:

Types of Corruption
Redo log Corruption
Data file Corruption
Lots more....



Note: All the documentations are being gather from different sites/blogs/groups/etc. for helping the newbies in Database field. This blog is only and only meant to help the newbies. Suggestion/Advices are highly appreciated.

Interview Questions for Oracle, DBA, Developer Candidates

PL/SQL Questions:

1. Describe the difference between a procedure, function and anonymous pl/sql block.

Level: Low

Expected answer : Candidate should mention use of DECLARE statement, a function must return a value while a procedure doesn?t have to.

2. What is a mutating table error and how can you get around it?

Level: Intermediate

Expected answer: This happens with triggers. It occurs because the trigger is trying to update a row it is currently using. The usual fix involves either use of views or temporary tables so the database is selecting from one while updating the other.

3. Describe the use of %ROWTYPE and %TYPE in PL/SQL

Level: Low

Expected answer: %ROWTYPE allows you to associate a variable with an entire table row. The %TYPE associates a variable with a single column type.

4. What packages (if any) has Oracle provided for use by developers?

Level: Intermediate to high

Expected answer: Oracle provides the DBMS_ series of packages. There are many which developers should be aware of such as DBMS_SQL, DBMS_PIPE, DBMS_TRANSACTION, DBMS_LOCK, DBMS_ALERT, DBMS_OUTPUT, DBMS_JOB, DBMS_UTILITY, DBMS_DDL, UTL_FILE. If they can mention a few of these and describe how they used them, even better. If they include the SQL routines provided by Oracle, great, but not really what was asked.

5. Describe the use of PL/SQL tables

Level: Intermediate

Expected answer: PL/SQL tables are scalar arrays that can be referenced by a binary integer. They can be used to hold values for use in later queries or calculations. In Oracle 8 they will be able to be of the %ROWTYPE designation, or RECORD.

6. When is a declare statement needed ?

Level: Low

The DECLARE statement is used in PL/SQL anonymous blocks such as with stand alone, non-stored PL/SQL procedures. It must come first in a PL/SQL stand alone file if it is used.

7. In what order should a open/fetch/loop set of commands in a PL/SQL block be implemented if you use the %NOTFOUND cursor variable in the exit when statement? Why?

Level: Intermediate

Expected answer: OPEN then FETCH then LOOP followed by the exit when. If not specified in this order will result in the final return being done twice because of the way the %NOTFOUND is handled by PL/SQL.

8. What are SQLCODE and SQLERRM and why are they important for PL/SQL developers?

Level: Intermediate

Expected answer: SQLCODE returns the value of the error number for the last error encountered. The SQLERRM returns the actual error message for the last error encountered. They can be used in exception handling to report, or, store in an error log table, the error that occurred in the code. These are especially useful for the WHEN OTHERS exception.

9. How can you find within a PL/SQL block, if a cursor is open?

Level: Low

Expected answer: Use the %ISOPEN cursor status variable.

10. How can you generate debugging output from PL/SQL?

Level:Intermediate to high

Expected answer: Use the DBMS_OUTPUT package. Another possible method is to just use the SHOW ERROR command, but this only shows errors. The DBMS_OUTPUT package can be used to show intermediate results from loops and the status of variables as the procedure is executed. The new package UTL_FILE can also be used.

11. What are the types of triggers?

Level:Intermediate to high

Expected Answer: There are 12 types of triggers in PL/SQL that consist of combinations of the BEFORE, AFTER, ROW, TABLE, INSERT, UPDATE, DELETE and ALL key words:

BEFORE ALL ROW INSERT

AFTER ALL ROW INSERT

BEFORE INSERT

AFTER INSERT etc.

DBA:

1. Give one method for transferring a table from one schema to another:

Level:Intermediate

Expected Answer: There are several possible methods, export-import, CREATE TABLE... AS SELECT, or COPY.

2. What is the purpose of the IMPORT option IGNORE? What is it?s default setting?

Level: Low

Expected Answer: The IMPORT IGNORE option tells import to ignore "already exists" errors. If it is not specified the tables that already exist will be skipped. If it is specified, the error is ignored and the tables data will be inserted. The default value is N.

3. You have a rollback segment in a version 7.2 database that has expanded beyond optimal, how can it be restored to optimal?

Level: Low

Expected answer: Use the ALTER TABLESPACE ..... SHRINK command.

4. If the DEFAULT and TEMPORARY tablespace clauses are left out of a CREATE USER command what happens? Is this bad or good? Why?

Level: Low

Expected answer: The user is assigned the SYSTEM tablespace as a default and temporary tablespace. This is bad because it causes user objects and temporary segments to be placed into the SYSTEM tablespace resulting in fragmentation and improper table placement (only data dictionary objects and the system rollback segment should be in SYSTEM).

5. What are some of the Oracle provided packages that DBAs should be aware of?

Level: Intermediate to High

Expected answer: Oracle provides a number of packages in the form of the DBMS_ packages owned by the SYS user. The packages used by DBAs may include: DBMS_SHARED_POOL, DBMS_UTILITY, DBMS_SQL, DBMS_DDL, DBMS_SESSION, DBMS_OUTPUT and DBMS_SNAPSHOT. They may also try to answer with the UTL*.SQL or CAT*.SQL series of SQL procedures. These can be viewed as extra credit but aren?t part of the answer.

6. What happens if the constraint name is left out of a constraint clause?

Level: Low

Expected answer: The Oracle system will use the default name of SYS_Cxxxx where xxxx is a system generated number. This is bad since it makes tracking which table the constraint belongs to or what the constraint does harder.

7. What happens if a tablespace clause is left off of a primary key constraint clause?

Level: Low

Expected answer: This results in the index that is automatically generated being placed in then users default tablespace. Since this will usually be the same tablespace as the table is being created in, this can cause serious performance problems.

8. What is the proper method for disabling and re-enabling a primary key constraint?

Level: Intermediate

Expected answer: You use the ALTER TABLE command for both. However, for the enable clause you must specify the USING INDEX and TABLESPACE clause for primary keys.

9. What happens if a primary key constraint is disabled and then enabled without fully specifying the index clause?

Level: Intermediate

Expected answer: The index is created in the user?s default tablespace and all sizing information is lost. Oracle doesn?t store this information as a part of the constraint definition, but only as part of the index definition, when the constraint was disabled the index was dropped and the information is gone.

10. (On UNIX) When should more than one DB writer process be used? How many should be used?

Level: High

Expected answer: If the UNIX system being used is capable of asynchronous IO then only one is required, if the system is not capable of asynchronous IO then up to twice the number of disks used by Oracle number of DB writers should be specified by use of the db_writers initialization parameter.

11. You are using hot backup without being in archivelog mode, can you recover in the event of a failure? Why or why not?

Level: High

Expected answer: You can?t use hot backup without being in archivelog mode. So no, you couldn?t recover.

12. What causes the "snapshot too old" error? How can this be prevented or mitigated?

Level: Intermediate

Expected answer: This is caused by large or long running transactions that have either wrapped onto their own rollback space or have had another transaction write on part of their rollback space. This can be prevented or mitigated by breaking the transaction into a set of smaller transactions or increasing the size of the rollback segments and their extents.

13. How can you tell if a database object is invalid?

Level: Low

Expected answer: By checking the status column of the DBA_, ALL_ or USER_OBJECTS views, depending upon whether you own or only have permission on the view or are using a DBA account.

14. A user is getting an ORA-00942 error yet you know you have granted them permission on the table, what else should you check?

Level: Low

Expected answer: You need to check that the user has specified the full name of the object (select empid from scott.emp; instead of select empid from emp;) or has a synonym that points to the object (create synonym emp for scott.emp;)

15. A developer is trying to create a view and the database won?t let him. He has the "DEVELOPER" role which has the "CREATE VIEW" system privilege and SELECT grants on the tables he is using, what is the problem?

Level: Intermediate

Expected answer: You need to verify the developer has direct grants on all tables used in the view. You can?t create a stored object with grants given through views.

16. If you have an example table, what is the best way to get sizing data for the production table implementation?

Level: Intermediate

Expected answer: The best way is to analyze the table and then use the data provided in the DBA_TABLES view to get the average row length and other pertinent data for the calculation. The quick and dirty way is to look at the number of blocks the table is actually using and ratio the number of rows in the table to its number of blocks against the number of expected rows.

17. How can you find out how many users are currently logged into the database? How can you find their operating system id?

Level: high

Expected answer: There are several ways. One is to look at the v$session or v$process views. Another way is to check the current_logins parameter in the v$sysstat view. Another if you are on UNIX is to do a "ps -ef|grep oracle|wc -l? command, but this only works against a single instance installation.

18. A user selects from a sequence and gets back two values, his select is:

SELECT pk_seq.nextval FROM dual;

What is the problem?

Level: Intermediate

Expected answer: Somehow two values have been inserted into the dual table. This table is a single row, single column table that should only have one value in it.

19. How can you determine if an index needs to be dropped and rebuilt?

Level: Intermediate

Expected answer: Run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn?t near 1.0 (i.e. greater than 0.7 or so) then the index should be rebuilt. Or if the ratio

BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3.

SQL/ SQLPlus

1. How can variables be passed to a SQL routine?

Level: Low

Expected answer: By use of the & symbol. For passing in variables the numbers 1-8 can be used (&1, &2,...,&8) to pass the values after the command into the SQLPLUS session. To be prompted for a specific variable, place the ampersanded variable in the code itself:

"select * from dba_tables where owner=&owner_name;" . Use of double ampersands tells SQLPLUS to resubstitute the value for each subsequent use of the variable, a single ampersand will cause a reprompt for the value unless an ACCEPT statement is used to get the value from the user.

2. You want to include a carriage return/linefeed in your output from a SQL script, how can you do this?

Level: Intermediate to high

Expected answer: The best method is to use the CHR() function (CHR(10) is a return/linefeed) and the concatenation function "||". Another method, although it is hard to document and isn?t always portable is to use the return/linefeed as a part of a quoted string.

3. How can you call a PL/SQL procedure from SQL?

Level: Intermediate

Expected answer: By use of the EXECUTE (short form EXEC) command.

4. How do you execute a host operating system command from within SQL?

Level: Low

Expected answer: By use of the exclamation point "!" (in UNIX and some other OS) or the HOST (HO) command.

5. You want to use SQL to build SQL, what is this called and give an example

Level: Intermediate to high

Expected answer: This is called dynamic SQL. An example would be:

set lines 90 pages 0 termout off feedback off verify off

spool drop_all.sql

select ?drop user ?||username||? cascade;? from dba_users

where username not in ("SYS?,?SYSTEM?);

spool off

Essentially you are looking to see that they know to include a command (in this case DROP USER...CASCADE;) and that you need to concatenate using the ?||? the values selected from the database.

6. What SQLPlus command is used to format output from a select?

Level: low

Expected answer: This is best done with the COLUMN command.

7. You want to group the following set of select returns, what can you group on?

Max(sum_of_cost), min(sum_of_cost), count(item_no), item_no

Level: Intermediate

Expected answer: The only column that can be grouped on is the "item_no" column, the rest have aggregate functions associated with them.

8. What special Oracle feature allows you to specify how the cost based system treats a SQL statement?

Level: Intermediate to high

Expected answer: The COST based system allows the use of HINTs to control the optimizer path selection. If they can give some example hints such as FIRST ROWS, ALL ROWS, USING INDEX, STAR, even better.

9. You want to determine the location of identical rows in a table before attempting to place a unique index on the table, how can this be done?

Level: High

Expected answer: Oracle tables always have one guaranteed unique column, the rowid column. If you use a min/max function against your rowid and then select against the proposed primary key you can squeeze out the rowids of the duplicate rows pretty quick. For example:

select rowid from emp e

where e.rowid > (select min(x.rowid)

from emp x

where x.emp_no = e.emp_no);

In the situation where multiple columns make up the proposed key, they must all be used in the where clause.

10. What is a Cartesian product?

Level: Low

Expected answer: A Cartesian product is the result of an unrestricted join of two or more tables. The result set of a three table Cartesian product will have x * y * z number of rows where x, y, z correspond to the number of rows in each table involved in the join.

11. You are joining a local and a remote table, the network manager complains about the traffic involved, how can you reduce the network traffic?

Level: High

Expected answer: Push the processing of the remote data to the remote instance by using a view to pre-select the information for the join. This will result in only the data required for the join being sent across.

12. What is the default ordering of an ORDER BY clause in a SELECT statement?

Level: Low

Expected answer: Ascending

13. What is tkprof and how is it used?

Level: Intermediate to high

Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output.

14. What is explain plan and how is it used?

Level: Intermediate to high

Expected answer: The EXPLAIN PLAN command is a tool to tune SQL statements. To use it you must have an explain_table generated in the user you are running the explain plan for. This is created using the utlxplan.sql script. Once the explain plan table exists you run the explain plan command giving as its argument the SQL statement to be explained. The explain_plan table is then queried to see the execution plan of the statement. Explain plans can also be run using tkprof.

15. How do you set the number of lines on a page of output? The width?

Level: Low

Expected answer: The SET command in SQLPLUS is used to control the number of lines generated per page and the width of those lines, for example SET PAGESIZE 60 LINESIZE 80 will generate reports that are 60 lines long with a line width of 80 characters. The PAGESIZE and LINESIZE options can be shortened to PAGES and LINES.

16. How do you prevent output from coming to the screen?

Level: Low

Expected answer: The SET option TERMOUT controls output to the screen. Setting TERMOUT OFF turns off screen output. This option can be shortened to TERM.

17. How do you prevent Oracle from giving you informational messages during and after a SQL statement execution?

Level: Low

Expected answer: The SET options FEEDBACK and VERIFY can be set to OFF.

18. How do you generate file output from SQL?

Level: Low

Expected answer: By use of the SPOOL command

Tuning Questions:

1. A tablespace has a table with 30 extents in it. Is this bad? Why or why not.

Level: Intermediate

Expected answer: Multiple extents in and of themselves aren?t bad. However if you also have chained rows this can hurt performance.

2. How do you set up tablespaces during an Oracle installation?

Level: Low

Expected answer: You should always attempt to use the Oracle Flexible Architecture standard or another partitioning scheme to ensure proper separation of SYSTEM, ROLLBACK, REDO LOG, DATA, TEMPORARY and INDEX segments.

3. You see multiple fragments in the SYSTEM tablespace, what should you check first?

Level: Low

Expected answer: Ensure that users don?t have the SYSTEM tablespace as their TEMPORARY or DEFAULT tablespace assignment by checking the DBA_USERS view.

4. What are some indications that you need to increase the SHARED_POOL_SIZE parameter?

Level: Intermediate

Expected answer: Poor data dictionary or library cache hit ratios, getting error ORA-04031. Another indication is steadily decreasing performance with all other tuning parameters the same.

5. What is the general guideline for sizing db_block_size and db_multi_block_read for an application that does many full table scans?

Level: High

Expected answer: Oracle almost always reads in 64k chunks. The two should have a product equal to 64 or a multiple of 64.

6. What is the fastest query method for a table?

Level: Intermediate

Expected answer: Fetch by rowid

7. Explain the use of TKPROF? What initialization parameter should be turned on to get full TKPROF output?

Level: High

Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output.

8. When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If bad -How do you correct it?

Level: Intermediate

Expected answer: 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.

9. When should you increase copy latches? What parameters control copy latches?

Level: high

Expected answer: When you get excessive contention for the copy latches as shown by the "redo copy" latch hit ratio. You can increase copy latches via the initialization parameter LOG_SIMULTANEOUS_COPIES to twice the number of CPUs on your system.

10. Where can you get a list of all initialization parameters for your instance? How about an indication if they are default settings or have been changed?

Level: Low

Expected answer: You can look in the init.ora file for an indication of manually set parameters. For all parameters, their value and whether or not the current value is the default value, look in the v$parameter view.

11. Describe hit ratio as it pertains to the database buffers. What is the difference between instantaneous and cumulative hit ratio and which should be used for tuning?

Level: Intermediate

Expected answer: The hit ratio is a measure of how many times the database was able to read a value from the buffers verses how many times it had to re-read a data value from the disks. A value greater than 80-90% is good, less could indicate problems. If you simply take the ratio of existing parameters this will be a cumulative value since the database started. If you do a comparison between pairs of readings based on some arbitrary time span, this is the instantaneous ratio for that time span. Generally speaking an instantaneous reading gives more valuable data since it will tell you what your instance is doing for the time it was generated over.

12. Discuss row chaining, how does it happen? How can you reduce it? How do you correct it?

Level: high

Expected answer: Row chaining occurs when a VARCHAR2 value is updated and the length of the new value is longer than the old value and won?t fit in the remaining block space. This results in the row chaining to another block. It can be reduced by setting the storage parameters on the table to appropriate values. It can be corrected by export and import of the effected table.

13. When looking at the estat events report you see that you are getting busy buffer waits. Is this bad? How can you find what is causing it?

Level: high

Expected answer: Buffer busy waits could indicate contention in redo, rollback or data blocks. You need to check the v$waitstat view to see what areas are causing the problem. The value of the "count" column tells where the problem is, the "class" column tells you with what. UNDO is rollback segments, DATA is data base buffers.

14. If you see contention for library caches how can you fix it?

Level: Intermediate

Expected answer: Increase the size of the shared pool.

15. If you see statistics that deal with "undo" what are they really talking about?

Level: Intermediate

Expected answer: Rollback segments and associated structures.

16. If a tablespace has a default pctincrease of zero what will this cause (in relationship to the smon process)?

Level: High

Expected answer: The SMON process won?t automatically coalesce its free space fragments.

17. If a tablespace shows excessive fragmentation what are some methods to defragment the tablespace? (7.1,7.2 and 7.3 only)

Level: High

Expected answer: In Oracle 7.0 to 7.2 The use of the 'alter session set events 'immediate trace name coalesce level ts#';? command is the easiest way to defragment contiguous free space fragmentation. The ts# parameter corresponds to the ts# value found in the ts$ SYS table. In version 7.3 the ?alter tablespace coalesce;? is best. If the free space isn?t contiguous then export, drop and import of the tablespace contents may be the only way to reclaim non-contiguous free space.

18. How can you tell if a tablespace has excessive fragmentation?

Level: Intermediate

If a select against the dba_free_space table shows that the count of a tablespaces extents is greater than the count of its data files, then it is fragmented.

19. You see the following on a status report:

redo log space requests 23

redo log space wait time 0

Is this something to worry about? What if redo log space wait time is high? How can you fix this?

Level: Intermediate

Expected answer: Since the wait time is zero, no. If the wait time was high it might indicate a need for more or larger redo logs.

20. What can cause a high value for recursive calls? How can this be fixed?

Level: High

Expected answer: A high value for recursive calls is cause by improper cursor usage, excessive dynamic space management actions, and or excessive statement re-parses. You need to determine the cause and correct it By either relinking applications to hold cursors, use proper space management techniques (proper storage and sizing) or ensure repeat queries are placed in packages for proper reuse.

21. If you see a pin hit ratio of less than 0.8 in the estat library cache report is this a problem? If so, how do you fix it?

Level: Intermediate

Expected answer: This indicate that the shared pool may be too small. Increase the shared pool size.

22. If you see the value for reloads is high in the estat library cache report is this a matter for concern?

Level: Intermediate

Expected answer: Yes, you should strive for zero reloads if possible. If you see excessive reloads then increase the size of the shared pool.

23. You look at the dba_rollback_segs view and see that there is a large number of shrinks and they are of relatively small size, is this a problem? How can it be fixed if it is a problem?

Level: High

Expected answer: A large number of small shrinks indicates a need to increase the size of the rollback segment extents. Ideally you should have no shrinks or a small number of large shrinks. To fix this just increase the size of the extents and adjust optimal accordingly.

24. You look at the dba_rollback_segs view and see that you have a large number of wraps is this a problem?

Level: High

Expected answer: A large number of wraps indicates that your extent size for your rollback segments are probably too small. Increase the size of your extents to reduce the number of wraps. You can look at the average transaction size in the same view to get the information on transaction size.

25. In a system with an average of 40 concurrent users you get the following from a query on rollback extents:

ROLLBACK CUR EXTENTS

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

R01 11

R02 8

R03 12

R04 9

SYSTEM 4

You have room for each to grow by 20 more extents each. Is there a problem? Should you take any action?

Level: Intermediate

Expected answer: No there is not a problem. You have 40 extents showing and an average of 40 concurrent users. Since there is plenty of room to grow no action is needed.

26. You see multiple extents in the temporary tablespace. Is this a problem?

Level: Intermediate

Expected answer: As long as they are all the same size this isn?t a problem. In fact, it can even improve performance since Oracle won?t have to create a new extent when a user needs one.

Installation/Configuration

1. Define OFA.

Level: Low

Expected answer: OFA stands for Optimal Flexible Architecture. It is a method of placing directories and files in an Oracle system so that you get the maximum flexibility for future tuning and file placement.

2. How do you set up your tablespace on installation?

Level: Low

Expected answer: The answer here should show an understanding of separation of redo and rollback, data and indexes and isolation os SYSTEM tables from other tables. An example would be to specify that at least 7 disks should be used for an Oracle installation so that you can place SYSTEM tablespace on one, redo logs on two (mirrored redo logs) the TEMPORARY tablespace on another, ROLLBACK tablespace on another and still have two for DATA and INDEXES. They should indicate how they will handle archive logs and exports as well. As long as they have a logical plan for combining or further separation more or less disks can be specified.

3. What should be done prior to installing Oracle (for the OS and the disks)?

Level: Low

Expected Answer: adjust kernel parameters or OS tuning parameters in accordance with installation guide. Be sure enough contiguous disk space is available.

4. You have installed Oracle and you are now setting up the actual instance. You have been waiting an hour for the initialization script to finish, what should you check first to determine if there is a problem?

Level: Intermediate to high

Expected Answer: Check to make sure that the archiver isn?t stuck. If archive logging is turned on during install a large number of logs will be created. This can fill up your archive log destination causing Oracle to stop to wait for more space.

5. When configuring SQLNET on the server what files must be set up?

Level: Intermediate

Expected answer: INITIALIZATION file, TNSNAMES.ORA file, SQLNET.ORA file

6. When configuring SQLNET on the client what files need to be set up?

Level: Intermediate

Expected answer: SQLNET.ORA, TNSNAMES.ORA

7. What must be installed with ODBC on the client in order for it to work with Oracle?

Level: Intermediate

Expected answer: SQLNET and PROTOCOL (for example: TCPIP adapter) layers of the transport programs.

8. You have just started a new instance with a large SGA on a busy existing server. Performance is terrible, what should you check for?

Level: Intermediate

Expected answer: The first thing to check with a large SGA is that it isn?t being swapped out.

9. What OS user should be used for the first part of an Oracle installation (on UNIX)?

Level: low

Expected answer: You must use root first.

10. When should the default values for Oracle initialization parameters be used as is?

Level: Low

Expected answer: Never

11. How many control files should you have? Where should they be located?

Level: Low

Expected answer: At least 2 on separate disk spindles. Be sure they say on separate disks, not just file systems.

12. How many redo logs should you have and how should they be configured for maximum recoverability?

Level: Intermediate

Expected answer: You should have at least three groups of two redo logs with the two logs each on a separate disk spindle (mirrored by Oracle). The redo logs should not be on raw devices on UNIX if it can be avoided.

13. You have a simple application with no "hot" tables (i.e. uniform IO and access requirements). How many disks should you have assuming standard layout for SYSTEM, USER, TEMP and ROLLBACK tablespaces?

Expected answer: At least 7, see disk configuration answer above.

Data Modeler:

1. Describe third normal form?

Level: Low

Expected answer: Something like: In third normal form all attributes in an entity are related to the primary key and only to the primary key

2. Is the following statement true or false:

"All relational databases must be in third normal form"

Why or why not?

Level: Intermediate

Expected answer: False. While 3NF is good for logical design most databases, if they have more than just a few tables, will not perform well using full 3NF. Usually some entities will be denormalized in the logical to physical transfer process.

3. What is an ERD?

Level: Low

Expected answer: An ERD is an Entity-Relationship-Diagram. It is used to show the entities and relationships for a database logical model.

4. Why are recursive relationships bad? How do you resolve them?

Level: Intermediate

A recursive relationship (one where a table relates to itself) is bad when it is a hard relationship (i.e. neither side is a "may" both are "must") as this can result in it not being possible to put in a top or perhaps a bottom of the table (for example in the EMPLOYEE table you couldn?t put in the PRESIDENT of the company because he has no boss, or the junior janitor because he has no subordinates). These type of relationships are usually resolved by adding a small intersection entity.

5. What does a hard one-to-one relationship mean (one where the relationship on both ends is "must")?

Level: Low to intermediate

Expected answer: This means the two entities should probably be made into one entity.

6. How should a many-to-many relationship be handled?

Level: Intermediate

Expected answer: By adding an intersection entity table

7. What is an artificial (derived) primary key? When should an artificial (or derived) primary key be used?

Level: Intermediate

Expected answer: A derived key comes from a sequence. Usually it is used when a concatenated key becomes too cumbersome to use as a foreign key.

8. When should you consider denormalization?

Level: Intermediate

Expected answer: Whenever performance analysis indicates it would be beneficial to do so without compromising data integrity.

UNIX:

1. How can you determine the space left in a file system?

Level: Low

Expected answer: There are several commands to do this: du, df, or bdf

2. How can you determine the number of SQLNET users logged in to the UNIX system?

Level: Intermediate

Expected answer: SQLNET users will show up with a process unique name that begins with oracle, if you do a ps -ef|grep oracle|wc -l you can get a count of the number of users.

3. What command is used to type files to the screen?

Level: Low

Expected answer: cat, more, pg

4. What command is used to remove a file?

Level: Low

Expected answer: rm

5. Can you remove an open file under UNIX?

Level: Low

Expected answer: yes

6. How do you create a decision tree in a shell script?

Level: intermediate

Expected answer: depending on shell, usually a case-esac or an if-endif or fi structure

7. What is the purpose of the grep command?

Level: Low

Expected answer: grep is a string search command that parses the specified string from the specified file or files

8. The system has a program that always includes the word nocomp in its name, how can you determine the number of processes that are using this program?

Level: intermediate

Expected answer: ps -ef|grep *nocomp*|wc -l

9. What is an inode?

Level: Intermediate

Expected answer: an inode is a file status indicator. It is stored in both disk and memory and tracts file status. There is one inode for each file on the system.

10. The system administrator tells you that the system hasn?t been rebooted in 6 months, should he be proud of this?

Level: High

Expected answer: Maybe. Some UNIX systems don?t clean up well after themselves. Inode problems and dead user processes can accumulate causing possible performance and corruption problems. Most UNIX systems should have a scheduled periodic reboot so file systems can be checked and cleaned and dead or zombie processes cleared out.

11. What is redirection and how is it used?

Level: Intermediate

Expected answer: redirection is the process by which input or output to or from a process is redirected to another process. This can be done using the pipe symbol "|", the greater than symbol ">" or the "tee" command. This is one of the strengths of UNIX allowing the output from one command to be redirected directly into the input of another command.

12. How can you find dead processes?

Level: Intermediate

Expected answer: ps -ef|grep zombie -- or -- who -d depending on the system.

13. How can you find all the processes on your system?

Level: Low

Expected answer: Use the ps command

14. How can you find your id on a system?

Level: Low

Expected answer: Use the "who am i" command.

15. What is the finger command?

Level: Low

Expected answer: The finger command uses data in the passwd file to give information on system users.

16. What is the easiest method to create a file on UNIX?

Level: Low

Expected answer: Use the touch command

17. What does >> do?

Level: Intermediate

Expected answer: The ">>" redirection symbol appends the output from the command specified into the file specified. The file must already have been created.

18. If you aren?t sure what command does a particular UNIX function what is the best way to determine the command?

Expected answer: The UNIX man -k command will search the man pages for the value specified. Review the results from the command to find the command of interest.

Oracle Troubleshooting:

1. How can you determine if an Oracle instance is up from the operating system level?

Level: Low

Expected answer: There are several base Oracle processes that will be running on multi-user operating systems, these will be smon, pmon, dbwr and lgwr. Any answer that has them using their operating system process showing feature to check for these is acceptable. For example, on UNIX a ps -ef|grep dbwr will show what instances are up.

2. Users from the PC clients are getting messages indicating :

Level: Low

ORA-06114: (Cnct err, can't get err txt. See Servr Msgs & Codes Manual)

What could the problem be?

Expected answer: The instance name is probably incorrect in their connection string.

3. Users from the PC clients are getting the following error stack:

Level: Low

ERROR: ORA-01034: ORACLE not available

ORA-07318: smsget: open error when opening sgadef.dbf file.

HP-UX Error: 2: No such file or directory

What is the probable cause?

Expected answer: The Oracle instance is shutdown that they are trying to access, restart the instance.

4. How can you determine if the SQLNET process is running for SQLNET V1? How about V2?

Level: Low

Expected answer: For SQLNET V1 check for the existence of the orasrv process. You can use the command "tcpctl status" to get a full status of the V1 TCPIP server, other protocols have similar command formats. For SQLNET V2 check for the presence of the LISTENER process(s) or you can issue the command "lsnrctl status".

5. What file will give you Oracle instance status information? Where is it located?

Level: Low

Expected answer: The alert.ora log. It is located in the directory specified by the background_dump_dest parameter in the v$parameter table.

6. Users aren?t being allowed on the system. The following message is received:

Level: Intermediate

ORA-00257 archiver is stuck. Connect internal only, until freed

What is the problem?

Expected answer: The archive destination is probably full, backup the archive logs and remove them and the archiver will re-start.

7. Where would you look to find out if a redo log was corrupted assuming you are using Oracle mirrored redo logs?

Level: Intermediate

Expected answer: There is no message that comes to the SQLDBA or SRVMGR programs during startup in this situation, you must check the alert.log file for this information.

8. You attempt to add a datafile and get:

Level: Intermediate

ORA-01118: cannot add anymore datafiles: limit of 40 exceeded

What is the problem and how can you fix it?

Expected answer: When the database was created the db_files parameter in the initialization file was set to 40. You can shutdown and reset this to a higher value, up to the value of MAX_DATAFILES as specified at database creation. If the MAX_DATAFILES is set to low, you will have to rebuild the control file to increase it before proceeding.

9. You look at your fragmentation report and see that smon hasn?t coalesced any of you tablespaces, even though you know several have large chunks of contiguous free extents. What is the problem?

Level: High

Expected answer: Check the dba_tablespaces view for the value of pct_increase for the tablespaces. If pct_increase is zero, smon will not coalesce their free space.

10. Your users get the following error:

Level: Intermediate

ORA-00055 maximum number of DML locks exceeded

What is the problem and how do you fix it?

Expected answer: The number of DML Locks is set by the initialization parameter DML_LOCKS. If this value is set to low (which it is by default) you will get this error. Increase the value of DML_LOCKS. If you are sure that this is just a temporary problem, you can have them wait and then try again later and the error should clear.

11. You get a call from you backup DBA while you are on vacation. He has corrupted all of the control files while playing with the ALTER DATABASE BACKUP CONTROLFILE command. What do you do?

Level: High

Expected answer: As long as all datafiles are safe and he was successful with the BACKUP controlfile command you can do the following:

CONNECT INTERNAL

STARTUP MOUNT

(Take any read-only tablespaces offline before next step ALTER DATABASE DATAFILE .... OFFLINE;)

RECOVER DATABASE USING BACKUP CONTROLFILE

ALTER DATABASE OPEN RESETLOGS;

(bring read-only tablespaces back online)

Shutdown and backup the system, then restart

If they have a recent output file from the ALTER DATABASE BACKUP CONTROL FILE TO TRACE; command, they can use that to recover as well.

If no backup of the control file is available then the following will be required:

CONNECT INTERNAL

STARTUP NOMOUNT

CREATE CONTROL FILE .....;

However, they will need to know all of the datafiles, logfiles, and settings for MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES for the database to use the command.

Free Online books or Tutorials on Database(Oracle/Mysql/SqlServer/Postgre)

List of Books available for free download:

1) Oracle 9i Database Administrators Guide
2) Oracle 9i Database Concept
3) Oracle 9i Database Getting Started
4) Oracle 9i Security Network Integration
5) Oracle 8 How to.zip
6) O'Reilly - Oracle Application
7) Oreilly Mastering Oracle SQL
8) Teach Yourself Oracle 8 In 21 Days
9) Oracle Unleashed (SAMS)
10)Oracle PL/SQL Bookshelf
11)Using Oracle8

http://programmerworld.net/books/oracle.htm


Available for MySql/SqlServer/Postgre Database Documentation for free download.

http://programmerworld.net/books/database.htm

How do you tune your Oracle database?

This article provides technical insight into Oracle database Wait-Event performance issues. Wait-Event Analysis for Oracle Databases is the industry best practice today for database tuning and performance optimization. Understanding the importance of each Oracle Wait-Event or “Resource” is essential for DBAs in keeping their database performing at its optimal level. Each month, Confio Software brings you this update to provide insight into a specific Oracle Resource, its significance in your Oracle system, and how to identify and address related problems. Oracle Resource is: index block split Definition: As applications, users, or sessions request rows from a table, Oracle may determine through the cost-based optimizer, which index access path is best for finding rows in a table. During this index lookup process, if another session is inserting or updating data, which in turn causes updates to that index and requires an index block split, the first session must wait on that index block split until finished. After which the first session must retry the index lookup request again to get the appropriate index keys for the rows required. Indexes are made up of a root block, branch blocks, and leaf blocks. Each of which can go through a block split. As index entries are created, and because index structures are inherently ordered, if the block required holding the new index key is full, room must be made by performing a block split. These block splits can occur in two different flavors. The first case splitting the block 50/50 where a new block is created and half the entries are contained in each of the blocks after the split. The second case is a 99/1 split that accommodates indexes where there are ever increasing values and the new key value is the highest key. In this case the original block is left intact and the new block contains only the new entry. Finding the splitting index When an index block split causes a session to wait, an event will be seen in the V$SESSION_WAIT view. The wait time associated with the event that holds up the session from selecting a row is important, but often just determining the splitting index object is key. The block splitting can then be limited by modifying the structure of the index. There are essentially three steps to this process of finding the offending index: 1. Find the data block addresses (dba) of the splitting index from the V$SESSION_WAIT view. Two different dbas are given plus the level of the index block:
P1 : rootdba: The root of the index
P2 : level: The level of the index where the block is being split
P3 : childdba: The actual block of the index being split

SELECT sid, event, p1, p2, p3 FROM v$session_wait

1. Find the physical location of the splitting index by using the DBMS_UTILITY package. Two functions will help zero in on the physical location of the index block using the rootdba value from step

1: DATA_BLOCK_ADDRESS_FILE: Returns the file number of the dba

DATA_BLOCK_ADDRESS_BLOCK: Returns the block number the dba

SELECT DBMS_UTILITY.DATA_BLOCK _ADDRESS_FILE() FILE_ID, DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK() BLOCK_ID
FROM dual;

Find the offending index object from DBA_EXTENTS using the FILE_ID and BLOCK_ID values determined from step

2: SELECT owner, segment_name FROM dba_extents WHERE file_id = AND BETWEEN block_id AND block_id + blocks -1;

How to combat index block splits

1. Re-evaluate the setting of PCTFREE for problematic indexes. Giving a higher PCTFREE will allow more index entries to be inserted into existing index blocks and thus prolong the need for an index block split.

2. Check the indexed columns to make sure they are valid. An improperly formed index key can cause excessive splitting by the nature and order of the columns it contains.

3. Check application logic. Many ill-formed applications have been known to perform excessive updates to indexes when not required. Review application code to verify all data manipulations are required, especially if some tables are treated as temporary objects when in fact they are permanent tables.

Conclusion

Through the normal processing of insertions and updates to data, Oracle must maintain indexes so future queries to the underlying data can be accessed quickly through the use of indexes. Maintaining these indexes requires Oracle to keep index entries in order and thus may need to split and move keys between blocks at times. Splitting, allocating a new block, and moving keys are very expensive operations. If done too often the performance of queries against those indexes must wait and could slow down processing. Proper detection of the offending index and taking corrective action through changing the index structure or application processing must be done.

Aug 13, 2006

Oracle 1z0-032: Oracle 9i Database Fundamentals-II #4

QUESTION NO: 16

What is the new Oracle Shared Server?
A. An improved version of multithreaded server configuration.
B. A connection pooling configuration where several clients are connected to the same server process.
C. Two more database servers, which share data by means of database links; the client software is unaware to which server it is connected.
D. A configuration of Real Application Cluster where the client connection is routed to the least busy instance.

Answer: A

Explanation:

Oracle Shared Server is an improved version of multithreaded server configuration.

Incorrect Answers
B: Oracle Shared Server does not provide configuration where several clients are connected to the same server process.
C: Oracle Shared Server does not include two or more database servers, which share data by means of database links.
D: Oracle Shared Server is not a configuration of Real Application Clusters where the client connection is routed to the least busy instance.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 144-152
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 59-60
Chapter 2: Oracle9i Architecture Changes

QUESTION NO: 17

What type of protection is implemented when the DBA issues the ALTER DATABASE SET STANDBY DATABASE PROTECTED; command?

A. The standby database is protected against write operations.
B. The primary database is protected against write operations.
C. The primary database is protected against data loss and data divergence.
D. The standby database is protected against data loss and data divergence.

Answer: C

Explanation:

The failure resolution policy specifies what should happen on the primary database if all the standby databases ion the configuration are unable to archive the redo logs. To specify guaranteed protection, you must establish the PROTECTED mode for the primary database. The PROTECTED mode will establish a zero divergence and zero data loss configuration.

Incorrect Answers

A: The standby database is not protected against write operations by this operation. The standby database can be mounted for recovery or open as read-only database.
B: The primary database is not protected against write operations.
D: The primary, not standby, database is protected against data loss and data divergence.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 64-72
Chapter 2: Availability Enhancements
Oracle 9i New Features, Robert Freeman, p. 86-99
Chapter 3: New Oracle9i Availability and Recoverability Features

QUESTION NO: 18

You are attempting to create an Oracle-Managed Files (OMF) tablespace in a production database with the following statement and receive the following error message:

CREATE TABLESPACE tbsl;

ORA-02199: missing DATAFILE/TEMPFILE clause
oerr ora 2199 02199, 00000, “missing DATAFILE/TEMPFILE clause”

*Cause: A CREATE TABLESPACE statement has no DATAFILE/TEMPFTLE clause.
*Action: specify DATAFILE/TEMPFILE clause.

What is the corrective action to create the OMF based tablespace?
A. Issue the CREATE TABLESPACE tbsl DATAFILE SIZE 10M; command.
B. Issue the CREATE TABLESPACE tbsl EXTENT MANAGEMENT ORACLE; command.
C. Set the db_create_file_dest parameter using the ALTER SESSION command and reissue the statement.
D. An OMF tablespace is now allowed; only control files and/or redo log files can be created by OMF.

Answer: C

Explanation:

You can set the DB_CREATE_FILE_DEST parameter using the ALTER SESSION command and re-issue the statement. You should define directories for OMF datafiles, redo log files and control files. Oracle9i gives you two new initialization parameters, DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n, to specify the location where Oracle will create and manage OMFs; n can take a value from 1 to 5.

Incorrect Answers

A: This command will not fix the problem.
B: There is no EXTENT MANAGEMENT ORACLE option in the CREATE TABLESPACE command.
D: An OMF tablespace is allowed; datafiles, control files and redo log files can be created by OMF.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 153-160
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 2-12
Chapter 1: Oracle9i Database Administration and Management Features

QUESTION NO: 19

Why can setting too low a value for the FAST_START_MTTR_TARGET parameter reduce your overall database performance?

A. Data blocks have to be written more frequently by DBWR.
B. Redo blocks have to be written more frequently by LGWR.
C. You need to substantially increase the size of your database buffer cache to hold the additional checkpoint records.
D. You need to substantially increase the size of your redo buffer cache to hold the additional checkpoint records.

Answer: A

Explanation:

If you set a value for the FAST_START_MTTR_TARGET too low DBWR will write the data blocks more frequently to reduce recovery time in accordance with the FAST_START_MTTR_TARGET parameter. It can cause the overall database performance degradation.

Incorrect Answers

B: It will not make LGWR to write redo blocks more frequently: data blocks will be written more frequently by DBWR.
C: You don’t need to substantially increase the size of your database buffer cache to hold the additional checkpoint records.
D: You don’t need to substantially increase the size of your redo buffer cache to hold the additional checkpoint records.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 42-45
Chapter 2: Availability Enhancements
Oracle 9i New Features, Robert Freeman, p. 73-75
Chapter 3: New Oracle9i Availability and Recoverability Features

QUESTION NO: 20

What is true regarding a shared, server-side parameter file for a Real Application Cluster database?

A. It can contain parameters with distinct values for each distance.
B. It can contain only parameters with identical values for each instance.
C. It must contain an IFILE parameter for each instance’s individual parameter file.
D. It must be located in the default location for the primary instance’s parameter file.

Answer: A

Explanation:

The server-side parameter file for a Real Application Clusters database can contain parameters with distinct values for each instance.

Incorrect Answers

B: It can contain not only parameters with identical values for each instance, but distinct values for each instance.
C: It is not required that it must contain an IFILE parameter for each instance's individual parameter file. It needs to be done when the DBA stores the common parameters in one file and references that common file in each instance by using the IFILE initialization parameter.
D: It can be not located in the default location for the primary instance's parameter file.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 227-230
Chapter 4: Performance and Scalability Enhancements
Oracle 9i New Features, Robert Freeman, p. 188-192
Chapter 7: Oracle9i Real Application Clusters

Aug 11, 2006

Oracle 1z0-032: Oracle 9i Database Fundamentals-II #3

QUESTION NO: 11

When does Oracle9i flag an index as being used in the V$OBJECT_USAGE view?
A. During a query’s parse time only.
B. During a query’s execution time only.
C. During any kind of DML statement execution.
D. During the execution of an INSERT statement only.

Answer: A

Explanation:

During a query's parse time Oracle9i flags an index as being used in the V$OBJECT_USAGE view. You can query the V$OBJECT_USAGE view to review the index utilization data. If the index has been used within the period of time it was monitored, the USED column within this view will contain a YES value; it will contain a NO otherwise.

Incorrect Answers

B: During a query's execution time Oracle9i does not flag an index as being used in the V$OBJECT_USAGE view.
C: Oracle9i flags an index as being used in the V$OBJECT_USAGE view during a query's parse time, not during any kind of DML statement execution.
D: Oracle9i flags an index as being used in the V$OBJECT_USAGE view during a query's parse time, not during execution of an INSERT statement.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 212-214
Chapter 4: Performance and Scalability Enhancements
Oracle 9i New Features, Robert Freeman, p. 56-57
Chapter 2: Oracle9i Architecture Changes

QUESTION NO: 12

Using a bitmap structure to manage database object space has several benefits over using freelist structures. Which three are benefits of managing space using automaticsegment-space managed objects? (Choose three)
A. It readily responds to dynamic changes for concurrent access.
B. It improves performance and space utilization in a multiple-instance environment.
C. It requires fewer space related options then freelist managed structures.
D. It improves performance for SYSTEM tablespaces where a high degree of concurrency is required.

Answer: A, B, D

Explanation:
Managing space with automatic segment-space managed objects can respond to dynamic changes for concurrent access, improves performance and space utilization in a multi-instance environment and improves performance for SYSTEM tablespaces where a high degree of concurrency is required.

Incorrect Answers

C: It requires more space related options than freelist managed structures.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 138-140
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 53-54
Chapter 2: Oracle9i Architecture Changes

QUESTION NO: 13

The EMPLOYEES table has six indexes and DML operations are slow. Which command begins monitoring the EMPLOYEE_IDX_FK index to determine whether it has been used by an execution plan?
A. ALTER TABLE employees monitor index employee_idx_fk;
B. ALTER INDEX employee_idx_fk monitoring on;
C. ALTER TABLE employees monitor all indexes;
D. ALTER INDEX employee_idx_fk monitoring usage;

Answer: D

Explanation:

This statement provides correct syntax to start monitoring the EMPLOYEE_IDX_FK index to determine whether it has been used by an execution plan.

Incorrect Answers
A: This command requires MONITORING USAGE clause with ALTER INDEX command to be used, not MONITOR INDEX clause with ALTER TABLE command.
B: This command requires MONITORING USAGE clause to be used, not MONITORING ON clause.
C: This command requires MONITORING USAGE clause with ALTER INDEX command to be used, not MONITOR ALL INDEXES clause with ALTER TABLE command.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 212-214
Chapter 4: Performance and Scalability Enhancements
Oracle 9i New Features, Robert Freeman, p. 56-59
Chapter 2: Oracle9i Architecture Changes

QUESTION NO: 14

You can control instance recover performance by setting parameters to define targets for ______.

A. The size of the redo buffer in SGA.
B. The instance that will perform recovery in Real Application Cluster database.
C. The number of blocks to be read during instance recovery, or the time needed to complete instance recovery.
D. The number of passes through the redo logs made by the recovery process to identify blocks needing recovery.

Answer: C

Explanation:

Oracle9i added the FAST_START_MTTR_TARGET parameter to define targets for the number of blocks to be read during instance recovery, or the time needed to complete instance recovery. Oracle internally uses the FAST_START_MTTR_TARGET parameter value to calculate and set the FAST_START_IO_TARGET and LOG_CHECKPOINT_INTERVAL parameters. If you specified the FAST_START_IO_TARGET and LOG_CHECKPOINT_INTERVAL parameter values, they will override the values Oracle calculates from the FAST_START_MTTR_TARGET parameter.

Incorrect Answers

A: You cannot control instance recovery performance by setting parameters to define targets for the size of the redo buffer in the SGA
B: It’s not possible to control instance recovery performance for the instance that will perform recovery in a Real Application Clusters database.
D: The number of passes through the redo logs made by the recovery process to identify blocks needing recovery will not help to control instance recovery performance.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 42-45
Chapter 2: Availability Enhancements
Oracle 9i New Features, Robert Freeman, p. 73-75
Chapter 3: New Oracle9i Availability and Recoverability Features

QUESTION NO: 15

Which three statements are true about the privileged connection options available in Oracle9i? (Choose three)

A. The CONNECT INTERNAL is disallowed.
B. The Server Manager tool is no longer supplied.
C. The listener must be running to make a connection.
D. The use of remote password login file (orapw) is unchanged.

Answer: A, B, C

Explanation:

The CONNECT INTERNAL is disallowed in Oracle9i. The Server Manager tool is no longer supplied also. And the listener must be running to make a connection.

Incorrect Answers
D: The use of a remote password login file (orapw) is changed in Oracle9i.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 5-10
Chapter 1: Security Enhancements
Oracle 9i New Features, Robert Freeman, p. 132-135
Chapter 5: Miscellaneous Oracle9i Features and Enhancements

Aug 9, 2006

Oracle 1z0-032: Oracle 9i Database Fundamentals-II #2

QUESTION NO: 6

Which statement correctly describes the function of Oracle9i Cache Fusion feature?

A. It provides each session with its own view of the database at a different point in the past.
B. It enables you to execute scalable applications on a clustered database without having to partition the users or the database tables.
C. It lets you dynamically reassign memory in your database buffer cache to different block buffer sizes.
D. It allows you to add new sites to multimaster replication environment without quiescing the master definition site.

Answer: B

Explanation:
The Oracle9i Cache Fusion allows you to execute scalable applications on a clustered database without having to partition the users or the database tables.

Incorrect Answers

A: It does not provide each session with its own view of the database at a different point in the past.
C: The Oracle9i Cache Fusion feature does not dynamically reassign memory in your database buffer cache to different block buffer sizes.
D: It does not provide you ability to add new sites to multimaster replication environment without quiescing the master definition site.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 223-230
Chapter 4: Performance and Scalability Enhancements
Oracle 9i New Features, Robert Freeman, p. 193-206
Chapter 7: Oracle9i Real Application Clusters

QUESTION NO: 7

What is true if you want to switch undo tablespaces from the current one, called UNDO1, to a new one called UNDO2?

A. It is NOT possible to switch unless no active transaction exist in UNDO1.
B. It is possible to switch to UNDO2; but current active transactions will abort.
C. It is possible to switch to UNDO2; current active transactions will be automatically migrated to UNDO2.
D. It is possible to switch to UNDO2; only current active transactions will continue to execute inside UNDO1.

Answer: D

Explanation:

You can switch undo tablespaces from the current one, called UNDO1, to a new one called UNDO2. Only current active transactions will continue to execute inside UNDO1, all new transactions will be assigned to the new undo tablespace.

Incorrect Answers

A: You can switch undo tablespaces while active transactions will run in the old undo tablespace. All new transactions will be assigned to the new undo tablespace.
B: Current active transactions will abort if you switched undo tablespaces.
C: Current active transactions will continue to execute inside UNDO1 till they commit or rollback. They will not be automatically migrated to UNDO2.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 160-166
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 19-25
Chapter 1: Oracle9i Database Administration and Management Features

QUESTION NO: 8

Examine the list of variables and their data types:
NAME DATA Type
TS, TS1 TIMESTAMP
TSZ TIMESTAMP WITH TIME ZONE
TLZ TIMESTAMP WITH LOCAL TIME ZONE
IYM INTERVAL YEAR TO MONTH
IDS, IDSI INTERVAL YEAR To SECOND

Which three expressions using the new data and time data types are valid? (Choose three)

A. IDS* 2
B. TS + IYM
C. TS –TSI
D. IDS – TS
E. IDS + IYM

Answer: A, B, E

Explanation:
IDS*2, TS+IYM and IDS+IYM are valid new date and time data types.

Incorrect Answers

C: You cannot subtract timestamps.
D: It’s not possible to subtract timestamp from the interval day to second.
OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 266-271
Chapter 5: Language Enhancements
Oracle 9i New Features, Robert Freeman, p. 132-135
Chapter 5: Miscellaneous Oracle9i Features and Enhancements

QUESTION NO: 9

Consider the following statement:
SQL> EXECUTE DBMS_STATS.GATHER_SHEMA_STATS (-2> ownname => ‘OE’, -
3> estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, -
4> method opt => ‘for all columns size AUTO’);

What is the effect of ‘for all columns size AUTO’ of the METHOD_OPT option?

A. The Oracle server creates a new histogram based on existing histogram definitions for all table, column, and index statistics for the OE schema.
B. The Oracle server creates a histogram based on data distribution regardless of how the application uses the column/s for all table, column, and index statistics for the OE schema.
C. The Oracle server creates a histogram based on data and application usage of the column/s for all table, column, and index statistics for the OE schema.
D. The Oracle server creates a histogram based on application usage, regardless of data distribution, for all table, column, and index statistics for the OE schema.

Answer: C

Explanation:
The Oracle server creates a histogram based on data distribution and application usage of the column/s for all table, column, and index statistics for the OE schema.

Incorrect Answers

A: The Oracle server does not create a new histogram based on existing histogram.
B: Histogram creation is not regardless of how the application uses the column/s for all table, column, and index statistics for the OE schema.
D: The Oracle server creates a histogram not only based on application usage, but based on data distribution also.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 220-222
Chapter 4: Performance and Scalability Enhancements
Oracle 9i New Features, Robert Freeman, p. 180-181
Chapter 6: Oracle9i SQL, PL/SQL New Features

QUESTION NO: 10

Which two are true regarding external tables? (Choose two)

A. External tables can be updated.
B. External tables are read-only tables.
C. Indexes can be created on external tables.
D. Indexes cannot be created on external tables.

Answer: B, D

Explanation:
External tables are read-only tables whose data resides in an external OS flat file, and whose definition is stored inside the database. Indexes cannot be created on external tables.

Incorrect Answers
A: External tables cannot be updated. They are read-only tables.
C: Indexes cannot be created on external tables.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 131-134
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 111-116
Chapter 4: New Oracle9i Database DDS and Data-Warehouse Features

Aug 7, 2006

Oracle 1z0-032: Oracle 9i Database Fundamentals-II #1

QUESTION NO: 1
What criterion does Oracle9i use to determine whether a database file is an Oracle Managed File?
A. The filename format.
B. Information stored inside a data dictionary table.
C. Information stored in the ALERT.LOG file for the corresponding instance.
D. Information stored inside the corresponding initialization parameter file for the instance.

Answer: A
Explanation:
Oracle will use naming conventions when it creates the OMF files. In this naming convention, %t represents the tablespace name, %u is a unique 8-character string, and %g stands for the redo log group number.

Incorrect Answers
B: Oracle will create a locally managed tablespaces, so information about a datafile will not be stored inside a data dictionary table.
C: Oracle does not use ALERT.LOG file to store information about datafiles. It just keep log of database events and database structure changes.
D: Initialization parameter file will not be used to store this information. Oracle reads this file to set initialization parameters to start the instance. The structure of the database is stored inside control files. Oracle uses them to mount and open the database.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 153-160
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 2-12
Chapter 1: Oracle9i Database Administration and Management Features

QUESTION NO: 2

Oracle9i extends the cursor sharing functionality with the new value of SIMILAR for the CURSOR_SHARING parameter. With CURSOR_SHARING = SIMILAR, cursors are shared for safe literals only. What is meant by ‘safe literals only’?
A. No literal value is substituted for a shared cursor.
B. Different execution plans are generated for substituted literal values.
C. The substitution of a literal value will produce different execution plans.
D. The substitution of any literal value will produce exactly the same execution plan.

Answer: D
Explanation:
Oracle9i has enhanced cursor sharing mode. It can use additional value, SIMILAR, in addition to the EXACT and FORCE cursor sharing modes. When you specify SIMILAR, Oracle only uses the execution plan if is certain that the execution plan does not have any association with the specific literal value. You can enable similar statements to share the same SQL execution plan by setting CURSOR_SHARING to either FORCE or SIMILAR.

Incorrect Answers
A: Literal value is substituted for a shared cursor. The substitution of any literal value will produce exactly the same execution plan.
B: Exactly the same execution plans will be generated for substituted literal values.
C: The substitution of any literal value will produce exactly the same execution plan.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 215-217
Chapter 4: Performance and Scalability Enhancements
Oracle 9i New Features, Robert Freeman, p. 57-59
Chapter 2: Oracle9i Architecture Changes

QUESTION NO: 3

The Dynamic SGA feature allows the SGA to grow and shrink dynamically according to an ALTER SYSTEM command. This avoids the previous need of shutting down the instance in order to modify the components of the SGA, namely the buffer cache and shared pool components.
Which three statements are true for the Dynamic SGA feature? (Choose three)
A. The maximum granule size is 4 MB.
B. The minimum SGA configuration is three granules.
C. SGA memory is based on granules by SGA components.
D. The size of the SGA components is set by the SGA_MAX_SIZE parameter.
E. The size of the SGA components is limited by the setting of SGA_MAX_SIZE parameter.

Answer: B, C, E

Explanation:
The minimum SGA configuration is three granules. One is for fixed SGA, one for database buffer, one for shared pool. Oracle9i has enhanced the nature of SGA parameters; they are now dynamic. You can change the values of the shared pool and the buffer cache without restarting the database instance. The Oracle9i dynamic SGA concept enables you to take memory from one area of the SGA and allocate it to another area as needed while the database instance is up and running. Additionally, the unit of memory allocation fr SGA is a granule in Oracle9i. Oracle9i also introduces SGA_MAX_SIZE, a new static parameter that enables the DBA to start with a smaller SGA and dynamically increase it to the maximum value specified by SGA_MAX_SIZE. If you do not set SGA_MAX_SIZE or if you set it to a value less than initial SGA size, you cannot increase the SGA size later.

Incorrect Answers
A: The size of a granule is 4 MB if the SGA at startup is less than 128 MB; it will be 16 MB otherwise.
D: The size of the SGA components is not set by the SGA_MAX_SIZE parameter. This parameter is just maximum limit for sum of the SGA components.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 180-182
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 16-17
Chapter 1: Oracle9i Database Administration and Management Features

QUESTION NO: 4

There is more than one way to set the server to detect and affect long running operations automatically. What is the best choice of you want to reduce the impact of long running operations on other users without aborting the long running operations?
A. Define user profiles and set the CPU_PER_CALL limit.
B. Define a SWITCH_TIME for a plan in the Resource Manager.
C. Create a batch job that checks V$SESSION_LONGOPS; the batch job alters the session priority of the long running operations.
D. Create a user defined event in the Oracle Enterprise Manager, which monitors V$SESSION_LONGOPS.

Answer: B

Explanation:
You can define a SWITCH_TIME for a plan in the Resource Manager to reduce the impact of long running operations on other users without aborting the long running operations.

Incorrect Answers
A: You cannot do this with CPU_PER_CALL limit.
C: You don’t need to use a batch job to check V$SESSION_LONGOPS for this purpose.
D: It can be done with a SWITCH_TIME for a plan in the Resource Manager, you don’t need to monitor V$SESSION_LONGOPS.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 122-129
Chapter 3: Manageability Enhancements

QUESTION NO: 5

What are three benefits of performing data definition language (DDL) statements against a partitioned table with the UPDATE GLOBAL INDEXES clause? (Choose three)
A. Global indexes are rebuilt automatically at the end of the DDL operation thereby avoiding problems with the UNUSABLE status.
B. You do not have to search for invalid global indexes after the DDL command completes and rebuild them individually.
C. Global indexes are maintained during the operation of the DDL command and therefore can be used by any concurrent query.
D. Global indexes remain intact and available for use by data manipulation language (DML) statements even for sessions that have not enabled the skipping of unusable indexes.

Answer: A, B, D

Explanation:
Oracle9i overcomes the problem of rebuilding the global index by giving you the option to update global indexes as Oracle performs the partition DDL. This feature is not applicable to local indexes, domain indexes, index-organized tables (IOTs), or to indexes that were UNUSABLE prior to start of the partition DML. You can invoke this capability by using the optional clause UPDATE GLOBAL INDEX of the ALTER TABLE command. You can use this clause with the ADD, COALESCE, DROP, EXCHANGE, MERGE, MOVE, SPLIT, and TRUNCATE partition DDL commands.

Incorrect Answers
C: Global indexes are not maintained during the operation of the DDL command.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 130-131
Chapter 3: Manageability Enhancements
Oracle 9i New Features, Robert Freeman, p. 102-107
Chapter 4: New Oracle9i Database DDS and Data-Warehouse Features





*This is published for helping newbies in Oracle/MySql DBA field. Please excuse, If in any sense violating the rules/laws.

Oracle FAQs #2

41. WHAT IS DEFAULT VALUE FOR EVERY COLUMN OF A TABLE?
Ans: NULL.

42. WHAT IS CREATED IMPLICITLY FOR EVERY UNIQUE AND PRIMARY KEY COLUMNS?
Ans: Index.

43. WHAT ARE LIMITATIONS OF CHECK CONSTRAINT?
Ans: In this we can't specify Pseudo Columns like sysdate etc.

44. WHAT IS DIFFERENCE BETWEEN REFERENCES AND FOREIGN KEY CONSTRAINT?
Ans: References is used as column level key word where as foreign key is used as table level constraint.

45. WHAT IS "ON DELETE CASCADE"?
Ans: when this key word is included in the definition of a child table then whenever the records from the parent table is deleted automatically the respective values in the child table will be deleted.

46. WHAT IS PARENT-CHILD OR MASTER-DETAIL RELATIONSHIP?
Ans: A table which references a column of another table(using References)is called as a child table(detail table) and a table which is being referred is called Parent (Master) Table .

47. HOW TO DROP A PARENT TABLE WHEN IT'S CHILD TABLE EXISTS?
Ans: Using "on delete cascade".

48. IS ORACLE CASE SENSITIVE?
Ans: NO

49. HOW ORACLE IDENTIFIES EACH RECORD OF TABLE UNIQUELY?
Ans: By Creating indexes and reference IDs.

50. WHAT IS A PSEUDO-COLUMN? NAME SOME PSEUDO-COLUMNS OF ORACLE?
Ans: Columns that are not created explicitly by the user and can be used explicitly in queries are called Pseudo-Columns.
Ex:currval,nextval,sysdate….

51. WHAT FOR "ORDER BY" CLAUSE FOR A QUERY?
Ans: To arrange the query result in a specified order(ascending,descending) by default it takes ascending order.

52. WHAT IS "GROUP BY" QUERIES?
Ans: To group the query results based on condition.

53. NAME SOME AGGREGATE FUNCTIONS OF SQL?
Ans: AVG, MAX, SUM, MIN,COUNT.

54. WHAT IS DIFFERENCE BETWEEN COUNT (), COUNT (*) FUNCTIONS?
Ans: Count () will count the specified column whereas count (*) will count total no. of rows in a table.

55. WHAT FOR ROLLUP AND CUBE OPERATORS ARE?
Ans: To get subtotals and grand total of values of a column.

56. WHAT IS A SUB-QUERY?
Ans: A query within a query is called a sub query where the result of inner query will be used by the outer query.

57. WHAT ARE SQL OPERATORS?
Ans: Value (), Ref () is SQL operator.

58. EXPLAIN "ANY","SOME","ALL","EXISTS" OPERATORS?
Ans: Any: The Any (or it's synonym SOME) operator computes the lowest value from the set and compares a value to each returned by a sub query.
All: ALL compares a value to every value returned by SQL.
Exists: This operator produces a BOOLWAN results. If a sub query produces any result then it evaluates it to TRUE else it evaluates it to FALSE.

59. WHAT IS A CORRELATED SUB QUERY, HOW IT IS DIFFERENT FROM A NORMAL SUB QUERY?
Ans: A correlated subquery is a nested subquery, which is executed once for each 'Candidate row' by the main query, which on execution uses a value from a column in the outer query. In normal sub query the result of inner query is dynamically substituted in the condition of the outer query where as in a correlated subquery, the column value used in inner query refers to the column value present in the outer query forming a correlated subquery.

60. WHAT IS A JOIN - TYPES OF JOINS?
Ans: A join is used to combine two or more tables logically to get query results.

There are four types of Joins namely
EQUI Join
NON-EQUI Join
SELF Join
OUTER Join.

61. WHAT ARE MINIMUM REQUIREMENTS FOR AN EQUI-JOIN?
Ans: There shold be atleast one common column between the joining tables.

62. WHAT IS DIFFERENCE BETWEEN LEFT, RIGHT OUTER JOIN?
Ans:If there r any values in one table that do not have corresponding values in the other,in an equi join that row will not be selected.Such rows can be forcefully selected by using outer join symbol(+) on either of the sides(left or right) based on the requirement.

63. WHAT IS DIFFERENCE BETWEEN EQUI AND SELF JOINS?
Ans: SELF JOIN is made within the table whereas EQUI JOIN is made between different tables having common column.

64. WHAT ARE "SET" OPERATORS?
Ans: UNION, INTERSECT or MINUS is called SET OPERATORS.

65. WHAT IS DIFFERENCE BETWEEN "UNION" AND "UNION ALL" OPERATORS?
Ans: UNION will return the values distinctly whereas UNION ALL will return even duplicate values.

66. NAME SOME NUMBER, CHARACTER, DATE, CONVERSION, OTHER FUNCTIONS.
Ans: Number Functions:
Round (m, [n]),
Trunc (m, [n]),
Power (m, n),
Sqrt,
Abs (m),
Ceil (m),
Floor (m),
Mod (m, n)
Character Functions:
Chr (x)
Concert (string1, string2)
Lower (string)
Upper (string)
Substr (string, from_str, to_str)
ASCII (string)
Length (string)
Initcap (string).
Date Functions:
sysdate
Months between (d1, d2)
To_char (d, format)
Last day (d)
Next_day (d, day).
Conversion Functions:
To_char
To_date
To_number

67. WHAT IS DIFFERENCE BETWEEN MAX () AND GREATEST () FUNCTIONS?
Ans: MAX is an aggregate function which takes only one column name of a table as parameter whereas Greatest is a general function which can take any number of values and column names from dual and table respectively.

68. WHAT FOR NVL () FUNCTION IS?
Ans: NVL Function helps in substituting a value in place of a NULL.

69. WHAT FOR DECODE () FUNCTION IS?
Ans: It is substitutes value basis and it actually does an 'if-then-else' test.

70. WHAT IS DIFFERENCE BETWEEN TRANSLATE () AND REPLACE () FUNCTIONS?
Ans: Translate() is a superset of functionality provided by Replace().

71. WHAT IS DIFFERENCE BETWEEN SUBSTR () AND INSTR () FUNCTIONS?
Ans: Substr() will return the specified part of a string whereas Instr() return the position of the specified part of the string.

72. WHAT IS A JULIAN DAY NUMBER?
Ans: It will return count of the no. Of days between January 1, 4712 BC and the given date.

73. HOW TO DISPLAY TIME FROM A DATE DATA?
Ans: By using time format as 'hh [hh24]: mi: ss' in to_char() function.

74. HOW TO INSERT DATE AND TIME INTO A DATE COLUMN?
Ans: By using format 'dd-mon-yy hh [hh24]: mi: ss' in to_date() function.

75. WHAT IS DIFFERENCE BETWEEN TO_DATE () AND TO_CHAR () CONVERSION FUNCTIONS?
Ans: To_date converts character date to date format whereas
To_char function converts date or numerical values to characters.

76. WHAT IS A VIEW? HOW IT IS DIFFERENT FROM A TABLE?
Ans: View is database object, which exists logically but contains no physical data and manipulates the base table. View is saved as a select statement in the database and contains no physical data whereas Table exists physically.

77. WHAT IS DIFFERENCE BETWEEN SIMPLE AND COMPLEX VIEWS?
Ans: Simple views can be modified whereas Complex views(created based on more than one table) cannot be modified.

78. WHAT IS AN INLINE VIEW?
Ans: Inline view is basically a subquery with an alias that u can use like a view inside a SQL statement. It is not a schema object like SQL-object.

79. HOW TO UPDATE A COMPLEX VIEW?
Ans: Using 'INSTEAD OF' TRIGGERS Complex views can be Updated.

80. WHAT FOR "WITH CHECK OPTION" FOR A VIEW?
Ans: "WITH CHECK OPTION" clause specifies that inserts and updates r performed through the view r not allowed to create rows which the view cannot select and therefore allows integrity constraints and data validation checks to be enforced on data being inserted or updated.

81. WHAT IS AN INDEX? ADVANTAGE OF AN INDEX
Ans: An Index is a database object used n Oracle to provide quick access to rows in a table. An Index increases the performance of the database.

82. WHAT IS A SEQUENCE? PSEUDO-COLUMNS ASSOCIATED WITH SEQUENCE?
Ans: Sequence is a Database Object used to generate unique integers to use as primary keys. Nextval, Currval are the Pseudo Columns associated with the sequence.

**83. WHAT IS A CLUSTER? WHEN TO USE A CLUSTER? HOW TO DROP A CLUSTER WHEN CLUSTERED TABLE EXISTS?
Ans: Cluster and Indexes are transparent to the user. Clustering is a method of storing tables that are intimately related and are often joined together into the same area on the disk. When cluster table exists then to drop cluster we have to drop the table first then only cluster is to be dropped.

84. WHAT IS A SNAPSHOT OR MATERIALIZED VIEW?
Ans: Materialized views can be used to replicate data. Earlier the data was replicated through CREATE SNAPSHOT command. Now CREATE MATERIALIZED VIEW can be used as synonym for CREATE SNAPSHOT. Query performance is improved using the materialized view as these views pre calculate expensive joins and aggregate operations on the table.

85. WHAT IS A SYNONYM?
Ans: A Synonym is a database object that allows you to create alternate names for Oracle tables and views. It is an alias for a table, view, snapshot, sequence, procedure, function or package.

86. WHAT IS DIFFERENCE BETWEEN PRIVATE AND PUBLIC SYNONYM?
Ans: Only the user or table owner can reference Private synonym whereas any user can reference the Public synonym.

87. WHAT IS DIFFERENCE BETWEEN "SQL" AND "SQL*PLUS" COMMANDS?
Ans: SQL commands are stored in the buffer whereas SQL*PLUS are not.

**88. NAME SOME SQL*PLUS COMMANDS?
Ans: DESC [CRIBE], START, GET, SAVE, / are SQL*PLUS COMMANDS.

89. WHAT ARE "SQL*PLUS REPORTING" COMMANDS?
Ans: SPOOL file-name, SPOOL OUT, TTITLE, BTITLE, BREAK ON, COMPUTE OF [break] ON etc are SQL*PLUS REPORTING COMMANDS.

90. WHAT ARE SYSTEM AND OBJECT PRIVILEGES?
Ans: Connect and Resource etc are System Privileges. Create < object >, Select, Insert, Alter etc are Object Privileges.