Thursday, June 29, 2006

Interveiw Questions - DBA

8. What is the proper method for disabling and re-enabling a primary key consraint?
Ans: ALTER TABLE commnad. For the enable clause, sepecify the USING INDEX and TABLESPACE clasue for primary key.

DS: (1) ALTER TABLE schema.table MODIFY PRIMARY KEY DISABLE
(2) ALTER TABLE schema.table MODIFY PRIMARY KEY USING INDEX TABLESPACE tablespace_name ENABLE

9.
What happens if a primary key constraint is disabled and then enabled without fully specifying the index clause
Ans: 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 contraint definition, but only as part of the index definition, when the contraint was disabled the index was dropped and the information is gone. (?? DS: what the meaning of sizing information)

10. (on UNIX) When should more than one DB writer process be used? How many should be used?
Ans: If the UNIX system being used is capable of asynchronous IO, then only one is required, if the system in not capable of asynchronous IO, then up to twice the number of disks used by Oracle. The number of DB writers shoud be specified by use of the DB_WRITERS initialziation parameter .
(?? DS: DB_WRITERS is pre-release 8.0 name, DBWR_IO_SLAVES)
---------------------------------
from Oracle9i Database ReferenceRelease 2 (9.2)Part Number A96536-01
-------------------------------

DBWR_IO_SLAVES is relevant only on systems with only one database writer process (DBW0). It specifies the number of I/O server processes used by the DBW0 process. The DBW0 process and its server processes always write to disk. By default, the value is 0 and I/O server processes are not used.
If you set DBWR_IO_SLAVES to a nonzero value, the number of I/O server processes used by the ARCH and LGWR processes is set to 4. However, the number of I/O server processes used by Recovery Manager is set to 4 only if asynchronous I/O is disabled (either your platform does not support asynchronous I/O or disk_asynch_io is set to false.

Typically, I/O server processes are used to simulate asynchronous I/O on platforms that do not support asynchronous I/O or that implement it inefficiently. However, you can use I/O server processes even when asynchronous I/O is being used. In that case the I/O server processes will use asynchronous I/O.

I/O server processes are also useful in database environments with very large I/O throughput, even if asynchronous I/O is enabled.

-------------
DS: Asynchronous I/O interfaces have been available in Solaris for some time, providing a means by which applications could issue I/O requests and not have to "block" or cease working until the I/O was completed.


11. You are using hot backup without being in archivelog mode, can you recover in the event of a failure? Why or why not?
Ans: 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?
Ans: 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.

DS: additional refs: http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:275215756923

13. How can you tell if a database object is invalid?
Ans: By checking the status column of the DBA_, ALL_ or USER_OBJECTS views.

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?
Ans: check the user has specified the full name of the object (e.g. select empid from scott.emp; instead of select empid form 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 adn SELECT grants on the tables he is using, what is the problem?
Ans: You need to verify the developer has direct grants on all talbes used in the view. You can't create a stored object with grants given through views
(DS: plan to create a test case to verify)

16. If you have an example table, what is the best way to get sizeing data for the production table imeplementation?
Ans: The best way is to analyze the table and then use the data provide in the DBA_TABLES view to get the average row length and other pertinent data for the caculation. 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. [SN0606291540]

17. How can you find out how many users are currently logged into the database? How can you find their operating system id?
Ans: several ways:
(1) v$session or v$process
(2) check 'current_logins' parameter in the v$sysstat view
(3) If on unix, "ps -efgrep oracle wc -l?" (only works against a single instance installation)

18 skip
19. How can you determine if an index needs to be dropped and rebuilt?
Ans: run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of ...

No comments: