Latest Oracle Scenarious Interview Questions For Freshers
Q – 1 Explain about the oracle disaster recovery scenarios?
Ans- USE DBNAME
go
EXEC sp_change_users_login ‘Update_One’, ‘LoginUserid’, ‘LoginUserid’
Note: if you are using a different SQl login userid then this ‘Login Userid’ ,’NewloginUserid’
Q – 2 Explain What is Testing Scenario? What is scenario based testing? can u explain with an example?
Ans- Scenario testing is the real time testing techniques implemented on an application with the presence of certain applied conditions and environment.In this type of testing the behavior of the application or s/w is tracked and results are analyzed.And bugs are reported
Q – 3 Explain How can we see the source code of the package?
Ans- SELECT TEXT FROM USER_SOURCE/ALL_SOURCE/DBA_SOURCE
WHERE NAME= AND TYPE=’PACKAGE’;
HERE THE TYPE MAY BE PACKAGE,PROCEDURE,….
Q – 4 Explain In exception handling we have some NOT_FOUND and OTHERS. In inner layer we have some NOT_FOUND and OTHERS. While executing which one whether outer layer or inner layer will check first?
Ans- inner layer. execution carry on furthur without going to outer exception blocks.
Q – 5 Explain What are the differences between database designing and database modeling?
Ans- Database modeling comprises: discovery, design, documentation, communication, DDL generation, re engineering
Q – 6 Explain What are the differences you have seen while installing Oracle on NT and Unix platform?
Ans- Oracle Server = Oracle Instance + Oracle Database Oracle instance comprises of Background Process and memory structures in Unix all background processes are treated as independent processes but in windows all are combined together within oracle.exe in unix when a user logins he is dedicated to the server via an independed process so if require you can kill a process through os level ..this is one of the major advantage of using oracle on unix based system rather then windows system bcoz in case database stucks or hangs an independent process causing the problem can be killed and database will be made resumable immediately.
And one more diffrence is in windows you are require to create a service to start the instance by using oradim but in unix its not required .you can start the instance.in windows unique service name is required but in unix diffrent user can have the same service name started by them but its not advisable.
Q – 7 Explain the Dual table. Is any data internally storing in dual table. Lot of users are accessing select sysdate from dual and they getting some millisecond differences. If we execute SELECT SYSDATE FROM EMP; what error will we get and Why?
Ans- The built-in function SYSDATE returns a DATE value containing the current date and time on your system. DUAL is built-in relation in Oracle which serves as a dummy relation to put in the FROM clause when nothing else is appropriate. For example, try “select 1+2 from dual;”.So “select sysdate from EMP” won’t generate the desired result.
Select sysdate from emp will not return any error.. It will return sysdate in all the rows. i.e if emp has 100 rows sysdate will be returned 100 times
Q – 8 Explain How to do the scheduled task/jobs in Unix platform?
Ans- Use DBMS_JOB/DBMS_SCHEDULER and give the Job_type as EXECUTABLE and give the path name of the shell script to execute.
Q – 9 Explain What is mutated trigger, is it the problem of locks. In single user mode we got mutated error, as a DBA how you will resolve it?
Ans- mutated trigger: example:Table A has an insert trigger.In that Trigger: There is a statement like insert into Table A, which caues mutated trigger.Avoid to have those kind of triggers in the database.
Q – 10 Explain What is bulk SQL?
Ans- Bulk sql are forall and bulk collect INTO statement,
For performence reason the bulk bind is used to eleminate the context switching between two sql and pl/sql eng.
Q – 11 Tell us In which situation whether peak time or off peak time we will execute the ANALYZE TABLE command and Why?
Ans- We have to run the analyze command during off peak time only because it actually performs full table scan.
Q – 12 Explain If the SQL * Plus hangs for a long time, what is the reason?
Ans- You are running a cartisian query, typically by mistake. Make sure every table has a join criteria specified for it.
You are working on a table with 100+million rows.
The database server is busy doing a backup.
Check the disk IO for the process that appears hung and if the disk IO is increasing every 5-10 seconds then the job is not hung, it is just taking a while to complete.
Q – 13 Explain How do we increase the performance of %LIKE operator?
Ans- The wildcard char % can be placed in one of three ways:
%searchwordhere%
searchwordhere%
%searchwordhere
The searchwordhere% is the fastest because it can use an index if one is specified on that column. The other two %searchwordhere%, and %searchwordhere would never use the index even if one is specified and thus result in slow table scans.
Q – 14 Explain the total process of eim?
Ans- after you get the legacy data thorugh exl format
1. you identify the which base table and which base column suitable for legacy data.
2.after that u have to use control file or dts processing to load the lagacy to eim table.
3. after that by using IFB file from eim to base table store the data.
Q – 15 If All the users are complaining that their application is hanging. How we will resolve this situation in OLTP?
Ans- If the user is complaining the hang problem ..then the experience of a dba reflects the work style that he is going to perform and basically as the rule suggest first try to connect to the database itself and fire some query to check whether you are allowed to connect or not if you are connected then check for any locked_objects by checking v$locked_object and dba_waiters and dba_blockers.then you have to eliminate the things which are working properly and targeting yourself to the weaker place and then check at os level that which process is consuming the most of the time and then analyze the problem if the problem relates to a single user process then check what that user is doing by checking the sql statement he is firing.than so on
Q – 16 Explain If the entire disk is corrupted how will you and what are the steps to recover the database?
Ans- if the entire disk is corrupted and no backup is there don nothing sit and relax their is no possibility of recovery …a backup is required for restoration and for recovery redo log and archive logs.
Once if you have theses than think of recovering ..a dba should always plan for the recovery scenario depending upon the criticality of the database.oracle provides 0% data loss facilty through data guard and online backup .its dba who has to decide.
Q – 17 Schema A has some objects and created one procedure and granted to Schema B.
Schema B has the same objects like schema A. Schema B executed the procedure like inserting some records. In this case where the data will be stored whether in Schema A or Schema B?
Ans- Schema1 Leo
Table Name emp
Procedure Test
Schema2 Leo1
Table Name emp
Schema 1
SQL>
SQL> CREATE TABLE emp (
2 emp_id NUMBER(2),
3 emp_name VARCHAR2(25),
4 dep_id NUMBER(2),
5 emp_status CHAR(1)
6 );
Table created.
SQL> SQL> CREATE OR REPLACE PROCEDURE test AS
2 BEGIN
3 INSERT INTO emp VALUES (1,’LEO’,2,’Y’);
4 COMMIT;
5 END;
6 /
Procedure created.
SQL> EXEC test
PL/SQL procedure successfully completed.
SQL> select * from emp;
EMP_ID EMP_NAME DEP_ID E
1 LEO 2 Y
SQL> GRANT EXECUTE ON test TO leo1;
Grant succeeded.
SQL> GRANT SELECT ON emp TO leo1;
Grant succeeded.
@Schema Leo1
SQL> CREATE TABLE emp AS SELECT * FROM leo.emp WHERE ROWNUM = 0;
Table created.
SQL> desc emp
Name Null? Type
EMP_ID NUMBER(2)
EMP_NAME VARCHAR2(25)
DEP_ID NUMBER(2)
EMP_STATUS CHAR(1)
Now we created the table exactly as the same structure of emp table in schema leo. Now let us try to execute the procedure.
SQL> EXEC test
BEGIN test; END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier ‘TEST’ must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Guess what if you think this should work (as I did) we are wroung. It took a while for me to figure this out. To execute the procedure from leo1 do as follows:
SQL> exec leo.test
PL/SQL procedure successfully completed.
Now let us check where the rows are being inserted.
@Schema leo1:
SQL> select * from emp;
no rows selected
@Schema leo:
SQL> select * from emp;
EMP_ID EMP_NAME DEP_ID E
1 LEO 2 Y
1 LEO 2 Y
There you go. You added one more row now. So even though you execute the procedure from schema leo1 you inserted a row in leo.
So the ANSWER to the question is : Schema A.
Q – 18 Can we create procedures to fetch more than one record?
Ans- We can create a procedure to return REF cursor or VARRAY or PL/SQL Table type out parameters which can return more than one value.
Q – 19 Explain What is spooling?
Ans- Acronym for simultaneous peripheral operations on-line, spooling refers to putting jobs in a buffer, a special area in memory or on a disk where a device can access them when it is ready. Spooling is useful because devices access data at different rates. The buffer provides a waiting station where data can rest while the slower device catches up.
Q – 20 We are regularly changing the package body part. How will we create or what will we do before creating that package?
Ans- Create package specifications before creatin package body.
Q – 21 Explain If the large table contains thousands of records and the application is accessing 35% of the table which method to use: index searching or full table scan?
Ans- A full table scan could be quicker,since it will fetch multiple blocks in one fetch, compared to index->table, index->table for each row.
Measure both ways and decide