Oracle interview questions
1. What’s the command to see the current user name? Sql> show
     user;
  2. What’s the command to change the SQL prompt name?
     SQL> set sqlprompt “database-1 > “
     database-1 >
     database-1 >
  3. How do you switch to DOS prompt from SQL prompt? SQL> host
  4. How do I eliminate duplicate rows in an Oracle database?
     SQL> delete from table_name where rowid not in (select max(rowid)
     from table group by duplicate_values_field_name);
     or
     SQL> delete duplicate_values_field_name dv from table_name ta
     where rowid < (select min(rowid) from table_name tb where
     ta.dv=tb.dv);
  5. How do I display row number with records? Use the row-num
     pseudocolumn with query, like
     SQL> select rownum, ename from emp;
  6. How do you display the records within a given range?
     select rownum, empno, ename from emp where rowid in
     (select rowid from emp where rownum < =&rangeend
     minus
     select rowid from emp where rownum<&rangebegin);
  7. The NVL function only allows the same data type. But here’s the task:
     if the commission field is null, then the text “Not Applicable”
     should be displayed, instead of blank space. How do you write the
     query?
     SQL> select nvl(to_char(comm.),’Not Applicable’) from emp;
  8. Explain explicit cursor attributes. There are four cursor attributes
     used in Oracle: cursor_name%Found, cursor_name%NOTFOUND,
     cursor_name%ROWCOUNT, cursor_name%ISOPEN
  9. Explain implicit cursor attributes. Same as explicit cursor but
     prefixed by the word SQL: SQL%Found, SQL%NOTFOUND, SQL
     %ROWCOUNT, SQL%ISOPEN
  10.
  11.      How do you view version information in Oracle?
     SQL> select banner from $version;
Oracle DBA interview questions
        1. Explain the difference between a hot backup and a cold
           backup and the benefits associated with each. - A hot
           backup is basically taking a backup of the database while it is
           still up and running and it must be in archive log mode. A cold
           backup is taking a backup of the database while it is shut down
           and does not require being in archive log mode. The benefit of
           taking a hot backup is that the database is still available for use
           while the backup is occurring and you can recover the database
           to any point in time. The benefit of taking a cold backup is that
           it is typically easier to administer the backup and recovery
           process. In addition, since you are taking cold backups the
           database does not require being in archive log mode and thus
           there will be a slight performance gain as the database is not
           cutting archive logs to disk.
        2. You have just had to restore from backup and do not
           have any control files. How would you go about bringing
           up this database? - I would create a text based backup control
           file, stipulating where on disk all the data files where and then
           issue the recover command with the using backup control file
           clause.
        3. How do you switch from an init.ora file to a spfile? - Issue
           the create spfile from pfile command.
        4. Explain the difference between a data block, an extent
           and a segment. - A data block is the smallest unit of logical
           storage for a database object. As objects grow they take chunks
           of additional storage that are composed of contiguous data
           blocks. These groupings of contiguous data blocks are called
           extents. All the extents that an object takes when grouped
           together are considered the segment of the database object.
        5. Give two examples of how you might determine the
           structure of the table DEPT. - Use the describe command or
           use the dbms_metadata.get_ddl package.
6. Where would you look for errors from the database
   engine? - In the alert log.
7. Compare and contrast TRUNCATE and DELETE for a table.
   - Both the truncate and delete command have the desired
   outcome of getting rid of all the rows in a table. The difference
   between the two is that the truncate command is a DDL
   operation and just moves the high water mark and produces a
   now rollback. The delete command, on the other hand, is a DML
   operation, which will produce a rollback and thus take longer to
   complete.
8. Give the reasoning behind using an index. - Faster access
   to data blocks in a table.
9. Give the two types of tables involved in producing a star
   schema and the type of data they hold. - Fact tables and
   dimension tables. A fact table contains measurements while
   dimension tables will contain data that will help describe the fact
   tables.
10. What type of index should you use on a fact table? - A
   Bitmap index.
11. Give two examples of referential integrity constraints. - A
   primary key and a foreign key.
12. A table is classified as a parent table and you want to
   drop and re-create it. How would you do this without
   affecting the children tables? - Disable the foreign key
   constraint to the parent, drop the table, re-create the table,
   enable the foreign key constraint.
