Thread

From Oracle FAQ
Jump to: navigation, search

A thread is a set of redo log files. Each instance mounts one thread of redo logs when it starts up. When using RAC, each instance must have its own thread of redo logs.

To map an instance to a different thread, use the THREAD initialization parameter (for example: THREAD = 2).

[edit] Monitor

Query v$instance or v$thread to see the thread currently in use. v$log lists the redo log files with the threads they belong to:

SQL> SELECT thread#, instance, status FROM v$thread;
   THREAD# INSTANCE   STATUS
---------- ---------- ------
         1 o102       OPEN
SQL> SELECT thread#, group#, status FROM v$log;
   THREAD#     GROUP# STATUS
---------- ---------- ----------------
         1          1 CURRENT
         1          2 INACTIVE
         1          3 INACTIVE

[edit] Adding threads

Example SQL commands to add a new thread to a database:

SQL> CONNECT SYS AS SYSBDA
SQL> STARTUP EXCLUSIVE
SQL> ALTER DATABASE ADD LOGFILE THREAD 2
SQL>     GROUP G4 ('FILE4.log') SIZE 500k,
SQL>     GROUP G5 ('FILE5.log') SIZE 500k,
SQL>     GROUP G6 ('FILE6.log') SIZE 500k;
SQL> ALTER DATABASE ENABLE PUBLIC THREAD 2;
Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #