DBA Data[Home] [Help]

PACKAGE: APPS.FND_ADG_UTILITY

Source


1 package fnd_adg_utility AUTHID CURRENT_USER as
2 /* $Header: AFDGUTLS.pls 120.4 2010/03/23 20:08:08 rsanders noship $ */
3 
4 /*
5 	fnd_adg_utility
6 	===============
7 
8 	There are two pieces that go to make up Active Data Guard [ ADG ]
9 	support:
10 
11 		Infrastructure
12 		RPC Usage
13 
14 	Infrastructure is a completely new feature and the infrastructure patch
15 	can be applied at any time to a supported R12 EBS system.
16 
17 	RPC Usage depends on the infrastructure and is a set of updates
18 	to existing EBS packages. The RPC Usage patch must be at the
19 	correct revision for your EBS system.
20 
21 	This package is used to manage the infrastructure components of
22 	Active Data Guard support.
23 
24 	For backwards compatibility, ADG support patches can be
25 	applied to 10g databases but they cannot be actived as ADG is
26 	an 11g only feature.
27 
28 	ADG Support
29 	-----------
30 
31 	EBS ADG support is currently only available for concurrent requests .
32         There is no support for online queries to be redirected to an
33 	ADG instance.
34 
35 	Concurrent request support is further restricted as follows:
36 
37 		- Only standalone programs can be redirected to ADG.
38 		- At present standalone programs are further restricted
39 		  to just reportwriter reports.
40 		- Only reportwriter reports that have no direct or indirect
41 		  DML dependency can be run on ADG
42 		    - e.g. Reports that use sequences cannot be used as
43 		           the database uses DML to manage the sequence cache.
44 		- Reportwriter reports can only be run on ADG if they have
45 		  been run at least once on the primary database. This is
46 	          again a database restriction in the way it manages remote
47 		  PL/SQL dependencies which can result in dictionary DML being
48 		  executed during PL/SQL execution.
49 
50 	The infrastructure is in part provided to allow customers to
51 	provide information and shortcuts to address some of the above
52 	issues.
53 
54 	In future releases of the database, it is hoped that many of these
55 	restrictions will be lifted.
56 
57 	How is ADG Support implemented?
58 	===============================
59 
60  	Although there is no support for report program updates	, the
61 	concurrent manager does have DML dependencies and these cannot be
62 	avoided without major code changes. These dependencies can only be
63         addressed by executing updates on the primary via db links. For reasons
64 	that are too numerous to mention, this poses significant challenges for
65  	EBS  - the broad issue is our direct and indirect use of PL/SQL and
66 	PL/SQL state.
67 
68 	To provide ADG support, the RPC usage piece contains standard EBS
69 	packages that contain calls to shadow packages which then invoke
70 	the original procedure/function remotely - it is a non-transparent
71 	form or RMI.
72 
73 	These shadow packages are built by the infrastructure and then
74 	invoked by standard packages such as FND_CONCURRENT.
75 
76 	To avoid introducing db link dependencies into the core EBS code,
77 	RPC access is controlled by compile directives. This is all
78 	transparent. However, when switching to/from RPC usage, package bodies
79 	dependent on this directive will become invalid and require
80 	recompilation. Switching on RPC usage is a one off operation,
81 	as whether ADG is actually used is independent of package
82 	compilation - i.e. ADG support can be disabled even if RPC usage
83 	has been enabled.
84 
85 	How is ADG Support enabled?
86 	===========================
87 
88 	In addition to RPC code being in place, there are various
89 	steps to go through before a report can be directed to an ADG
90 	instance. First, it is important to understand how a manager works
91 	in a ADG environment.
92 
93 	To use ADG you need to have Parallel Concurrent Processing [ PCP ]
94 	set up, with one or more nodes dedicated to serving ADG requests.
95 	These managers would in most circumstances be co-located with the
96 	ADG instance, as the majority of SQL traffic will be between
97 	the report and the database.
98 
99 	ADG support makes use of the concurrent manage feature that allows
100 	the report connection [ TWO_TASK ] to be separate from the manager
101 	connection. The manager connection will always be to the primary
102 	database whereas the report will connect to the ADG instance.
103 
104 	Connections depend on connect strings [ TNSNAMES.ORA ] and at
105 	present autoconfig does not provide support for ADG connect strings.
106 	These need to be set up manually.
107 
108 	It is possible [ and quite probable ] that customers are already
109 	using PCP with complex shift and exclude/include rules. Although
110 	report definitions can be changed to use a different connection string,
111         that becomes problematic when the ADG instance is unavailable for
112 	read access. This is addressed in the infrastructure by providing
113 	support for transparent redirection to ADG concurrent managers.
114 	This is achieved by defining include rules on the
115 	ADG managers with corresponding exclude rules on all other
116 	managers. When a concurrent request is created, triggers determine
117 	whether a request can be run on ADG and if all tests are met,
118 	the request is changed to use the include rule along with the
119 	ADG connection alias. If the tests are not met and/or the ADG managers
120 	are not running the request is run as is, using the existing rules
121 	set down for the report.
122 
123 	Basic steps for setting up ADG support
124 	======================================
125 
126 	1. Install infrastructure patch.
127 	2. Prepare for rpc :  - prepare_for_rpc_system
128 	3. At this point no further steps are possible until
129 	   the RPC usage patch has been installed. All triggers are
130 	   no-op and the compile directive is disabled.
131 	4. Install RPC usage patch - again this is a no-op until
132 	   compile directive is enabled.
133 	5. Register the dblink for connecting from standby to primary - i.e.
134 	   a dblink to connect to the primary database. For security
135 	   reasons this link should be a public database link - i.e. it does
136 	   not require any passwords to be specified.
137 	6. Switch the RPC system on. This will perform various validations
138 	   and if all ok, the compile directive will be enabled. This will
139 	   result in invalid objects. Either use standard RDBMS scripts
140 	   or use the convenience procedure, compile_rpc_dependents.
141 	7. At this point you can enable ADG support but apart from
142 	   seed data, there are no reports that are candidates for switching
143 	   to ADG and there are no registered ADG [ standby ] connection
144 	   strings.
145 	8. Register ADG [ standby ] connections - up to 5 ADG databases are
146 	   supported.
147 	9. Register a simulated standby connection. This is optional but allows
148 	   reports to be run in simulation mode on the primary database. This,
149 	   in conjunction with server patch xxxxxx, allows ADG violations to
150 	   be recorded.
151 	10.Register class type for ADG include rules.
152 	11.Manage the reports available for ADG redirection.
153 	12.For simulation mode, installed database triggers must be
154 	   enabled.
155 	13.Determine how ADG support is managed.
156         14.Enable ADG support.
157 */
158 
159 
160 /*	Constants
161 	=========
162 */
163 
164   C_MAX_COMMIT_WAIT_TIME       constant       number := 300;
165 
166 /*	Constants for registering connections.
167 */
168 
169   C_CONNECT_STANDBY_TO_PRIMARY	constant	number := 1;
170   C_CONNECT_PRIMARY_TO_STANDBY    constant        number := 2;
171   C_CONNECT_TO_SIMULATED_STANDBY  constant        number := 3;
172 
173 /*	Package Documentation
174 	=====================
175 
176 	The procedures/functions are divided into two parts:
177 
178 		Part I - Public Utility Methods
179 		Part II- Support Methods
180 
181 	The support methods are for the most part informational and are not
182 	required for general use.
183 */
184 
185 /*	Part I - Public Utility Methods
186 	===============================
187 
188 	Part I covers utility methods that are used to manage and
189 	control the ADG support environment.
190 */
191 
192 /*	Cleanup and clone
193 	=================
194 
195 	If you clone from primary to development/test, data tables need to be
196 	cleaned up.
197 
198 	clone_clean would be typically used for cloning. It does the following:
199 
200 		Purge trace and commit_wait tables.
201 		Resets control data to initial values
202 		   - i.e. no ADG support, no RPC support, no registered
203 		          connections.
204 
205         clean_all is as per clone_clean with the addition of :
206 
207 		Initialise the RPC package list
208 		Purge the concurrent programs report list.
209 
210 	clean_all should only be used if you want to completely reset
211 	ADG support.
212 */
213 
214   procedure clone_clean(p_commit boolean default true);
215 
216   procedure clean_all(p_commit boolean default true);
217 
218 /*	prepare_for_rpc_system
219 	======================
220 
221 	This procedure builds and compiles the RPC packages. To run
222 	both ADG and RPC support must be disabled.
223 */
224 
225   procedure prepare_for_rpc_system;
226 
227 /*	switch_rpc_system_on
228 	====================
229 
230 	Switches on a prepared RPC system. The switch will fail unless
231         the following is true:
232 
233 		- RPC system is enabled.
234 		- ADG support is disabled.
235 		- RPC usage has been installed
236 		- Standby to Primary connection has been registered and is
237 		  valid.
238 
239 	If all conditions are met, the RPC synonyms are built, the compile
240 	directive is set to ENABLE and RPC is marked as being enabled.
241 
242 	Switching the compile directive will cause dependent package bodies
243 	to be invalidated. Either use standard scripts to recompile or
244 	use the convenience procedure,compile_rpc_dependents, to recompile
245 	affected packages.
246 */
247 
248   procedure switch_rpc_system_on;
249 
250 /*	switch_rpc_system_off
251 	=====================
252 
253 	Switches off the RPC system. The switch will fail unless
254         the following is true:
255 
256 		- RPC system is enabled.
257 		- ADG support is disabled.
258 
259 	If all conditions are met, the compile directive is set to DISABLE.
260 
261         Switching the compile directive will cause dependent package bodies
262         to be invalidated. Either use standard scripts to recompile or
263         use the convienence procedure,compile_rpc_dependents, to recompile
264         affected packages.
265 */
266 
267   procedure switch_rpc_system_off;
268 
269 /*	resync_compile_directive
270 	========================
271 
272 	If the shipped package spec for the compile directive is accidentally
273 	reloaded, perhaps by an incorrect inclusion in a patch, it is possible
274 	that the RPC system will be effectively disabled.
275 
276 	This procedure validates that the internal RPC state is in sync
277 	with the compile directive. If they are out of sync [ source of truth
278 	being the internal RPC state ] then the compile directive is changed
279 	accordingly.
280 */
281 
282   procedure resync_compile_directive;
283 
284 /*	compile_rpc_dependents
285 	======================
286 
287 	This procedure compiles all dependent package bodies used by the
288 	RPC system. This procedure should only be run during maintenance
292   procedure compile_rpc_dependents;
289 	periods.
290 */
291 
293 
294 /*	Managing Connections
295 	====================
296 
297 	There are three types of database connections that can be
298 	registered:
299 
300 		Standby -> Primary
301 		Primary -> Standby
302 	        Primary -> Simulated Standby
303 
304 	When you register a connection you are registering a database link
305 	and connection string [ TNS alias ]. Each connection is discussed in
306 	turn.
307 
308 	Standby -> Primary
309 
310 		This is a database link that resolves to primary and is used
311 		from the standby to connect back to the primary for RPC
312 		calls.
313 
314 	Primary -> Standby
315 
316 		This is a database link that resolves to a standby database The
317 		link is not directly used but the connection string is
318 		used by the concurrent manager for setting the
319 		TWO_TASK variable.
320 
321 		Up to five Primary -> Standby connections can be registered.
322 
323 	Primary -> Simulated Standby
324 
325 		This is a database link that resolves to primary. The
326 		link is not directly used but the connection string is
327                 used by the conncurrent manager for setting the
328                 TWO_TASK variable.
329 
330 		Simulation is discussed further under
331 		set_simulated_standby_options
332 
333 	All the connections must be valid before they can be used.
334 
335 		Standby to Primary connection must be valid before the RPC
336 		system can be enabled.
337 
338 		Primary to Standby must be valid for requests to be redirected
339 		to standby.
340 
341 		Primary to Simulated Standby must be valid for requests to
342 		be redirected to simulated standby.
343 */
344 
345 /*	register_connection
346 	===================
347 
348 	p_type	- see constants.
349 	p_link_name - database link name
350 	p_link_owner- only valid value is PUBLIC
351 	p_link_connstr - the TNS connect string [ alias ]
352 	p_create_db_link_if_undefined
353 		- auto create the database link. In most cases it is expected
354 		  that customers will create their own database links.
355         p_standby_number - 1 to 5.
356 
357 	A connection is not usable until is has been validated - see below.
358 
359 	Prerequisites:
360 
361                 - RPC system is disabled if type is Standby -> Primary.
362                 - ADG support is disabled.
363 */
364 
365   procedure register_connection(p_type number,
366                                 p_link_name varchar2,
367                                 p_link_owner varchar2 default 'PUBLIC',
368                                 p_link_connstr varchar2 default null,
369                                 p_create_db_link_if_undefined
370                                                  boolean default false,
371                                 p_standby_number number default null
372                                );
373 
374 /*	clear_connection
375 	================
376 
377 	Clear specified connection.
378 
379 	Prerequisites:
380 
381                 - RPC system is disabled if type Standby -> Primary.
382                 - ADG support is disabled.
383 */
384 
385   procedure clear_connection(p_type number,
386                              p_standby_number number default null);
387 
388 /*	validate_connection
389 	===================
390 
391 	Validate specified connection.
392 
393 	The validation includes connecting to the end point [ dblink ] and
394 	ensuring it is the correct database running in the correct mode.
395 
396         Prerequisites:
397 
398                 - RPC system is disabled if type Standby -> Primary.
399                 - ADG support is disabled.
400 */
401 
402   procedure validate_connection(p_type number,
403                                 p_standby_number number default null);
404 
405 /*
406 	get_connection_data
407 	===================
408 
409 	Retrieve connect string and state of connection.
410 */
411 
412   procedure get_connection_data(p_type number,
413                                 p_valid out nocopy boolean,
414                                 p_connstr out nocopy varchar2,
415                                 p_standby_number number default null
416                                );
417 
418 /*      is_connection_registered
419         ========================
420 
421         Check whether the given connect string is registered as either
422         a standby or simulated standby connection.
423 
424 	  p_check_valid     - connection string must be valid.
425           p_check_available - connection target [ database ] must be open.
426 */
427 
428   function is_connection_registered(p_connstr varchar2,
429                                     p_check_valid boolean default false,
430                                     p_check_available boolean default false)
431               return boolean;
432 
433 /*	register_standby_cm_class
434 	=========================
435 
436 	Register the Concurrent Manager Class Id that maps
437 	to Include Rule for given Standby.
438 
439         Prerequisites:
440 
441                 - ADG support is disabled.
442 		- is_standby_manager_defined() returns true - see below.
443 */
444 
445   procedure register_standby_cm_class  (p_standby_number number,
446                                         p_req_class_app_id number,
447                                         p_req_class_id number );
448 
449 /*	get_standby_cm_class
450 	====================
454 
451 
452 	Retreive class/app id for given standby.
453 */
455   procedure get_standby_cm_class       (p_standby_number number,
456                                         p_req_class_app_id out nocopy number,
457                                         p_req_class_id out nocopy number );
458 
459 /*	is_standby_manager_defined
460 	==========================
461 
462 	Queries FND_CONCURRENT_QUEUES to check that class/app id are
463 	defined as an include rule.
464 
465 	Optionally check that Concurrent manager is running.
466 */
467 
468   function is_standby_manager_defined(p_req_class_app_id number,
469                                       p_req_class_id     number,
470                                       p_must_be_running boolean) return boolean;
471 
472 /*	get_standby_to_primary_dblink
473 	=============================
474 
475 	Return standby -> primary dblink.
476 */
477 
478   function get_standby_to_primary_dblink return varchar2;
479 
480 /*	find_registered_standby
481 	=======================
482 
483 	Find registered standby for given connect string.
484 */
485 
486   procedure find_registered_standby(p_connstr varchar2,
487                                     p_exists  out nocopy boolean,
488                                     p_valid   out nocopy boolean,
489                                     p_req_class_app_id out nocopy number,
490                                     p_req_class_id out nocopy number
491                                    );
492 
493 /*	get_max_standby_systems
494 	=======================
495 
496 	Return maximum number of standby databases supported.
497 */
498 
499   function get_max_standby_systems return number;
500 
501 /*	validate_adg_support
502 	====================
503 
504 	This procedure validates all registered connections.
505 
506                 - RPC system is disabled.
507                 - ADG support is disabled.
508 */
509 
510   procedure validate_adg_support(p_no_standby_systems number default null);
511 
512 /*	enable_adg_support
513 	==================
514 
515 	Validates that all RPC dependent packages are enabled and valid.
516 
517         Prerequisites:
518 
519                 - RPC system is enabled.
520                 - ADG support is disabled.
521 */
522 
523   procedure enable_adg_support;
524 
525 /*	disable_adg_support
526 	===================
527 
528 	Disables ADG support.
529 
530         Prerequisites:
531 
532                 - RPC system is enabled.
533                 - ADG support is enabled.
534 */
535 
536   procedure disable_adg_support;
537 
538 /*	is_adg_support_enabled
539 	======================
540 
541 	Returns true if ADG support is enabled.
542 */
543 
544   function is_adg_support_enabled return boolean;
545 
546 /*	enable_database_triggers
547 	========================
548 
549 	Enable schema logon,logoff and error triggers.
550 */
551 
552   procedure enable_database_triggers;
553 
554 /*	disable_database_triggers
555 	=========================
556 
557 	Disable schema logon,logoff and error triggers.
558 */
559 
560   procedure disable_database_triggers;
561 
562 /*	set_control_options
563 	===================
564 
565 	Control options that affect how runtime support is used.
566 
567         Prerequisites:
568 
569                 - ADG support is disabled.
570 
571 	p_enable_commit_wait
572 
573 		If an RPC has been built to use commit-wait processing,
574 		then the RPC will wait until DML changes have arrived
575 		on the standby before returning to the caller.
576 
577 		The default setting for this option is TRUE.
578 
579 	p_max_commit_wait_time
580 
581 		The maximum time to wait for committed changes to
582 		arrive on the standby.
583 
584 		The default setting is 60 seconds. The maximum time allowed
585 		is 300 seconds.
586 
587 	p_runtime_validate_timestamp
588 
589 	 	Validate that the RPC timestamp is >= caller timestamp.
590 
591 		Can be disabled if packages have been recompiled by patches
592 	 	and it is not possible to call "compile_rpc_dependents".
593 
594 		The default setting for this option is TRUE.
595 
596 	p_always_collect_primary_data
597 
598 		Even if ADG support has not been enabled always record
599 		that a report has been run at least once on primary.
600 
601 		The default setting for this option is TRUE.
602 
603 	p_enable_redirect_if_valid
604 
605 		In addition to program level options, this is a system
606 		wide override option to enable/disable redirection of valid
607 		reports.
608 
609 		The default setting for this option is TRUE.
610 
611 	p_enable_standby_error_checks
612 
613 		If database triggers are enabled,then standby READ-WRITE
614 		errors are recorded for the redirected program. Errors
615 		will only be recorded if the the number of errors exceed
616 		p_standby_error_threshold
617 
618 		The default setting for this option is TRUE.
619 
620 	p_enable_automatic_redirection
621 
622 		Reports that are valid will be automatically redirected to
623 		standby, regardless of requested node/connect string.
624 
625 		The default setting for this option is FALSE.
626 
627 	p_standby_error_threshold
628 
629 		Threshold above which standby READ-WRITE errors will be
633 
630 		recorded.
631 
632 	p_debug_rpc
634 		Enable RPC trace - i.e. trace for the standby session.
635 
636 		1 - SQL_TRACE
637 
638 		The default setting for this option is none.
639 
640 	p_debug_slave_rpc
641 
642 		Enable slave RPC trace - i.e. trace for the dblink session.
643 
644 		1 - SQL_TRACE
645 
646                	The default setting for this option is none.
647 */
648 
649   procedure set_control_options(p_enable_commit_wait boolean default null,
650                                 p_max_commit_wait_time number default null,
651                                 p_runtime_validate_timestamp
652                                                      boolean default null,
653                                 p_always_collect_primary_data
654                                                      boolean default null,
655                                 p_enable_redirect_if_valid
656                                                      boolean default null,
657                                 p_enable_standby_error_checks
658                                                      boolean default null,
659                                 p_enable_automatic_redirection
660                                                      boolean default null,
661                                 p_standby_error_threshold number default null,
662                                 p_debug_rpc number default null,
663                                 p_debug_slave_rpc number default null
664                                );
665 
666 /*	Simulated Standby
667 	=================
668 
669 	The goal of simulated standby is to allow reports to be run on
670 	primary as if they were on the standby. Read-write failures
671 	can then be analysed and recorded.
672 
673 	To effectively use simulation mode the following must be true:
674 
675 		simulated standby must be enabled.
676 		simulated standby service must be registered
677 		trace directory object must be registered
678 		database triggers must be enabled
679 		simulated standby connection must be registered and valid
680 
681 	With these settings in place you can set the program definition
682 	to use the simulated standby connect string. Alternatively
683 	use the auto-simulation mode.
684 */
685 
686 /*	set_simulated_standby_options
687 	=============================
688 
689 	Options for controlling standby simulation.
690 
691         Prerequisites:
692 
693                 - ADG support is disabled.
694 
695 	p_enable_simulated_standby
696 
697 		When reports connect using the simulated standby
698 		service and this option is enabled, RPC calls will always
699 		be used - i.e. fnd_adg_support.is_standby will return true
700 		for primary sessions.
701 
702 		To capture read-write violations, databases triggers
703 		must be enabled - see enable_database_triggers.
704 
705 		The default setting for this option is TRUE.
706 
707 	p_enable_auto_simulation
708 
709 		This option will automatically direct requests to
710 		use simulation mode if not already done so.
711 
712 		The default setting for this option is FALSE.
713 
714 	p_simulated_standby_service
715 
716 		The service used to identify a simulation session.
717 
718 		If database triggers have been enabled, then the logon
719 		trigger checks to see which service a session is using.
720 		If it is this service and p_enable_simulated_standby is true,
721 		then the session is treated as being run on standby.
722 
723 	p_simulation_error_threshold
724 
725 		If running as a simulation session, then on logoff the
726 		session trace file is analysed and the number of
727 		read-write violations determined.  If the number of
728 		errors exceeds this threshold, then the difference is
729 		recorded for the program.
730 
731 	p_trace_directory_obj
732 
733 		The database directory object for the trace file directory.
734 */
735 
736   procedure set_simulated_standby_options(p_enable_simulated_standby
737                                                  boolean default null,
738                                           p_enable_auto_simulation
739                                                  boolean default null,
740                                           p_simulated_standby_service
741                                                  varchar2 default null,
742                                           p_simulation_error_threshold
743                                                  number default null,
744                                           p_trace_directory_obj
745                                                  varchar2 default null);
746 
747 /*	Managing concurrent programs
748 	============================
749 
750 	The ADG state for concurrent programs is managed by the
751 	manage_concurrent_program procedure.
752 
753 	The underlying table is fnd_adg_concurrent_program and maps one-to-one
754         with FND_CONCURRENT_PROGRAM. The table is dynamically populated but
755 	can be pre-populated - e.g.
756 
757                declare
758                   cursor c1 is select a.APPLICATION_ID,a.CONCURRENT_PROGRAM_ID
759                                  from fnd_concurrent_programs a;
760                begin
761                   for f_rec in c1 loop
762                     fnd_adg_utility.manage_concurrent_program
763                         (p_application_id => f_rec.APPLICATION_ID,
764                          p_concurrent_program_id => f_rec.CONCURRENT_PROGRAM_ID
765                         );
766                   end loop;
767                end;
768 
769 	The state flags are also managed dynamically but can be overridden
773 	be true:
770 	through the manage_concurrent_program API.
771 
772 	For a concurrent program to be valid for standby the following must
774 
775 		p_has_run_on_primary is TRUE
776 		p_has_run_on_simulated_standby is TRUE
777 		p_run_on_standby is TRUE
778 
779 		p_no_standby_failures < p_max_standby_failures and
780 		p_no_simulated_stdby_failures < p_max_simulated_stdby_failures
781 
782 		If concurrent manager is not running
783 		then
784 		   p_always_redirect_if_valid is TRUE
785                 end if
786 
787 		If Request:connstr is not a valid standby connection
788                 then
789 		   p_use_automatic_redirection is TRUE
790                 end if
791 */
792 
793 /*	manage_concurrent_program
794 	=========================
795 
796 	p_application_id,
797         p_concurrent_program_id
798 
799 		FND_CONCURRENT_PROGRAM primary key.
800 
801 	p_has_run_on_primary
802 
803 		Set flag to indicate whether program has been run on primary.
804 
805 		Default value is FALSE.
806 
807 	p_has_run_on_simulated_standby
808 
809 		Set flag to indicate whether program has run on simulated
810 		standby.
811 
812 		Default value is FALSE.
813 
814 	p_run_on_standby
815 
816 		Set flag to indicate that report can run on standby.
817 
818 		Default value is FALSE.
819 
820  	p_no_standby_failures
821 
822 		Set/reset the number of standby failovers for this program.
823 
824 		Default value is zero.
825 
826 	p_max_standby_failures
827 
828 		Maximum number of allowed standby failovers before
829 		p_run_on_standby is set to FALSE.
830 
831 		Default value is zero.
832 
833 	p_no_simulated_stdby_failures
834 
835 		Set/reset the number of simulated standby failovers.
836 
837 		Default value is zero.
838 
839 	p_max_simulated_stdby_failures
840 
841 		Maximum number of simulated standby failovers. If the number
842 		of simulated standby failovers exceeds the maximum, the request
843 		will be marked as not runnable on standby.
844 
845 		Default value is zero.
846 
847 	p_always_redirect_if_valid
848 
849 		Program level option to always redirect valid reports to
850 		standby regardless of the state of the concurrent managers -
851 		i.e. if concurrent manager is inactive, report will just sit
852 		in the queue.
853 
854 		Has no effect unless the control option
855                 "p_enable_redirect_if_valid" is also enabled.
856 
857 		Default value is TRUE.
858 
859 	p_use_automatic_redirection
860 
861  		If the report can be run on standby, then automatically
862 		redirect to the first available ADG database, ignoring
863 		any primary instance/node affinity.
864 
865 		Default value is FALSE.
866 */
867 
868   procedure manage_concurrent_program
869                          (p_application_id              number,
870                           p_concurrent_program_id       number,
871                           p_has_run_on_primary          boolean default null,
872                           p_has_run_on_simulated_standby boolean default null,
873                           p_run_on_standby              boolean default null,
874                           p_no_standby_failures         number default null,
875                           p_max_standby_failures        number default null,
876                           p_no_simulated_stdby_failures number default null,
877                           p_max_simulated_stdby_failures number default null,
878                           p_always_redirect_if_valid    boolean default null,
879                           p_use_automatic_redirection   boolean default null
880                          );
881 
882 /*	purge_commit_wait_data
883 	======================
884 
885 	Purge old commit-wait data.
886 */
887 
888   procedure purge_commit_wait_data;
889 
890 /*      Part II- Support Methods
891         ========================
892 
893         These methods are for the most part informational.
894 */
895 
896 /*	is_standby_access_supported
897 	===========================
898 
899 	Returns true if database version is >= 11.
900 */
901 
902   function is_standby_access_supported return boolean;
903 
904 /*	is_session_simulated_standby
905 	============================
906 
907 	Returns true if session is running as a simulated standby session.
908 */
909 
910   function is_session_simulated_standby return boolean;
911 
912 /*	is_simulated_standby_enabled
913 	============================
914 
915 	Returns true if this option has been enabled.
916 		- see set_simulated_standby_options.
917 */
918 
919   function is_simulated_standby_enabled return boolean;
920 
921 /*	is_auto_simulation_enabled
922 	==========================
923 
924 	Returns true if this option has been enabled.
925 		- see set_simulated_standby_options.
926 */
927 
928   function is_auto_simulation_enabled return boolean;
929 
930 /*	is_automatic_redirection
931 	========================
932 
933 	Returns true if this option has been enabled.
934 		- see set_control_options.
935 */
936 
937   function is_automatic_redirection return boolean;
938 
939 /*	is_commit_wait_enabled
940 	======================
941 
942 	Returns true if this option has been enabled.
943 		- see set_control_options.
944 */
945 
946   function is_commit_wait_enabled return boolean;
947 
951 	Returns true if this option has been enabled.
948 /*	is_runtime_validate_timestamp
949 	=============================
950 
952 		- see set_control_options.
953 */
954 
955   function is_runtime_validate_timestamp return boolean;
956 
957 /*	is_always_collect_primary_data
958 	==============================
959 
960 	Returns true if this option has been enabled.
961 		- see set_control_options.
962 */
963 
964   function is_always_collect_primary_data return boolean;
965 
966 /*	is_enable_redirect_if_valid
967 	===========================
968 
969 	Returns true if this option has been enabled.
970                 - see set_control_options.
971 */
972 
973   function is_enable_redirect_if_valid return boolean;
974 
975 /*	get_rpc_debug
976 	=============
977 
978 	Get the rpc debug options
979 		- see set_control_options.
980 */
981 
982   procedure get_rpc_debug(p_debug_rpc out nocopy number,
983                           p_debug_slave_rpc out nocopy number);
984 
985 /*	get_max_commit_wait_time
986 	========================
987 
988 	Return the maximum commit wait time
989 		 see set_control_options.
990 */
991 
992   function get_max_commit_wait_time return number;
993 
994 /*	get_standby_error_threshold
995 	===========================
996 
997 	Returns standby error threshold
998 		- see set_control_options.
999 */
1000 
1001   function get_standby_error_threshold return number;
1002 
1003 /*	get_simulation_error_threshold
1004 	==============================
1005 
1006 	Returns simulation error threshold
1007 		- see set_simulated_standby_options.
1008 */
1009 
1010   function get_simulation_error_threshold return number;
1011 
1012 /*	is_standby_error_checking
1013 	=========================
1014 
1015 	Returns true if this option has been enabled.
1016                 - see set_control_options.
1017 */
1018 
1019   function is_standby_error_checking return boolean;
1020 
1021 /*	process_adg_violations
1022 	======================
1023 
1024 	Called during logoff processing for simulated standby session.
1025 */
1026 
1027   procedure process_adg_violations(p_logoff boolean,
1028                                    p_application_id number default null,
1029                                    p_concurrent_program_id number default null);
1030 
1031 /*	enable_violation_trace
1032 	======================
1033 
1034 	Called during logon rocessing for simulated standby session.
1035 */
1036 
1037   procedure enable_violation_trace;
1038 
1039 /*	disable_violation_trace
1040 	=======================
1041 
1042         Called during logoff processing for simulated standby session.
1043 */
1044 
1045   procedure disable_violation_trace;
1046 
1047 /*	get_program_access_code
1048 	=======================
1049 
1050 	Internal security check function.
1051 */
1052 
1053   function get_program_access_code return number;
1054 
1055 /*	disable_control_cache
1056 	=====================
1057 
1058 	Disable control record caching - see enable_control_cache.
1059 */
1060 
1061   procedure disable_control_cache(p_previous_state boolean default false);
1062 
1063 /*	enable_control_cache
1064 	====================
1065 
1066         Improve performance of ADG control queries by caching the control
1067         record. The control data is rarely changed so runtime caching
1068         improves performance.
1069 */
1070 
1071   function enable_control_cache return boolean;
1072 
1073 /*	refresh_control_cache
1074 	=====================
1075 
1076 	Refresh cached copy of control record.
1077 */
1078 
1079   procedure refresh_control_cache;
1080 
1081 end fnd_adg_utility;