13. Explain the difference between ARCHIVELOG mode and
   NOARCHIVELOG mode and the benefits and
   disadvantages to each. - ARCHIVELOG mode is a mode that
   you can put the database in for creating a backup of all
   transactions that have occurred in the database so that you can
   recover to any point in time. NOARCHIVELOG mode is basically
   the absence of ARCHIVELOG mode and has the disadvantage of
   not being able to recover to any point in time. NOARCHIVELOG
   mode does have the advantage of not having to write
   transactions to an archive log and thus increases the
   performance of the database slightly.
14. What command would you use to create a backup control
   file? - Alter database backup control file to trace.
          15. Give the stages of instance startup to a usable state
             where normal users may access it. - STARTUP NOMOUNT -
             Instance startup. STARTUP MOUNT - The database is mounted.
             STARTUP OPEN - The database is opened
          16. What column differentiates the V$ views to the GV$
             views and how? - The INST_ID column which indicates the
             instance in a RAC environment the information came from.
          17. How would you go about generating an EXPLAIN plan? -
             Create a plan table with utlxplan.sql. Use the explain plan set
             statement_id = ‘tst1′ into plan_table for a SQL statement. Look
             at the explain plan with utlxplp.sql or utlxpls.sql
          18. How would you go about increasing the buffer cache hit
             ratio? - Use the buffer cache advisory over a given workload
             and then query the v$db_cache_advice table. If a change was
             necessary then I would use the alter system set db_cache_size
             command.
          19. Explain an ORA-01555 - You get this error when you get a
             snapshot too old within rollback. It can usually be solved by
             increasing the undo retention or increasing the size of rollbacks.
             You should also look at the logic involved in the application
             getting the error message.
          20. Explain the difference between $ORACLE_HOME and
             $ORACLE_BASE. - ORACLE_BASE is the root directory for
             oracle. ORACLE_HOME located beneath ORACLE_BASE is where
             the oracle products reside.
  1. on UNIX? Basically, set up disks, kernel parameters, and run orainst.
  1.
JDBC and JSP interview questions
  1. What is the query used to display all tables names in SQL
       Server (Query analyzer)?
  2.    select * from information_schema.tables
  3. How many types of JDBC Drivers are present and what are
       they?- There are 4 types of JDBC Drivers
          o JDBC-ODBC Bridge Driver
      o Native API Partly Java Driver
      o Network protocol Driver
      o JDBC Net pure Java Driver
4. Can we implement an interface in a JSP?- No
5. What is the difference between ServletContext and
   PageContext?- ServletContext: Gives the information about the
   container. PageContext: Gives the information about the Request
6. What is the difference in using request.getRequestDispatcher()
   and context.getRequestDispatcher()?-
   request.getRequestDispatcher(path): In order to create it we need to
   give the relative path of the resource,
   context.getRequestDispatcher(path): In order to create it we need to
   give the absolute path of the resource.
7. How to pass information from JSP to included JSP?- Using <
   %jsp:param> tag.
8. What is the difference between directive include and jsp
   include?- <%@ include>: Used to include static resources during
   translation time. JSP include: Used to include dynamic content or static
   content during runtime.
9. What is the difference between RequestDispatcher and
   sendRedirect?- RequestDispatcher: server-side redirect with request
   and response objects. sendRedirect : Client-side redirect with new
   request and response objects.
10. How does JSP handle runtime exceptions?- Using errorPage
   attribute of page directive and also we need to specify
   isErrorPage=true if the current page is intended to URL redirecting of a
   JSP.
11. How do you delete a Cookie within a JSP?
12.          Cookie mycook = new Cookie("name","value");
13.          response.addCookie(mycook);
14.          Cookie killmycook = new Cookie("mycook","value");
15.          killmycook.setMaxAge(0);
16.          killmycook.setPath("/");
17.          killmycook.addCookie(killmycook);
18. How do I mix JSP and SSI #include?- If you’re just including raw
   HTML, use the #include directive as usual inside your .jsp file.
19.         <!--#include file="data.inc"-->
   But it’s a little trickier if you want the server to evaluate any JSP code
   that’s inside the included file. If your data.inc file contains jsp code you
   will have to use
    <%@ vinclude="data.inc" %>
   The <!–#include file="data.inc"–> is used for including non-JSP files.
20. I made my class Cloneable but I still get Can’t access protected
   method clone. Why?- Some of the Java books imply that all you
   have to do in order to have your class support clone() is implement
   the Cloneable interface. Not so. Perhaps that was the intent at some
   point, but that’s not the way it works currently. As it stands, you have
   to implement your own public clone() method, even if it doesn’t do
   anything special and just calls super.clone().
21. Why is XML such an important development?- It removes two
   constraints which were holding back Web developments: dependence
   on a single, inflexible document type (HTML) which was being much
   abused for tasks it was never designed for; the complexity of full
   SGML, whose syntax allows many powerful but hard-to-program
   options. XML allows the flexible development of user-defined document
   types. It provides a robust, non-proprietary, persistent, and verifiable
   file format for the storage and transmission of text and data both on
   and off the Web; and it removes the more complex options of SGML,
   making it easier to program for.
22. What is the fastest type of JDBC driver?- JDBC driver performance
   will depend on a number of issues:
       o the quality of the driver code,
       o the size of the driver code,
       o the database server and its load,
       o network topology,
       o the number of times your request is translated to a different
          API.
   In general, all things being equal, you can assume that the more your
   request and response change hands, the slower it will be. This means
   that Type 1 and Type 3 drivers will be slower than Type 2 drivers (the
   database calls are make at least three translations versus two), and
   Type 4 drivers are the fastest (only one translation).
23. How do I find whether a parameter exists in the request
   object?
24. boolean hasFoo = !(request.getParameter("foo") == null
25.        || request.getParameter("foo").equals(""));
        or
        boolean hasParameter =
         request.getParameterMap().contains(theParameter); //(which
        works in Servlet 2.3+)
  26. How can I send user authentication information while
        makingURLConnection?- You’ll want to use
        HttpURLConnection.setRequestProperty and set all the appropriate
        headers to HTTP authorization.
Data warehouse interview questions
  1. What is source qualifier?
  2. Difference between DSS & OLTP?
  3. Explain grouped cross tab?
  4. Hierarchy of DWH?
  5. How many repositories can we create in Informatica?
  6. What is surrogate key?
  7. What is difference between Mapplet and reusable transformation?
  8. What is aggregate awareness?
  9. Explain reference cursor?
  10.         What are parallel querys and query hints?
  11.         DWH architecture?
  12.         What are cursors?
  13.         Advantages of de normalized data?
  14.         What is operational data source (ODS)?
  15.         What is meta data and system catalog?
  16.         What is factless fact schema?
  17.         What is confirmed dimension?
  18.         What is the capacity of power cube?
  19.         Difference between PowerPlay transformer and power play
        reports?
  20.         What is IQD file?
  21.         What is Cognos script editor?
  22.         What is difference macros and prompts?
  23.         What is power play plug in?
  24.         Which kind of index is preferred in DWH?
  25.         What is hash partition?
  26.         What is DTM session?
  27.          How can you define a transformation? What are different types
        of transformations in Informatica?
  28.         What is mapplet?
  29.         What is query panel?
  30.          What is a look up function? What is default transformation for
        the look up function?
  31.        What is difference between a connected look up and
        unconnected look up?
  32.         What is staging area?
  33.         What is data merging, data cleansing and sampling?
  34.          What is up date strategy and what are th options for update
        strategy?
  35.         OLAP architecture?
  36.         What is subject area?
  37.         Why do we use DSS database for OLAP tools?
Java database interview questions
  1. How do you call a Stored Procedure from JDBC? - The first step is
        to create a CallableStatement object. As with Statement and
        PreparedStatement objects, this is done with an open Connection
   object. A CallableStatement object contains a call to a stored
   procedure.
2. CallableStatement cs =
3.           con.prepareCall("{call SHOW_SUPPLIERS}");
4. ResultSet rs = cs.executeQuery();
5. Is the JDBC-ODBC Bridge multi-threaded? - No. The JDBC-ODBC
   Bridge does not support concurrent access from different threads. The
   JDBC-ODBC Bridge uses synchronized methods to serialize all of the
   calls that it makes to ODBC. Multi-threaded Java programs may use
   the Bridge, but they won’t get the advantages of multi-threading.
6. Does the JDBC-ODBC Bridge support multiple concurrent open
   statements per connection? - No. You can open only one Statement
   object per connection when you are using the JDBC-ODBC Bridge.
7. What is cold backup, hot backup, warm backup recovery? - Cold
   backup (All these files must be backed up at the same time, before the
   databaseis restarted). Hot backup (official name is ‘online backup’) is a
   backup taken of each tablespace while the database is running and is
   being accessed by the users.
8. When we will Denormalize data? - Data denormalization is reverse
   procedure, carried out purely for reasons of improving performance. It
   maybe efficient for a high-throughput system to replicate data for
   certain data.
9. What is the advantage of using PreparedStatement? - If we are
   using PreparedStatement the execution time will be less. The
   PreparedStatement object contains not just an SQL statement, but the
   SQL statement that has been precompiled. This means that when the
   PreparedStatement is executed,the RDBMS can just run the
   PreparedStatement’s Sql statement without having to compile it first.
10. What is a “dirty read"? - Quite often in database processing, we
   come across the situation wherein one transaction can change a value,
   and a second transaction can read this value before the original
   change has been committed or rolled back. This is known as a dirty
   read scenario because there is always the possibility that the first
   transaction may rollback the change, resulting in the second
   transaction having read an invalid value. While you can easily
   command a database to disallow dirty reads, this usually degrades the
   performance of your application due to the increased locking overhead.
   Disallowing dirty reads also leads to decreased system concurrency.
11. What is Metadata and why should I use it? - Metadata (’data
   about data’) is information about one of two things: Database
   information (java.sql.DatabaseMetaData), or Information about a
   specific ResultSet (java.sql.ResultSetMetaData). Use
   DatabaseMetaData to find information about your database, such as its
   capabilities and structure. Use ResultSetMetaData to find information
   about the results of an SQL query, such as size and types of columns
12. Different types of Transaction Isolation Levels? - The isolation
   level describes the degree to which the data being updated is visible to
   other transactions. This is important when two transactions are trying
   to read the same row of a table. Imagine two transactions: A and B.
   Here three types of inconsistencies can occur:
       o Dirty-read: A has changed a row, but has not committed the
          changes. B reads the uncommitted data but his view of the data
          may be wrong if A rolls back his changes and updates his own
          changes to the database.
       o Non-repeatable read: B performs a read, but A modifies or
          deletes that data later. If B reads the same row again, he will
          get different data.
       o Phantoms: A does a query on a set of rows to perform an
          operation. B modifies the table such that a query of A would
          have given a different result. The table may be inconsistent.
   TRANSACTION_READ_UNCOMMITTED : DIRTY READS, NON-
   REPEATABLE READ AND PHANTOMS CAN OCCUR.
   TRANSACTION_READ_COMMITTED : DIRTY READS ARE PREVENTED,
   NON-REPEATABLE READ AND PHANTOMS CAN OCCUR.
   TRANSACTION_REPEATABLE_READ : DIRTY READS , NON-
   REPEATABLE READ ARE PREVENTED AND PHANTOMS CAN OCCUR.
   TRANSACTION_SERIALIZABLE : DIRTY READS, NON-REPEATABLE
   READ AND PHANTOMS ARE PREVENTED.
13. What is 2 phase commit? - A 2-phase commit is an algorithm used
   to ensure the integrity of a committing transaction. In Phase 1, the
   transaction coordinator contacts potential participants in the
   transaction. The participants all agree to make the results of the
   transaction permanent but do not do so immediately. The participants
   log information to disk to ensure they can complete In phase 2 f all the
   participants agree to commit, the coordinator logs that agreement and
   the outcome is decided. The recording of this agreement in the log
   ends in Phase 2, the coordinator informs each participant of the
   decision, and they permanently update their resources.
14. How do you handle your own transaction ? - Connection Object
   has a method called setAutocommit(Boolean istrue)
   - Default is true. Set the Parameter to false , and begin your
   transaction
15. What is the normal procedure followed by a java client to
   access the db.? - The database connection is created in 3 steps:
             1. Find a proper database URL
2.        Load the database driver
             3. Ask the Java DriverManager class to open a connection to your
                database
          In java code, the steps are realized in code as follows:
4.    Create a properly formatted JDBR URL for your database. (See FAQ on
JDBC URL for more information). A JDBC URL has the form
jdbc:someSubProtocol://myDatabaseServer/theDatabaseName
5.    Class.forName("my.database.driver");
         6. Connection conn = DriverManager.getConnection("a.JDBC.URL",
             “databaseLogin","databasePassword");
     2. What is a data source? - A DataSource class brings another level of
          abstraction than directly using a connection object. Data source can be
          referenced by JNDI. Data Source may point to RDBMS, file System ,
          any DBMS etc.
     3. What are collection pools? What are the advantages? - A
          connection pool is a cache of database connections that is maintained
          in memory, so that the connections may be reused
     4. How do you get Column names only for a table (SQL Server)?
          Write the Query. -
     5.    select name from syscolumns
     6.            where id=(select id from sysobjects where
          name='user_hdr')
                   order by colid --user_hdr is the table name