Sunday, August 20, 2006

Fundamentals I -Ch5 - Control and Redo Log Files

Chapter 5 - Control and Redo Log Files


OCA/OCP: Oracle9i DBA Fundamentals I Study Guide
by Biju Thomas and Bob Bryla



Review Questions


1. Which method is best for renaming a control file?


A. Use the ALTER DATABASE RENAME FILE command.
B. Shut down the database, rename the control file by using an operating system command, and restart the database after changing the CONTROL_FILES parameter in the initialization parameter file.
C. Put the database in RESTRICTED mode and issue the ALTER DATABASE RENAME FILE command.
D. Shut down the database, change the CONTROL_FILES parameter, and start up the database.
E. Re-create the control file using the new name.

To rename (or multiplex, or drop) a control file, you shut down the database, rename (or copy, or delete) the control file by using operating systems commands, change the parameter CONTROL_FILES in the initialization parameter file, and start up the database.
Ans: B.



2. Which piece of information is not available in the control file?


A. Instance name
B. Database name
C. Tablespace names
D. Log sequence number
----
The instance name is not in the control file. The control file has information about the physical database structure.
Ans: A.


3. When you create a control file, the database has to be:


A. Mounted
B. Not mounted
C. Open
D. Restricted
-----
The database should be in the NOMOUNT state to create a control file. When you mount the database, Oracle tries to open the control file to read the physical database structure.
Ans: B.


4. Which data dictionary view provides the names of the control files?


A. V$DATABASE
B. V$INSTANCE
C. V$CONTROLFILESTATUS
D. None of the above
----
The V$CONTROLFILE view shows the names of the control files in the database.
Ans: D.


5. The initialization parameter FAST_START_MTTR_TARGET has been set to 500. What does this mean?


A. A checkpoint will occur every 500 seconds regardless of database activity.
B. A checkpoint will occur after writing 500 blocks to the redo log file.
C. Upon instance startup, the database will not be ready for connections for at least 500 seconds while instance recovery is performed by SMON.
D. Recovery from an instance failure should not take more than 500 seconds.
---
Oracle will automatically adjust other parameters (buffer sizes, intervals, and so on) to ensure that instance recovery will not exceed a specified number of seconds.
Ans: D.


6. Which data dictionary view shows that the database is in ARCHIVELOG mode?


A. V$INSTANCE
B. V$LOG
C. V$DATABASE
D. V$THREAD
---
The V$DATABASE view shows whether the database is in ARCHIVELOG mode or in NOARCHIVELOG mode.
Ans: C.


7. What is the biggest advantage of having the control files on different disks?


A. Database performance.
B. Guards against failure.
C. Faster archiving.
D. Writes are concurrent, so having control files on different disks speeds up control file writes.
-----
Having the control files on different disks ensures that even if you lose one disk, you lose only one control file. If you lose one of the control files, you can shut down the database, copy a control file, or change the CONTROL_FILES parameter and restart the database.
Ans: B.


8. Which file records all changes made to the database and is used only when recovering an instance?


A. Archive log file
B. Redo log file
C. Control file
D. Alert log file
----
The redo log file records all changes made to the database. The LGWR process writes the redo log buffer entries to the redo log files. These entries are used to roll forward, or to update, the data files during an instance recovery. Archive log files are used for media recovery.
Ans: B.


9. What will happen if ARCn could not write to a mandatory archive destination?


A. The database will hang.
B. The instance will shut down.
C. ARCn starts writing to LOG_ARCHIVE_DUPLEX_DEST if it is specified.
D. Oracle stops writing the archived log files.
----
Oracle will write a message to the alert file, and all database operations will be stopped. Database operation resumes automatically after successfully writing the archived log file. If the archive destination becomes full, you can make room for archives either by deleting the archive log files after copying them to a different location or by changing the parameter to point to a different archive location.
Ans: A.


10. How many ARCn processes can be associated with an instance?


A. Five
B. Four
C. Ten
D. Operating system dependent
----
You can have a maximum of ten archiver processes.
Ans: C.



11. Which of the following is an invalid status code in the V$LOGFILE view?


A. STALE
B. Blank
C. ACTIVE
D. INVALID
----

The STATUS column in V$LOGFILE can have the values INVALID (file is not accessible), STALE (file’s contents are incomplete), DELETED (file is no longer used), or blank (file is in use).

Ans: C.


12. If you have two redo log groups with four members each, how many disks does Oracle recommend to keep the redo log files?


A. Eight
B. Two
C. One
D. Four
----
Oracle recommends that you keep each member of a redo log group on a different disk. You should have a minimum of two redo log groups, and it is recommended that you have two members in each group. The maximum number of redo log groups is determined by the MAXLOGFILES database parameter. The MAXLOGMEMBERS database parameter specifies the maximum number of members per group.
Ans: D.


13. What will happen if you issue the following command?


ALTER DATABASE ADD LOGFILE
(‘/logs/file1’ REUSE, ‘/logs/file2’ REUSE);

A. Statement will fail, because the group number is missing
B. Statement will fail, because log file size is missing
C. Creates a new redo log group, with two members
D. Adds two members to the current redo log group
----
The statement creates a new redo log group with two members. When you specify the GROUP option, you must use an integer value. Oracle will automatically generate a group number if the GROUP option is not specified. Use the SIZE option if you are creating a new file. Use the REUSE option if the file already exists.

Ans: C.


14. Which two parameters cannot be used together to specify the archive destination?


A. LOG_ARCHIVE_DEST and LOG_ARCHIVE_DUPLEX_DEST
B. LOG_ARCHIVE_DEST and LOG_ARCHIVE_DEST_1
C. LOG_ARCHIVE_DEST_1 and LOG_ARCHIVE_DEST_2
D. None of the above; you can specify all the archive destination parameters with valid destination names.
-----
When using a LOG_ARCHIVE_DEST_n parameter, you cannot use the LOG_ARCHIVE_DEST or LOG_ARCHIVE_DUPLEX_DEST parameters to specify other archive locations. Using a LOG_ARCHIVE_DEST_n parameter, you can specify as many as five archiving locations.
Ans: B.


15. Which of the following statements is NOT true regarding the use of OMF for redo logs?


A. Dropping log files with OMF automatically drops the related operating system file.
B. OMF manages archived redo log files using the initialization parameter DB_CREATE_ARCHIVE_LOG_DEST_n.
C. A new log file group can be added without specifying a filename in the ALTER DATABASE statement.
D. A log file group managed with OMF can be dropped by specifying only the log group number.
----
You canot manage archived redo logs with OMF.
Ans: B.


16. Querying which view will show whether automatic archiving is enabled?


A. V$ARCHIVE_LOG
B. V$DATABASE
C. V$PARAMETER
D. V$LOG
---
You enable automatic archiving by setting the initialization parameter LOG_ARCHIVE_START = TRUE. All the parameter values can be queried using the V$PARAMETER view. The ARCHIVE LOG LIST command will also show whether automatic archiving is enabled.
Ans: C.


17. If you need to have your archive log files named with the log sequence numbers as arch_0000001, arch_0000002, and so on (zero filled, fixed width), what should be the value of the LOG_ARCHIVE_FORMAT parameter?


A. arch_%S
B. arch_%s
C. arch_000000%s
D. arch_%0%s
----
Four formatting variables are available to use with archive log file names: %s specifies the log sequence number; %S specifies the log sequence number, leading zero filled; %t specifies the thread; and %T specifies the thread, leading zero filled.
Ans: A.


18. Following are the steps needed to rename a redo log file. Order them in the proper sequence.


A. Use an operating system command to rename the redo log file.
B. Shut down the database.
C. ALTER DATABASE RENAME FILE ‘oldfile’ TO ‘newfile’
D. STARTUP MOUNT
E. ALTER DATABASE OPEN
F. Backup the control file.
----
Ans: B, A, D, C, E, and F. The correct order is:

Shut down the database.
Use an operating system command to rename the redo log file.
STARTUP MOUNT
ALTER DATABASE RENAME FILE ‘oldfile’ TO ‘newfile’
ALTER DATABASE OPEN
Back up the control file.


19. Which of the following commands is a key step in multiplexing redo log files using an SPFILE?


A.
ALTER SYSTEM SET CONTROL_FILES= ‘/u01/oradata/PRD/cntrl01.ctl’, ‘/u01/oradata/PRD/cntrl02.ctl’ SCOPE=SPFILE;

B.
ALTER SYSTEM SET CONTROL_FILES=
‘/u01/oradata/PRD/cntrl01.ctl’,
‘/u01/oradata/PRD/cntrl02.ctl’ SCOPE=MEMORY;

C.
ALTER SYSTEM SET CONTROL_FILES=
‘/u01/oradata/PRD/cntrl01.ctl’,
‘/u01/oradata/PRD/cntrl02.ctl’ SCOPE=BOTH;

D.
The number of control files is fixed when the database is created.
-----
The location of the new control files is not valid until an operating system copy is made of the current control file to the new location(s), and the instance is restarted. The SCOPE=SPFILE option specifies that the parameter change will not take place until a restart. Specifying either MEMORY or BOTH will cause an error, since the new control file does not exist yet.
Ans: A.


20. Which statement will add a member /logs/redo22.log to log file group 2?


A. ALTER DATABASE ADD LOGFILE ‘/logs/redo22.log’ TO GROUP 2;
B. ALTER DATABASE ADD LOGFILE MEMBER ‘/logs/redo22.log’ TO GROUP 2;
C. ALTER DATABASE ADD MEMBER ‘/logs/redo22.log’ TO GROUP 2;
D. ALTER DATABASE ADD LOGFILE ‘/logs/redo22.log’;
---
When adding log file members, specify the group number or specify all the existing group members. Option D would create a new group with one member.
Ans: B.

No comments: