1: 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 Schema B Though the procedure is executed from schema A, the data will be stored in schema B coz' the object name is same. 2: 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 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. A trigger is said to be mutated when the table on which the trigger is written, is being used inside trigger for DML operation. 3: 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 inner layer. execution carry on furthur without going to outer exception blocks. 4: Dual table explain. 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. Why select * from dual; output will be:DUMMY X It has a field called DUMMY with a value X.When you run select sysdate from emp;You will not get any error. You will get system in all rows (as number of rows in emp table). the sysdate is displayed irrespective of the table u r trying to select it from. The output is the same as that of using dual. The output wont be same .Ideally dual has single row so when selecting sysydate you will get one row which is not the case in emp which has multiple row . 5: How can you see the source code of the package select text from dba_source where type='PACKAGE' and name=' '; 6: You are regularly changing the package body part. How will you create or what will you do before creating that package Create package specifications before creatin package body. 7: How do you increase the performance of %LIKE operator never user '%' before a seraching word e.g '%TABLE%' Always uses 'TABLE%' 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. Q8: All the users are complaining that their application is hanging. How you will resolve this situation in OLTP By increasing memory to process simutanous access 1 Q9: If the SQL * Plus hangs for a long time, what is the reason Use hanganalyze ALTER SESSION SET EVENTS 'immediate trace name hanganalyze level 5'; 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. 10:A schema is collection of database objects of a User. Schema objects are the logical structures that directly refer to the database's data. Schema objects include tables, views, sequences, synonyms, indexes, clusters, database triggers, procedures, functions packages and database links 11:Can objects of the same Schema reside in different tablespaces.? Yes 12:What are synonyms used for ? (Synonym is a alias for table, view …. 2 types private and public) Synonyms are used to : Mask the real name and owner of an object. Provide public access to an object Provide location transparency for tables, views or program units of a remote database. Simplify the SQL statements for database users. 13:What is an Index ? An Index is an optional structure associated with a table to have direct access to rows, which can be created to increase the performance of data retrieval. Index can be created on one or more columns of a table 14:How are Indexes Update ? Indexes are automatically maintained and used by ORACLE. Changes to table data are automatically incorporated into all relevant indexes. 15:What are Clusters ? Clusters are groups of one or more tables physically stores together to share common columns and are often used together. 16:What is cluster Key ? The related columns of the tables in a cluster is called the Cluster Key. 17:What is Index Cluster ? A Cluster with an index on the Cluster Key. 18:What is Hash Cluster ? A row is stored in a hash cluster based on the result of applying a hash function to the row's cluster key value. All rows with the same hash key value are stores together on disk. 19:When can Hash Cluster used ? Hash clusters are better choice when a table is often queried with equality queries. For such queries the specified cluster key value is hashed. The resulting hash key value points directly to the area on disk that stores the specified rows. 2 20:What is Database Link ? A database link is a named object that describes a "path" from one database to another. 21:What is Private Database Link ? Private database link is created on behalf of a specific user. A private database link can be used only when the owner of the link specifies a global object name in a SQL statement or in the definition of the owner's views or procedures. 22:What are the types of Database Links ? Private Database Link, Public Database Link & Network Database Link. 23:What is Public Database Link ? Public database link is created for the special user group PUBLIC. A public database link can be used when any user in the associated database specifies a global object name in a SQL statement or object definition. 23:What is Network Database link ? Network database link is created and managed by a network domain service. A network database link can be used when any user of any database in the network specifies a global object name in a SQL statement or object definition. 24:What is Data Block ? ORACLE database's data is stored in data blocks. One data block corresponds to a specific number of bytes of physical database space on disk. 25:How to define Data Block size ? A data block size is specified for each ORACLE database when the database is created. A database users and allocated free database space in ORACLE datablocks. Block size is specified in INIT.ORA file and can’t be changed latter. 26:What is Row Chaining ? In Circumstances, all of the data for a row in a table may not be able to fit in the same data block. When this occurs , the data for the row is stored in a chain of data block (one or more) reserved for that segment. 27:What is an Extent ? An Extent is a specific number of contiguous data blocks, obtained in a single allocation, and used to store a specific type of information. 28:What is a Segment ? A segment is a set of extents allocated for a certain logical structure 29:What are the different type of Segments ? Data Segment, Index Segment, Rollback Segment and Temporary Segment. 30:What is an Index Segment ? Each Index has an Index segment that stores all of its data. 31:What is a Data Segment ? Each Non-clustered table has a data segment. All of the table's data is stored in the extents of its data segment. Each cluster has a data segment. The data of every table in the cluster is stored in the cluster's data segment. 32:What is Rollback Segment ? A Database contains one or more Rollback Segments to temporarily store "undo" information. 33:What are the uses of Rollback Segment ? Rollback Segments are used : To generate read-consistent database information during database recovery to rollback uncommitted transactions for users. 3 34:What is a Temporary Segment ? Temporary segments are created by ORACLE when a SQL statement needs a temporary work area to complete execution. When the statement finishes execution, the temporary segment extents are released to the system for future use. 35:What is a Data File ? Every ORACLE database has one or more physical data files. A database's data files contain all the database data. The data of logical database structures such as tables and indexes is physically stored in the data files allocated for a database. 36:What are the Characteristics of Data Files ? A data file can be associated with only one database. Once created a data file can't change size. One or more data files form a logical unit of database storage called a tablespace. 37:What is a Redo Log ? The set of Redo Log files for a database is collectively known as the database's redo log. 38:What is the function of Redo Log ? The Primary function of the redo log is to record all changes made to data. 39:What is the use of Redo Log Information ? The Information in a redo log file is used only to recover the database from a system or media failure prevents database data from being written to a database's data files. 40:What is the use of Control File ? When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery. 41:What does a Control file Contain ? A Control file records the physical structure of the database. It contains the following information. 42:What is a Data Dictionary ? The data dictionary of an ORACLE database is a set of tables and views that are used as a read-only reference about the database. It stores information about both the logical and physical structure of the database, the valid users of an ORACLE database, integrity constraints defined for tables in the database and space allocated for a schema object and how much of it is being used. 43:What is an Integrity Constrains ? An integrity constraint is a declarative way to define a business rule for a column of a table. 43:Can an Integrity Constraint be enforced on a table if some existing table data does not satisfy the constraint ? No. 44:Describe the different type of Integrity Constraints supported by ORACLE ? NOT NULL Constraint - Disallows Nulls in a table's column. UNIQUE Constraint - Disallows duplicate values in a column or set of columns. PRIMARY KEY Constraint - Disallows duplicate values and Nulls in a column or set of columns. FOREIGN KEY Constrain - Require each value in a column or set of columns match a value in a related table's UNIQUE or PRIMARY KEY. CHECK Constraint - Disallows values that do not satisfy the logical expression of the constraint. 4 45:Describe Referential Integrity ? A rule defined on a column (or set of columns) in one table that allows the insert or update of a row only if the value for the column or set of columns (the dependent value) matches a value in a column of a related table (the referenced value). It also specifies the type of data manipulation allowed on referenced data and the action to be performed on dependent data as a result of any action on referenced data. 46What are the Referential actions supported by FOREIGN KEY integrity constraint ? UPDATE and DELETE Restrict - A referential integrity rule that disallows the update or deletion of referenced data. 47:What is self-referential integrity constraint ? If a foreign key reference a parent key of the same table is called self-referential integrity constraint. 48:What is the maximum number of CHECK constraints that can be defined on a column ? No Limit. 49:What are the Limitations of a CHECK Constraint ? The condition must be a Boolean expression evaluated using the values in the row being inserted or updated and can't contain sub queries, sequence, the SYSDATE,UID,USER or USERENV SQL functions, or the pseudo columns LEVEL or ROWNUM. 50: what is the difference between SID and Global Database Name ? SID (System Identifier) : A SID (almost) uniquely identifies an instance. Actually, $ORACLE_HOME, $ORACLE_SID and $HOSTNAME identify an instance uniquely. The SID is 64 characters, or less; at least on Oracle 9i. The system identifier is included in the CONNECT_DATA parts of the connect descriptors in a tnsnames.ora file. The SID defaults to the database name. Global Database Name : A database is uniquely identified by a global database name. Usually, a global database name has the form somename.domain. The global database name is the composit of db_domain and db_name. 51: what is the differnece between materialized view and snapshot A materialized view is a replica of a target master from a singlepoint in time. The concept was first introduced with Oracle7 termed asSNAPSHOT. In Oracle release 7.1.6 snapshots were enhanced to enableDMLs along with a new terminology, updatable snapshots. With Oracle8.1.6 snapshots started to be used in data warehouse environments so anew terminology materialized view was introduced to address bothdistributed and data warehouse materialized views. 52:Define Transaction ? A Transaction is a logical unit of work that comprises one or more SQL statements executed by a single user. 53: When does a Transaction end ? When it is committed or Rollbacked. 54:What does COMMIT do ? COMMIT makes permanent the changes resulting from all SQL statements in the transaction. The changes made by the SQL statements of a transaction become visible to other user sessions transactions that start only after transaction is committed. 55:What does ROLLBACK do ? ROLLBACK retracts any of the changes resulting from the SQL statements in the transaction. 5 56:What is SAVE POINT ? For long transactions that contain many SQL statements, intermediate markers or savepoints can be declared which can be used to divide a transaction into smaller parts. This allows the option of later rolling back all work performed from the current point in the transaction to a declared savepoint within the transaction. 57:What is Read-Only Transaction ? A Read-Only transaction ensures that the results of each query executed in the transaction are consistant with respect to the same point in time. 59:What is the function of Optimizer ? The goal of the optimizer is to choose the most efficient way to execute a SQL statement. 60:What is Execution Plan ? The combinations of the steps the optimizer chooses to execute a statement is called an execution plan. 61What are the factors that affect OPTIMIZER in choosing an Optimization approach ? The OPTIMIZER_MODE initialization parameter Statistics in the Data Dictionary the OPTIMIZER_GOAL parameter of the ALTER SESSION command hints in the statement. 62:What are the different approaches used by Optimizer in choosing an execution plan ? Rule-based and Cost-based. 63:What are the values that can be specified for OPTIMIZER MODE Parameter ? COST and RULE. 64:What are the values that can be specified for OPTIMIZER_GOAL parameter of the ALTER SESSION Command ? CHOOSE,ALL_ROWS,FIRST_ROWS and RULE. What is the effect of setting the value "CHOOSE" for OPTIMIZER_GOAL, parameter of the 65:ALTER SESSION Command ? The Optimizer chooses Cost_based approach and optimizes with the goal of best throughput if statistics for atleast one of the tables accessed by the SQL statement exist in the data dictionary. Otherwise the OPTIMIZER chooses RULE_based approach. 66:What is the effect of setting the value "ALL_ROWS" for OPTIMIZER_GOAL parameter of the ALTER SESSION command ? This value causes the optimizer to the cost-based approach for all SQL statements in the session regardless of the presence of statistics and to optimize with a goal of best throughput. 67:What is RULE-based approach to optimization ? Choosing an executing planbased on the access paths available and the ranks of these access paths. 68:What is COST-based approach to optimization ? Considering available access paths and determining the most efficient execution plan based on statistics in the data dictionary for the tables accessed by the statement and their associated clusters and indexes. 6