1. Which two statements are true about identifying unused indexes? (Choose two.) A. Performance is improved by eliminating unnecessary overhead during DML operations. B. V$INDEX_STATS displays statistics that are gathered when using the MONITORING USAGE keyword. C. Each time the MONITORING USAGE clause is specified, the V$OBJECT_USAGE view is reset for the specified index. D. Each time the MONITORING USAGE clause is specified, a new monitoring start time is recorded in the alert log. Answer: A, C Explanation: Monitoring Index Usage Oracle provides a means of monitoring indexes to determine if they are being used or not used. If it is determined that an index is not being used, then it can be dropped, thus eliminating unnecessary statement overhead. To start monitoring an index’s usage, issue this statement: ALTER INDEX index MONITORING USAGE; Later, issue the following statement to stop the monitoring: ALTER INDEX index NOMONITORING USAGE; The view V$OBJECT_USAGE can be queried for the index being monitored to see if the index has been used. The view contains a USED column whose value is YES or NO, depending upon if the index has been used within the time period being monitored. The view also contains the start and stop times of the monitoring period, and a MONITORING column (YES/NO) to indicate if usage monitoring is currently active. Each time that you specify MONITORING USAGE, the V$OBJECT_USAGE view is reset for the specified index. The previous usage information is cleared or reset, and a new start time is recorded. When you specify NOMONITORING USAGE, no further monitoring is performed, and the end time is recorded for the monitoring period. Until the next ALTER INDEX ... MONITORING USAGE statement is issued, the view information is left unchanged. 2. You need to create an index on the SALES table, which is 10 GB in size. You want your index to be spread across many tablespaces, decreasing contention for index lookup, and increasing scalability and manageability. Which type of index would be best for this table? A. bitmap B. unique C. partitioned D. reverse key E. single column F. function-based Answer: C Explanation: I suggest that you read chapters 10 & 11 in Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A9652401 (a96524.pdf) Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A96524-01 (a96524.pdf) ch 10 Bitmap Indexes The purpose of an index is to provide pointers to the rows in a table that contain a given key value. In a regular index, this is achieved by storing a list of rowids for each key corresponding to the rows with that key value. Oracle stores each key valuerepeatedly with each storedrowid.In abitmap index,abitmapfor eachkey value is used instead of a list of rowids. Each bit in the bitmap corresponds to a possible rowid. If the bit is set, then it means that the row with the corresponding rowid contains the key value. A mapping function converts the bit position to an actual rowid, so the bitmap index provides the same functionality as a regular index even though it uses a different representation internally. If the number of different key values is small, then bitmap indexes are very space efficient. Bitmap indexing efficiently merges indexes that correspond to several conditions in a WHERE clause. Rows that satisfy some, but not all, conditions are filtered out before the table itself is accessed. This improves response time, often dramatically. Note: Bitmap indexes are available only if you have purchased the Oracle9i Enterprise Edition. See Oracle9i Database New Features for more information about the features available in Oracle9i and the Oracle9i Enterprise Edition. Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A96524-01 (a96524.pdf) ch 11 Partitioned Indexes
1
Just like partitioned tables, partitioned indexes improve manageability, availability, performance, and scalability. They can either be partitioned independently (global indexes) or automatically linked to a table's partitioning method (local indexes). Local Partitioned Indexes Local partitioned indexes are easier to manage than other types of partitioned indexes. They also offer greater availability and are common in DSS environments. The reason for this is equipartitioning: each partition of a local index is associated with exactly one partition of the table. This enables Oracle to automatically keep the index partitions in sync with the table partitions, and makes each table-index pair independent. Any actions that make one partition's data invalid or unavailable only affect a single partition. You cannot explicitly add a partition to a local index. Instead, new partitions are added to local indexes only when you add a partition to the underlying table. Likewise, you cannot explicitly drop a partition from a local index. Instead, local index partitions are dropped only when you drop a partition from the underlying table. A local index can be unique. However, in order for a local index to be unique, the partitioning key of the table must be part of the index’s key columns. Unique localindexes are useful for OLTP environments. See Also: Oracle9i Data Warehousing Guide for more information about partitioned indexesname, and stores the index partition in the same tablespace as the table partition. Global Partitioned Indexes Global partitioned indexes are flexible in that the degree of partitioning and the partitioning key are independent from the table's partitioning method. They are commonly used for OLTP environments and offer efficient access to any individual record. The highest partition of a global index must have a partition bound, all of whose values are MAXVALUE. This ensures that all rows in the underlying table can be represented in the index. Global prefixed indexes can be unique or nonunique. You cannot add a partition to a global index because the highest partition always has a partition bound of MAXVALUE. If you wish to add a new highest partition, use the ALTER INDEX SPLIT PARTITION statement. If a global index partition is empty, you can explicitly drop it by issuing the ALTER INDEX DROP PARTITION statement. If a global index partition contains data, dropping the partition causes the next highest partition to be marked unusable. You cannot drop the highest partition in a global index. Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A96524-01 (a96524.pdf) ch 10 Unique and Nonunique Indexes Indexes canbeunique or nonunique.Unique indexesguaranteethat notworows of a table have duplicate values in the key column (or columns). Nonunique indexes do not impose this restriction on the column values. Oracle recommends that unique indexes be created explicitly, and not through enabling a unique constraint on a table. Alternatively, you can define UNIQUE integrity constraints on the desired columns. Oracle enforces UNIQUE integrity constraints by automatically defining a unique index on the unique key. However, it is advisable that any index that exists for query performance, including unique indexes, be created explicitly. Reverse Key Indexes Creating a reverse key index,compared to a standard index, reverses the bytes of each column indexed (except the rowid) while keeping the column order. Such an arrangement can help avoid performance degradation with Oracle9i Real Application Clusters where modifications to the index are concentrated on a small set of leaf blocks. By reversing the keys of the index, the insertions become distributed across all leaf keys in the index. Using the reverse key arrangement eliminates the ability to run an index range scanning query on the index. Because lexically adjacent keys are not stored next to each other in a reverse-key index, only fetch-by-key or full-index (table) scans can be performed. Sometimes, using a reverse-key index can make an OLTP Oracle9i Real Application Clusters application faster. For example, keeping the index of mail messages in an e-mail application: some users keep old messages, and the index must maintain pointers to these as well as to the most recent. The REVERSE keyword provides a simple mechanism for creating a reverse key index. You can specify the keyword REVERSE along with the optional index specifications in a CREATE INDEX statement: CREATE INDEX i ON t (a,b,c) REVERSE; You can specify the keyword NOREVERSE to REBUILD a reverse-key index into one that is not reverse keyed: ALTER INDEX i REBUILD NOREVERSE; Rebuilding a reverse-key index without the NOREVERSE keyword produces a rebuilt, reverse-key index. Function-Based Indexes You can create indexes on functions and expressions that involve one or more columns in the table being indexed. A function-based index computes the value of the function or expression and stores it in the index. You can create a function-based index as either a B-tree or a bitmap index. Function-based indexes provide an efficient mechanism for evaluating statements that contain functions in their WHERE clauses. The value of the expression is computedand stored intheindex.WhenitprocessesINSERT and UPDATE statements, however, Oracle must still evaluate the function to process the statement.
2
For example, if you create the following index: CREATEINDEX idx ON table_1 (a + b * (c - 1),a,b); then Oracle can use it when processing queries such as this: SELECT a FROM table_1 WHERE a + b * (c - 1) < 100; 3. Which type of index does this syntax create? CREATE INDEX hr.employees_last_name_idx ON hr.employees(last_name) PCTFREE 30 STORAGE(INITIAL 200K NEXT 200K PCTINCREASE 0 MAXEXTENTS 50) TABLESPACE indx; A. bitmap B. B-Tree C. partitioned D. reverse key Answer: B Explanation: Oracle provides several indexing schemes that provide complementary performance functionality. These are: 1 B-tree indexes-the default and the most common. 2 B-tree cluster indexes-defined specifically for cluster. 3 Hash cluster indexes-defined specifically for a hash cluster. 4 Global and local indexes-relate to partitioned tables and indexes. 5 Reverse key indexes-most useful for Oracle Real Application Cluster applications. 6 Bitmap indexes-compact; work best for columns with a small set of values. 7 Function-based indexes-contain the precomputed value of a function/expression. 8 Domain indexes-specific to an application or cartridge. 4. The credit controller for your organization has complained that the report she runs to show customers with bad credit ratings takes too long to run. You look at the query that the report runs and determine that the report would run faster if there were an index on the CREDIT_RATING column of the CUSTOMERS table. The CUSTOMERS table has about 5 million rows and around 100 new rows are added every month. Old records are not deleted from the table. The CREDIT_RATING column is defined as a VARCHAR2(5) field. There are only 10 possible credit ratings and a customer's credit rating changes infrequently. Customers with bad credit ratings have a value in the CREDIT_RATINGS column of 'BAD' or 'F'. Which type of index would be best for this column? A. B-Tree B. bitmap C. reverse key D. function-based Answer: B Explanation: Ad A: Why B-tree is not good for this problem: (1) B-trees provide excellent retrieval performance for a wide range of queries, including exact match and range searches. (2) Inserts, updates, and deletes are efficient, maintaining key order for fast retrieval. Since, we will not update this column, and no records are deleted, also we don’t have a wide range of queries for this column so B-tree is not a good solution. Ad C: Creating a reverse key index, compared to a standard index, reverses the bytes of each column indexed (except the rowid) while keeping the column order. Such an arrangement can help avoid performance degradation with Oracle9i Real Application Clusters where modifications to the index are concentrated on a small set of leaf blocks. By reversing the keys of the index, the insertions become distributed across all leaf keys in the index. Using the reverse key arrangement eliminates the ability to run an index range scanning query on the index. Because lexically adjacent keys are not stored next to each other in a reverse-key index, only fetch-by-key or full-index (table) scans can be performed. Full index (table) scan for 1 million records???? NO WAY!!!!
3
Ad D: The function-based index is a new type of index, implemented in Oracle8i, that is designed to improve query performance by making it possible to define an index that works when your WHERE clause contains operations on columns. 5. Your developers asked you to create an index on the PROD_ID column of the SALES_HISTORY table, which has 100 million rows. The table has approximately 2 million rows of new data loaded on the first day of every month. For the remainder of the month, the table is only queried. Most reports are generated according to the PROD_ID, which has 96 distinct values. Which type of index would be appropriate? A. bitmap B. reverse key C. unique B-Tree D. normal B-Tree E. function based F. non-unique concatenated Answer: A Explanation: Regular B*-tree indexes work best when each key or key range references only a few records, such as employee names. Bitmap indexes, by contrast, work best when each key references many records, such as employee gender. Bitmap indexes can substantially improve performance of queries with the following characteristics: (a) The WHERE clause contains multiple predicates on low- or medium-cardinality columns. (b) The individual predicates on these low- or medium-cardinality columns select a large number of rows. (c) Bitmap indexes have been created on some or all of these low- or medium-cardinality columns. (d) The tables being queried contain many rows. You can use multiple bitmap indexes to evaluate the conditions on a single table. Bitmap indexes are thus highly advantageous for complex ad hoc queries that contain lengthy WHERE clauses. Bitmap indexes can also provide optimal performance for aggregate queries. 96<<100 million low cardinality ==> bitmap indexes, lot of rows ==> bitmap indexes. See Oracle8 Tuning Release 8.0 December, 1997 Part No. A58246-01 (a58246.pdf) pg. 181. (10-13) 6. You need to create an index on the PASSPORT_RECORDS table. It contains 10 million rows of data. The key columns have low cardinality. The queries generated against this table use a combination of multiple WHERE conditions involving the OR operator. Which type of index would be best for this type of table? A. bitmap B. unique C. partitioned D. reverse key E. single column F. function-based Answer: A Explanation: Bitmap indexes can substantially improve performance of queries with the following characteristics: (a) The WHERE clause contains multiple predicates on low- or medium-cardinality columns. (b) The individual predicates on these low- or medium-cardinality columns select a large number of rows. (c) Bitmap indexes have been created on some or all of these low- or medium-cardinality columns. (d) The tables being queried contain many rows. You can use multiple bitmap indexes to evaluate the conditions on a single table. Bitmap indexes are thus highly advantageous for complex ad hoc queries that contain lengthy WHERE clauses. Bitmap indexes can also provide optimal performance for aggregate queries.
4
Ad A: True. low cardinality ==> bitmap indexes, lot of rows ==> bitmap indexes. See Oracle8 Tuning Release 8.0 December, 1997 Part No. A58246-01 (a58246.pdf) pg. 181. (10-13) 7. The user Smith created the SALES HISTORY table. Smith wants to find out the following information about the SALES HISTORY table: - The size of the initial extent allocated to the sales history data segment - The total number of extents allocated to the sales history data segment Which data dictionary view(s) should Smith query for the required information? A. USER_EXTENTS B. USER_SEGMENTS C. USER_OBJECT_SIZE D. USER_OBJECT_SIZE and USER_EXTENTS E. USER_OBJECT_SIZE and USER_SEGMENTS Answer: B Explanation: SQL> desc user_segments Name SEGMENT_NAME PARTITION_NAME SEGMENT_TYPE TABLESPACE_NAME BYTES BLOCKS EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_POOL
Null?
Type VARCHAR2(81) VARCHAR2(30) VARCHAR2(18) VARCHAR2(30) NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER VARCHAR2(7)
8. Which password management feature ensures a user cannot reuse a password for a specified time interval? A. Account Locking B. Password History C. Password Verification D. Password Expiration and Aging Answer: B Explanation: Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A96524-01 (a96524.pdf) 22-8 Account Locking Oracle can lock a user’s account if the user fails to login to the system within a specified number of attempts. Depending on how the account is configured, it can be unlocked automatically after a specified time interval or it must be unlocked by the database administrator. Password Complexity Verification Complexity verification checks that each password is complex enough to provide reasonable protection against intruders who try to break into the system by guessing passwords. Password History The password history option checks each newly specified password to ensure that a password is not reused for the specified amount of time or for the specified number of password changes. The database administrator can configure the rules for password reuse with CREATE PROFILE statements.
5
9. Which view provides the names of all the data dictionary views? A. DBA_NAMES B. DBA_TABLES C. DICTIONARY D. DBA_DICTIONARY Answer: C Explanation: http://docs.rinet.ru:8080/O8/ch02/ch02.htm All the data dictionary tables and views are owned by SYS. You can query the DICTIONARY table to obtain the list of all dictionary views. 10. The control file defines the current state of the physical database. Which three dynamic performance views obtain information from the control file? (Choose three.) A. V$LOG B. V$SGA C. V$THREAD D. V$VERSION E. V$DATAFILE F. V$PARAMETER Answer: A, C, E Explanation: V$LOG: This view contains log file information from the control files. V$SGA: This view contains summary information on the system global area (SGA). V$THREAD: This view contains thread information from the control file. V$VERSION: Version numbers of core library components in the Oracle server. There is one row for each component. V$DATAFILE: This view contains datafile information from the control file. V$PARAMETER: displays information about the initialization parameters that are currently in effect for the session. A new session inherits parameter values from the instance-wide values displayed by the V$SYSTEM_PARAMETER view. 11. Which data dictionary view shows the available free space in a certain tablespace? A. DBA_EXTENTS B. V$FREESPACE C. DBA_FREE_SPACE D. DBA_TABLESPACFS E. DBA_FREE_EXTENTS Answer: C 12. Which data dictionary view would you use to get a list of object privileges for all database users? A. DBA_TAB_PRIVS B. ALL_TAB_PRIVS C. USER_TAB_PRIVS D. ALL_TAB_PRIVS_MADE Answer: A Explanation: Ad A: True. DBA_TAB_PRIVS This view lists all grants on objects in the database. (a58242.pdf) Pg. 261. (2-91). Ad B: False. ALL_TAB_PRIVS This view lists the grants on objects for which the user or PUBLIC is the grantee. (a58242.pdf) Pg. 203. (2-33).
6
Ad C: False. USER_TAB_PRIVS This view contains information on grants on objects for which the user is the owner, grantor, or grantee. (a58242.pdf) Pg. 333. (2-163). Ad D: False. ALL_TAB_PRIVS_MADE This view lists the user’s grants and grants on the user’s objects. (a58242.pdf) Pg. 204. (2-34). 13. User Smith created indexes on some tables owned by user John. You need to display the following: index names index types Which data dictionary view(s) would you need to query? A. DBA_INDEXES only B. DBA_IND_COLUMNS only C. DBA_INDEXES and DBA_USERS D. DBA_IND COLUMNS and DBA_USERS E. DBA_INDEXES and DBA_IND_EXPRESSIONS F. DBA_INDEXES, DBA_TABLES, and DBA_USERS Answer: A Explanation: Ad A: DBA_INDEXES. This view contains descriptions for all indexes in the database. To gather statistics for this view, use the SQL command ANALYZE. This view supports parallel partitioned index scans. (a58242.pdf) Pg. 230. (2-60). Ad B: DBA_IND_COLUMNS. This view contains descriptions of the columns comprising the indexes on all tables and clusters. (a58242.pdf) Pg. 232. (2-62). Ad C: DBA_USERS. This view lists information about all users of the database. (a58242.pdf) Pg. 267. (2-97). Ad E: DBA_IND_EXPRESSIONS does not exist. Ad F: DBA_TABLES. This view contains descriptions of all relational tables in the database. To gather statistics for this view, use the SQL command ANALYZE. (a58242.pdf) Pg. 262. (2-92). 14. You need to know how many data files were specified as the maximum for the database when it was created. You did not create the database and do not have the script used to create the database. How could you find this information? A. Query the DBA_DATA_FILES data dictionary view. B. Query the V$DATAFILE dynamic performance view. C. Issue the SHOW PARAMETER CONTROL_FILES command. D. Query the V$CONTROLFILE_RECORD_SECTION dynamic performance view. Answer: D Explanation: Ad A: False. DBA_DATA_FILES contains information about database files. We need information about max number of datafiles. See (a58242.pdf) Pg. 225. (2-55) Ad B: V$DATAFILE ontains datafile information from the control file. (a58242.pdf) Pg. 363. (3-23) Ad C: This command just shows the locations of the current control files. Ad D: V$CONTROLFILE_RECORD_SECTION displays information about the controlfile record sections. (a58242.pdf) Pg. 360. (3-20) 15. Examine the command: CREATE TABLE employee ( employee_id NUMBER CONSTRAINT employee_empid_pk PRIMARY KEY, employee_name VARCNAR2(30), manager_id NUMBER CONSTRAINT employee_mgrid_fk REFERENCES employee(employee_id)); The EMP table contains self referential integrity requiring all NOT NULL values inserted in the MANAGER_ID column to exist in the EMPLOYEE_ID column. Which view or combination of views is required to return the name of the foreign key constraint and the referenced primary key? A. DBA_TABLES only
7
B. DBA_CONSTRAINTS only C. DBA_TAB_COLUMNS only D. DBA_CONS_COLUMNS only E. DBA_TABLES and DBA_CONSTRAINTS F. DBA_TABLES and DBA_CONS_COLUMNS Answer: B Explanation: Ad A: False. DBA_TABLES contains descriptions of all relational tables in the database. To gather statistics for this view, use the SQL command ANALYZE. No constraint information See (a58242.pdf) pg. 262 (2-92). Ad B: True. DBA_CONSTRAINTS contains constraint definitions on all tables. See (a58242.pdf) pg. 253 (2-83). Ad C: False. DBA_TAB_COLUMNS contains information which describes columns of all tables, views, and clusters. No constraint name information. See (a58242.pdf) pg. 259 (2-89). Ad D: False. DBA_CONS_COLUMNS contains information about accessible columns in constraint definitions. See (a58242.pdf) pg. 224 (2-54). Ad E: False. We don’t need the DBA_TABLES. Ad F: False. 16. Which data dictionary view(s) do you need to query to find the following information about a user? - Whether the user's account has expired - The user's default tablespace name - The user's profile name A. DBA_USERS only B. DBA_USERS and DBA_PROFILES C. DBA_USERS and DBA_TABLESPACES D. DBA_USERS, DBA_TS_QUOTAS, and DBA_PROFILES E. DBA_USERS, DBA_TABLESPACES, and DBA_PROFILES Answer: A Explanation: SQL> desc dba_users Name USERNAME USER_ID PASSWORD ACCOUNT_STATUS LOCK_DATE EXPIRY_DATE DEFAULT_TABLESPACE TEMPORARY_TABLESPACE CREATED PROFILE INITIAL_RSRC_CONSUMER_GROUP EXTERNAL_NAME
Null? NOT NULL NOT NULL NOT NULL DATE DATE NOT NULL NOT NULL NOT NULL NOT NULL
Type VARCHAR2(30) NUMBER VARCHAR2(30) VARCHAR2(32) VARCHAR2(30) VARCHAR2(30) DATE VARCHAR2(30) VARCHAR2(30) VARCHAR2(4000)
17. You need to determine the location of all the tables and indexes owned by one user. In which DBA view would you look? A. DBA_TABLES B. DBA_INDEXES C. DBA_SEGMENTS D. DBA_TABLESPACES Answer: C Explanation: Ad A: False. DBA_TABLES contains descriptions of all relational tables in the database. To gather statistics for this view, use the SQL command ANALYZE. No index information See (a58242.pdf) pg. 262 (2-92).
8
Ad B: False. DBA_INDEXES contains descriptions for all indexes in the database. To gather statistics for this view, use the SQL command ANALYZE. This view supports parallel partitioned index scans. No table information. See (a58242.pdf) pg. 230 (2-60). Ad C: True. DBA_SEGMENTS contains information about storage allocated for all database segments. Username of the segment owner, Type of segment: … TABLE, INDEX …. See (a58242.pdf) pg. 254 (2-84). Ad D: False. DBA_TABLESPACES contains descriptions of all tablespaces. No table and Index information. See (a58242.pdf) pg. 264 (2-94). 18. Which data dictionary view would you use to get a list of all database users and their default settings? A. ALL_USERS B. USER_USERS C. DBA_USERS D. V$SESSION Answer: C Explanation: Ad A: False. ALL_USERS This view contains information about all users of the database: Name of the user, ID number of the user, User creation date, but No default settings. See (a58242.pdf) pg. 209 (2-39). Ad B: False. USER_USERS This view contains information about the current user. not all user. See (a58242.pdf) pg. 339 (2-169). Ad C: True. DBA_USERS This view lists information about all users of the database. Default tablespace for data, Default tablespace for temporary table See (a58242.pdf) pg. 267 (2-97). Ad D: False. V$SESSION This view lists session information for each current session. See (a58242.pdf) pg. 417 (377). 19. You want to limit the number of transactions that can simultaneously make changes to data in a block, and increase the frequency with which Oracle returns a block back on the free list. Which parameters should you set? A. INITRANS and PCTUSED B. MAXTRANS and PCTFREE C. INITRANS and PCTFREE D. MAXTRANS and PCTUSED Answer: D Explanation: http://perun.si.umich.edu/~radev/654/resources/oracledefs.html PCTFREE specifies the percentage of space in each of the table's data blocks reserved for future updates to the table's rows. The value of PCTFREE must be a positive integer from 1 to 99. A value of 0 allows the entire block to be filled by inserts of new rows. The default value is 10. This value reserves 10% of each block for updates to existing rows and allows inserts of new rows to fill a maximum of 90% of each block. PCTFREE has the same function in the commands that create and alter clusters, indexes, snapshots, and snapshot logs. The combination of PCTFREE and PCTUSED determines whether inserted rows will go into existing data blocks or into new blocks. PCTUSED specifies the minimum percentage of used space that ORACLE maintains for each data block of the table. A block becomes a candidate for row insertion when its used space falls below PCTUSED. PCTUSED is specified as a positive integer from 1 to 99 and defaults to 40. PCTUSED has the same function in the commands that create and alter clusters, snapshots, and snapshot logs. The sum of PCTFREE and PCTUSED must be less than 100. You can use PCTFREE and PCTUSED together use space within a table more efficiently. INITRANS specifies the initial number of transaction entries allocated within each data block allocated to the table. This value can range from 1 to 255 and defaults to 1. In general, you should not change the INITRANS value from its default. Each transaction that updates a block requires a transaction entry in the block. The size of a transaction entry depends on your operating system. This parameter ensures that a minimum number of concurrent transactions can update the block and helps avoid the overhead of dynamically allocating a transaction entry. The INITRANS parameter serves the
9
same purpose in clusters, indexes, snapshots, and snapshot logs as in tables. The minimum and default INITRANS value for a cluster or index is 2, rather than 1. MAXTRANS specifies the maximum number of concurrent transactions that can update a data block allocated to the table. This limit does not apply to queries. This value can range from 1 to 255 and the default is a function of the data block size. You should not change the MAXTRANS value from its default. If the number concurrent transactions updating a block exceeds the INITRANS value, ORACLE dynamically allocates transaction entries in the block until either the MAXTRANS value is exceeded or the block has no more free space. The MAXTRANS parameter serves the same purpose in clusters, snapshots, and snapshot logs as in tables. 20. Which steps should you take to gather information about checkpoints? A. Set the LOG_CHECKPOINTS_TO_ALERT initialization parameter to TRUE. Monitor the alert log file. B. Set the LOG_CHECKPOINT_TIMEOUT parameter. Force a checkpoint by using the FAST_START_MTTR_TARGET parameter. Monitor the alert log file. C. Set the LOG_CHECKPOINT_TIMEOUT parameter. Force a log switch by using the command ALTER SYSTEM FORCE LOGSWITCH. Force a checkpoint by using the command ALTER SYSTEM FORCE CHECKPOINT. Monitor the alert log file. D. Set the FAST_START_MTTR_TARGET parameter to TRUE. Force a checkpoint by using the command ALTER SYSTEM FORCE CHECKPOINT. Monitor the alert log file. Answer: A Testking said B. Explanation: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch1103.htm#1019186 LOG_CHECKPOINTS_TO_ALERT lets you log your checkpoints to the alert file. Doing so is useful for determining whether checkpoints are occurring at the desired frequency. FAST_START_MTTR_TARGET: Lets you specify in seconds the expected mean time to recover (MTTR), which is the expected amount of time Oracle takes to perform recovery and startup the instance. LOG_CHECKPOINT_TIMEOUT: Limits the number of seconds between the most recent redo record and the checkpoint. LOG_CHECKPOINT_INTERVAL: Limits the number of redo blocks generated between the most recent redo record and the checkpoint. 21. You decided to use Oracle Managed Files (OMF) for the control files in your database. Which initialization parameter do you need to set to specify the default location for control files if you want to multiplex the files in different directories? A. DB_FILES B. DB_CREATE_FILE_DEST C. DB_FILE_NAME_CONVERT D. DB_CREATE_ONLINE_LOG_DEST_n Answer: D Explanation: http://www.orafaq.net/parms/> Paramter Name: db_files Description: max allowable # db files Paramter Name: db_create_file_dest Description: default database location http://www.orafaq.net/archive/oracle-l/2002/07/08/102823.htm: DB_FILE_NAME_CONVERT converts the db file name: db_file_name_convert=('/vobs/oracle/dbs','/fs2/oracle/stdby') http://www.oracle-base.com/Articles/9i/OracleManagedFiles.asp: Managing Redo Log Files Using OMF When using OMF for redo logs the DB_CREAT_ONLINE_LOG_DEST_n parameters in the init.ora file decide on the locations and numbers of logfile members. For exmple: DB_CREATE_ONLINE_LOG_DEST_1 = c:\Oracle\Oradata\TSH1 DB_CREATE_ONLINE_LOG_DEST_2 = d:\Oracle\Oradata\TSH1
10
22. Which command can you use to display the date and time in the form 17:45:01 JUL-12-2000 using the default US7ASCII character set? A. ALTER SYSTEM SET NLS_DATE_FORMAT='HH24:MI:SS MON-DD-YYYY'; B. ALTER SESSION SET DATE_FORMAT='HH24:MI:SS MON-DD-YYYY'; C. ALTER SESSION SET NLS_DATE_FORMAT='HH24:MI:SS MON-DD-YYYY'; D. ALTER SYSTEM SET NLS_DATE_FORMAT='HH:MI:SS MON-DD-YYYY'; Answer: C Explanation: http://www.idera.com/support/documentation/Oracle_Date_Format.htm ALTER SESSION SET NLS_DATE_FORMAT =
23. Which initialization parameter determines the location of the alert log file? A. USER_DUMP_DEST B. DB_CREATE_FILE_DEST C. BACKGROUND_DUMP_DEST D. DB_CREATE_ONLINE_LOG_DEST_n Answer: C http://www.experts-exchange.com/Databases/Oracle/Q_20308350.html There is one alert log per db instance and normally named as alert_<sid>.log. Trace files, on the other hand, are generated by the oracle background processes or other connected net8 processes when oracle internal errors occur and they dump all information about the error into the trace files. You can also set the level of tracing for Net8 connections as per your requirement. The alert log is a special trace file. The alert log of a database is a chronological log of messages and errors, which includes the following: (a) All internal errors (ORA-600), block corruption errors (ORA-1578), and deadlock errors (ORA-60) that occur. (b) Administrative operations, such as CREATE/ALTER/DROP DATABASE/TABLESPACE/ROLLBACK SEGMENT SQL statements and STARTUP, SHUTDOWN, and ARCHIVE LOG. (c) Several messages and errors relating to the functions of shared server and dispatcher processes. (d) Errors occurring during the automatic refresh of a snapshot. (e) The values of all initialization parameters at the time the database and instance start. Location: All trace files for background processes and the alert log are written to the destination specified by the initialization parameter BACKGROUND_DUMP_DEST. All trace files for server processes are written to the destination specified by the initialization parameter USER_DUMP_DEST. The names of trace files are operating system specific, but usually include the name of the process writing the file (such as LGWR and RECO). Info about all the Oracle parameters: http://www.orafaq.net/parms/ 24. Which two environment variables should be set before creating a database? (Choose two.) A. DB_NAME B. ORACLE_SID C. ORACLE_HOME D. SERVICE_NAME E. INSTANCE_NAME Answer: B, C Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 67.: You may need to configure a few environment variables before creating your database, such as ORACLE_BASE, ORACLE_HOME, ORACLE_SID, ORA_NLS33, LD_LIBRARY_PATH, and others. Check out: In this question we deal with environment variables, not parameters!
11
INSTANCE_NAME Represents the name of the instance and is used to uniquely identify a specific instance when clusters share common services names. The instance name is identified by the INSTANCE_NAME parameter in the instance initialization file, initsid.ora. The instance name is the same as the Oracle system identifier (sid). Oracle system identifier (sid) A name that identifies a specific instance of a running pre-release 8.1 Oracle database. For an Oracle9i Real Application Clusters database, each node within the cluster has an instance referencing the database. The database name, specified by the DB_NAME parameter in the initdb_name.ora file, and unique thread number make up each node's sid. The thread ID starts at 1 for the first instance in the cluster, and is incremented by 1 for the next instance, and so on. ORACLE_HOME Corresponds to the environment in which Oracle products run. This environment includes location of installed product files, PATH variable pointing to products' binary files, registry entries, net service name, and program groups. If you install an OFA-compliant database, using Oracle Universal Installer defaults, Oracle home (known as \ORACLE_HOME in this guide) is located beneath X:\ORACLE_BASE. It contains subdirectories for Oracle software executables and network files. Oracle Corporation recommends that you never set the ORACLE_HOME environment variable, because it is not required for Oracle products to function properly. If you set the ORACLE_HOME environment variable, then Oracle Universal Installer will unset it for you. SERVICE_NAME A logical representation of a database. This is the way a database is presented to clients. A database can be presented as multiple services and a service can be implemented as multiple database instances. The service name is a string that includes: (a) The global database name (b) A name comprised of the database name (DB_NAME) (c) Domain name (DB_DOMAIN) (d) The service name is entered during installation or database creation. If you are not sure what the global database name is, you can obtain it from the combined values of the SERVICE_NAMES parameter in the common database initialization file, initdbname.ora. 25. During a checkpoint in an Oracle9i database, a number of dirty database buffers covered by the log being checkpointed are written to the data files by DBWn. Which parameter determines the number of buffers being written by DBWn? A. LOG_CHECKPOINT_TARGET B. FAST_START_MTTR_TARGET C. LOG_CHECKPOINT_IO_TARGET D. FAST_START_CHECKPOINT_TARGET Answer: B Explanation: Ad A: False. There is no LOG_CHECKPOINT_TARGET parameter in Oracle. Ad B: True. FAST_START_MTTR_TARGET parameter determines the number of buffers being written by DBWn. Parameter FAST_START_MTTR_TARGET has been introduced in Oracle9i and it replaces FAST_START_IO_TARGET and LOG_CHECKPOINT_INTERVAL in Oracle8i, although the old parameters can still be set if required in Oracle9i. FAST_START_MTTR_TARGET enables you to specify the number of seconds the database takes to perform crash recovery of a single instance. Ad C: False. There is no LOG_CHECKPOINT_IO_TARGET parameter in Oracle. Ad D: False. There is no FAST_START_CHECKPOINT_TARGET parameter in Oracle. 26. The ORDERS table has a constant transaction load 24 hours a day, so down time is not allowed. The indexes become fragmented. Which statement is true? A. The index needs to be dropped, and then re-created. B. The resolution of index fragmentation depends on the type of index. C. The index can be rebuilt while users continue working on the table. D. The index can be rebuilt, but users will not have access to the index during this time.
12
E. The fragmentation can be ignored because Oracle resolves index fragmentation by means of a freelist. Answer: C Explanation: http://www.dbatoolbox.com/WP2001/spacemgmt/reorg_defrag_in_o8i_fo.pdf> Oracle8i can create an index online; users can continue to update and query the base table while the index is being created. No table or row locks are held during the creation operation. Changes to the base table and index during the build are recorded in a journal table and merged into the new index at the completion of the operation, as illustrated in Figure 1. These online operations also support parallel index creation and can act on some or all of the partitions of a partitioned index. Online index creation improves database availability by providing users full access to data in the base table during an index build. 27. You set the value of the OS_AUTHENT_PREFIX initialization parameter to OPS$ and created a user account by issuing this SQL statement: CREATE USER OPS$smith
IDENTIFIED EXTERNALLY;
Which two statements are true? (Choose two.)
A. Oracle server assigns the DEFAULT profile to the user. B. You can specify the PASSWORD EXPIRE clause for an external user account. C. The user does not require CREATE SESSION system privilege to connect to the database. D. If you query the DBA_USERS data dictionary view the USERNAME column will contain the value SMITH. E. The user account is maintained by Oracle, but password administration and user authentication are performed by the operating system or a network service. Answer: A, E Explanation: With external authentication, your database relies on the underlying operating system or network authentication service to restrict access to database accounts. A database password is not used for this type of login. If your operating system or network service permits, you can have it authenticate users. If you do so, set the parameter OS_AUTHENT_PREFIX, and use this prefix in Oracle usernames. This parameter defines a prefix that Oracle adds to the beginning of every user’s operating system account name. Oracle compares the prefixed username with the Oracle usernames in the database when a user attempts to connect. If a user with an operating system account named TSMITH” is to connect to an Oracle database and be authenticated by the operating system, Oracle checks that there is a corresponding database user “OPS$TSMITH” and, if so, allows the user to connect. See: (a58397.pdf) Pg. 377. (20-9) Ad A: True. PROFILE reassigns the profile named to the user. The profile limits the amount of database resources the user can use. If you omit this clause, Oracle assigns the DEFAULT profile to the user. See (a58225.pdf) Pg. 541. (4357). Ad B: When you choose external authentication for a user, the user account is maintained by Oracle, but password administration and user authentication is performed by an external service. This external service can be the operating system or a network service, such as Oracle Net. Ad C: False. Ad D: False. Ad E: When you choose external authentication for a user, the user account is maintained by Oracle, but password administration and user authentication is performed by an external service. This external service can be the operating system or a network service, such as Oracle Net. 28. Which type of segment is used to improve the performance of a query? A. index B. table C. temporary D. boot strap Answer: A Explanation: http://vsbabu.org/oracle/sect16.html There is a SEGMENT_TYPE = ‘index’ condition -> index IS a segment. And it also helps queries to be faster.
13
29. Which three are the physical structures that constitute the Oracle database? (Choose three) A. table B. extent c. segment D. data file E. log file F. tablespace G. control file Answer: D, E, G Explanation: http://www.adp-gmbh.ch/ora/notes.html Physical and logical elements An oracle server consists of an oracle database and an oracle instance. If you don't want technical terms, you can think of an instance as the software, and the database as the data that said software operates on. More technically, the instance is the combination of background processes and memory buffers (or SGA http://www.adpgmbh.ch/ora/concepts/sga.html). The data (of the database) resides in datafiles. Because these datafiles are visible (as files) they're called physical structures as opposed to logical structures. One ore more datafiles make up a Tablespace http://www.adp-gmbh.ch/ora/concepts/tablespaces.html. Besides of datafiles, there are two other types of physical structures: redo log files and control files The logical structures are Tablespace, schema objects, data blocks, extends, and segments. Control Files An Oracle Database must at least have one control file, but usually (for Backup und Recovery http://www.adpgmbh.ch/ora/concepts/backup_recovery/index.html reasons) it has more than one (all of which are exact copies of one control file). The Control File contains a number of important information that the instance needs to operate the database. The following pieces of information are held in a control file: The name (os path) of all datafiles that the database consists of, the name of the database, the timestamp of when the database was created, the checkpoint (all database changes prior to that checkpoint are saved in the datafiles) and information for RMAN. When a database is mounted, its control file is used to find the datafiles and redo log files for that database. Because the control file is so important, it is imperative to back up the control file whenever a structural change was made in the database. Redo Log Whenever something is changed on a Datafile, oracle records it in a redo log. The name redo log indicates its purpose: When the database crashes, oracle can redo all changes on datafiles which will take the database data back to the state it was when the last redo record was written. Use v$log http://www.adpgmbh.ch/ora/misc/dynamic_performance_views.html, v$logfile http://www.adpgmbh.ch/ora/misc/dynamic_performance_views.html, v$log_history http://www.adpgmbh.ch/ora/misc/dynamic_performance_views> and v$thread http://www.adpgmbh.ch/ora/misc/dynamic_performance_views.html to find information about the redo log of your database. Each redo log file belongs to exactly on group (of which at least two must exist). Exactly one of these groups is the CURRENT group (can be queried using the column status of v$log http://www.adpgmbh.ch/ora/misc/dynamic_performance_views>). Oracle uses that current group to write the redo log entries. When the group is full, a log switch occurs, making another group the current one. Each log switch causes checkpoint, however, the converse is not true: a checkpoint does not cause a redo log switch. I believe the website - files are usually said physical, and these are basic ones -> D E G 30. Which three statements about the Oracle database storage structure are true? (Choose three) A. A data block is a logical structure B. A single data file can belong to multiple tablespaces. C. When a segment is created, it consists of at least one extent. D. The data blocks of an extent may or may not belong to the same file. E. A tablespace can consist of multiple data files, each from a separate disk. F. Within a tablespace, a segment cannot include extents from more than one file. Answer: A, C, E
14
Explanation: A is OK, see Q29. B is false (Oracle7 documentation, Server Concepts, 4-10): A tablespace in an Oracle database consists of one or more physical datafiles. A datafile can be associated with only one tablespace, and only one database. C is OK (Oracle7 documentation, Server Concepts, 3-10): An extent is a logical unit of database storage space allocation made up of a number of contiguous data blocks. Each segment is composed of one or more extents. D is false (Oracle7 documentation, Server Concepts, 3-3): Oracle allocates space for segments in extents. Therefore, when the existing extents of a segment are full, Oracle allocates another extent for that segment. Because extents are allocated as needed, the extents of a segment may or may not be contiguous on disk. The segments also can span files, but the individual extents cannot. E is OK (Oracle7 documentation, Server Concepts, 4-3): Each tablespace in an Oracle database is comprised of one or more operating system files called datafiles. A tablespace’s datafiles physically store the associated database data on disk. F is false - see ans for D 31. Examine the SQL statement: CREATE TABLESPACE user_data DATAFILE '/u01/oradata/user_data_0l.dbf' SIZE 100M LOCALLY MANAGED UNIFORM SIZE 1M AUTOMATIC SEGMENT SPACE MANAGEMENT; Which part of the tablespace will be of a uniform size of 1 MB? A. extent B. segment C. Oracle block D. operating system block Answer: A Explanation: The extent_management_clause lets you specify how the extents of the tablespace will be managed. (a) Specify LOCAL if you want the tablespace to be locally managed. Locally managed tablespaces have some part of the tablespace set aside for a bitmap. This is the default. (b) AUTOALLOCATE specifies that the tablespace is system managed. Users cannot specify an extent size. This is the default if the COMPATIBLE initialization parameter is set to 9.0.0 or higher. (c) UNIFORM specifies that the tablespace is managed with uniform extents of SIZE bytes. Use K or M to specify the extent size in kilobytes or megabytes. The default SIZE is 1 megabyte. Note: Once you have specified extent management with this clause, you can change extent management only by migrating the tablespace. Remark: One tablespace has many segments.Segment is space allocated fo a db object-> each index has its own segment. If the segment of the index fills up, a new extent is created for the segment. It means, that the tablespace gets 1mb bigger, if the segment for one of the objects fills up. If another segment fills up, the tablespace gets 1 mb bigger again, no matter how much empty space we have in the previous extent. The consequence is that data does not become fragmented. 32. Which is a complete list of the logical components of the Oracle database? A. tablespaces, segments, extents, and data files B. tablespaces, segments, extents, and Oracle blocks C. tablespaces, database, segments, extents, and data files D. tablespaces, database, segments, extents, and Oracle blocks E. tablespaces, segments, extents, data files, and Oracle blocks Answer: B See Q29 33. Which option lists the correct hierarchy of storage structures, from largest to the smallest? A. segment, extent, tablespace, data block
15
B. data block, extent, segment, tablespace C. tablespace, extent, data block, segment D. tablespace, segment, extent, data block E. tablespace, data block, extent, segment Answer: D Explanation: Logical Database Structures: The logical structures of an Oracle database include schema objects, data blocks, extents, segments, and tablespaces. Oracle Data Blocks: At the finest level of granularity, Oracle database data is stored in data blocks. One data block corresponds to a specific number of bytes of physical database space on disk. Extents: The next level of logical database space is an extent. An extent is a specific number of contiguous data blocks, obtained in a single allocation, used to store a specific type of information. Segments: Above extents, the level of logical database storage is a segment. A segment is a set of extents allocated for a certain logical structure. The following table describes the different types of segments. Tablespaces: A database is divided into logical storage units called tablespaces, which group related logical structures together. 34. Extents are a logical collection of contiguous _________________. A. segments B. database blocks C. tablespaces D. operating system blocks Answer: B Explanation: An extent is a specific number of contiguous data blocks, obtained in a single allocation, and used to store a specific type of information. 35. Which two statements about segments are true? (Choose two.) A. Each table in a cluster has its own segment. B. Each partition in a partitioned table is a segment. C. All data in a table segment must be stored in one tablespace. D. If a table has three indexes only one segment is used for all indexes. E. A segment is created when an extent is created, extended, or altered. F. A nested table of a column within a table uses the parent table segment. Answer: B, C Explanation: A single data segment in an Oracle database holds all of the data for one of the following: (a) A table that is not partitioned or clustered. (b) A partition of a partitioned table. (c) A cluster of tables. A table or materialized view can contain LOB, varray, or nested table column types. These entities can be stored in their own segments. Ad A: False. Each table in a cluster does not have its own segment. Clustered tables contain some blocks as a common part for two or more tables. Clusters enable you to store data from several tables inside a single segment so users can retrieve data from those two tables together very quickly. Ad D: False. For each index, Oracle allocates one or more extents to form its index segment. Ad E: False. Oracle creates this data segment when you create the nonclustered table or cluster with the CREATE command. Ad F: False. A nested table of a column within a table does not use the parent table segment: it has its own. Oracle databases use four types of segments: (a) Data Segments (b) Index Segments (c) Temporary Segments (d) Rollback Segments
16
See: (a58227.pdf) Pg. 107. (2-15) 36. Which type of table is usually created to enable the building of scalable applications, and is useful for large tables that can be queried or manipulated using several processes concurrently? A. regular table B. clustered table C. partitioned table D. index-organized table Answer: C What is Scalability? In the case of web applications, scalability is the capacity to serve additional users or transactions without fundamentally altering the application's architecture or program design. If an application is scalable, you can maintain steady performance as the load increases simply by adding additional resources such as servers, processors or memory. Cluster A cluster is an oracle http://infoboerse.doag.de/mirror/frank/glossary/faqgloso.htm object that allows one to store related rows from different tables in the same data http://infoboerse.doag.de/mirror/frank/glossary/faqglosd.htm block http://infoboerse.doag.de/mirror/frank/glossary/faqglosb.htm. Table http://infoboerse.doag.de/mirror/frank/glossary/faqglost.htm clustering is very seldomly used by Oracle http://infoboerse.doag.de/mirror/frank/glossary/faqgloso.htm DBA http://infoboerse.doag.de/mirror/frank/glossary/faqglosd.htm's and Developers. Ans is c -> multiprocess access is better, if the 2 processes access different files. 37. How do you enable the HR_CLERK role? A. B. C. D.
SET ROLE hr_clerk; CREATE ROLE hr_clerk; ENABLE ROLE hr_clerk; SET ENABLE ROLE hr_clerk;
Answer: A Explanation: SQL 18-47 SET ROLE Purpose: Use the SET ROLE statement to enable and disable roles for your current session. In the IDENTIFIED BY password clause, specify the password for a role. If the role has a password, then you must specify the password to enable the role. D is out of question, bad syntax. I would go for A, if the role does not have a password, this command is ok. 38. Your database is currently configured with the database character set to WE8ISO8859P1 and national character set to AF16UTF16. Business requirements dictate the need to expand language requirements beyond the current character set, for Asian and additional Western European languages, in the form of customer names and addresses. Which solution saves space storing Asian characters and maintains consistent character manipulation performance? A. Use SQL CHAR data types and change the database character set to UTF8. B. Use SQL NCHAR data types and change the national character set to UTF8. C. Use SQL CHAR data types and change the database character set to AF32UTF8. D. Use SQL NCHAR data types and keep the national character set to AF16UTF16. Answer: D Testking said C -> Wrong: We need NCHAR not CHAR. Explanation: SQL NCHAR
17
Supporting multilingual data often means using Unicode. Unicode is a universal character encoding scheme that allows you to store information from any major language using a single character set. Unicode provides a unique code value for every character, regardless of the platform, program, or language. For many companies with legacy systems making the commitment to migrating their entire database to support Unicode is not practical. An alternative to storing all data in the database as Unicode is to use the SQL NCHAR datatypes. Unicode characters can be stored in columns of these datatypes regardless of the setting of the database character set. The NCHAR datatype has been redefined in Oracle9i to be a Unicode datatype exclusively. In other words, it stores data in the Unicode encoding only. The National Character Set supports UTF-16 and UTF-8 in the following encodings: (a) AL16UTF16 (default) (b) UTF8 SQL NCHAR datatypes (NCHAR, NVARCHAR2, and NCLOB) can be used in the same way as the SQL CHAR datatypes. This allows the inclusion of Unicode data in a non Unicode database. Some of the key benefits for using the NCHAR datatype versus having the entire database as Unicode include: You only need to support multilingual data in a limited number of columns - You can add columns of the SQL NCHAR datatypes to existing tables or new tables to support multiple languages incrementally. Or you can migrate specific columns from SQL CHAR datatypes to SQL NCHAR datatypes easily using the ALTER TABLE MODIFY COLUMN command. Example: ALTER TABLE emp MODIFY (ename NVARCHAR2(10)); You are building a packaged application that will be sold to customers, then you may want to build the application using SQL NCHAR datatypes - This is because with the SQL NCHAR datatype the data is always stored in Unicode, and the length of the data is always specified in UTF-16 code units. As a result, you need only test the application once, and your application will run on your customer databases regardless of the database character set. You want the best possible performance - If your existing database character set is single-byte then extending it with SQL NCHAR datatypes may offer better performance then migrating the entire database to Unicode. Your applications native environment is UCS-2 or UTF-16 - A Unicode database must run as UTF-8. This means there will be conversion between the client and database. By using the NCHAR encoding AL16UTF16, you can eliminate this conversion. 39. You have just accepted the position of DBA with a new company. One of the first things you want to do is examine the performance of the database. Which tool will help you to do this? A. Recovery Manager B. Oracle Enterprise Manager C. Oracle Universal Installer D. Oracle Database Configuration Assistant Answer: B Explanation: http://www.orafaq.com/faqoem.htm What is OEM (Oracle Enterprise Manager)? OEM is a set of system management tools provided by Oracle for managing the Oracle environment. It provides tools to automate tasks (both one-time and repetitive in nature) to take database administration a step closer to "Lights Out" management. What are the components of OEM? Oracle Enterprise Manager (OEM) has the following components: Management Server (OMS): Middle tier server that handles communication with the intelligent agents. The OEM Console connects to the management server to monitor and configure the Oracle enterprise. Console: This is a graphical interface from where one can schedule jobs, events, and monitor the database. The console can be opened from a Windows workstation, Unix XTerm (oemapp command) or Web browser session (oem_webstage). Intelligent Agent (OIA): The OIA runs on the target database and takes care of the execution of jobs and events scheduled through the Console. Data Gatherer (DG): The DG runs on the target database and takes care of the gathering database statistics over time. 40. You have a database with the DB_NAME set to PROD and ORACLE_SID set to PROD. These files are in the default location for the initialization files: - init.ora - initPROD.ora - spfile.ora - spfilePROD.ora The database is started with this command: SQL> startup
18
Which initialization files does the Oracle Server attempt to read, and in which order? A. init.ora, initPROD.ora, spfilePROD.ora B. spfile.ora, spfilePROD.ora, initProd.ora C. spfilePROD.ora, spfile.ora, initProd.ora D. initPROD.ora, spfilePROD.ora, spfile.ora Answer: C Explanation: http://www.trivadis.ch/publikationen/E/spfile_and_initora.en.pdf http://www.adp-gmbh.ch/ora/notes.html Up to version 8i, Oracle traditionally stored initialization parameters in a text file INIT.ORA (PFILE). With Oracle9i, server parameter files (SPFILE) can also be used. An SPFILE can be regarded as a repository for initialization parameters which is located on the database server. SPFILEs are small binary files that cannot be edited. Editing SPFILEs corrupts the file and either the instance fails to start or an active instance may crash. At database startup, if no PFILE is specified at the OS-dependent default location ($ORACLE_HOME/dbs under UNIX, $ORACLE_HOME\database under NT), the startup command searches for: 1. spfile${ORACLE_SID}.ora 2. spfile.ora 3. init${ORACLE_SID}.ora 41. You are in the planning stages of creating a database. How should you plan to influence the size of the control file? A. Specify size by setting the CONTROL_FILES initialization parameter instead of using the Oracle default value. B. Use the CREATE CONTROLFILE command to create the control file and define a specific size for the control file. C. Define the MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, MAXINSTANCES parameters in the CREATE DATABASE command. D. Define specific values for the MAXLOGFILES, MAXLOGGROUPS, MAXLOGHISTORY, MAXDATAFILES, and MAXINSTANCES parameters within the initialization parameter file. Answer: C Explanation: CONTROL_FILES is a string -> name of the files -> does not influence the size SQL 13-15 CREATE CONTROLFILE Use the CREATE CONTROLFILE statement to re-create a control file in one of the following cases: (a) All copies of your existing control files have been lost through media failure. (b) You want to change the name of the database. (c) You want to change the maximum number of redo log file groups, redo log file members, archived redo log files, datafiles, or instances that can concurrently have the database mounted and open. http://coffee.kennesaw.edu/tests/Oracle/ch3.doc: CREATE DATABASE Question 19. Which clauses in the CREATE DATABASE command specify limits for the database? The control file size depends on the following limits (MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, MAXINSTANCES), because Oracle pre-allocates space in the control file. MAXLOGFILES: specifies the maximum number of redo log groups that can ever be created in the database. MAXLOGMEMBERS: specifies the maximum number of redo log members (copies of the redo logs) for each redo log group. MAXLOGHISTORY: is used only with Parallel Server configuration. It specifies the maximum number of archived redo log files for automatic media recovery. MAXDATAFILES: specifies the maximum number of data files that can be created in this database. Data files are created when you create a tablespace, or add more space to a tablespace by adding a data file. MAXINSTANCES: specifies the maximum number of instances that can simultaneously mount and open this database. If you want to change any of these limits after the database is created, you must re-create the control file. Ad D: False. There is no MAXLOGGROUPS parameter in Oracle. 42. When is the SGA created in an Oracle database environment?
19
A. when the database is created B. when the instance is started C. when the database is mounted D. when a user process is started E. when a server process is started Answer: B Explanation: http://www.dbaoncall.net/references/ht_startup_shutdown_db.html To startup Oracle database use Server Manager (SRVMGRL), STARTUP command: STARTUP NOMOUNT - starts instance: allocates memory for SGA, starts background processes. 43. You need to enforce these two business rules: 1. No two rows of a table can have duplicate values in the specified column. 2. A column cannot contain null values. Which type of constraint ensures that both of the above rules are true? A. check B. unique C. not null D. primary key E. foreign key Answer: D No comment 44. Your company hired Joe, a DBA who will be working from home. Joe needs to have the ability to start the database remotely. You created a password file for your database and set REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE in the parameter file. Which command adds Joe to the password file, allowing him remote DBA access? A. GRANT DBA TO JOE; B. GRANT SYSDBA TO JOE; C. GRANT RESOURCE TO JOE; D. orapwd file=orapwdPROD user=JOE password=DBA Answer: B Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 35, 36.: Finally, setting REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE menas that a password file exists and any user/password combination in the password file can log into Oracle remotely and administer that instance. If this setting is used, the DBA may use the CREATE USER command in Oracle to create the users who are added to the password file, grant SYSOPER and/or SYSDBA system privileges to those users. This rules out A and C. D is rules out because of a wrong syntax: Oracle9i Database Administrator’s Guide Release 2 (9.2) March 2002 Part No. A96521-01 (a96521.pdf) 1-20. Using ORAPWD When you invoke the password file creation utility without supplying any parameters, you receive a message indicating the proper use of the command as shown in the following sample output: orapwd Usage: orapwd file= password=<password> entries=<users> where file - name of password file (mand). password - password for SYS (mand).
20
entries - maximum number of distinct DBAs and OPERs (opt). There are no spaces around the equal-to (=) character. The following command creates a password file named acct.pwd that allows up to 30 privileged users with different passwords. In this example, the file is initially created with the password secret for users connecting as SYS. ORAPWD FILE=acct.pwd PASSWORD=secret ENTRIES=30 45. You need to drop two columns from a table. Which sequence of SQL statements should be used to drop the columns and limit the number of times the rows are updated? A. ALTER TABLE employees DROP COLUMN comments DROP COLUMN email; B. ALTER TABLE employees DROP COLUMN comments; ALTER TABLE employees DROP COLUMN email; C. ALTER TABLE employees SET UNUSED COLUMN comments; ALTER TABLE employees DROP UNUSED COLUMNS; ALTER TABLE employees SET UNUSED COLUMN email; ALTER TABLE employees DROP UNUSED COLUMNS; D. ALTER TABLE employees SET UNUSED COLUMN comments; ALTER TABLE employees SET UNUSED COLUMN email; ALTER TABLE employees DROP UNUSED COLUMNS; Answer: D Explanation: http://certcities.com/certs/oracle/columns/story.asp?EditorialsID=36: Reorganizing Columns While it has been possible to add new columns to an existing table in Oracle for quite a while now, until Oracle 8i it was not possible to drop or remove a column from a table without dropping the table first and then re-creating it without the column you wanted to drop. With this method, you needed to perform an EXPORT before dropping the table and then an IMPORT after creating it without the column, or issue a CREATE TABLE ... AS SELECT statement with all of its associated headaches (see above). In Oracle 8i, we now have a way of marking columns UNUSED and then dropping them at a later date. Oracle is a little behind the times here compared to SQL Server, which does not require a complete rebuild of the table after dropping the column, but I'm just happy that I have the feature and hope that they'll improve it in Oracle 9i. To get rid of columns with this new method, the first step is to issue the ALTER TABLE <tablename> SET UNUSED COLUMN , which sets the column to no longer be used within the table but does not change the physical structure of the table. All rows physically have the column's data stored, and a physical place is kept for the column on disk, but the column cannot be queried and, for all intents and purposes, does not exist. In essence, the column is flagged to be dropped, though you cannot reverse setting the column to UNUSED. It is possible to set a number of columns UNUSED in a table before actually dropping them. The overhead of setting columns UNUSED is fairly minimal and allows you to continue to operate normally, except that any actions on the UNUSED columns will result in an error. The next step, when you have configured all the columns you want to get rid of as UNUSED, is to actually physically reorganize the table so that the data for the UNUSED columns is no longer on disk and the columns are really gone. This is done by issuing the command ALTER TABLE … DROP COLUMN. Physically dropping a column in an Oracle table is a process that will prevent anyone from accessing the table while the removal of the column(s) is processed. The commands that will affect an actual removal of a column are: ALTER TABLE <tablename> DROP COLUMN <columnname> ALTER TABLE <tablename> DROP UNUSED COLUMNS The commands will always do the same thing. This means that if you mark two or three columns as UNUSED in a table, if you decide you want to drop one of them using the ALTER TABLE … DROP COLUMN command, you will drop ALL columns marked as UNUSED whether you want to or not. The ALTER TABLE … DROP COLUMN can also be used when a column has not previously been marked as UNUSED but you simply want to drop it right away, but you will also drop any UNUSED columns because that's the way it works. If constraints depend on the column being dropped, you can use the CASCADE CONSTRAINTS option to deal with them; if you also want to explicitly mark views, triggers, stored procedures or other stored program units referencing the parent table and force them to be recompiled the next time they are used, you can also specify the INVALIDATE option. A problem could arise if you issue the DROP COLUMN command and the instance crashes during the rebuild of the table. In this case, the table will be marked as INVALID and will not be available to anyone. Oracle forces you to complete the DROP COLUMN operation before the table can be used again. To get out of this situation, issue the command ALTER TABLE … DROP COLUMNS CONTINUE. This will complete the process and mark the table as VALID upon completion. http://whizlabs.com/ocp/ocp-1Z0-007-tips.html Tip 34: Oracle allows columns to be dropped with the ‘Alter Table Drop Columns’ command. Dropping of columns generally takes a lot of time, so an alternative (faster) option would be to mark the column as unused with the ‘Set Unused Column’ clause and later drop the unused column.
21
46. When an Oracle instance is started, background processes are started. Background processes perform which two functions? (choose two) A. perform I/O B. lock rows that are not data dictionary rows C. monitor other Oracle processes D. connect users to the Oracle instance E. execute SQL statements issued through an application Answer: A, C Explanation: Oracle9i Database Administrator’s Guide Release 2 (9.2) March 2002 Part No. A96521-01 (a96521.pdf) 5-11. To maximize performance and accommodate many users, a multiprocess Oracle system uses some additional processes called background processes. Background processes consolidate functions that would otherwise be handled by multiple Oracle programs running for each user process. Background processes asynchronously perform I/O and monitor other Oracle processes to provide increased parallelism for better performance and reliability. 47. You omit the UNDO tablespace clause in your CREATE DATABASE statement. The UNDO_MANAGEMENT parameter is set to AUTO. What is the result of your CREATE DATABASE statement? A. The Oracle server creates no undo tablespaces. B. The Oracle server creates an undo segment in the SYSTEM tablespace. C. The Oracle server creates one undo tablespace with the name SYS_UNDOTBS. D. Database creation fails because you did not specify an undo tablespace on the CREATE DATABASE statement. Answer: C Explanation: http://www.oracle-base.com/Articles/9i/AutomaticUndoManagement.asp#EnablingAutomaticUndoManagement Using Automatic Undo Management: Creating an Undo Tablespace Oracle recommends that instead of using rollback segments in your database, you use an undo tablespace. This requires the use of a different set of initialization parameters, and optionally, the inclusion of the UNDO TABLESPACE clause in your CREATE DATABASE statement. You must include the following initialization parameter if you want to operate your database in automatic undo management mode: UNDO_MANAGEMENT=AUTO In this mode, rollback information, referred to as undo, is stored in an undo tablespace rather than rollback segments and is managed by Oracle. If you want to create and name a specific tablespace for the undo tablespace, you can include the UNDO TABLESPACE clause at database creation time. If you omit this clause, and automatic undo management is specified, Oracle creates a default undo tablespace named SYS_UNDOTBS. 48. A table is stored in a data dictionary managed tablespace. Which two columns are required from DBA_TABLES to determine the size of the extent when it extends? (Choose two) A. B. C. D. E.
BLOCKS PCT_FREE NEXT_EXTENT PCT_INCREASE INITIAL_EXTENT
Answer: C, D Explanation: The SIZE parameter of the ALLOCATE EXTENT clause is the extent size in bytes, rounded up to a multiple of the block size. If you do not specify SIZE, then Oracle calculates the extent size according to the values of the NEXT and PCTINCREASE storage parameters. Oracle does not use the value of SIZE as a basis for calculating subsequent extent allocations, which are determined by the values set for the NEXT and PCTINCREASE parameters.
22
49. Bob is an administrator who has FULL DBA privileges. When he attempts to drop the DEFAULT profile as shown below, he receives the error message shown. Which option best explains this error? SQL> drop profile SYS.DEFAULT; drop profile SYS.DEFAULT * ERROR at line 1: ORA-00950: invalid DROP option A. The DEFAULT profile cannot be dropped. B. Bob requires the DROP PROFILE privilege. C. Profiles created by SYS cannot be dropped. D. The CASCADE option was not used in the DROP PROFILE command. Answer: A Explanation: SQL 16-94 Restriction on dropping profiles: You cannot drop the DEFAULT profile. According to error messages, drop profile is not a valid statement: error messages 3-10: ORA-00950 invalid DROP option Cause: A DROP command was not followed by a valid DROP option, such as CLUSTER, DATABASE LINK, INDEX, ROLLBACK SEGMENT, SEQUENCE, SYNONYM, TABLE, TABLESPACE, or VIEW. Action: Check the command syntax, specify a valid DROP option, then retry the statement. 50. You are in the process of dropping the BUILDING_LOCATION column from the HR.EMPLOYEES table. The table has been marked INVALID until the operation completes. Suddenly the instance fails. Upon startup, the table remains INVALID. Which step(s) should you follow to complete the operation? A. Continue with the drop column command: ALTER TABLE hr.employees DROP COLUMNS CONTINUE; B. Truncate the INVALID column to delete remaining rows in the column and release unused space immediately. C. Use the Export and Import utilities to remove the remainder of the column from the table and release unused space. D. Mark the column as UNUSED and drop the column: ALTER TABLE hr.employees SET UNUSED COLUMN building location; ALTER TABLE hr.employees DPOP UNUSED COLUMN building_location CASCADE CONSTRAINTS; Answer: A Testking said D. Explanation: DROP UNUSED COLUMNS Clause: Specify DROP UNUSED COLUMNS to remove from the table all columns currently marked as unused. Use this statement when you want to reclaim the extra disk space from unused columns in the table. If the table contains no unused columns, then the statement returns with no errors. column Specify one or more columns to be set as unused or dropped. Use the COLUMN keyword only if you are specifying only one column. If you specify a column list, then it cannot contain duplicates. CASCADE CONSTRAINTS: Specify CASCADE CONSTRAINTS if you want to drop all foreign key constraints that refer to the primary and unique keys defined on the dropped columns, and drop all multicolumn constraints defined on the dropped columns. If any constraint is referenced by columns from other tables or remaining columns in the target table, then you must specify CASCADE CONSTRAINTS. Otherwise, the statement aborts and an error is returned..ALTER TABLE INVALIDATE: The INVALIDATE keyword is optional. Oracle automatically invalidates all dependent objects, such as views, triggers, and stored program units. Object invalidation is a recursive process. Therefore, all directly dependent and indirectly dependent objects are invalidated. However, only local dependencies are invalidated, because Oracle manages remote dependencies differently from local dependencies. An object invalidated by this statement is automatically revalidated when next referenced. You must then correct any errors that exist in that object before referencing it.
23
CHECKPOINT: Specify CHECKPOINT if you want Oracle to apply a checkpoint for the DROP COLUMN operation after processing integer rows; integer is optional and must be greater than zero. If integeris greater than the number of rows in the table, then Oracle applies a checkpoint after all the rows have been processed. If you do not specify integer, then Oracle sets the default of 512. Checkpointing cuts down the amount of undo logs accumulated during the DROP COLUMN operation to avoid running out of rollback segment space. However, if this statement is interrupted after a checkpoint has been applied, then the table remains in an unusable state. While the table is unusable, the only operations allowed on it are DROP TABLE, TRUNCATE TABLE, and ALTER TABLE DROP COLUMNS CONTINUE (described in sections that follow). You cannot use this clause with SET UNUSED, because that clause does not remove column data. DROP COLUMNS CONTINUE Clause: Specify DROP COLUMNS CONTINUE to continue the drop column operation from the point at which it was interrupted. Submitting this statement while the table is in a valid state results in an error. See http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_32a.htm#2103766. If there is a trick in this question, I couldn’t find it. I would answer A. 51. As SYSDBA you created the PAYCLERK role and granted the role to Bob. Bob in turn attempts to modify the authentication method of the PAYCLERK role from SALARY to NOT IDENTIFIED, but when doing so he receives the insufficient privilege error shown below. SQL> connect bob/crusader Connected. SQL> alter role payclerk not identified; alter role payclerk not identified * ERROR at line 1: ORA-01031: insufficient privileges Which privilege does Bob require to modify the authentication method of the PAYCLERK role? A. ALTER ANY ROLE B. MANAGE ANY ROLE C. UPDATE ANY ROLE D. MODIFY ANY ROLE Answer: A ORA-01031 insufficient privileges Cause: An attempt was made to change the current username or password without the appropriate privilege. This error also occurs if attempting to install a database without the necessary operating system privileges. Action: Ask the database administrator to perform the operation or grant the required privileges. Oracle_9i_Mix/Administrators Guide a96521.pdf Page 25-6 - Managing User Roles: To alter the authorization method for a role, you must have the ALTER ANY ROLE system privilege or have been granted the role with the ADMIN OPTION. Wrong: B, C, D - MANAGE ANY ROLE, UPDATE ANY ROLE, MODIFY ANY ROLE don’t exist. 52. You are going to re-create your database and want to reuse all of your existing database files. You issue the following SQL statement: CREATE DATABASE sampledb DATAFILE '/u01/oradata/sampledb/system0l.dbf' SIZE 100M REUSE LOGFILE GROUP 1 ('/u01/oradata/sampledb/logla.rdo', '/u02/oradata/sampledb/loglb.rdo') SIZE 50K REUSE, GROUP 2 ('/u01/oradata/sampledb/log2a.rdo', '/u02/oradata/sampledb/log2b.rdo') SIZE 50K REUSE MAXLOGFILES 5 MAXLOGHISTORY 100 MAXDATAFILES 10;
24
Why does the CREATE DATABASE statement fail? A. You have set MAXLOGFILES too low. B. You omitted the CONTROLFILE REUSE clause. C. You cannot reuse the online redo log files. D. You cannot reuse the data file belonging to the SYSTEM tablespace. Answer: B Explanation: Ad B: The initial control files of an Oracle database are created when you issue the CREATE DATABASE statement. The names of the control files are specified by the CONTROL_FILES parameter in the initialization parameter file used during database creation. The filenames specified in CONTROL_FILES should be fully specified and are operating system specific. If control files with the specified names currently exist at the time of database creation, you must specify the CONTROLFILE REUSE clause in the CREATE DATABASE statement, or else an error occurs. Ad A: MAXLOGILE min and max value is operating system dependent. But I think the min value is 1. Ad C: You can reuse a online redo log file. Ad D: DATAFILE Clause specify one or more files to be used as datafiles. All these files become part of the SYSTEM tablespace. 53. Evaluate this SQL command: GRANT REFERENCES (employee_id), UPDATE (employee_id, salary, commission_pct) ON hr.employees TO oe; Which three statements correctly describe what user OE can or cannot do? (Choose three.) A. CANNOT create a table with a constraint B. can create a table with a constraint that references HR.EMPLOYEES C. can update values of the EMPLOYEE_ID, SALARY, and COMMISSION_PCT columns D. can insert values of the EMPLOYEE_ID, SALARY, and COMMISSION_PCT columns E. CANNOT insert values of the EMPLOYEE_ID, SALARY, and COMMISSION_PCT columns F. CANNOT update values of the EMPLOYEE_ID, SALARY, and COMMISSION_PCT columns Answer: B, C, E Explanation: Granting Multiple Object Privileges on Individual Columns: Example To grant to user oe the REFERENCES privilege on the employee_id column and the UPDATE privilege on the employee_id, salary, and commission_pct columns of the employees table in the schema hr, issue the following statement: GRANT REFERENCES (employee_id), UPDATE (employee_id, salary, commission_pct) ON hr.employees TO oe; oe can subsequently update values of the employee_id, salary, and commission_pct columns. oe can also define referential integrity constraints that refer to the employee_id column. However, because the GRANT statement lists only these columns, oe cannot perform operations on any of the other columns of the employees table. For example, oe can create a table with a constraint: CREATE TABLE dependent (dependno NUMBER, dependname VARCHAR2(10), employee NUMBER CONSTRAINT in_emp REFERENCES hr.employees(employee_id) ); The constraint in_emp ensures that all dependents in the dependent table correspond to an employee in the employees table in the schema hr. 54. A network error unexpectedly terminated a user's database session. Which two events occur in this scenario? (Choose two.) A. Checkpoint occurs. B. A fast commit occurs.
25
C. RECO performs the session recovery. D. PMON rolls back the user's current transaction. E. SMON rolls back the user's current transaction. F. SMON frees the system resources reserved for the user session. G. PMON releases the table and row locks held by the user session. Answer: D, G Explanation: SMON: The system monitor performs crash recovery when a failed instance starts up again. In a cluster database (Oracle9i Real Application Clusters), the SMON process of one instance can perform instance recovery for other instances that have failed. SMON also cleans up temporary segments that are no longer in use and recovers dead transactions skipped during crash and instance recovery because of file-read or offline errors. These transactions are eventually recovered by SMON when the tablespace or file is brought back online. PMON: The process monitor performs process recovery when a user process fails. PMON is responsible for cleaning up the cache and freeing resources that the process was using. PMON also checks on the dispatcher processes (see below) and server processes and restarts them if they have failed. The process monitor process (PMON) cleans up failed user processes and frees up all the resources used by the failed process. It resets the status of the active transaction table and removes the process ID from the list of active processes. It reclaims all resources held by the user and releases all locks on tables and rows held by the user. PMON wakes up periodically to check whether it is needed. RECO: The recoverer process is used to resolve distributed transactions that are pending due to a network or system failure in a distributed database. At timed intervals, the local RECO attempts to connect to remote databases and automatically complete the commit or rollback of the local portion of any pending distributed transactions. Checkpoint (CKPT): At specific times, all modified database buffers in the SGA are written to the datafiles by DBWn. This event is called a checkpoint. The checkpoint process is responsible for signaling DBWn at checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint. 55. Evaluate the SQL statement: CREATE TABLESPACE hr_tbs DATAFILE '/usr/oracle9i/OraHomel/hr_data.dbf' SIZE 2M AUTOEXTEND ON MINIMUM EXTENT 4K NOLOGGING DEFAULT STORAGE (INITIAL 5K NEXT 5K PCTINCREASE 50) EXTENT MANAGEMENT DICTIONARY SEGMENT SPACE MANAGEMENT AUTO; Why does the statement return an error? A. The value of PCTINCREASE is too high. B. The size of the data file is too small. C. You cannot specify default storage for dictionary managed tablespaces. D. Segment storage management cannot be set to auto for a dictionary managed tablespace. E. You cannot specify default storage for a tablespace that consists of an autoextensible data file. F. The value specified for INITIAL and NEXT storage parameters should be a multiple of the value specified for MINIMUM EXTENT. Answer: D Explanation: PCTINCREASE Specify the percent by which the third and subsequent extents grow over the preceding extent. The default value is 50, meaning that each subsequent extent is 50% larger than the preceding extent. The minimum value is 0, meaning all extents after the first are the same size. The maximum value depends on your operating system. Specify the size of the file in bytes. Use K or M to specify the size in kilobytes or megabytes. No minimum size for DATAFILE. No Max size either. It can be unlimited. Operating system dependent. If you omit this clause when creating an Oracle-managed file, then Oracle creates a 100M file. DEFAULT storage_clause
26
Specify the default storage parameters for all objects created in the tablespace. For a dictionary-managed temporary tablespace, Oracle considers only the NEXT parameter of the storage_clause. Restriction on default storage: You cannot specify this clause for a locally managed tablespace. segment_management_clause The segment_management_clause is relevant only for permanent, locally managed tablespaces. It lets you specify whether Oracle should track the used and free space in the segments in the tablespace using free lists or bitmaps. INITIAL Specify in bytes the size of the object’s first extent. Oracle allocates space for this extent when you create the schema object. Use K or M to specify this size in kilobytes or megabytes. The default value is the size of 5 data blocks. In tablespaces with manual segmentspace management, the minimum value is the size of 2 data blocks plus one data block for each free list group you specify. In tablespaces with automatic segmentspace management, the minimum value is 5 data blocks. The maximum value depends on your operating system. In dictionary-managed tablespaces, if MINIMUM EXTENT was specified for the tablespace when it was created, then Oracle rounds the value of INITIAL up to the specified MINIMUM EXTENT size if necessary. If MINIMUM EXTENT was not specified, then Oracle rounds the INITIAL extent size for segments created in that tablespace up to the minimum value (see preceding paragraph), or to multiples of 5 blocks if the requested size is greater than 5 blocks. In locally managed tablespaces, Oracle uses the value of INITIAL in conjunction with the size of extents specified for the tablespace to determine the object’s first extent. For example, in a uniform locally managed tablespace with 5M extents, if you specify an INITIAL value of 1M, then Oracle creates five 1M extents. Restriction on INITIAL: You cannot specify INITIAL in an ALTER statement. NEXT Specify in bytes the size of the next extent to be allocated to the object. Use K or M to specify the size in kilobytes or megabytes. The default value is the size of 5 data blocks. The minimum value is the size of 1 data block. The maximum value depends on your operating system. Oracle rounds values up to the next multiple of the data block size for values less than 5 data blocks. For values greater than 5 data blocks, Oracle rounds up to a value that minimizes fragmentation, as described in Oracle9i Database Administrator’s Guide. If you change the value of the NEXT parameter (that is, if you specify it in an ALTER statement), then the next allocated extent will have the specified size, regardless of the size of the most recently allocated extent and the value of the PCTINCREASE parameter. TEMPORARY Specify TEMPORARY if the tablespace will be used only to hold temporary objects, for example, segments used by implicit sorts to handle ORDER BY clauses. Temporary tablespaces created with this clause are always dictionary managed, so you cannot specify the EXTENT MANAGEMENT LOCAL clause. To create a locally managed temporary tablespace, use the CREATE TEMPORARY TABLESPACE statement. 56. SALES_DATA is a nontemporary tablespace. You have set the SALES_DATA tablespace OFFLINE by issuing this command: ALTER TABLESPACE sales_data OFFLINE NORMAL; Which three statements are true? (Choose three.) A. You cannot drop the SALES_DATA tablespace. B. The SALES_DATA tablespace does not require recovery to come back online. C. You can read the data from the SALES_DATA tablespace, but you cannot perform any write operation on the data. D. When the tablespace SALES_DATA goes offline and comes back online, the event will be recorded in the data dictionary. E. When the tablespace SALES_DATA goes offline and comes back online, the event will be recorded in the control file. F. When you shut down the database the SALES_DATA tablespace remains offline, and is checked when the database is subsequently mounted and reopened. Answer: B, D, E Explanation: Ad D, E, F: See http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm#10136 When a Tablespace Goes Offline When a tablespace goes offline or comes back online, this is recorded in the data dictionary in the SYSTEM tablespace. If a tablespace is offline when you shut down a database, the tablespace remains offline when the database is subsequently mounted and reopened.
27
You can drop a tablespace regardless of whether it is online or offline (-> This makes A wrong). Oracle recommends that you take the tablespace offline before dropping it to ensure that no SQL statements in currently running transactions access any of the objects in the tablespace. Restriction on the OFFLINE clause: You cannot take a temporary tablespace offline. The FOR RECOVER setting for ALTER TABLESPACE ... OFFLINE has been deprecated. The syntax is supported for backward compatibility. However, users are encouraged to use the transportable tablespaces feature for tablespace recovery. NORMAL Specify NORMAL to flush all blocks in all datafiles in the tablespace out of the SGA. You need not perform media recovery on this tablespace before bringing it back online. This is the default. -> B is true. TEMPORARY If you specify TEMPORARY, then Oracle performs a checkpoint for all online datafiles in the tablespace but does not ensure that all files can be written. Any offline files may require media recovery before you bring the tablespace back online. Specify OFFLINE to take the tablespace offline and prevent further access to its segments. When you take a tablespace offline, all of its datafiles are also offline. 57. A table can be dropped if it is no longer needed, or if it will be reorganized. Which three statements are true about dropping a table? (Choose three.) A. All synonyms for a dropped table are deleted. B. When a table is dropped, the extents used by the table are released. C. Dropping a table removes the table definition from the data dictionary. D. Indexes and triggers associated with the table are not dropped but marked INVALID. E. The CASCADE CONSTRAINTS option is necessary if the table being dropped is the parent table in a foreign key relationship. Answer: B, C, E Explanation: Ad A: In general, the extents of a segment do not return to the tablespace until you drop the schema object whose data is stored in the segment (using a DROP TABLE or DROP CLUSTER statement). Ad B: Dropping a table removes the table definition from the data dictionary. All rows of the table are no longer accessible. Ad C: All indexes and triggers associated with a table are dropped. Ad D: False. All synonyms for a dropped table remain, but return an error when used. Ad E: If the table to be dropped contains any primary or unique keys referenced by foreign keys of other tables and you intend to drop the FOREIGN KEY constraints of the child tables, include the CASCADE clause in the DROP TABLE statement 58. Examine this TRUNCATE TABLE command: TRUNCATE TABLE departments;
Which four are true about the command? (Choose four.)
A. All extents are released. B. All rows of the table are deleted. C. Any associated indexes are truncated. D. No undo data is generated for the table's rows. E. It reduces the number of extents allocated to the DEPARTMENTS table to the original setting for MINEXTENTS. Answer: B, C, D, E Explanation: To remove all rows from a table or cluster and reset the STORAGE parameters to the values when the table or cluster was created. You can use the TRUNCATE command to quickly remove all rows from a table or cluster. Removing rows with the TRUNCATE command is faster than removing them with the DELETE command for the following reasons: The TRUNCATE command is a data definition language (DDL) command and generates no rollback information.
28
Truncating a table does not fire the table’s DELETE triggers. The TRUNCATE command allows you to optionally deallocate the space freed by the deleted rows. The DROP STORAGE option deallocates all but the space specified by the table’s MINEXTENTS parameter. Deleting rows with the TRUNCATE command is also more convenient than dropping and re-creating a table because dropping and re-creating: invalidates the table’s dependent objects, while truncating does not requires you to regrant object privileges on the table, while truncating does not requires you to re-create the table’s indexes, integrity constraints, and triggers and respecify its STORAGE parameters. See: Oracle8 SQL Reference Release 8.0 December 1997 Part No. A58225-01 (a58225.pdf) pg.722. (4-538) 59. Tom was allocated 10 MB of quota in the USERS tablespace. He created database objects in the USERS tablespace. The total space allocated for the objects owned by Tom is 5 MB. You need to revoke Tom's quota from the USERS tablespace. You issue this command: ALTER USER Tom QUOTA 0 ON users; What is the result? A. The statement raises the error: ORA-00940: invalid ALTER command. B. The statement raises the error: ORA-00922: missing or invalid option. C. The objects owned by Tom are automatically deleted from the revoked USERS tablespace. D. The objects owned by Tom remain in the revoked tablespace, but these objects cannot be allocated any new space from the USERS tablespace. Answer: D Explanation: Use the ALTER USER statement to change the authentication or database resource characteristics of a database user. Tom quota on the USERS tablespace is revoked with this statement. The objects are not deleted from the tablespace. After you have set the quota to zero, you still can insert and delete records from the table which was created in the users tablespace. So I guess, it will use the SYSTEM tablespace for the new results. 60. Which background process performs a checkpoint in the database by writing modified blocks from the database buffer cache in the SGA to the data files? A. LGWR B. SMON C. DBWn D. CKPT E. PMON Answer: C Explanation: Refer to question 54 for the explanation of some of the words used in the answer. Database Writer (DBW n) The database writer writes modified blocks from the database buffer cache to the datafiles. Although one database writer process (DBW0) is sufficient for most systems, you can configure additional processes (DBW1 through DBW9 and DBWa through DBWj) to improve write performance for a system that modifies data heavily. The initialization parameter DB_WRITER_PROCESSES specifies the number of DBWn processes. Checkpoint (CKPT) At specific times, all modified database buffers in the SGA are written to the datafiles by DBWn. This event is called a checkpoint. The checkpoint process is responsible for signaling DBWn at checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint. 61. Which command would revoke the ROLE_EMP role from all users? A. REVOKE role_emp FROM ALL; B. REVOKE role_emp FROM PUBLIC; C. REVOKE role_emp FROM default; D. REVOKE role_emp FROM ALL_USERS; Answer: B Explanation: Privileges and roles can also be granted to and revoked from the user group PUBLIC. Because PUBLIC is accessible to every database user, all privileges and roles granted to PUBLIC are accessible to every database user.
29
Errors given by the answers: Answer A: ORA-00987: missing or invalid username(s). Answer B: (It’s ok as long as the role was granted to PUBLIC). Answer C: ORA-00987: missing or invalid username(s). Answer D: ORA-01917: user or role 'ALL_USERS' does not exist. 62. You are experiencing intermittent hardware problems with the disk drive on which your control file is located. You decide to multiplex your control file. While your database is open, you perform these steps: 1. Make a copy of your control file using an operating system command. 2. Add the new file name to the list of files for the CONTROL FILES parameter in your text intialization parameter file using an editor. 3. Shut down the instance. 4. Issue the STARTUP command to restart the instance, mount, and open the database. The instance starts, but the database mount fails. Why? A. You copied the control file before shutting down the instance. B. You used an operating system command to copy the control file. C. The Oracle server does not know the name of the new control file. D. You added the new control file name to the CONTROL_FILES parameter before shutting down the instance. Answer: A Explanation: To Multiplex or Move Additional Copies of the Current Control File: 1. Shutdown the database. 2. Exit Server Manager. 3. Copy an existing control file to a different location, using operating system commands. 4. Edit the CONTROL_FILES parameter in the database's parameter file to add the new control file's name, or to change the existing control filename. 5. Restart Server Manager. 6. Restart the database. For more information refer to Steps for Creating New Control Files in Administrator’s guide on page 6-7 63. What determines the initial size of a tablespace? A. the INITIAL clause of the CREATE TABLESPACE statement B. the MINEXTENTS clause of the CREATE TABLESPACE statement C. the MINIMUM EXTENT clause of the CREATE TABLESPACE statement D. the sum of the INITIAL and NEXT clauses of the CREATE TABLESPACE statement E. the sum of the sizes of all data files specified in the CREATE TABLESPACE statement Answer: E Explanation: MINIMUM EXTENT Clause Specify the minimum size of an extent in the tablespace. This clause lets you control free space fragmentation in the tablespace by ensuring that every used or free extent size in a tablespace is at least as large as, and is a multiple of, integer. The storage_clause is interpreted differently for locally managed tablespaces. At creation, Oracle ignores MAXEXTENTS and uses the remaining parameter values to calculate the initial size of the segment. 64. You are going to create a new database. You will NOT use operating system authentication. Which two files do you need to create before creating the database? (Choose two.) A. control file B. password file C. redo log file D. alert log file E. initialization parameter file Answer: B, E
30
Explanation: I guess answer A is stupid. First of all, creating control files is the purpose of the whole create database procedure. Other proof: Oracle9i SQL Reference Release 2 (9.2) March 2002 Part No. A96540-01 (a96540.pdf) 13-26 CONTROLFILE REUSE Clause Specify CONTROLFILE REUSE to reuse existing control files identified by the initialization parameter CONTROL_FILES, thus ignoring and overwriting any information they currently contain. Normally you use this clause only when you are re-creating a database, rather than creating one for the first time. You cannot use this clause if you also specify a parameter value that requires that the control file be larger than the existing files. These parameters are MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, and MAXINSTANCES. If you omit this clause and any of the files specified by CONTROL_FILES already exist, Oracle returns an error. Password file But since no OS authentication is used, the other choice can only be password-file authentication. For this purpose a password file is needed. Redo log file Redo log file is used for the transactions within a database, not for database creation. Alert log file See question 11 (“Trace files, on the other hand, are generated by the oracle background processes or other connected net8 processes when oracle internal errors occur and they dump all information about the error into the trace files.”). Initialization parameter file We need one, this file contains the description of the created database. So the answer is B, E. Remark: It would be logical, that if Oracle wants to read from a file, the file needs to be there. If Oracle wants to write to a file, it will create one. 65. Based on the following profile limits, if a user attempts to log in and fails after five tries, how long must the user wait before attempting to log in again? ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME 60 PASSWORD_GRACE_TIME 10 PASSWORD_REUSE_TIME 1800 PASSWORD_REUSE_MAX UNLIMITED FAILED_LOGIN_ATTEMPTS 5 PASSWORD_LOCK_TIME 1/1440 PASSWORD_VERIFY_FUNCTION verify_function; A. 1 minute B. 5 minutes C. 10 minutes D. 14 minutes E. 18 minutes F. 60 minutes Answer: A Explanation: PASSWORD_LOCK_TIME is the interesting parameter: PASSWORD_LOCK_TIME specifies the number of days an account will be locked after the specified number of consecutive failed login attempts. Now we have 1/1440 days = 24/1440 hours = 24*60/1440 minutes = 1 minute. password_parameters FAILED_LOGIN_ATTEMPTS: Specify the number of failed attempts to log in to the user account before the account is locked. PASSWORD_LIFE_TIME: Specify the number of days the same password can be used for authentication. The password expires if it is not changed within this period, and further connections are rejected. PASSWORD_REUSE_TIME: Specify the number of days before which a password cannot be reused. If you set PASSWORD_REUSE_TIME to an integer value, then you must set PASSWORD_REUSE_MAX to UNLIMITED.
31
PASSWORD_REUSE_MAX: Specify the number of password changes required before the current password can be reused. If you set PASSWORD_REUSE_MAX to an integer value, then you must set PASSWORD_REUSE_TIME to UNLIMITED. PASSWORD_LOCK_TIME: Specify the number of days an account will be locked after the specified number of consecutive failed login attempts. PASSWORD_GRACE_TIME: Specify the number of days after the grace period begins during which a warning is issued and login is allowed. If the password is not changed during the grace period, the password expires. PASSWORD_VERIFY_FUNCTION: The PASSWORD_VERIFY_FUNCTION clause lets a PL/SQL password complexity verification script be passed as an argument to the CREATE PROFILE statement. Oracle provides a default script, but you can create your own routine or use third-party software instead. For function, specify the name of the password complexity verification routine, specify NULL to indicate that no password verification is performed. 66. Evaluate the following SQL: CREATE USER sh IDENTIFIED BY sh; GRANT CREATE ANY MATERIALIZED VIEW CREATE ANY DIMENSION , DROP ANY DIMENSION , QUERY REWRITE , GLOBAL QUERY REWRITE TO dw_manager WITH ADMIN OPTION; GRANT dw_manager TO sh WITH ADMIN OPTION; Which three actions is the user SH able to perform? (Choose three.) A. Select from a table B. Create and drop a materialized view C. Alter a materialized view that you created D. Grant and revoke the role to and from other users E. Enable the role and exercise any privileges in the role's privilege domain Answer: B, D, E Explanation: CREATE ANY MATERIALIZED VIEW: Create materialized views in any schema. CREATE ANY DIMENSION: Create dimensions in any schema. DROP ANY DIMENSION: Drop dimensions in any schema. QUERY REWRITE: Enable rewrite using a materialized view, or create a functionbased index, when that materialized view or index references tables and views that are in the grantee’s own schema. GLOBAL QUERY REWRITE: Enable rewrite using a materialized view, or create a functionbased index, when that materialized view or index references tables or views in any schema. WITH ADMIN OPTION: Specify WITH ADMIN OPTION to enable the grantee to: (a) Grant the role to another user or role, unless the role is a GLOBAL role. (b) Revoke the role from another user or role. (c) Alter the role to change the authorization needed to access it. (d) Drop the role. 67. Which constraint state prevents new data that violates the constraint from being entered, but allows invalid data to exist in the table? A. ENABLE VALIDATE B. DISABLE VALIDATE C. ENABLE NOVALIDATE D. DISABLE NOVALIDATE Answer: C Explanation: ENABLE VALIDATE specifies that all old and new data also complies with the constraint. An enabled validated constraint guarantees that all data is and will continue to be valid.
32
ENABLE NOVALIDATE ensures that all new DML operations on the constrained data comply with the constraint. This clause does not ensure that existing data in the table complies with the constraint and therefore does not require a table lock. DISABLE VALIDATE disables the constraint and drops the index on the constraint, but keeps the constraint valid. This feature is most useful in data warehousing situations, because it lets you load large amounts of data while also saving space by not having an index. This setting lets you load data from a nonpartitioned table into a partitioned table using the exchange_partition_clause of the ALTER TABLE statement or using SQL*Loader. All other modifications to the table (inserts, updates, and deletes) by other SQL statements are disallowed. DISABLE NOVALIDATE signifies that Oracle makes no effort to maintain the constraint (because it is disabled) and cannot guarantee that the constraint is true (because it is not being validated). For more info look at page 7-20 of Oracle9 i SQL Reference document. 68. Which storage structure provides a way to physically store rows from more than one table in the same data block? A. cluster table B. partitioned table C. unclustered table D. index-organized table Answer: A Explanation: Clusters: (a) Group of one or more tables physically stored together because they share common columns and are often used together. (b) Since related rows are stored together, disk access time improves. (c) Clusters do not affect application design. (d) Data stored in a clustered table is accessed by SQL in the same way as data stored in a non-clustered table. Partitioning addresses key issues in supporting very large tables and indexes by letting you decompose them into smaller and more manageable pieces called partitions. SQL queries and DML statements do not need to be modified in order to access partitioned tables. However, after partitions are defined, DDL statements can access and manipulate individuals partitions rather than entire tables or indexes. This is how partitioning can simplify the manageability of large database objects. Also, partitioning is entirely transparent to applications. More info look at page 10-64 Oracle9 iDatabase Concepts (nice diagram of Cluster and Non-cluster) 69. Which are considered types of segments? A. only LOBS B. only nested tables C. only index-organized tables D. only LOBS and index-organized tables E. only nested tables and index-organized tables F. only LOBS, nested tables, and index-organized tables G. nested tables, LOBS, index-organized tables, and boot straps Answer: G Explanation: 2-12 Oracle9i Database Concepts: A single data segment in an Oracle database holds all of the data for one of the following: (a) A table that is not partitioned or clustered. (b) A partition of a partitioned table Segments Overview. (c) A cluster of tables. Oracle databases use four types of segments: (1) Data Segments 1: A table that is not partitioned or clustered. (2) Data Segments 2: A partition of a partitioned table. (3) Index Segments: Every nonpartitioned index in an Oracle database has a single index segment to hold all of its data. For a partitioned index, every partition has a single index segment to hold its data.
33
(4) Temporary Segments: When processing queries, Oracle often requires temporary workspace for intermediate stages of SQL statement parsing and execution. Oracle automatically allocates this disk space called a temporary segment. Typically, Oracle requires a temporary segment as a work area for sorting. Oracle does not create a segment if the sorting operation can be done in memory or if Oracle finds some other way to perform the operation using indexes. Operations that Require Temporary Segments: (a) CREATE INDEX (b) SELECT ... ORDER BY (c) SELECT DISTINCT ... (d) SELECT ... GROUP BY (e) SELECT ... UNION (f) SELECT ... INTERSECT (g) SELECT ... MINUS Look at Segment Overview on Page 2-12 in the Oracle 9i Concepts pdf file. By the way, we use segments to store data, so everything is stored in segments. 70. Select the memory structure(s) that would be used to store the parse information and actual value of the bind variable id for the following set of commands: VARIABLE id NUMBER; BEGIN :id:=1; END; / A. PGA only B. Row cache and PGA C. PGA and library cache D. Shared pool only E. Library cache and buffer cache Answer: C Explanation: Reason for C instead of B: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c16sqlpl.htm#CNCPT416: Parsing is one stage in the processing of a SQL statement. When an application issues a SQL statement, the application makes a parse call to Oracle. During the parse call, Oracle: (a) Checks the statement for syntactic and semantic validity. (b) Determines whether the process issuing the statement has privileges to run it. (c) Allocates a private SQL area for the statement. Oracle also determines whether there is an existing shared SQL area containing the parsed representation of the statement in the library cache. If so, the user process uses this parsed representation and runs the statement immediately. If not, Oracle generates the parsed representation of the statement, and the user process allocates a shared SQL area for the statement in the library cache and stores its parsed representation there. The basic memory structures associated with Oracle include: (1) System Global Area (SGA), which is shared by all server and background processes and holds the following: (a) Database buffer cache. (b) Redo log buffer. (c) Shared pool. (d) Large pool (if configured). (2) Program Global Areas (PGA), which is private to each server and background process; there is one PGA for each process. The PGA holds the following: (a) Stack areas. (b) Data areas. As I understood, SGA is used to store the PL/SQL code only.
34
71. The new Human Resources Application will be used to manage employee data in the EMPLOYEES table. You are developing a strategy to manage user privileges. Your strategy should allow for privileges to be granted or revoked from individual users or groups of users with minimal administrative effort. The users of the Human Resources application have these requirements: A Manager should be able to view the personal information of the employees in his/her group and make changes to their Title and Salary. What should you grant to the manager user? A. grant SELECT on the EMPLOYEES table B. grant INSERT on the EMPLOYEES table C. grant UPDATE on the EMPLOYEES table D. grant SELECT on the EMPLOYEES table and then grant UPDATE on the TITLE and SALARY columns E. grant SELECT on the EMPLOYEES table and then grant INSERT on the TITLE and SALARY columns F. grant UPDATE on the EMPLOYEES table and then grant SELECT on the TITLE and SALARY columns G. grant INSERT on the EMPLOYEES table and then grant SELECT on the TITLE, MANAGER, and SALARY columns Answer: D I suppose this question is logical! 72. An INSERT statement failed and is rolled back. What does this demonstrate? A. insert recovery B. read consistency C. transaction recovery D. transaction rollback Answer: D Explanation: If at any time during execution a SQL statement causes an error, all effects of the statement are rolled back. The effect of the rollback is as if that statement had never been run. This operation is a statement-level rollback. Errors discovered during SQL statement execution cause statement-level rollbacks. An example of such an error is attempting to insert a duplicate value in a primary key. 73. The database currently has one control file. You decide that three control files will provide better protection against a single point of failure. To accomplish this, you modify the SPFILE to point to the locations of the three control files. The message "system altered" was received after execution of the statement. You shut down the database and copy the control file to the new names and locations. On startup you receive the error ORA-00205: error in identifying control file. You look in the alert log and determine that you specified the incorrect path for the for control file. Which steps are required to resolve the problem and start the database? A. 1. 2. 3. 4. 5. 6.
Connect as SYSDBA. Shut down the database. Start the database in NOMOUNT mode. Use the ALTER SYSTEM SET CONTROL_FILES command to correct the error. Shut down the database. Start the database.
B. 1. 2. 3. 4. 5. 6. 7.
Connect as SYSDBA. Shut down the database. Start the database in MOUNT mode. Remove the SPFILE by using a UNIX command. Recreate the SPFILE from the PFILE. Use the ALTER SYSTEM SET CONTROL_FILES command to correct the error. Start the database.
C. 1. Connect as SYSDBA. 2. Shut down the database. 3. Remove the control files using the OS command.
35
4. 5. 6. 7. 8. 9.
Start the database in NOMOUNT mode. Remove the SPFILE by using an OS command. Re-create the SPFILE from the PFILE. Use the ALTER SYSTEM SET CONTROL_FILES command to define the control files. Shut down the database. Start the database.
Answer: A Explanation: Some parameters can be changed dynamically by using the ALTER SESSION or ALTER SYSTEM statement while the instance is running. Unless you are using a Instance and Database Startup server parameter file, changes made using the ALTER SYSTEM statement are only in effect for the current instance. You must manually update the text initialization parameter file for the changes to be known the next time you start up an instance. When you use a server parameter file, you can update the parameters on disk, so that changes persist across database shutdown and startup. See question number 62: You do not need to create the SPFILE again. Use ALTER SYSTEM to update the CONTROL_FILES parameter value. 74. Which process is started when a user connects to the Oracle server in a dedicated server mode? A. DBWn B. PMON C. SMON D. Server Answer: D Explanation: SMON: The system monitor performs crash recovery when a failed instance starts up again. In a cluster database (Oracle9i Real Application Clusters), the SMON process of one instance can perform instance recovery for other instances that have failed. SMON also cleans up temporary segments that are no longer in use and recovers dead transactions skipped during crash and instance recovery because of file-read or offline errors. These transactions are eventually recovered by SMON when the tablespace or file is brought back online. PMON: The process monitor performs process recovery when a user process fails. PMON is responsible for cleaning up the cache and freeing resources that the process was using. PMON also checks on the dispatcher processes (see below) and server processes and restarts them if they have failed. Checkpoint (CKPT): At specific times, all modified database buffers in the SGA are written to the datafiles by DBWn. This event is called a checkpoint. The checkpoint process is responsible for signaling DBWn at checkpoints and updating all the datafiles and control files of the database to indicate the most recent checkpoint. Therefore, this leaves us with only one answer. 75. You are creating a new database. You do NOT want users to use the SYSTEM tablespace for sorting operations. What should you do when you issue the CREATE DATABASE statement to prevent this? A. Create an undo tablespace. B. Create a default temporary tablespace. C. Create a tablespace with the UNDO keyword. D. Create a tablespace with the TEMPORARY keyword. Answer: B Explanation: You can manage space for sort operations more efficiently by designating temporary tablespaces exclusively for sorts. Doing so effectively eliminates serialization of space management operations involved in the allocation and deallocation of sort space. All operations that use sorts, including joins, index builds, ordering, computing aggregates (GROUP BY), and collecting optimizer statistics, benefit from temporary tablespaces. The performance gains are significant with Real Application Clusters.
36
Specify a default temporary tablespace when you create a database, using the DEFAULT TEMPORARY TABLESPACE extension to the CREATE DATABASE statement. When a transaction begins, Oracle assigns the transaction to an available undo tablespace or rollback segment to record the rollback entries for the new transaction. A database administrator creates undo tablespaces individually, using the CREATE UNDO TABLESPACE statement. It can also be created when the database is created, using the CREATE DATABASE statement. To improve the concurrence of multiple sort operations, reduce their overhead, or avoid Oracle space management operations altogether, create temporary tablespaces. A temporary tablespace can be shared by multiple users and can be assigned to users with the CREATE USER statement when you create users in the database. Within a temporary tablespace, all sort operations for a given instance and tablespace share a single sort segment. Sort segments exist for every instance that performs sort operations within a given tablespace. The sort segment is created by the first statement that uses a temporary tablespace for sorting, after startup, and is released only at shutdown. An extent cannot be shared by multiple transactions. 76. Which four statements are true about profiles? (Choose four.) A. Profiles can control the use of passwords. B. Profile assignments do not affect current sessions. C. All limits of the DEFAULT profile are initially unlimited. D. Profiles can be assigned to users and roles, but not other profiles. E. Profiles can ensure that users log off the database when they have left their session idle for a period of time. Answer: A, B, C, E Explanation: It’s true that profiles can control the use of passwords. This feature protects the integrity of assigned usernames as well as the overall data integrity of the Oracle database. All limits of the DEFAULT profile are initially unlimited. The DEFAULT profile isn’t very restrictive of host system resources; in fact, DEFAULT profile gives users unlimited use of all resources definable in the database. Any option in any profile can be changed at any time; however, the change will not take effect for users assigned to that profile until the user logs out and logs back in. Also profiles can ensure that users log off the database when they have left their session idle for a period of time. Introduction to the Oracle Server 1-47: Each user is assigned a profile that specifies limitations on several system resources available to the user, including the following: (1) Number of concurrent sessions the user can establish. (2) CPU processing time available for: (a) The user’s session. (b) Asingle call to Oracle made by a SQL statement. (3) Amount of logical I/O available for: (a) The user’s session. (b) A single call toOracle made by a SQL statement. (4) Amount of idle time available for the user’s session. (5) Amount of connect time available for the user’s session Database Security Overview. (6) Password restrictions: (a)Account locking after multiple unsuccessful login attempts. (b)Password expiration and grace period. (c)Password reuse and complexity restrictions. Different profiles can be created and assigned individually to each user of the database. A default profile is present for all users not explicitly assigned a profile. The resource limit feature prevents excessive consumption of global database system resources. To allow for greater control over database security, Oracle’s password management policy is controlled by DBAs and security officers through user profiles. To alter the enforcement of resource limitation while the database remains open, you must have the ALTER SYSTEM system privilege. All unspecified resource limits for a new profile take the limit set by a DEFAULT profile. Initially, all limits of the DEFAULT profile are set to UNLIMITED. 77. The Database Writer (DBWn) background process writes the dirty buffers from the database buffer cache into the _______.
37
A. data files only B. data files and control files only C. data files and redo log files only D. data files, redo log files, and control files Answer: A Explanation: Database writer (DBWn) The database writer writes modified blocks from the database buffer cache to the datafiles. Oracle allows a maximum of 20 database writer processes (DBW0-DBW9 and DBWa-DBWj). The initialization parameter DB_WRITER_PROCESSES specifies the number of DBWn processes. Oracle selects an appropriate default setting for this initialization parameter (or might adjust a user specified setting) based upon the number of CPUs and the number of processor groups. 78. You used the password file utility to create a password file as follows: $orapwd file=$ORACLE_HOME/dbs/orapwDB01 password=orapass entries=5 You created a user and granted only the SYSDBA privilege to that user as follows: CREATE USER dba_user IDENTIFIED BY dba_pass; GRANT sysdba TO dba_user; The user attempts to connect to the database as follows: connect dba_user/orapass as sysdba; Why does the connection fail? A. The DBA privilege had not been granted to dba_user. B. The SYSOPER privilege had not been granted to dba_user. C. The user did not provide the password dba_pass to connect as SYSDBA. D. The information about dba_user has not been stored in the password file. Answer: C Explanation: When prompted, connect as SYS (or other administrative user) with the SYSDBA system privilege: CONNECT SYS/password AS SYSDBA Where password is the password of the user created. In this example, it is dba_user. 79. You intend to use only password authentication and have used the password file utility to create a password file as follows: $orapwd file=$ORACLE_HOME/dbs/orapwDB01 password=orapass entries=5 The REMOTE_LOGIN_PASSWORDFILE initialization parameter is set to NONE. You created a user and granted only the SYSDBA privilege to that user as follows: CREATE USER dba_user IDENTIFIED BY dba_pass GRANT sysdba TO dba_user The user attempts to connect to the database as follows: connect dba_user/dba_pass as sysdba; Why does the connection fail? A. The DBA privilege was not granted to dba_user. B. REMOTE_LOGIN_PASSWORDFILE is not set to EXCLUSIVE. C. The password file has been created in the wrong directory. D. The user did not specify the password orapass to connect as SYSDBA.
38
Answer: B Oracle 7 documentation, The Oracle7 Database Administrator, 1 - 11 REMOTE_LOGIN_PASSWORDFILE In addition to creating the password file, you must also set the initialization parameter REMOTE_LOGIN_PASSWORDFILE to the appropriate value. The values recognized are described below. Note: To STARTUP an instance or database, you must use Server Manager. You must specify a database name and a parameter file to initialize the instance settings. You may specify a fully-qualified remote database name using SQL*Net. However, the initialization parameter file and any associated files, such as a configuration file, must exist on the client machine. That is, the parameter file must be on the machine where you are running Server Manager. NONE Setting this parameter to NONE causes Oracle7 to behave as if the password file does not exist. That is, no privileged connections are allowed over nonsecure connections. NONE is the default value for this parameter. EXCLUSIVE An EXCLUSIVE password file can be used with only one database. Only an EXCLUSIVE file can contain the names of users other than SYS and INTERNAL. Using an EXCLUSIVE password file allows you to grant SYSDBA and SYSOPER system privileges to individual users and have them connect as themselves. A SHARED password file can be used by multiple databases. However, the only users recognized by a SHARED password file are SYS and INTERNAL; you cannot add users to a SHARED password file. All users needing SYSDBA or SYSOPER system privileges must connect using the same name, SYS, and password. This option is useful if you have a single DBA administering multiple databases. Suggestion: To achieve the greatest level of security, you should set the REMOTE_LOGIN_PASSWORDFILE file initialization parameter to EXCLUSIVE immediately after creating the password file. 80. For which two constraints are indexes created when the constraint is added? (Choose two.) A. check B. unique C. not null D. primary key E. foreign key Answer: B, D Explanation: Oracle enforces all PRIMARY KEY constraints using indexes. Oracle enforces unique integrity constraints with indexes. 81. You check the alert log for your database and discover that there are many lines that say "Checkpoint Not Complete". What are two ways to solve this problem? (Choose two.) A. delete archived log files B. add more online redo log groups C. increase the size of archived log files D. increase the size of online redo log files Answer: B, D Explanation: Checkpoint not complete" means that a checkpoint started, but before it could finish another higher priority checkpoint was issued (usually from a log switch), so the first checkpoint was essentially rolled-back. I found these answers from newsgroups and they sound quite good to me: Increasing the number of redo logs seems to be most effective. Normally, checkpoints occur for 1 of 3 reasons: 1) The log_checkpoint_interval was reached. 2) A log switch occurred. 3) The log_checkpoint_timeout was reached.
39
The archiver copies the online redo log files to archival storage after a log switch has occurred. Although a single ARCn process (ARC0) is sufficient for most systems, you can specify up to 10 ARCn processes by using the dynamic initialization parameter LOG_ARCHIVE_MAX_PROCESSES. If the workload becomes too great for the current number of ARCn processes, then LGWR automatically starts another ARCn process up to the maximum of 10 processes. ARCn is active only when a database is in ARCHIVELOG mode and automatic archiving is enabled. There is no Archive log file as far as I know. It is called Redo log file. 82. The database needs to be shut down for hardware maintenance. All users sessions except one have either voluntarily logged off or have been forcibly killed. The one remaining user session is running a business critical data manipulation language (DML) statement and it must complete prior to shutting down the database. Which shutdown statement prevents new user connections, logs off the remaining user, and shuts down the database after the DML statement completes? A. SHUTDOWN B. SHUTDOWN ABORT C. SHUTDOWN NORMAL D. SHUTDOWN IMMEDIATE E. SHUTDOWN TRANSACTIONAL Answer: E Explanation: From a newsgroup: There are four ways to shut down a database: (a) Shutdown waits for everyone to finish & log out before it shuts down. The database is cleanly shutdown. (b) Shutdown immediate rolls back all uncommitted transactions before it shuts down. The database is cleanly shutdown. (c) Shutdown transactional waits for all current transactions to commit or rollback before it shuts down. The database is cleanly shutdown. (d) Shutdown abort quickly shuts down - the next restart will require instance recovery. The database is technically crashed. The key reason for an immediate shutdown not being immediate is because of the need to rollback all current transactions. If a user has just started a transaction to update emp set sal = sal * 2 where emp_id = 1000; then this will be rolled back almost instantaneously. However, if another user has been running a huge update for the last four hours, and has not yet committed, then four hours of updates have to be rolled back and this takes time. So, if you really want to shutdown right now, then the advised route is: shutdown abort - startup restrict - shutdown When you shutdown abort, Oracle kills everything immediately. Startup restrict will allow only dba users to get in but, more importantly, will carry out instance recovery and recover back to a consistent state using the current on-line redo logs. The final shutdown will perform a clean shutdown. Any cold backups taken now will be of a consistent database. There has been much discussion on this very subject on the Oracle Server newsgroups. Some people are happy to backup the database after a shutdown abort, others are not. I prefer to use the above method prior to taking a cold backup - if I have been unable to shutdown or shutdown immediate that is. 83. When preparing to create a database, you should be sure that you have sufficient disk space for your database files. When calculating the space requirements you need to consider that some of the files may be multiplexed. Which two types of files should you plan to multiplex? (Choose two.) A. data files B. control file C. password file D. online redo log files E. initialization parameter file Answer: B, D Explanation: Multiplex: files are stored at more than one location.
40
Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A96524-01 (a96524.pdf) 3-22 Multiplexed Control Files: As with online redo log files, Oracle enables multiple, identical control files to be open concurrently and written for the same database. By storing multiple control files for a single database on different disks, you can safeguard against a single point of failure with respect to control files. If a single disk that contained a control file crashes, then the current instance fails when Oracle attempts to access the damaged control file. However, when other copies of the current control file are available on different disks, an instance can be restarted easily without the need for database recovery. If all control files of a database are permanently lost during operation, then the instance is aborted and media recovery is required. Media recovery is not straightforward if an older backup of a control file must be used because a current copy is not available. Therefore, it is strongly recommended that you adhere to the following practices: (a) Use multiplexed control files with each database (b) Store each copy on a different physical disk (c) Use operating system mirroring (d) Monitor backups Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A96524-01 (a96524.pdf) 1-7 Redo Log Files: To protect against a failure involving the redo log itself, Oracle allows a multiplexed redo log so that two or more copies of the redo log can be maintained on different disks. The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to the datafiles. For.Database Structure and Space Management Overview example, if an unexpected power outage terminates database operation, then data in memory cannot be written to the datafiles, and the data is lost. However, lost data can be recovered when the database is opened, after power is restored. By applying the information in the most recent redo log files to the database datafiles, Oracle restores the database to the time at which the power failure occurred. 84. You decide to use Oracle Managed Files in your database. Which two are requirements with respect to the directories you specify in the DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n initialization parameters? (Choose two). A. The directory must already exist. B. The directory must not contain any other files. C. The directory must be created in the $ORACLE_HOME directory. D. The directory must have appropriate permissions that allow Oracle to create files in it. Answer: A, D Explanation: Setting the DB_CREATE_ONLINE_LOG_DEST_ n Initialization Parameter: You specify the name of a file system directory that becomes the default location for the creation of the operating system files for these entities. You can specify up to five multiplexed locations. Setting the DB_CREATE_FILE_DEST Initialization Parameter: You specify the name of a file system directory that becomes the default location for the creation of the operating system files for these entities As a conclusion, the directories must exist, but it doesn’t matter what is inside. Also, it can be anywhere since you specify the location of it. And must give permission to oracle to read and write to those directories. 85. In which two situations does the Log Writer (LGWR) process write the redo entries from the redo log buffer to the current online redo log group? (Choose two.) A. when a transaction commits B. when a rollback is executed C. when the redo log buffer is about to become completely full (90%) D. before the DBWn writes modified blocks in the database buffer cache to the data files E. when there is more than a third of a megabyte of changed records in the redo log buffer Answer: A, D
41
Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 19.: The redo log buffer writes to the redo logfile under the following situations: (a) When a transaction commits. (b) When the redo log buffer is one-third full. (c) When there is more than one megabyte of changes recorded in the redo log buffer. (d) Before the DBWn writes modified blocks in the database buffer cache to the datafiles. 86. Examine the syntax below, which creates a DEPARTMENTS table: CREATE TABLE hr.departments( Department_id NUMBER(4), department_name VARCNAR2(30), manager_id NUMBER(6), location_id NUMBER(4)) STORAGE(INITIAL 200K NEXT 200K PCTINCREASE 50 MINEXTENTS 1 MAXEXTENTS 5) TABLESPACE data; What is the size defined for the fifth extent? A. 200 K B. 300 K C. 450 K D. 675 K E. not defined Answer: D Explanation: The size of the first and the second extent is 200K, PCTINCREASE is set to 50%, so we have the following calculation: 200 * 1,5 * 1,5 * 1,5 = 675. 87. After running the ANALYZE INDEX orders cust_idx VALIDATE STRUCTURE command, you query the INDEX_STATS view and discover that there is a high ratio of DEL_LF_ROWS to LF_ROWS values for this index. You decide to reorganize the index to free up the extra space, but the space should remain allocated to the ORDERS_CUST_IDX index so that it can be reused by new entries inserted into the index. Which command(s) allows you to perform this task with the minimum impact to any users who run queries that need to access this index while the index is reorganized? A. ALTER INDEX REBUILD B. ALTER INDEX COALESCE C. ALTER INDEX DEALLOCATE UNUSED D. DROP INDEX followed by CREATE INDEX Answer: B Explanation: When you rebuild an index, you use an existing index as the data source. Creating an index in this manner enables you to change storage characteristics or move to a new tablespace. Rebuilding an index based on an existing data source removes intra-block fragmentation. Compared to dropping the index and using the CREATE INDEX statement, re-creating an existing index offers better performance. Improper sizing or increased growth can produce index fragmentation. To eliminate or reduce fragmentation, you can rebuild or coalesce the index. Coalescing an index online vs. rebuilding an index online. Online index coalesce is an in-place data reorganization operation, hence does not require additional disk space like index rebuild does. Index rebuild requires temporary disk space equal to the size of the index plus sort space during the operation. Index coalesce does not reduce the height of the B-tree. It only tries to reduce the number of leaf blocks. The coalesce operation does not free up space for users but does improve index scan performance.
42
If a user needs to move an index to a new tablespace, online index rebuild is recommended. Index rebuild also improves space utilization, but the index rebuild operation has higher overhead than the index coalesce operation 88. You started your database with this command: STARTUP PFILE=initSAMPLEDB.ora One of the values in the initSAMPLEDB.ora parameter file is: LOG_ARCHIVE_START=false While your database is open, you issue this command to start the Archiver process: ALTER SYSTEM ARCHIVE LOG START; You shut down your database to take a back up and restart it using the initSAMPLEDB.ora parameter file again. When you check the status of the Archiver, you find that it is disabled. Why is the Archiver disabled? A. When you take a backup the Archiver process is disabled. B. The Archiver can only be started by issuing the ALTER DATABASE ARCHIVELOG command. C. LOG_ARCHIVE_START is still set to FALSE because the PFILE is not updated when you issue the ALTER SYSTEM command. D. The Archiver can only be started by issuing the ALTER SYSTEM ARCHIVE LOG START command each time you open the database. Answer: C Explanation: If an instance is shut down and restarted after automatic archiving is enabled using the ALTER SYSTEM statement, the instance is reinitialized using the settings of the initialization parameter file. Those settings may or may not enable automatic archiving. If your intent is to always archive redo log files automatically, then you should include LOG_ARCHIVE_START = TRUE in your initialization parameters. Answer D is correct, since every time the database is started, the init value of the LOG_ARCHIVE_START=false Answer D is somewhat correct, but C is better. Since the PFILE’s LOG_ARCHIVE_START = FALSE, then the only way you can start the Archiver is by issuing the command. There is no other way, (Except of course, if you modify the PFILE and the start the database again) 89. What provides for recovery of data that has not been written to the data files prior to a failure? A. redo log B. undo segment C. rollback segment D. system tablespace Answer: A Explanation: Oracle 7 documentation, Oracle 7 Server concepts, 22-5 The Redo Log The redo log, present for every Oracle database, records all changes made in an Oracle database. The redo log of a database consists of at least two redo log files that are separate from the datafiles (which actually store a database’s data). As part of database recovery from an instance or media failure, Oracle applies the appropriate changes in the database’s redo log to the datafiles, which updates database data to the instant that the failure occurred. A database’s redo log can be comprised of two parts: the online redo log and the archived redo log, discussed in the following sections. The Online Redo Log Every Oracle database has an associated online redo log. The online redo log works with the Oracle background process LGWR to immediately record all changes made through the associated instance. The online redo log consists of two or more pre-allocated files that are reused in a circular fashion to record ongoing database changes; see “The Online Redo Log” on page 22-6 for more information.
43
The Archived (Offline) Redo Log Optionally, you can configure an Oracle database to archive files of the online redo log once they fill. The online redo log files that are archived are uniquely identified and make up the archived redo log. By archiving filled online redo log files, older redo log information is preserved for more extensive database recovery operations, while the pre-allocated online redo log files continue to be reused to store the most current database changes; see “The Archived Redo Log” page 22-16 for more information. Oracle9i Database Administrator’s Guide Release 2 (9.2) March 2002 Part No. A96521-01 (a96521.pdf) 13-2 Undo and rollback segments Every Oracle database must have a method of maintaining information that is used to roll back, or undo, changes to the database. Such information consists of records of the actions of transactions, primarily before they are committed. Oracle refers to these records collectively as undo. Undo records are used to: (a) Roll back transactions when a ROLLBACK statement is issued. (b) Recover the database. (c) Provide read consistency. When a rollback statement is issued, undo records are used to undo changes that were made to the database by the uncommitted transaction. During database recovery, undo records are used to undo any uncommitted changes applied from the redo log to the datafiles. Undo records provide read consistency by maintaining the before image of the data for users who are accessing the data at the same time that another user is changing it. Historically, Oracle has used rollback segments to store undo. Space management for these rollback segments has proven to be quite complex. Oracle now offers another method of storing undo that eliminates the complexities of managing rollback segment space, and enables DBAs to exert control over how long undo is retained before being overwritten. This method uses an undo tablespace. 90. There are three ways to specify National Language Support parameters: 1. initialization parameters 2. environment variables 3. ALTER SESSION parameters Match each of these with their appropriate definitions. A. 1) Parameters on the client side to specify locale-dependent behavior overriding the defaults set for the server 2) Parameters on the server side to specify the default server environment 3) Parameters override the default set for the session or the server B. 1) Parameters on the server side to specify the default server environment 2) Parameters on the client side to specify locale-dependent behavior overriding the defaults set for the server 3) Parameters override the default set for the session or the server C. 1) Parameters on the server side to specify the default server environment 2) Parameters override the default set for the session or the server 3) Parameters on the client side to specify locale-dependent behavior overriding the defaults set for the server D. 1) Parameters on the client side to specify locale-dependent behavior overriding the defaults set for the server 2) Parameters override the default set for the session or the server 3) Parameters on the server side to specify the default server environment Answer: B Explanation: Oracle has attempted to provide appropriate values in the starter initialization parameter file provided with your database software, or as created for you by the Database Configuration Assistant. You can edit these Oracle-supplied initialization parameters and add others, depending upon your configuration and options and how you plan to tune the database. 91. Which graphical DBA administration tool would you use to tune an Oracle database?
44
A. SQL*Plus B. Oracle Enterprise Manager C. Oracle Universal Installer D. Oracle Database Configuration Assistant Answer: B Explanation: If you think SQL*Plus is a GRAPHICAL tool, then I call Microsoft Windows an Artistic Tool ;-) You can more easily administer the Database Resource Manager through the Oracle Enterprise Manager (OEM). It provides an easy to use graphical interface for administering the Database Resource Manager. You can choose to use the Oracle Enterprise Manager for administering your database, including starting it up and shutting it down. The Oracle Enterprise Manager is a separate Oracle product, that combines a graphical console, agents, common services, and tools to provide an integrated and comprehensive systems management platform for managing Oracle products. It enables you to perform the functions discussed in this book using a GUI interface, rather than command lines. The Database Configuration Assistant (DBCA) an Oracle supplied tool that enables you to create an Oracle database, configure database options for an existing Oracle database, delete an Oracle database, or manage database templates. DBCA islaunched automatically by the Oracle Universal Installer, but it can be invoked standalone from the Windows operating system start menu (under Configuration Assistants) 92. Which method is correct for starting an instance to create a database? A. STARTUP B. STARTUP OPEN C. STARTUP MOUNT D. STARTUP NOMOUNT Answer: D Explanation: Start an instance without mounting a database. Typically, you do this only during database creation or while performing maintenance on the database. Use the STARTUP command with the NOMOUNT option. 93. You just created five roles using the statements shown: CREATE CREATE CREATE CREATE CREATE
ROLE ROLE ROLE ROLE ROLE
payclerk; oeclerk IDENTIFIED BY salary; hr_manager IDENTIFIED EXTERNALLY; genuser IDENTIFIED GLOBALLY; dev IDENTIFIED USING dev_test;
Which statement indicates that a user must be authorized to use the role by the enterprise directory service before the role is enabled? A. CREATE ROLE payclerk; B. CREATE ROLE genuser IDENTIFIED GLOBALLY; C. CREATE ROLE oeclerk IDENTIFIED BY salary; D. CREATE ROLE dev IDENTIFIED USING dev_test; E. CREATE ROLE hr_manager IDENTIFIED EXTERNALLY; Answer: B Explanation: Creating a Global User - The following statement illustrates the creation of a global user, who is authenticated by SSL and authorized by the enterprise directory service: CREATE USER scott IDENTIFIED GLOBALLY AS 'CN=scott,OU=division1,O=oracle,C=US'; The string provided in the AS clause provides an identifier (distinguished name, or DN) meaningful to the enterprise directory.
45
In this case, scott is truly a global user. But, the disadvantage here is that user scott must then be created in every database that he must access, plus the directory. 94. Examine the list of steps to rename the data file of a non-SYSTEM tablespace HR_TBS. The steps are arranged in random order. 1. 2. 3. 4. 5. 6.
Shut down the database. Bring the HR_TBS tablespace online. Execute the ALTER DATABASE RENAME DATAFILE command. Use the operating system command to move or copy the file. Bring the tablespace offline. Open the database.
What is the correct order for the steps? A. 1, 3, 4, 6; steps 2 and 5 are not required B. 1, 4, 3, 6; steps 2 and 5 are not required C. 2, 3, 4, 5; steps 1 and 6 are not required D. 5, 4, 3, 2; steps 1 and 6 are not required E. 5, 3, 4, 1, 6, 2 F. 5, 4, 3, 1, 6, 2 Answer: D Explanation: Renaming Datafiles in a Single Tablespace: To rename datafiles from a single tablespace, complete the following steps: (1) Take the non-SYSTEM tablespace that contains the datafiles offline. For example: ALTER TABLESPACE users OFFLINE NORMAL; (2) Rename the datafiles using the operating system. (3) Use the ALTER TABLESPACE statement with the RENAME DATAFILE clause to change the filenames within the database. The new files must already exist; this statement does not create the files. Also, always provide complete filenames (including their paths) to properly identify the old and new datafiles. In particular, specify the old datafile name exactly as it appears in the DBA_DATA_FILES view of the data dictionary. (4) Back up the database. After making any structural changes to a database, always perform an immediate and complete backup. (5) Bring the datafile online (this was added by me, I couldn’t find it in the documents). To use this clause for datafiles and tempfiles, the database must be mounted. The database can also be open, but the datafile or tempfile being renamed must be offline. So first make the tablespace offline (Step 5) => Answers A and B are out. The Alter renames the file, but only on the oracle. The statement does not actually change the name of the file ’disk. You must perform this operation through your operating system. => Use the step 4 to copy the new file to the specified location. Then execute the alter database. You don’t need to shut down and start the database. 95. For a tablespace created with automatic segment-space management, where is free space managed? A. in the extent B. in the control file C. in the data dictionary D. in the undo tablespace Answer: A Explanation: When you create a table in a locally managed tablespace for which automatic segment-space management is enabled, the need to specify the PCTFREE (or FREELISTS) parameter is eliminated. Automatic segment-space management is specified at the tablespace level. The Oracle database server automatically and efficiently manages free and used space within objects created in such tablespaces.
46
In my opinion, the free space is managed in the table space itself. A table space consists of extents. Therefore, extents are the actual spaces. So, I recommend answer A. Also in answer D, UNDO table space is used for UNDO purpose only and not for space management. 96. Which is true when considering the number of indexes to create on a table? A. Every column that is updated requires an index. B. Every column that is queried is a candidate for an index. C. Columns that are part of a WHERE clause are candidates for an index. D. On a table used in a Data Warehouse application there should be no indexes. Answer: C No comment 97. More stringent user access requirements have been issued. You need to do these tasks for the user pward: 1. 2. 3. 4.
Change user authentication to external authentication. Revoke the user's ability to create objects in the TEST TS tablespace. Add a new default and temporary tablespace and set a quota of unlimited. Assign the user to the CLERK profile.
Which statement meets the requirements? A. ALTER USER pward IDENTIFIED EXTERNALLY DEFAULT TABLESPACE data_ts TEMPORARY TABLESPACE temp_ts QUOTA UNLIMITED ON data_ts QUOTA 0 ON test_ts GRANT clerk TO pward; B. ALTER USER pward IDENTIFIED by pward DEFAULT TABLESPACE dsta_ts TEMPORARY TABLESPACE temp_ts QUOTA UNLIMITED ON data_ts QUOTA 0 ON test_ts PROFILE clerk; C. ALTER USER pward IDENTIFIED EXTERNALLY DEFAULT TABLESPACE data_ts TEMPORARY TABLESPACE temp_ts QUOTA UNLIMITED ON data_ts QUOTA 0 ON test_ts PROFILE clerk; D. ALTER USER pward IDENTIFIED EXTERNALLY DEFAULT TABLESPACE data_ts TEMPORARY TABLESPACE temp_ts QUOTA UNLIMITED ON data_ts QUOTA 0 ON test ts; GRANT clerk to pward; Answer: C Explanation: Creating a User Who is Authenticated Externally: CREATE USER scott IDENTIFIED EXTERNALLY; Or Use Alter instead of Create. The important keyword is the IDENTIFIED EXTERNALLY.
47
Check the picture to see how the DEFAULT AND TEMPORARY table spaces are set. Also the QUOTA keyword is shown on the picture. Since the ALTER USER also has a profile keyword, then PROFILE can also be used. Therefore answer C is correct. 98. You create a new table named DEPARTMENTS by issuing this statement: CREATE TABLE departments( department_id NUMBER(4), department_name VARCHAR2(30), manager_id NUMBER(6), location_id NUMBER(4)) STORAGE(INITIAL 200K NEXT 200K PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 5); You realize that you failed to specify a tablespace for the table. You issue these queries: SQL> SELECT username, default_tablespace, temporary tablespace 2> FROM user_users;
USERNAME
DEFAULT_TABLESPACE
HR
SAMPLE
TEMPORARY_TABLESPACE TEMP
SQL> SELECT * from user_ts_quotas;
TABLESPACE_NAME SAMPLE INDX
BYTES
28311552 0
MAX_BYTES -1
-1
6912
BLOCKS -1
0
MAX_BLOCKS -1
In which tablespace was your new DEPARTMENTS table created? A. TEMP B. SYSTEM C. SAMPLE D. USER_DATA Answer: C Explanation: The DEFAULT TABLESPACE clause of the CREATE USER statement names the location where the user’s database objects will be created by default. This clause plays an important role in protecting the integrity of the SYSTEM tablespace. If no DEFAULT TABLESPACE is named for the user, objects that the user creates may be placed in the SYSTEM tablespace. Recall that SYSTEM contains many database objects, such as the data dictionary and the SYSTEM rollback segment, that are critical to database use. Users should not be allowed to create their database objects in the SYSTEM tablespaces. Ad A: False. TEMP tablespace is set as temporary tablespace for the user, so it will not be used to store the DEPARTMENTS table. The default tablespace SAMPLE will be used for this purpose. Ad B: False. User have SAMPLE as default tablespace, so it will be used, not SYSTEM tablespace, to store the DEPARTMENTS table. Ad D: False. USER_DATE is not defined as default tablespace for theuser, so it will not be used to store the DEPARTMENTS table. OCA Oracle 9i Associate DBA Certification Exam Guide, Jason Couchman, p. 804-807, Chapter 15: Managing Database Users
48
99. You should back up the control file when which two commands are executed? (Choose two.) A. CREATE USER B. CREATE TABLE C. CREATE INDEX D. CREATE TABLESPACE E. ALTER TABLESPACE <tablespace name> ADD DATAFILE Answer: D, E Explanation: Back Up Control Files It is very important that you back up your control files. This is true initially, and at any time after you change the physical structure of your database. Such structural changes include: (a) Adding, dropping, or renaming datafiles. (b) Adding or dropping a tablespace, or altering the read-write state of the tablespace. (c) Adding or dropping redo log files or groups. 100. You have two undo tablespaces defined for your database. The instance is currently using the undo tablespace named UNDOTBS_1. You issue this command to switch to UNDOTBS_2 while there are still transactions using UNDOTBS_1: ALTER SYSTEM SET UNDO_TABLESPACE = undotbs_2 Which two results occur? (Choose two.) A. New transactions are assigned to UNDOTBS_2. B. Current transactions are switched to the UNDOTBS_2 tablespace. C. The switch to UNDOTBS_2 fails and an error message is returned. D. The UNDOTBS_1 undo tablespace enters into a PENDING OFFLINE mode (status). E. The switch to UNDOTBS_2 does not take place until all transactions in UNDOTBS_1 are completed. Answer: A, D Explanation: See http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96521/undo.htm#9117: Switching Undo Tablespaces Switching Undo Tablespaces You can switch from using one undo tablespace to another. Because the UNDO_TABLESPACE initialization parameter is a dynamic parameter, the ALTER SYSTEM SET statement can be used to assign a new undo tablespace. The database is online while the switch operation is performed, and user transactions can be executed while this command is being executed. When the switch operation completes successfully, all transactions started after the switch operation began are assigned to transaction tables in the new undo tablespace. The switch operation does not wait for transactions in the old undo tablespace to commit. If there are any pending transactions in the old undo tablespace, the old undo tablespace enters into a PENDING OFFLINE mode (status). In this mode, existing transactions can continue to execute, but undo records for new user transactions cannot be stored in this undo tablespace. An undo tablespace can exist in this PENDING OFFLINE mode, even after the switch operation completes successfully. A PENDING OFFLINE undo tablespace cannot used by another instance, nor can it be dropped. Eventually, after all active transactions have committed, the undo tablespace automatically goes from the PENDING OFFLINE mode to the OFFLINE mode. From then on, the undo tablespace is available for other instances (in an Oracle Real Application Cluster environment). 101. Which two statements grant an object privilege to the user Smith? (Choose two.) A. GRANT CREATE TABLE TO smith; B. GRANT CREATE ANY TABLE TO smith; C. GRANT CREATE DATABASE LINK TO smith; D. GRANT ALTER ROLLBACK SEGMENT TO smith; E. GRANT ALL ON scott.salary_view TO smith; F. GRANT CREATE PUBLIC DATABASE LINK TO smith; G. GRANT ALL ON scott.salary_view TO smith WITH GRANT OPTION;
49
Answer: E, G Object Privileges: ALTER, DELETE, EXECUTE, INDEX, INSERT, REFERENCES, SELECT, UPDATE. Ad D: ALTER: Permits the grantee of this object privilege to alter the definition of a table or sequence only. The ALTER privilege on all other database objects are considered system privileges. 102. Which memory structure contains the information used by the server process to validate the user privileges? A. buffer cache B. library cache C. data dictionary cache D. redo log buffer cache Answer: C Explanation: Ad A: False. The database buffer cache is the portion of the SGA that holds copies of data blocks read from datafiles. All user processes concurrently connected to the instance share access to the database buffer cache. See (a58227.pdf) Pg 155. (6-3). Ad B: False. Library Cache The library cache includes the shared SQL areas, private SQL areas, PL/SQL proce-dures and packages, and control structures such as locks and library cache handles. Ad C: True. One of the most important parts of an Oracle database is its data dictionary, which is a read-only set of tables that provides information about its associated database. A data dictionary contains: (a) the definitions of all schema objects in the database (tables, views, indexes, clusters, synonyms, sequences, procedures, functions, packages, triggers, and so on). (b) how much space has been allocated for, and is currently used by, the schema objects. (c) default values for columns. (d) integrity constraint information. (e) the names of Oracle users. (f) privileges and roles each user has been granted. (g) auditing information, such as who has accessed or updated various schema objects. (h) in Trusted Oracle, the labels of all schema objects and users (see your TrustedOracle documentation). (i) other general database information. See (a58227.pdf) Pg. 134. (4-2). Ad D: False. The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to a database’s datafiles. See (a58227.pdf) Pg. 46. (1-12) 103. Click the Exhibit button and examine the tablespace requirements for a new database. Tablespace
Purpose
Size
APP_DATA APP_NDX SYSTEM TEMP UNDOTBS USERS
Application Data Application Index System Data Temporary Data Undo Data User Data
1 Gig 500M 300M 100M 150M 100M
Which three tablespaces can be created in the CREATE DATABASE statement? (Choose three.) A. TEMP B. USERS C. SYSTEM D. APP_NDX E. UNDOTBS F. APP_DATA Answer: A, C, E Explanation:
50
You can create default SYSTEM, TEMP and UNDOTBS tablespaces in the CREATE DATABASE statement. Non-default tablespaces, as USERS, APP_NDX and APP_DATA, can be created later with CREATE TABLESPACE command. Ad B: Wrong. USER tablespace can be created with the CREATE TABLESPACE command. Ad D: Wrong. It is not possible to create non-default APP_NDX tablespace with the CREATE DATABASE command. Ad F: Wrong. APP_DATA tablespace can be created with the CREATE TABLESPACE command. 104. Examine these statements: 1) 2) 3) 4)
MOUNT mounts the database for certain DBA activities but does not provide user access to the database. The NOMOUNT command creates only the Data Buffer but does not provide access to the database. The OPEN command enables users to access the database. The STARTUP command starts an instance.
Which option correctly describes whether some or all of the statements are TRUE or FALSE? A. 2 and 3 are TRUE B. 1 and 3 are TRUE C. 1 is TRUE, 4 is FALSE D. 1 is FALSE, 4 is TRUE E. 1 is FALSE, 3 is TRUE F. 2 is FALSE, 4 is FALSE Answer: B Explanation: (1) is true: Mounted database: A database associated with an Oracle instance. The database can be opened or closed. A database must be both mounted and opened to be accessed by users. A database that has been mounted but not opened can be accessed by DBAs for some maintenance purposes. See Oracle8™ Enterprise Edition Getting Started Release 8.0.5 for Windows NT June 19, 1998 Part No. A64416-01 pg. 446. (2) is false: After selecting the Startup Nomount, the instance starts. At this point, there is no database. Only an SGA (System Global Area is a shared memory region that contains data and control information for one Oracle instance) and background processes are started in preparation for the creation of a new database. See Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 pg. 60. (a58397.pdf). (3) is true: Opening a mounted database makes it available for normal database operations. Any valid user can connect to an open database and access its information. When you open the database, Oracle opens the online datafiles and online redo log files. If a tablespace was offline when the database was previously shut down, the tablespace and its corresponding datafiles will still be offline when you reopen the database. If any of the datafiles or redo log files are not present when you attempt to open the database, Oracle returns an error. See Oracle8 Concepts Release 8.0 December, 1997 Part No. A58227-01 pg. 149. (a58227.pdf). (4) is true: STARTUP: Purpose Start an Oracle instance with several options, including mounting and opening a database. Prerequisites You must be connected to a database as INTERNAL, SYSOPER, or SYSDBA. You cannot be connected via a multi-threaded server. See Oracle ® Enterprise Manager Administrator’s Guide Release 1.6.0 June, 1998 Part No. A63731-01 (oemug.pdf) pg. 503. (B-31). 105. A DBA has issued the following SQL statement: SELECT max_blocks FROM dba_ts_quotas WHERE tablespace_name='USER_TBS' AND username='JENNY'; User Jenny has unlimited quota on the USER_TBS tablespace. Which value will the query return? A. 0 B. 1 C. -1 D. NULL E. 'UNLIMITED'
51
Answer: C Explanation: Ad A: False. Value –1, not 0, shows that user Jenny has unlimited quota on the USER_TBS tablespace. Ad B: False. Value –1, not 1, shows that user Jenny has unlimited quota on the USER_TBS tablespace. Ad C: True. A value of –1 in MAX_BYTES or MAX_BLOCKS means that the user has an unlimited space quota for the tablespace. Ad D: False. Value NULL can be used to set the quota on the tablespace. Ad E: False. Quota value must be numeric. It cannot be defined as string. OCA Oracle 9i Associate DBA Certification Exam Guide, Jason Couchman, p. 815-817, Chapter 15: Managing Database Users 106. Which two statements are true about rebuilding an index? (Choose two.) A. The resulting index may contain deleted entries. B. A new index is built using an existing index as the data source. C. Queries cannot use the existing index while the new index is being built. D. During a rebuild, sufficient space is needed to accommodate both the old and the new index in their respective tablespaces. Answer: B, D Explanation: (A) False. The resulting index will not contain deleted entries. It’s the main reason to rebuild the index. (B) True. You can create an index using an existing index as the data source. Creating an index in this manner allows you to change storage characteristics or move to a new tablespace. Re-creating an index based on an existing data source also removes intra-block fragmentation. In fact, compared to dropping the index and using the CREATE INDEX command, re-creating an existing index offers better performance. (58246.pdf) Pg. 178. (10-10). (C) False. A further advantage of this approach is that the old index is still available for queries (58246.pdf) Pg. 178. (10-10). (D) True. 107. Consider this SQL statement: UPDATE employees SET first_name = 'John' WHERE emp_id = 1009; COMMIT; What happens when a user issues the COMMIT in the above SQL statement? A. Dirty buffers in the database buffer cache are flushed. B. The server process places the commit record in the redo log buffer. C. Log Writer (LGWR) writes the redo log buffer entries to the redo log files and data files. D. The user process notifies the server process that the transaction is complete. E. The user process notifies the server process that the resource locks can be released. Answer: E Testking said B. Questions is posed very ambiguous! What happens first? Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 19.: What exactly does processing a commit statement consist of? (1) Release table/row locks acquired by transaction. (2) Release undo segement locks acquired by transaction. (3) Generate redo for commited transaction.
52
108. A new user, psmith, has just joined the organization. You need to create psmith as a valid user in the database. You have the following requirements: 1. 2. 3. 4. 5.
Create a user who is authenticated externally. Make sure the user has CONNECT and RESOURCE privileges. Make sure the user does NOT have DROP TABLE and CREATE USER privileges. Set a quota of 100 MB on the default tablespace and 500 K on the temporary tablespace. Assign the user to the DATA_TS default tablespace and the TEMP_TS temporary tablespace.
Which statement would you use to create the user? A. CREATE USER psmith IDENTIFIED EXTERNALLY DEFAULT TABLESPACE data_ts QUOTA 100M ON data_ts QUOTA 500K ON temp_ts TEMPORARY TABLESPACE temp_ts; REVOKE DROP_TABLE, CREATE_USER from psmith; B. CREATE USER psmith IDENTIFIED EXTERNALLY DEFAULT TABLESPACE data_ts QUOTA 500K ON temp_ts QUOTA 100M ON data_ts TEMPORARY TABLESPACE temp_ts; GRANT connect, resource TO psmith; C. CREATE USER psmith IDENTIFIED EXTERNALLY DEFAULT TABLESPACE data_ts QUOTA 100M ON data_ts QUOTA 500K ON temp_ts TEMPORARY TABLESPACE temp_ts; GRANT connect TO psmith; D. CREATE USER psmith INDENTIFIED GLOBALLY AS ‘’ DEFAULT TABLESPACE data_ts QUOTA 500K ON temp_ts QUOTA 100M ON data_ts TEMPORARY TABLESPACE temp_ts; GRANT connect, resource TO psmith; REVOKE DROP_TABLE, CREATE_USER from psmith; Answer: B Explanation: (D) is false, because the user must be identified by the operating system, while GLOBALLY AS ’external_name’ indicates that a user must be authenticated by the Oracle Security Service. (A) and (C) has no connect and resource privileges. CREATE USER: Purpose To create a database user, or an account through which you can log in to the database and establish the means by which Oracle permits access by the user. You can assign the following optional properties to the user: (a) default tablespace. (b) temporary tablespace. (c) quotas for allocating space in tablespaces. (d) profile containing resource limits. Prerequisites: You must have CREATE USER system privilege. See Oracle8™ SQL Reference Release 8.0 December 1997 Part No. A58225-01 pg. 541. (4-357) (a588225.pdf)
53
109. You are logged on to a client. You do not have a secure connection from your client to the host where your Oracle database is running. Which authentication mechanism allows you to connect to the database using the SYSDBA privilege? A. control file authentication B. password file authentication C. data dictionary authentication D. operating system authentication Answer: B Explanation: Local Database Administration: Do you want to use OS authentication? Yes: Use OS authentication. No: Use a password file. Remote Database Administration: Do you have a secure connection? No: Use a password file. Yes: Do you want to use OS authentication? Yes: Use OS authentication. No: Use a password file. See: Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 pg. 37. (a58397.pdf) 110. Which type of file is part of the Oracle database? A. control file B. password file C. parameter files D. archived log files Answer: A Explanation: Control file is an administrative file required to start and run the database. The control file records the physical structure of the database. For example, a control file contains the database name, and the names and locations of the database’s data files and redo log files. See: Oracle8™ Enterprise Edition Getting Started Release 8.0.5 for Windows NT June 19, 1998 Part No. A64416-01 (a55928.pdf) pg. 109. (5-9). 111. You issue these queries to obtain information about the REGIONS table: SQL> SELECT segment_name, tablespace_name 2> FROM user_segments 3> WHERE segment_name = 'REGIONS';
SEGMENT_NAME
TABLESPACE_NAME
REGIONS
SAMPLE
SQL> SELECT constraint_name, constraint_type 2> FROM user constraints 3> WHERE table_name = ‘REGIONS’;
CONSTRAINT_NAME REGION_ID_NN REG_ID
C C P
54
SQL> SELECT index_named 2> FROM user indexes 3> WHERE table_name = ‘REGIONS’; INDEX_NAME REG_ID_PK
You then issue this command to move the REGIONS table: ALTER TABLE regions MOVE TABLESPACE user_data; What else must you do to complete the move of the REGIONS table? A. You must rebuild the REG_ID_PK index. B. You must re-create the REGION_ID_NN and REG_ID_PK constraints. C. You must drop the REGIONS table that is in the SAMPLE tablespace. D. You must grant all privileges that were on the REGIONS table in the SAMPLE tablespace to the REGIONS table in the USER_DATA tablespace. Answer: A Explanation: Each table’s data is stored in its own data segment, while each index’s data is stored in its own index segment. So after move indexes must be rebuilt. 112. You query DBA_CONSTRAINTS to obtain constraint information on the HR_EMPLOYEES table: SQL> select constraint_name, constraint_type, deferrable, 2> deferred, validated 3> from dba_constraints 4> where owner = 'HR' and table_name='EMPLOYEES';
CONSTRAINT_NAME EMP_DEPT_FK EMP_EMAIL_NV EMP_EMAIL_UK EMP_EMP_ID_PK EMP_HIRE_DATE_NN EMP_JOB_FK EMP_JOB_NN EMP_LAST_NAME_NN EMP_MANAGER_FK EMP_SALARY_MIN
C R C U P C R C C R C
DEFERRABLE NOT DEFERRABLE NOT DEFERRABLE NOT DEFERRABLE NOT DEFERRABLE NOT DEFERRABLE NOT DEFERRABLE DEFERRABLE NOT DEFERRABLE NOT DEFERRABLE NOT DEFERRABLE
DEFERRED IMMEDIATE IMMEDIATE IMMEDIATE IMMEDIATE IMMEDIATE IMMEDIATE DEFERRED IMMEDIATE IMMEDIATE IMMEDIATE
Which type of constraint is EMP_JOB_NN? A. check B. unique C. not null D. primary key E. foreign key Answer: C Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 313.:
55
VALIDATED VALIDATED VALIDATED VALIDATED VALIDATED VALIDATED VALIDATED NOT VALIDATED VALIDATED VALIDATED VALIDATED
CONSTRAINT_TYPE: Displays p for primary key, r for foreign key (referential integrity constraint), c for check constraints (including checks to see if data is not null), and u for unique constraints. Because of this, options A and C remain. Because of the name of the constraint, EMP_JOB_NN, I would go for C, because NN usually stands for NOT NULL. 113. Temporary tablespaces should be locally managed and the uniform size should be a multiple of the ________. A. DB_BLOCK_SIZE B. DB_CACHE_SIZE C. SORT_AREA_SIZE D. operating system block size Answer: C Explanation: http://www.interealm.com/technotes/roby/temp_ts.html Temporary Tablespace Considerations By Roby Sherman (http://www.interealm.com/roby/) Today, depending on your RDBMS version, Oracle offers three varieties of temporary tablespaces to choose from. These spaces are used for disk based sorts, large index rebuilds, global temporary tables, etc. To ensure that your disk-based sorting is optimal, it is critical to understand the different types, caveats, and benefits of these temporary tablespace options: (a) Permanent Tablespaces with Temporary Segments. (b) Tablespaces of Type “Temporary”. (c) Temporary Tablespaces. Permanent Tablespaces with Temporary Segments This option has been available since Oracle 7.3 and is the least efficient for disk-based sorting. In this type of configuration, temporary (sort) extents are allocated within a permanent tablespace. Compared to other temp tablespace choices, the performance and operation of this disk-sort option suffers in the areas of: Extent Management: The ST-Enqueue (and subsequent recursive dictionary SQL) is used for the allocation and deallocation of extents allotted to each sort segment. Sort Segment Reuse: Each process performing a disk sort creates then drops a private sort segment. This adds additional overhead to the sorting process. Extent Reuse: Because of the “private sort segment” policy used in this tablespace option, there is no ability for diskbased sorts to re-use extents that are no longer active. Tablespaces of Type “Temporary” This disk-sorting option was introduced in Oracle 8.0 as a way to provide a more dedicated facility for disk-based sorting while reducing some amount of resources and I/O associated with extent management. It is created by invoking the CREATE TABLESPACE xyz… TEMPORARY; SQL clause. Sorts assigned to a tablespaces of type temporary use a single sort segment (multiple segments in an OPS environment) that is only dropped at instance start up and is created during the first disk-based sort. Sorts using this type of tablespace have the ability to reuse extents that are no longer active. This added level of reuse reduces the amount of resources necessary to manage individual segments and allocate/deallocate extents. Although extent allocation and de-allocation is reduced in this type of tablespace, the ST-Enqueue (and subsequent dictionary-generated recursive SQL) is still required in these activities when they occur. Since this type of tablespace cannot be configured with local extent management, there is not easy way to bypass this performance degradation. Temporary Tablespaces This new class of temporary tablespace was introduced in Oracle 8i and provides the most robust and efficient means of disk-based sorting in Oracle today. Temporary tablespaces are created using the SQL syntax CREATE TEMPORARY TABLEPSPACE xyz TEMPFILE …. There are a number of performance benefits of this tablespace option over permanent and tablespaces of type temporary in the areas of: Extent Management: Extents in this tablespace are allocated via a locally-managed bitmap. Therefore use of the STEnqueue and recursive SQL for this activity is eliminated. Segment Reuse: Sorts assigned to a tablespaces of type temporary use a single sort segment (multiple segments in an OPS environment) that is only dropped at instance start up and is created during the first disk-based sort.
56
Extent Reuse: Sorts using this type of tablespace have the ability to reuse extents that are no longer active. This added level of reuse reduces the amount of resources necessary to manage individual segments and allocate / deallocate extents. Note: If the extent management clause is not specified for Temporary tablespaces, the database will automatically set the tablespace with a uniform extent size of 1 MB. Which Do I Choose? Whether you are on an existing database application migrating to a newer Oracle version or a new application in the initial development phase, for optimal performance you should use the most recent temporary tablespace option available to your database version: - For Oracle versions 7.3.4 and below, use Permanent tablespaces with temporary segments - For Oracle versions 8.0.3 - 8.0.6 use tablespaces of type “temporary” - For Oracle versions 8.1.5 - 9.x use Temporary tablespaces Selecting the Right Extent Size Regardless of the type of Temporary tablespace you use, you should ensure that the extent sizes selected for the space do not impede system performance. In dictionary-managed temporary tablespaces, the INITIAL and NEXT extent sizes should be a multiple of SORT_AREA_SIZE and HASH_AREA_SIZE. PCTINCREASE should be set to 0. In locally-managed temp tablespaces, the uniform extent size should be a multiple of SORT_AREA_SIZE and HASH_AREA_SIZE. 114. Your database is in ARCHIVELOG mode. Which two must be true before the Log Writer (LGWR) can reuse a filled online redo log file? (Choose two). A. The redo log file must be archived. B. All of the data files must be backed up. C. All transactions with entries in the redo log file must complete. D. The data files belonging to the SYSTEM tablespace must be backed up. E. The changes recorded in the redo log file must be written to the data files. Answer: A, E Explanation: ARCHIVELOG: The filled online redo log files are archived before they are reused in the cycle. NOARCHIVELOG: The filled online redo log files are not archived. (a58227.pdf) Pg. 72. (1-38). When you run a database in ARCHIVELOG mode, the archiving of the online redo log is enabled. Information in a database control file indicates that a group of filled online redo log files cannot be used by LGWR until the group is archived (A true). A filled group is immediately available to the process performing the archiving after a log switch occurs (when a group becomes inactive). The process performing the archiving does not have to wait for the checkpoint of a log switch to complete before it can access the inactive group for archiving (C false). See: Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 (a58397.pdf) pg. 454. (23-2) 115. Which two statements are true about the control file? (Choose two.) A. The control file can be multiplexed up to eight times. B. The control file is opened and read at the NOMOUNT stage of startup. C. The control file is a text file that defines the current state of the physical database. D. The control file maintains the integrity of the database, therefore loss of the control file requires database recovery. Answer: A, D Explanation: Ad A: True. CONTROL_FILES indicates one or more names of control files separated by commas. The instance startup procedure recognizes and opens all the listed files. The instance maintains all listed control files during database operation. See: Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 (a58397.pdf) pg. 126. (6-2). Ad B: False. After mounting the database, the instance finds the database control files and opens them. (Control files are specified in the CONTROL_FILES initialization parameter in the parameter file used to start the instance.) Oracle then reads the control files to get the names of the database’s datafiles and redo log files. (a58227.pdf) pg. 148. (56).
57
Ad C: False. The control file of a database is a small binary file necessary for the database to start and operate successfully. A control file is updated continuously by Oracle during database use, so it must be available for writing whenever the database is open. If for some reason the control file is not accessible, the database will not function properly. (a58227.pdf) pg. 693. (28-19). Ad D: True. see previous. 116. Which two methods enforce resource limits? (Choose two.) A. ALTER SYSTEM SET RESOURCE_LIMIT= TRUE B. Set the RESOURCE_LIMIT parameter to TRUE C. CREATE PROFILE sessions LIMIT SESSIONS_PER_USER 2 CPU_PER_SESSION 10000 IDLE_TIME 60 CONNECT_TIME 480; D. ALTER PROFILE sessions LIMIT SESSIONS_PER_USER 2 CPU_PER_SESSION 10000 IDLE_TIME 60 CONNECT_TIME 480; Answer: A, B Explanation: Resource limitation can be enabled or disabled by the RESOURCE_LIMIT initialization parameter in the database’s initialization parameter file. Valid values for the parameter are TRUE (enables enforcement) and FALSE. By default, this parameter’s value is set to FALSE. Once the initialization parameter file has been edited, the database instance must be restarted to take effect. Every time an instance is started, the new parameter value enables or disables the enforcement of resource limitation. Resource limitation feature must be altered temporarily, you can enable or disable the enforcement of resource limitation using the SQL statement ALTER SYSTEM. After an instance is started, an ALTER SYSTEM statement overrides the value set by the RESOURCE_LIMIT initialization parameter. 117. The server parameter file (SPFILE) provides which three advantages when managing initialization parameters? (Choose three.) A. The Oracle server maintains the server parameter file. B. The server parameter file is created automatically when the instance is started. C. Changes can be made in memory and/or in the SPFILE with the ALTER SYSTEM command. D. The use of SPFILE provides the ability to make changes persistent across shut down and start up. E. The Oracle server keeps the server parameter file and the text initialization parameter file synchronized. Answer: A, C, D Testking said B, C, D. Explanation: Sources: http://download-west.oracle.com/docs/cd/B10501_01/rac.920/a96596/glossary.htm#436831. See OCP Oracle 9i Database: Fundamentals I, p. 70/71. Ad A: True. A server parameter file (SPFILE) can be thought of as a repository for initialization parameters that is maintained on the machine where the Oracle database server executes. It is, by design, a server-side initialization parameter file (http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96521/create.htm#999226). Ad B: False. The server parameter file must initially be created from a traditional text initialization parameter file. It must be created prior to its use in the STARTUP command. The CREATE SPFILE statement is used to create a server parameter file (http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96521/create.htm#1012659). Ad C: True. Use the SET clause of the ALTER SYSTEM statement to set or change initialization parameter values. Additionally, the SCOPE clause specifies the scope of a change as described in the following table: (1) SCOPE = SPFILE: The change is applied in the server parameter file only. The effect is as follows: (a) For dynamic parameters, the change is effective at the next startup and is persistent.
58
(b) For static parameters, the behavior is the same as for dynamic parameters. This is the only SCOPE specification allowed for static parameters. (2) SCOPE = MEMORY: The change is applied in memory only. The effect is as follows: (a) For dynamic parameters, the effect is immediate, but it is not persistent because the server parameter file is not updated. (b) For static parameters, this specification is not allowed. (3) SCOPE = BOTH: The change is applied in both the server parameter file and memory. The effect is as follows: (a) For dynamic parameters, the effect is immediate and persistent. (b) For static parameters, this specification is not allowed. Ad D: True. If you are using a server parameter file, initialization parameter file changes made by the ALTER SYSTEM statement can persist across shutdown and startup. This is discussed in "Managing Initialization Parameters Using a Server Parameter File" (http://downloadwest.oracle.com/docs/cd/B10501_01/server.920/a96521/create.htm#999226). Ad E: False. If you are using a traditional text initialization parameter file, your changes are only for the current instance. To make them permanent, you must update them manually in the initialization parameter file, otherwise they will be lost over the next shutdown and startup of the database (http://downloadwest.oracle.com/docs/cd/B10501_01/server.920/a96521/create.htm#999226). 118. You examine the alert log file and notice that errors are being generated from a SQL*Plus session. Which files are best for providing you with more information about the nature of the problem? A. control file B. user trace files C. background trace files D. initialization parameter files Answer: B Explanation: Ad A: False The control file of a database is a small binary file necessary for the database to start and operate successfully. A control file is updated continuously by Oracle during database use, so it must be available for writing whenever the database is open. If for some reason the control file is not accessible, the database will not function properly. (a58227.pdf) pg. 693. (28-19). A trace file is created each time an Oracle instance starts or an unexpected event occurs in a user process or background process. The name of the trace file includes the instance name, the process name, and the Oracle process number. The file extension or file type is usually TRC, and, if different, is noted in your operating system-specific Oracle documentation. The contents of the trace file may include dumps of the system global area, process global area, supervisor stack, and registers. Two initialization parameters specify where the trace files are stored: Ad B: False BACKGROUND_DUMP_DES Specifies the location for trace files created by the Oracle background processes PMON, DBWR, LGWR, and SMON. Ad C: True USER_DUMP_DEST Specifies the location for trace files created by user processes such as SQL*DBA, SQL*Plus, or Pro*C. See: Oracle8™ Error Messages Release 8.0.4 December 1997 Part No. A58312-01 (a58312.pdf) pg. 27. (1-5). Ad D: False Parameter file contains initialization parameters. These parameters specify the name of the database, the amount of memory to allocate, the names of control files, and various limits and other system parameters. (a58227.pdf) pg. 61. (1-27) 119. You can use the Database Configuration Assistant to create a template using an existing database structure. Which three will be included in this template? (Choose three.) A. data files B. tablespaces C. user defined schemas D. user defined schema data E. initialization parameters Answer: A, B, E We have to suppose that the type of the template is "non-seed". Explanation:
59
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96521/create.htm#1026131. Creating Templates Using DBCA From an existing template: Using an existing template, you can create a new template based on the pre-defined template settings. You can add or change any template settings such as initialization parameters, storage parameters, or use custom scripts. From an existing database (structure only): You can create a new template that contains structural information about an existing database, including database options, tablespaces, datafiles, and initialization parameters specified in the source database. User defined schema and their data will not be part of the created template. The source database can be either local or remote. From an existing database (structure as well as data--a seed database): You can create a new template that has both the structural information and physical datafiles of an existing database. Databases created using such a template are identical to the source database. User defined schema and their data will be part of the created template. The source database must be local. 120. The users pward and psmith have left the company. You no longer want them to have access to the database. You need to make sure that the objects they created in the database remain. What do you need to do? A. Revoke the CREATE SESSION privilege from the user. B. Drop the user from the database with the CASCADE option. C. Delete the users and revoke the CREATE SESSION privilege. D. Delete the users by using the DROP USER command from the database. Answer: A Explanation: Ad A: True CREATE SESSION Right: Connect to the database. Ad B: If the user’s schema contains any schema objects, use the CASCADE option to drop the user and all associated objects and foreign keys that depend on the tables of the user successfully. If you do not specify CASCADE and the user’s schema contains objects, an error message is returned and the user is not dropped. Before dropping a user whose schema contains objects, thoroughly investigate which objects the user’s schema contains and the implications of dropping them before the user is dropped. Pay attention to any unknown cascading effects. For example, if you intend to drop a user who owns a table, check whether any views or procedures depend on that particular table. See: Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 (a58397.pdf) Pg. 385. (20-17). Ad C: False After deleted one can not revoke privilege. Ad D: When a user is dropped, the user and associated schema is removed from the data dictionary and all schema objects contained in the user’s schema, if any, are immediately dropped. See: Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 (a58397.pdf) Pg. 385. (20-17). 121. You need to create an index on the CUSTOMER_ID column of the CUSTOMERS table. The index has these requirements: 1. 2. 3. 4. 5. 6. 7.
The index will be called CUST_PK. The index should be sorted in ascending order. The index should be created in the INDEX01 tablespace, which is a dictionary managed tablespace. All extents of the index should be 1 MB in size. The index should be unique. No redo information should be generated when the index is created. 20% of each data block should be left free for future index entries.
Which command creates the index and meets all the requirements? A. CREATE UNIQUE INDEX cust_pk ON customers(customer_id) TABLESPACE index0l PCTFREE 20 STORAGE (INITIAL lm NEXT lm PCTINCREASE 0); B. CREATE UNIQUE INDEX cust_pk ON customers(customer_id) TABLESPACE index0l PCTFREE 20 STORAGE (INITIAL 1m NEXT 1m PCTINCREASE 0) NOLOGGING; C. CREATE UNIQUE INDEX cust_pk ON customers(customer_id)
60
TABLESPACE index0l PCTUSED 80 STORAGE (INITIAL lm NEXT lm PCTINCREASE 0) NOLOGGING; D. CREATE UNIQUE INDEX cust_pk ON customers(customer_id) TABLESPACE index0l PCTUSED 80 STORAGE (INITIAL lm NEXT lm PCTINCREASE 0); Answer: B Explanation: PCTFREE is the percentage of space to leave free for updates and insertions within each of the index’s data blocks. TABLESPACE is the name of the tablespace to hold the index or index partition. If you omit this option, Oracle creates the index in the default tablespace of the owner of the schema containing the index. LOGGING / NOLOGGING specifies that the creation of the index will be logged (LOGGING) or not logged (NOLOGGING) in the redo log file. STORAGE PCTINCREASE specifies the percent by which the third and subsequent extents grow over the preceding extent. The default value is 50, meaning that each subsequent extent is 50% larger than the preceding extent. NEXT specifies the size in bytes of the next extent to be allocated to the object. You can use K or M to specify the size in kilobytes or megabytes. INITIAL specifies the size in bytes of the object’s first extent. Oracle allocates space for this extent when you create the schema object. You can use K or M to specify this size in kilobytes or megabytes. ASC / DESC are allowed for DB2 syntax compatibility, although indexes are always created in ascending order. (a58225.pdf) Pg. 421. (4-237). Ad Ad Ad Ad
A: False, Nologging missing. B: True. C: False. We need PCTFREE not PCTUSED. Remark PCTFREE + PCTUSED should be less than (not equal to) 100. D: False. Nologging missing, we need PCTFREE not PCTUSED.
122. John has issued the following SQL statement to create a new user account: CREATE USER john IDENTIFIED BY john TEMPORARY TABLESPACE temp_tbs QUOTA 1M ON system QUOTA UNLIMITED ON data_tbs PROFILE apps_profile PASSWORD EXPIRE DEFAULT ROLE apps_dev_role; Why does the above statement return an error? A. You cannot assign a role to a user within a CREATE USER statement. B. You cannot explicitly grant quota on the SYSTEM tablespace to a user. C. You cannot assign a profile to a user within a CREATE USER statement. D. You cannot specify PASSWORD EXPIRE clause within a CREATE USER statement. E. You cannot grant UNLIMITED quota to a user within a CREATE USER statement. Answer: A Explanation: It is not possible to assign a role to a user within a CREATE USER statement: you can use GRANT role_name TO user_name command to do that. 123. Which two actions cause a log switch? (Choose two.) A. A transaction completes. B. The instance is started. C. The instance is shut down D. The current online redo log group is filled E. The ALTER SYSTEM SWITCH LOGFILE command is issued.
61
Answer: D, E Explanation: A log switch, by default, takes place automatically when the current online redo log file group fills. See: Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 (a58397.pdf) Pg. 118. (5-10). To force a log switch, you must have the Alter System privilege. To force a log switch, use either the Switch Logfile menu item of Enterprise Manager or the SQL command ALTER SYSTEM with the SWITCH LOGFILE option. The following statement forces a log switch: ALTER SYSTEM SWITCH LOGFILE; See: Oracle8 Administrator’s Guide Release 8.0 December, 1997 Part No. A58397-01 (a58397.pdf) Pg. 121. (5-13) 124. Evaluate the SQL command: CREATE TEMPORARY TABLESPACE temp_tbs TEMPFILE '/usr/oracle9i/OraHomel/temp_data.dbf' SIZE 2M AUTOEXTEND ON; Which two statements are true about the TEMP_TBS tablespace? (Choose two.) A. TEMP_TBS has locally managed extents. B. TEMP_TBS has dictionary managed extents. C. You can rename the tempfile temp_data.dbf. D. You can add a tempfile to the TEMP_TBS tablespace. E. You can explicitly create objects in the TEMP_TBS tablespace. Answer: A, D Testking said B, D. Explanation: Ad A: True. Use the CREATE TEMPORARY TABLESPACE statement to create a locally managed temporary tablespace, which is an allocation of space in the database that can contain schema objects for the duration of a session. If you subsequently assign this temporary tablespace to a particular user, then Oracle will also use this tablespace for sorting operations in transactions initiated by that user. (a96540.pdf) Pg. 1258. (15-92) Ad B: False. Because of previous. Starting with Oracle 9i, Oracle creates non-SYSTEM tablespaces to be localley managed by default. See OCP Oracle 9i Database: Fundamentals I, p. 153. Ad C: Renaming is not possible. Ad D: ? Ad E: ? 125. Which statement is true regarding enabling constraints? A. ENABLE NOVALIDATE is the default when a constraint is enabled. B. Enabling a constraint NOVALIDATE places a lock on the table. C. Enabling a UNIQUE constraint to VALIDATE does not check for constraint violation if the constraint is deferrable. D. A constraint that is currently disabled can be enabled in one of two ways: ENABLE NOVALIDATE or ENABLE VALIDATE. Answer: D Explanation: Constraint States Table constraints can be enabled and disabled using the CREATE TABLE or ALTER TABLE statement. In addition the VALIDATE or NOVALIDATE keywords can be used to alter the action of the state: (1) ENABLE VALIDATE is the same as ENABLE. The constraint is checked and is guaranteed to hold for all rows. (2) ENABLE NOVALIDATE means the constraint is checked for new or modified rows, but existing data may violate the constraint. (3) DISABLE NOVALIDATE is the same as DISABLE. The constraint is not checked so data may violate the constraint. (4) DISABLE VALIDATE means the constraint is not checked but disallows any modification of the constrained columns. 126. Which statement about the shared pool is true?
62
A. The shared pool CANNOT be dynamically resized. B. The shared pool contains only fixed structures. C. The shared pool consists of the library cache and buffer cache. D. The shared pool stores the most recently executed SQL statements and the most recently accessed data definitions. Answer: D Explanation: Ad C: False. The shared pool portion of the SGA contains three major areas: library cache, dictionary cache, and control structures. Ad D: True. In general, any item (shared SQL area or dictionary row) in the shared pool remains until it is flushed according to a modified LRU algorithm. The memory for items that are not being used regularly is freed if space is required for new items that must be allocated some space in the shared pool. (a58227.pdf) Pg. 158. (6-6) 127. As a DBA, one of your tasks is to periodically monitor the alert log file and the background trace files. In doing so, you notice repeated messages indicating that Log Writer (LGWR) frequently has to wait for a redo log group because a checkpoint has not completed or a redo log group has not been archived. What should you do to eliminate the wait LGWR frequently encounters? A. Increase the number of redo log groups to guarantee that the groups are always available to LGWR. B. Increase the size of the log buffer to guarantee that LGWR always has information to write. C. Decrease the size of the redo buffer cache to guarantee that LGWR always has information to write. D. Decrease the number of redo log groups to guarantee that checkpoints are completed prior to LGWR writing. Answer: A Explanation: You need to increase the number of redo log groups to guarantee that the groups are always available to LGWR. Log Writer (LGWR) frequently has to wait for a redo log group because a checkpoint has not completed or a redo log group has not been archived if there are not enough redo log groups or they are too small. Ad B: Increasing the size of the log buffer will not affect the checkpoint frequency. You can increase the redo log file size to eliminate the wait LGWR frequently encounters. Ad C: Decreasing the size of the redo buffer cache will not affect the checkpoint frequency. Ad D: Decreasing the number of redo log groups you will just make LGWR wait for a redo log group more frequently because a checkpoint has not completed or a redo log group has not been archived. 128. Which privilege is required to create a database? A. DBA B. SYSDBA C. SYSOPER D. RESOURCE Answer: B Explanation: You must have the OSDBA role enabled. The roles CONNECT, RESOURCE, DBA, EXP_FULL_DATABASE, and IMP_FULL_DATABASE are defined automatically for Oracle databases. These roles are provided for backward compatibility to earlier versions of Oracle and can be modified in the same manner as any other role in an Oracle database. See (a58227.pdf) Pg. 622. (26-16). Ad C: False. SYSOPER permits you to perform STARTUP, SHUTDOWN, ALTER DATABASE OPEN/MOUNT, ALTER DATABASE BACKUP, ARCHIVE LOG, and RECOVER, and includes the RESTRICTED SESSION privilege. Ad B: True. SYSDBA contains all system privileges with ADMIN OPTION, and the SYSOPER system privilege; permits CREATE DATABASE and time-based recovery. See (a58227.pdf) Pg. 637. (25-7). 129. Which structure provides for statement-level read consistency? A. undo segments B. redo log files C. data dictionary tables
63
D. archived redo log files Answer: A Explanation: Oracle7 Server Concepts 10-6 Statement Level Read Consistency Oracle always enforces statement-level read consistency. This guarantees that the data returned by a single query is consistent with respect to the time that the query began. Therefore, a query never sees dirty data nor any of the changes made by transactions that commit during query execution. As query execution proceeds, only data committed before the query began is visible to the query. The query does not see changes committed after statement execution begins. A consistent result set is provided for every query, guaranteeing data consistency, with no action on the user’s part. The SQL statements SELECT, INSERT with a query, UPDATE, and DELETE all query data, either explicitly or implicitly, and all return consistent data. Each of these statements uses a query to determine which data it will affect (SELECT, INSERT, UPDATE, or DELETE, respectively). A SELECT statement is an explicit query and may have nested queries or a join operation. An INSERT statement can use nested queries. UPDATE and DELETE statement can use WHERE clauses or subqueries to affect only some rows in a table rather than all rows. While queries used in INSERT, UPDATE, and DELETE statements are guaranteed a consistent set of results, they do not see the changes made by the DML statement itself. In other words, the data the query in these operations sees reflects the state of the data before the operation began to make changes. For this purpose only the undo segments are necessary from the possible answers. 130. You just issued the STARTUP command. Which file is checked to determine the state of the database? A. the control file B. the first member of redo log file group 1 C. the data file belonging to the SYSTEM tablespace D. the most recently created archived redo log file Answer: A Explanation: Oracle9i Database Administrator’s Guide Release 2 (9.2) March 2002 Part No. A96521-01 (a96521.pdf) 4-16 Quiescing a Database There are times when there is a need to put a database into a state where only DBA transactions, queries, fetches, or PL/SQL statements are allowed. This is called a quiesced state, in the sense that there are no ongoing non-DBA transactions, queries, fetches, or PL/SQL statements in the system. This quiesced state allows you or other administrators to perform actions that cannot safely be done otherwise. Placing a Database into a Quiesced State To place a database into a quiesced state, issue the following statement: ALTER SYSTEM QUIESCE RESTRICTED; Viewing the Quiesce State of an Instance The V$INSTANCE view can be queried to see the current state of an instance. It contains a column named ACTIVE_STATE, whose values are shown in the following table: ACTIVE_STATE NORMAL QUIESCING QUIESCED
Description Normal unquiesced state Being quiesced, but there are still active non-DBA sessions running Quiesced, no active non-DBA sessions are active or allowed
Since the state can be queried, I believe it’s really in a control file. 131. Which two are true about the data dictionary views with prefix USER_? (Choose two.) A. The column OWNER is implied to be the current user. B. A user needs the SELECT ANY TABLE system privilege to query these views. C. The definitions of these views are stored in the user's default tablespace. D. These views return information about all objects to which the user has access.
64
E. Users can issue an INSERT statement on these views to change the value in the underlying base tables. F. A user who has the CREATE PUBLIC SYNONYM system privilege can create public synonyms for these views. Answer: A, F Explanation: Ad A: True. Views with the prefix USER usually exclude the column OWNER. This column is implied in the USER views to be the user issuing the query. See (a58227.pdf) Pg. 137. (4-5) have columns identical to the other views, except that the column OWNER is implied the current user. See (a58227.pdf) Pg. 138. (4-6). Ad B: False. The data dictionary views accessible to all users of an Oracle Server. Most views can be accessed by any user with the CREATE_SESSION privilege. The data dictionary views that begin with DBA_ are restricted. These views can be accessed only by users with the SELECT_ANY_TABLE privilege. This privilege is assigned to the DBA role when the system is initially installed. See (a58242.pdf) pg. 171 (2-1). Ad C: False. The data dictionary is always available when the database is open. It resides in the SYSTEM tablespace, which is always online. See (a58227.pdf) Pg. 137. (4-5). Ad D: False. These views do not return information about all objects to which the user has access. The data dictionary views with prefix ALL_ provide this access. Ad E: False. Any Oracle user can use the data dictionary as a read-only reference for information about the database. See (a58227.pdf) Pg. 135. (4-3). Ad F: True. 132. An Oracle instance is executing in a nondistributed configuration. The instance fails because of an operating system failure. Which background process would perform the instance recovery when the database is reopened? A. PMON B. SMON C. RECO D. ARCn E. CKPT Answer: B Explanation: SMON (Oracle System MONitor) SMON is an Oracle background process created when you start a database http://www.orafaq.com/glossary/faqglosd.htm instance http://www.orafaq.com/glossary/faqglosi.htm. The SMON process performs instance http://www.orafaq.com/glossary/faqglosi.htm recovery, cleans up after dirty shutdowns and coalesces adjacent free extents into larger free extents. PMON (Oracle Process MONitor) PMON is an Oracle background process created when you start a database http://www.orafaq.com/glossary/faqglosd.htm instance http://www.orafaq.com/glossary/faqglosi.htm. The PMON process will free up resources if a user http://www.orafaq.com/glossary/faqglosu.htm process fails (eg. release database http://www.orafaq.com/glossary/faqglosd.htm locks). RECO (Oracle RECOverer Process) RECO is an Oracle background process created when you start an instance http://www.orafaq.com/glossary/faqglosi.htm with DISTRIBUTED_TRANSACTIONS= in the INIT.ORA http://www.orafaq.com/glossary/faqglosi.htm file http://www.orafaq.com/glossary/faqglosf.htm. The RECO process will try to resolve in-doubt transactions across Oracle distributed databases. ARCH (Oracle ARCHiver Process) ARCH is an Oracle background process created when you start an instance http://www.orafaq.com/glossary/faqglosi.htm in ARCHIVE LOG MODE. The ARCH process will archive on-line redo log http://www.orafaq.com/glossary/faqglosr.htm files to some backup http://www.orafaq.com/glossary/faqglosb.htm media. CKPT CKPT (Oracle http://www.orafaq.com/glossary/faqgloso.htm Checkpoint http://www.orafaq.com/glossary/faqglosc.htm Process) is the Oracle http://www.orafaq.com/glossary/faqgloso.htm background process that timestams all datafiles and control files to indicate that a checkpoint http://www.orafaq.com/glossary/faqglosc.htm has occurred 133. Your database contains a locally managed uniform sized tablespace with automatic segment-space management, which contains only tables. Currently, the uniform size for the tablespace is 512 K.
65
Because the tables have become so large, your configuration must change to improve performance. Now the tables must reside in a tablespace that is locally managed, with uniform size of 5 MB and automatic segment-space management. What must you do to meet the new requirements? A. The new requirements cannot be met. B. Re-create the control file with the correct settings. C. Use the ALTER TABLESPACE command to increase the uniform size. D. Create a new tablespace with correct settings then move the tables into the new tablespace. Answer: D Explanation: Ad A: False. The new requirements can be met by creating a new tablespace with correct settings and by moving the tables into the new tablespace. Ad B: False. It’s wrong way to recreate control files. You will need that when you will create new tablespace with new uniform size to save changes in the control files. But changing the control files themselves will not fix the issue. Ad C: False. You cannot dynamically change the uniform size. 134. You created a tablespace SH_TBS. The tablespace consists of two data files: sh_tbs_datal .dbf and sh_tbs_data2.dbf. You created a nonpartitioned table SALES_DET in the SH_TBS tablespace. Which two statements are true? (Choose two.) A. The data segment is created as soon as the table is created. B. The data segment is created when the first row in the table is inserted. C. You can specify the name of the data file where the data segment should be stored. D. The header block of the data segment contains a directory of the extents in the segment. Answer: A, D Explanation: Ad A: True. Every nonclustered table or partition and every cluster in an Oracle database has a single data segment to hold all of its data. Oracle creates this data segment when you create the nonclustered table or cluster with the CREATE command. If the table or index is partitioned, each partition is stored in its own segment. See: Oracle8 Concepts Release 8.0 December, 1997 Part No. A58227-01 (a58227.pdf) pg. 107. (2-15). Ad B: False. because of the previous. Ad C: False. Ad D: True. For maintenance purposes, the header block of each segment contains a directory of the extents in that segment. See: Oracle8 Concepts Release 8.0 December, 1997 Part No. A58227-01 (a58227.pdf) pg. 103. (2-11). 135. The DBA can structure an Oracle database to maintain copies of online redo log files to avoid losing database information. Which three are true regarding the structure of online redo log files? (Choose three.) A. Each online redo log file in a group is called a member. B. Each member in a group has a unique log sequence number. C. A set of identical copies of online redo log files is called an online redo log group. D. The Oracle server needs a minimum of three online redo log file groups for the normal operation of a database. E. The current log sequence number of a redo log file is stored in the control file and in the header of all data files. F. The LGWR background process concurrently writes the same information to all online and archived redo log files in a group. Answer: A, C, E Explanation: http://www.siue.edu/~dbock/cmis565/ch7-redo_log.htm Each Redo Log Group has identical Redo Log Files. The LGWR concurrently writes identical information to each Redo Log File in a Group. The Oracle Server needs a minimum of two online Redo Log Groups for normal database operation. Thus, if Disk 1 crashes as shown in the figure above, none of the Redo Log Files are truly lost because there are duplicates. If the group has more members, you need more disk drives!
66
If possible, you should separate the Online Redo Log Files from the Archive Log Files as this reduces contention for the I/O buss path between the ARCn and LGWR background processes. You should also separate Datafiles from the Online Redo Log Files as this reduces LGWR and DBWn contention. It also reduces the risk of losing both Datafiles and Redo Log Files if a disk crash occurs. Redo Log Files in a Group are called Members. Each Group Member has identical log sequence numbers and is the same size - they cannot be different sizes. The log sequence number is assigned by the Oracle Server as it writes to a log group and the current log sequence number is stored in the control files and in the header information of all Datafiles - this enables synchronization between Datafiles and Redo Log Files. Plus: Archived Redo logs are not used: F is not OK. 136. Which three statements are true about the use of online redo log files? (Choose three.) A. Redo log files are used only for recovery. B. Each redo log within a group is called a member. C. Redo log files are organized into a minimum of three groups. D. An Oracle database requires at least three online redo log members. E. Redo log files provide the database with a read consistency method. F. Redo log files provide the means to redo transactions in the event of an instance failure. Answer: A, B, F Explanation: Ad A: True. The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to a database’s datafiles. See (a58227.pdf) Pg. 46. (1-12) Ad C: False. Every Oracle database has a set of two or more redo log files. 2 files can not be organized to 3 groups See (a58227.pdf) Pg. 46. (1-12) Ad D: False. There is requirement to have at least TWO, not three redo log groups in Oracle. Ad E: False. Every database contains one or more rollback segments, which are portions of the database that record the actions of transactions in the event that a transaction is rolled back. You use rollback segments to provide read consistency, rollback transactions, and recover the database. (a58227.pdf) Pg. 109. (2-17) 137. Which steps should you follow to increase the size of the online redo log groups? A. Use the ALTER DATABASE RESIZE LOGFILE GROUP command for each group to be resized. B. Use the ALTER DATABASE RESIZE LOGFILE MEMBER command for each member within the group being resized. C. Add new redo log groups using the ALTER DATABASE ADD LOGFILE GROUP command with the new size. Drop the old redo log files using the ALTER DATABASE DROP LOGFILE GROUP command. D. Use the ALTER DATBASE RESIZE LOGFILE GROUP command for each group to be resized. Use the ALTER DATABASE RESIZE LOGFILE MEMBER command for each member within the group. Answer: C Explanation: Ad A: There is no ALTER DATABASE RESIZE LOGFILE GROUP command in Oracle. Ad B: There is no ALTER DATABASE RESIZE LOGFILE MEMBER command in Oracle. Ad C: To increase the size of the online redo log groups you need first to add new redo log groups using the ALTER DATABASE ADD LOGFILE GROUP with increased size of redo log group members. After that you can change status of redo log group with small size of file by using command ALTER SYSTEM SWITCH LOGFILE and than drop the old redo log files using the ALTER DATABASE DROP LOGFILE GROUP command. Ad D: There are no ALTER DATABASE RESIZE LOGFILE GROUP and ALTER DATABASE RESIZE LOGFILE MEMBER commands in Oracle. 138. Oracle guarantees read-consistency for queries against tables. What provides read-consistency? A. redo logs B. control file C. undo segments D. data dictionary
67
Answer: C Explanation: Ad A: False. The information in a redo log file is used only to recover the database from a system or media failure that prevents database data from being written to a database’s datafiles. See (a58227.pdf) Pg. 46. (1-12). Ad B: False. The control file of a database is a small binary file necessary for the database to start and operate successfully. (a58227.pdf) pg. 693. (28-19). Ad C: True. Every database contains one or more rollback segments, which are portions of the database that record the actions of transactions in the event that a transaction is rolled back. You use rollback segments to provide read consistency, rollback transactions, and recover the database. (a58227.pdf) Pg. 109. (2-17). Ad D: False. Each Oracle database has a data dictionary. An Oracle data dictionary is a set of tables and views that are used as a read-only reference about the database. For example, a data dictionary stores information about both the logical and physical structure of the database. (a58227.pdf) Pg. 81, 134 (1-47, 4-1). 139. You need to shut down your database. You want all of the users who are connected to be able to complete any current transactions. Which shutdown mode should you specify in the SHUTDOWN command? A. ABORT B. NORMAL C. IMMEDIATE D. TRANSACTIONAL Answer: D Explanation: Ad A: False. This option of the SHUTDOWN command is used for emergency database shutdown. Ad B: False. Normal database shutdown proceeds with the following conditions: (a) No new connections are allowed after the statement is issued. (b) Before the database is shut down, Oracle waits for all currently connected users to disconnect from the database. (c) The next startup of the database will not require any instance recovery proce-dures. Ad C: False. Immediate database shutdown proceeds with the following conditions: (a) Current client SQL statements being processed by Oracle are terminated immediately. (b) Any uncommitted transactions are rolled back. If long uncommitted transactions exist, this method of shutdown might not complete quickly, despite its name. (c) Oracle does not wait for users currently connected to the database to disconnect. (d) Oracle implicitly rolls back active transactions and disconnects all connected users. Ad D: True. After submitting this statement, no client can start a new transaction on this particular instance. If a client attempts to start a new transaction, they are disconnected. After all transactions have either committed or aborted, any client still connected to the instance is disconnected. At this point, the instance shuts down just as it would when a SHUTDOWN IMMEDIATE statement is submitted. A transactional shutdown prevents clients from losing work, and at the same time, does not require all users to log off. See (a58397.pdf) Pg. 78. (3-8) 140. You decided to use multiple buffer pools in the database buffer cache of your database. You set the sizes of the buffer pools with the DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE parameters and restarted your instance. What else must you do to enable the use of the buffer pools? A. Re-create the schema objects and assign them to the appropriate buffer pool. B. List each object with the appropriate buffer pool initialization parameter. C. Shut down the database to change the buffer pool assignments for each schema object. D. Issue the ALTER statement and specify the buffer pool in the BUFFER_POOL clause for the schema objects you want to assign to each buffer pool. Answer: D Explanation: Ad A: False. It is not required to recreate the schema objects to assign them to the appropriate buffer pool. You can do that with ALTER TABLE command. Ad B: False. You don’t need to list each object with the appropriate buffer pool initialization parameter. By default object is stored in the DEFAULT buffer pool.
68
Ad C: False. To change the buffer assignments for each schema object from DEFAULT to KEEP or RECYCLE you need just use ALTER TABLE command. You don’t need to restart database to enforce these changes. Ad D: True. Unlike DB_BLOCK_BUFFERS, which specifies the number of data block-sized buffers that can be stored in SGA, Oracle9i introduces a new parameter, DB_CACHE_SIZE, which can be used to specify the size of the buffer cache in the Oracle SGA. There are two other parameters used to set KEEP and RECYCLE parts of the buffer pools: DB_KEEP_CACHE_SIZE and DB_RECYCLE_CACHE_SIZE. To enable the use of the buffer pools you need to issue the ALTER statement and specify the buffer pool (or exact part of buffer pool, DEFAULT, KEEP or RECYCLE) in the BUFFER_POOL clause for the schema objects you want to assign to each buffer pool. Syntax of these statements: ALTER TABLE table_name STORAGE (BUFFER_POOL DEFAULT), ALTER TABLE table_name STORAGE (BUFFER_POOL KEEP) or ALTER TABLE table_name STORAGE (BUFFER_POOL RECYCLE). OCA Oracle 9i Associate DBA Certification Exam Guide, Jason Couchman, p. 544-547, Chapter 10: Basics of the Oracle Database Architecture 141. A user calls and informs you that a 'failure to extend tablespace' error was received while inserting into a table. The tablespace is locally managed. Which three solutions can resolve this problem? (Choose three.) A. add a data file to the tablespace B. change the default storage clause for the tablespace C. alter a data file belonging to the tablespace to autoextend D. resize a data file belonging to the tablespace to be larger E. alter the next extent size to be smaller, to fit into the available space Answer: A, C, D Explanation: Ad A, C, D: You can add a data file to the tablespace, alter a data file belonging to the tablespace to extend automatically, resize a data file belonging to the tablespace to be larger. Ad B: False. Changing the default storage of the tablespace will not solve the problem. Ad E: False. If you alter the next extent size to be smaller and insert data into a table, but it’s just temporary decision of problem: error will be generated again when the size of next extents will grow to fit the segment. OCA Oracle 9i Associate DBA Certification Exam Guide, Jason Couchman, p. 637-640, Chapter 12: Managing Tablespaces and Datafiles 142. Which table type should you use to provide fast key-based access to table data for queries involving exact matches and range searches? A. regular table B. clustered table C. partitioned table D. index-organized table Answer: D Explanation: Ad A: Regular table will require indexes to provide fast key-based access to table data for queries involving exact matches and range searches. Ad B: False. Clusters are an optional method of storing table data. Clusters are groups of one or more tables physically stored together because they share common columns and are often used together. Because related rows are physically stored together, disk access time improves. (a58227.pdf) Pg. 79. (1-45). Ad C: False. Partitioning addresses the key problem of supporting very large tables and indexes by allowing you to decompose them into smaller and more manageable pieces called partitions. Once partitions are defined, SQL statements can access and manipulate the partitions rather than entire tables or indexes. Partitions are especially useful in data warehouse applications, which commonly store and analyze large amounts of historical data. All partitions of a table or index have the same logical attributes, although their physical attributes can be different. For example, all partitions in a table share the same column and constraint definitions; and all partitions in an index share the same index columns. However, storage specifications and other physical attributes such as PCTFREE, PCTUSED, INITRANS, and MAXTRANS can vary for different partitions of the same table or index. Each partition is stored in a separate segment. Optionally, you can store each partition in a separate tablespace. See (a58227.pdf) Pg. 244. (9-2).
69
Ad D: True. An index-organized table differs from a regular table in that the data for the table is held in its associated index. Changes to the table data, such as adding new rows, updating rows, or deleting rows, result only in updating the index. The index-organized table is like a regular table with an index on one or more of its columns, but instead of maintaining two separate storages for the table and the B*-tree index, the database system only maintains a single B*-tree index which contains both the encoded key value and the associated column values for the corresponding row. Benefits of Index-Organized Tables Because rows are stored in the index, index-organized tables provide a faster key-based access to table data for queries involving exact match and/or range search. (a58227.pdf) Pg. 229. (8-29). 143. You issue the following queries to obtain information about the redo log files: SQL> SELECT group#, type, member FROM v$logfile;
GROUP#
TYPE
MEMBER
1 1 2 2 3 3
ONLINE ONLINE ONLINE ONLINE ONLINE ONLINE
/databases/DB01/ORADATA/u02/log1a.rdo /databases/DB01/ORADATA/u03/log1b.rdo /databases/DB01/ORADATA/u02/log2a.rdo /databases/DB01/ORADATA/u03/log2b.rdo /databases/DB01/ORADATA/u02/log3a.rdo /databases/DB01/ORADATA/u03/log3b.rdo
SQL> SELECT group#, sequence#, status FROM v$log;
GROUP# 1 2 3
SEQUENCE# 250 251 249
STATUS INACTIVE CURRENT INACTIVE
You immediately issue this command: ALTER DATABASE DROP LOGFILE MEMBER
'/databases/DB01/ORADATA/u03/log2b.rdo';
Why does the command fail? A. Each online redo log file group must have two members. B. You cannot delete any members of online redo log file groups. C. You cannot delete any members of the current online redo log file group D. You must delete the online redo log file in the operating system before issuing the ALTER DATABASE command. Answer: C Explanation: Oracle9i Database Concepts Release 2 (9.2) March 2002 Part No. A96524-01 (a96524.pdf) 9-41 DROP LOGFILE Clause Use the DROP LOGFILE clause to drop all members of a redo log file group. Specify a redo log file group as indicated for the ADD LOGFILE MEMBER clause. (a) To drop the current log file group, you must first issue an ALTER SYSTEM SWITCH LOGFILE statement. (b) You cannot drop a redo log file group if it needs archiving. (c) You cannot drop a redo log file group if doing so would cause the redo thread to contain less than two redo log file groups. See Also: ALTER SYSTEM on page 10-22 and "Dropping Log File Members: Example" on page 9-54 If you execute switch logfile, then the current logfile will be different, so answer C is ok. 144. Which statement about an Oracle instance is true? A. The redo log buffer is NOT part of the shared memory area of an Oracle instance. B. Multiple instances can execute on the same computer, each accessing its own physical database. C. An Oracle instance is a combination of memory structures, background processes, and user processes.
70
D. In a shared server environment, the memory structure component of an instance consists of a single SGA and a single PGA. Answer: B Not completely sure about D. Explanation: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c06start.htm#8106. Multiple instances can run concurrently on the same computer, each accessing its own physical database. In clustered and massively parallel systems (MPS), Real Application Clusters enables multiple instances to mount a single database. Ad A: False. The redo log buffer is a circular buffer in the SGA that holds information about changes made to the database. See (a58227.pdf) Pg. 158, 144. (6-6, 5-2). Ad C: False. Oracle allocates a memory area called the System Global Area (SGA) and starts one or more Oracle processes. This combination of the SGA and the Oracle processes is called an Oracle instance. See (a58227.pdf) Pg. 144. (5-2). Ad D: True/False. ??? A PGA is nonshared memory area to which a process can write. One PGA is allocated for each server process; the PGA is exclusive to that server process and is read and written only by Oracle code acting on behalf of that process. A PGA is allocated by Oracle when a user connects to an Oracle database and a session is created, though this varies by operating system and configuration. The basic memory structures associated with Oracle include: (a) Software Code Areas (b) System Global Area (SGA): the database buffer cache, the redo log buffer, the shared pool (c) Program Global Areas (PGA): the stack areas, the data areas, Sort Areas See (a58227.pdf) Pg. 154. (6-2) 145. The current password file allows for five entries. New DBAs have been hired and five more entries need to be added to the file, for a total of ten. How can you increase the allowed number of entries in the password file? A. Manually edit the password file and add the new entries. B. Alter the current password file and resize if to be larger. C. Add the new entries; the password file will automatically grow. D. Drop the current password file, recreate it with the appropriate number of entries and add everyone again. Answer: D Explanation: You can create a password file using the password file creation utility, ORAPWD or, for selected operating systems, you can create this file as part of your standard installation. ENTRIES: This parameter sets the maximum number of entries allowed in the password file. This corresponds to the maximum number of distinct users allowed to connect to the database as SYSDBA or SYSOPER. If you ever need to exceed this limit, you must create a new password file. It is safest to select a number larger than you think you will ever need. See (a58397.pdf) Pg. 39, 41. (1-9, 1-11). 146. ABC Company consolidated into one office building, so the very large EMPLOYEES table no longer requires the OFFICE_LOCATION column. The DBA decided to drop the column using the syntax below: ALTER TABLE hr.employees DROP COLUMN building_location CASCADE CONSTRAINTS; Dropping this column has turned out to be very time consuming and is requiring a large amount of undo space. What could the DBA have done to minimize the problem regarding time and undo space consumption? A. Use the Export and Import utilities to bypass undo. B. Mark the column as UNUSED. Remove the column at a later time when less activity is on the system. C. Drop all indexes and constraints associated with the column prior to dropping the column.
71
D. Mark the column INVALID prior to beginning the drop to bypass undo. Remove the column using the DROP UNUSED COLUMNS command. E. Add a checkpoint to the DROP UNUSED COLUMNS command to minimize undo space. Answer: E Testking said B. Explanation: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96521/tables.htm#5508. Removing Unused Columns The ALTER TABLE ... DROP UNUSED COLUMNS statement is the only action allowed on unused columns. It physically removes unused columns from the table and reclaims disk space. In the example that follows the optional keyword CHECKPOINT is specified. This option causes a checkpoint to be applied after processing the specified number of rows, in this case 250. Checkpointing cuts down on the amount of undo logs accumulated during the drop column operation to avoid a potential exhaustion of undo space. ALTER TABLE hr.admin_emp DROP UNUSED COLUMNS CHECKPOINT 250; 147. User A issues this command: UPDATE emp SET id=200 WHERE id=1 Then user B issues this command: UPDATE emp SET id=300 WHERE id=1 User B informs you that the UPDATE statement seems to be hung. How can you resolve the problem so user B can continue working? A. no action is required B. ask user B to abort the statement C. ask user A to commit the transaction D. ask user B to commit the transaction Answer: C Explanation: Because of the consistency, while a transaction not committed no one else can modify the same columns. Ad A: False. This situation requires DBA intervention if session of user A keeps EMP table locked for other users updates during a long time. Ad B: False. User A needs to commit UPDATE command to resolve this issue. User B does not need to abort the transaction. Ad D: False. User B cannot commit his/her transaction before user A commits his/her transaction. 148. Anne issued this SQL statement to grant Bill access to the CUSTOMERS table in Anne's schema: GRANT SELECT ON customers TO bill WITH GRANT OPTION; Bill issued this SQL statement to grant Claire access to the CUSTOMERS table in Anne's schema: GRANT SELECT ON anne.customers TO claire; Later, Anne decides to revoke the select privilege on the CUSTOMERS table from Bill. Which statement correctly describes both what Anne can do to revoke the privilege, and the effect of the REVOKE command? A. Anne can run the REVOKE SELECT ON customers FROM bill statement. Both Bill and Claire lose their access to the customers table. B. Anne can run the REVOKE SELECT ON customers FROM bill statement. Bill loses access to the CUSTOMERS table, but Claire will keep her access. C. Anne cannot run the REVOKE SELECT ON customers from BILL statement unless Bill first revokes Claire's access to the CUSTOMERS table. D. Anne must run the REVOKE SELECT ON customers FROM bill CASCADE statement. Both Bill and Claire lose their access to the ri ISTOMERS table.
72
Answer: A Explanation: Anne can run the REVOKE SELECT ON customers FROM bill statement. Both Bill and Claire lose their access to the CUSTOMERS table because of cascade revoking of privilege. Ad A: True. Anne can run the REVOKE SELECT ON customers FROM bill statement. Both Bill and Claire lose their access to the CUSTOMERS table because of cascade revoking of privilege. Ad B: False. Both Bill and Claire lose their access to the CUSTOMERS table, not only Bill. Ad C: False. Anne can run the REVOKE SELECT ON customers FROM bill statement. There is no limitation in Oracle that Bill needs first to revoke Claire's access to the CUSTOMERS table if Anne granted this privilege to Bill WITH GRANT OPTION. Ad D: False. Anne can revoke the privilege from the Bill and Claire just with REVOKE command. There is no CASCADE clause in the REVOKE command. But the CASCADE CONSTRAINTS optional clause requires if you are revoking the REFERENCES privilege. In our case it is not required. 149. John has created a procedure named SALARY_CALC. Which SQL query allows him to view the text of the procedure? A. SELECT text FROM user_source WHERE name = 'SALARY_CALC'; B. SELECT * FROM user_source WHERE source_name = 'SALARY_CALC'; C. SELECT * FROM user_objects WHERE object_name = 'SALARY_CALC'; D. SELECT * FROM user_procedures WHERE object_name = 'SALARY_CALC'; E. SELECT text FROM user_source WHERE name = 'SALARY_CALC' AND owner = 'JOHN'; Answer: A Explanation: SQL> desc user_source Name NAME TYPE LINE TEXT
Null?
Type VARCHAR2(30) VARCHAR2(12) NUMBER VARCHAR2(4000)
150. Which statement should you use to obtain information about the number, names, status, and location of the control files? A. SELECT name, status FROM v$parameter; B. SELECT name, status FROM v$controlfile; C. SELECT name, status, location FROM v$control_files; D. SELECT status, location FROM v$parameter WHERE parameter=control_files; Answer: B Explanation: Ad A: False. V$PARAMETER This view lists information about initialization parameters. See (a58242.pdf) Pg. 402. Ad B: True. V$CONTROLFILE This view lists the names of the control files. See (a58242.pdf) Pg. 360. Ad C: False. v$control_files does not exist. See (a58242.pdf). Ad D: False. V$PARAMETER This view lists information about initialization parameters, it has no parameter column. See (a58242.pdf) Pg. 402. 151. You need to make one of the data file of the PROD_TBS tablespace auto extensible. You issue this SQL command: ALTER TABLESPACE prod_tbs DATAFILE '/uo1/private/oradata/prod.dbf' AUTOEXTEND ON; Which error occurs? A. ORA 02789 Max number of files reached. B. ORA 03280 Invalid DATAFILE filename specified.
73
C. ORA 03283 SPECIFIED DATAFILE STRING does not exist. D. ORA 02142 Missing or invalid ALTER TABLESPACE option. E. ORA 01516 Non existent log file, data file or tempfile 'string'. F. ORA 03244 No free space found to place the control information. G. ORA 00238 Operation would reuse a filename that is part of the database. Answer: D Explanation: Try it! See OCP Oracle 9i Database: Fundamentals I, p. 162.: The correct statement should be: ALTER DATABASE DATAFILE '/uo1/private/oradata/<filename>' AUTOEXTEND ON; 152. You issue this command: STARTUP MOUNT Which three events occour when the instance is started and the database is mounted? (Choose three) A. The SGA is allocated. B. The control file is opened. C. The background process is started. D. The existence of the datafile is verified. E. The existence of the online redo log file is verified. Answer: A, B, C Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 56.: A and C already occur with NOMOUNT option. B also occurs with the MOUNT option. With this option, the control file is read (!) to obtain the names and status of the datafiles and the redo log files. Ad D, E: datafiles and redo log files are opened (and therefore checked) with the OPEN option. 153. You are creating a data base manually and you need to limit the number of initial online redo log groups and members. Which two keywords should you use within the create database command to define the maximum number of online redo log files? (Choose two). A. MAXLOGMEMBERS, which determines the maximum number of members per group. B. MAXREDOLOGS, which specifies the maximum number of online redo log files. C. MAXLOGFILES, which determines the absolute maximum of online redo log groups. D. MAXLOGGROUPS, which specifies the maximum number of online redo log files, groups and members. Answer: A, C Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 77f.: The MAXLOGFILES option defines the maximum number of redo log file groups and the MAXLOGMEMBERS option defines the maximum number of members for a redo log file group that can be created in the database. The other options (MAXREDOLOGS, MAXLOGGROUPS) do not exist. 154. Which four do you find in the alert log file ? (Choose four) A. An entry for creation for a user. B. An entry for creation of a table. C. An entry for creation of a tablespace. D. An entry for the startup of the instance. E. An entry indicating a log switch has occured. F. A list of the values of an undefault initialization parameter at the time the instance starts. Answer: C, D, E, F
74
Explanation: CREATE USER and CREATE TABLE do not produce an entry in the alert log file. See OCP Oracle 9i Database: Fundamentals I, p. 64.: The alert log stores information that is extremely useful in order to know the health of the database. It records the starting and stopping of the databases, creation of new redo log file (which happens every time a log switch occurs), creation of tablespaces, addition of new datafiles to the tablespaces, and most importantly the errors that are generated by Oracle. 155. You need to determine the amount of space currently used in each tablespace. You can retrieve this information in a single SQL statment using only one DBA view in the FROM clause providing you use either the _______ or _______ DBA view. A.DBA_EXTENTS. B.DBA_SEGMENTS. C.DBA_DATA_FILES. D.DBA_TABLESPACES. Answer: A, C Explanation: See OCP Oracle 9i Database: Fundamentals I, p. 211
75
Related Documents