Subject: Multiple archiver processes FAQ Type: FAQ Status: PUBLISHED Content Type: TEXT/PLAIN Creation Date: 13-JUL-1999 Last Revision Date: 27-JUL-2000 Language: USAENG CONTENTS -------- 1. What does the parameter LOG_ARCHIVE_MAX_PROCESSES do? 2. Is the parameter dynamic ? 3. What is the nature of dynamism of the archiver processes and how are they activated and deactivated ? 4. How does one know which archiver process has archived an online log ? QUESTIONS & ANSWERS 1. What does the parameter LOG_ARCHIVE_MAX_PROCESSES do? Answer ------ Since Oracle 8i supports multiple archive destinations it also supports multiple archiver processes to ease the load on a single archiver. LOG_ARCHIVE_MAX_PROCESSES specifies the number of ARCH processes to be invoked. This value is evaluated at instance startup if the LOG_ARCHIVE_START initialization parameter has the value TRUE. If the LOG_ARCHIVE_START is true and LOG_ARCHIVE_MAX_PROCESSES is not set explicitly it will start the arc0 process. Otherwise if LOG_ARCHIVE_MAX_PROCESSES is explicitly set to a value (range 1-10) then it will start additional archiver processes named arc0, arc1, arc2. . . . . . etc. There is no need to change this parameter from its default value of 1, because the system determines how many ARCn processes are needed and LGWR automatically starts up more ARCn processes when the database workload requires more. 2. Is the parameter dynamic ? Answer ------ It can be dynamically changed by alter system set LOG_ARCHIVE_MAX_PROCESSES=n where n varies between 1 and 10. However, this has no effect if LOG_ARCHIVE_START is FALSE . 3. What is the nature of dynamism of the archiver processes and how are they activated and deactivated ? Answer ------ If LOG_ARCHIVE_START is set to true, Oracle starts up a single archiver process names ARC0. Subsequently if the parameter is changed using the ALTER SYSTEM command it will start the specified number of archive processes. For example: SVRMGRL>alter system set LOG_ARCHIVE_MAX_PROCESSES=4; will invoke additional processes ARC1 , ARC2 and ARC3 in the following sequence: a. The shadow process contacts the primary archive process(arc0 here) and sends a message to increase the number of processes. b. The archiver process invokes the kcrrschd function. (kcrrschd: Schedule Multiple arch Processes). c. It checks whether the requested(new) number of processes is lower than the current(old) number of archiver processes. If it is lower or if ARCHIVING is DISABLED then it simply returns. Else if it is more than the supported limit (10) it limits the requested number of processes to 10. d. The scheduler function acquires a latch on the kcrrxs{} structure (ARCH Activation status) structure. e. The function then loops over the specified number of processes and updates the structure to change the state to scheduled (KCRRSCHED) f. It then releases the latch and hands over to the kcrrsmp(kcrrsmp: Start Multiple arch Processes) function for invocation. g. The kcrrsmp function acquires a latch prematurely on the kcrrxs{} structure(ARCH Activation status) to serialize access to the code section. h. It schedules any pending archiver processes and cleans up dead processes, if any. i. The function then loops over the specified number of processes and changes the state of each from KCRRSCHED to KCRRSTART i.e. the Archiver process is pending activation. j. The latch is then released and ARCH processes are started . k. The kcrrsmp function then re-acquires the latch. Individual archiver processes are then notified to activate themselves. The archiver processes activate themselves and update the alert file. l. The calling function sleeps for all the archiver processes to activate themselves and finally when all are active it updates the state in the kcrrxs structure. m. Finally when the current number of archiver processes match the requested number of archiver processes, it releases the latch and breaks. The alert. log reflects the sequence of events as follows: sql: prodding the archiver ALTER SYSTEM SET log_archive_max_processes=4; Tue Jul 13 02:15:14 1999 ARC0: changing ARC1 KCRRNOARCH->KCRRSCHED ARC0: changing ARC2 KCRRNOARCH->KCRRSCHED ARC0: changing ARC3 KCRRNOARCH->KCRRSCHED ARC0: STARTING ARCH PROCESSES ARC0: changing ARC1 KCRRSCHED->KCRRSTART ARC0: changing ARC2 KCRRSCHED->KCRRSTART ARC0: changing ARC3 KCRRSCHED->KCRRSTART ARC0: invoking ARC1 Tue Jul 13 02:15:15 1999 ARC1: changing ARC1 KCRRSTART->KCRRACTIVE Tue Jul 13 02:15:15 1999 ARC0: Initializing ARC1 ARC0: ARC1 invoked ARC0: invoking ARC2 ARC1 started with pid=10 ARC1: Archival started Tue Jul 13 02:15:15 1999 ARC2: changing ARC2 KCRRSTART->KCRRACTIVE Tue Jul 13 02:15:15 1999 ARC0: Initializing ARC2 The same activation sequence follows for ARC2 and ARC3. InterEstingly, the number of processes can also be reduced. For example : SVRMGRL>alter system set LOG_ARCHIVE_MAX_PROCESSES=2; will do the following sequentially: a. The shadow process contacts the currently active archiver process. b. The archiver process will then invoke the kcrrxmp function( kcrrxmp: Stop Multiple Arch Processes). c. The kcrrxmp function will acquire a latch on the kcrrxs{} structure(ARCH Activation status) so that another process cannot update the structure simultaneously. d. It checks whether the requested(new) number of processes is lower than the current(old) number of archiver processes. e. If less, then it scans the "head" of the list to find which processes have been scheduled recently and are less likely to get rescheduled for archival. f. It loops over each process and asks it to change status from KCRRACTIVE to KCRRSHUTDN g. Once the state is changed it signals the Operating system to terminate the process and the state changes to KCRRDEAD. The relevant process state information is cleared and the kcrrxs{} structure updated. The loop mentioned in (f) and (g) continues till the current number of archiver processes match the requested number of archiver processes. h. The kcrrxs structure is updated with the new number of archiver processes. i. The latch is released. The sequence of states is recorded in the alert. log file as follows: sql: prodding the archiver Tue Jul 13 00:34:20 1999 ARC3: changing ARC0 KCRRACTIVE->KCRRSHUTDN ARC3: sending ARC0 shutdown message ARC3: changing ARC1 KCRRACTIVE->KCRRSHUTDN ARC3: sending ARC1 shutdown message ARC3: received prod Tue Jul 13 00:34:20 1999 ALTER SYSTEM SET log_archive_max_processes=2; Tue Jul 13 00:34:20 1999 ARCH shutting down ARC0: Archival stopped ARC0: changing ARC0 KCRRSHUTDN->KCRRDEAD Tue Jul 13 00:34:20 1999 ARCH shutting down ARC1: Archival stopped ARC1: changing ARC1 KCRRSHUTDN->KCRRDEAD 4. How does one know which archiver process has archived an online log ? Answer ------ The achiver processes are scheduled to do the archiving in a round-robin manner. There could be scenarios, however, when multiple archiver processes are activated depending upon the load. Since Oracle8i supports multiple archive log destinations as well as duplexing of archive logs, it becomes all the more necessary to record which process has archived which logfile. Any successful archival in Oracle8i generates a trace file with the archiver process name. Extracts from one such trace follows: Instance name: v815 Redo thread mounted by this instance: 1 Oracle process number: 12 Unix process pid: 3658, image: oracle@oracle8i (ARC3) *** Session ID:(12. 1) 1999. 07. 13. 02. 15. 15. 000 *** 1999. 07. 13. 02. 15. 15. 000 *** 1999. 07. 13. 02. 33. 06. 000 ARC3: Begin archiving log# 1 seq# 38 thrd# 1 ARC3: VALIDATE ARC3: PREPARE ARC3: INITIALIZE ARC3: SPOOL ARC3: Creating archive destination 1 : '/bigdisk/oracle8i/dbs/arch/1_38. dbf' ARC3: Archiving block 1 count 1 to : '/bigdisk/oracle8i/dbs/arch/1_38. dbf' ARC3: Closing archive destination 1 : /bigdisk/oracle8i/dbs/arch/1_38. dbf ARC3: FINISH ARC3: Archival success destination 1 : '/bigdisk/oracle8i/dbs/arch/1_38. dbf' ARC3: COMPLETE, all destinations archived ARC3: ArchivedLog entry added: /bigdisk/oracle8i/dbs/arch/1_38. dbf ARC3: ARCHIVED *** 1999. 07. 13. 02. 33. 06. 000 ARC3: Completed archiving log# 1 seq# 38 thrd# 1 From this it is evident that Archiver process 3 archived Log sequence 38 onto destination 1 :/bigdisk/oracle8i/dbs/arch.