CHAPTER 5 ■■■ Managing Control Files and Online Redo Logs An Oracle database consists of three types of mandatory files: datafiles, control files, and online redo logs. Chapter 4 focused on tablespaces and datafiles. This chapter focuses on managing control files and online redo logs. The first part of this chapter discusses typical control-file maintenance tasks such adding, moving, and removing control files. The latter part of the chapter focuses on how to manage online redo log files. You learn how to rename, resize, and relocate these critical files. Managing Control Files A control file is a small binary file that stores the following types of information: • Database name • Names and locations of datafiles • Names and locations of online redo log files • Current online redo log sequence number • Checkpoint information • Names and locations of Oracle Recovery Manager (RMAN) backup files (if using) You can query much of the information stored in the control file from data-dictionary views. The following example displays the types of information stored in the control file by querying V$CONTROLFILE_RECORD_SECTION: SQL> select distinct type from v$controlfile_record_section; Here’s a partial listing of the output: TYPE ---------------------------FILENAME TABLESPACE RMAN CONFIGURATION BACKUP CORRUPTION PROXY COPY FLASHBACK LOG D. Kuhn et al., Pro Oracle Database 11g Administration © Darl Kuhn 2010 91 CHAPTER 5 ■ MANAGING CONTROL FILES AND ONLINE REDO LOGS REMOVABLE RECOVERY FILES DATAFILE You can view database information stored in the control file via the V$DATABASE view: SQL> select name, open_mode, created, current_scn from v$database; Here is the output for this example: NAME OPEN_MODE CREATED CURRENT_SCN --------- -------------------- --------- ----------ORC11G READ WRITE 01-JAN-10 5077636 Every Oracle database must have at least one control file. When you start your database in nomount mode, the instance is aware of the location of the control files from the CONTROL_FILES parameter: -- locations of control files are known to the instance SQL> startup nomount; At this point, the control files haven’t been touched by any processes. When you alter your database into mount mode, the control files are read and opened for use: -- control files opened SQL> alter database mount; If any of the control files listed in the CONTROL_FILES initialization parameter aren’t available, then you can’t mount your database. When you successfully mount your database, the instance is aware of the locations of the datafiles and online redo logs, but hasn’t yet opened them. After you alter your database into open mode, the datafiles and online redo logs are opened: -- datafiles and online redo logs opened SQL> alter database open; The control file is created when the database is created. As you saw in Chapter 2, you should create at least two control files when you create your database (to avoid a single point of failure). If possible, you should have multiple control files stored on separate storage devices controlled by separate controllers. Oracle writes to all control files specified by the CONTROL_FILES initialization parameter. If Oracle can’t write to one of the control files, an error is thrown: ORA-00210: cannot open the specified control file If one of your control files becomes unavailable, shut down your database and resolve the issue before restarting. Fixing the problem may mean resolving a storage-device failure or modifying the CONTROL_FILES initialization parameter to remove the control-file entry for the control file that isn’t available. 92