Oracle9i Real Application Clusters Real Application Clusters Guard I - Concepts and Administration Release 2 (9.2) Part Number A96601-01 |
|
This chapter describes the scripts that should be customized for each Oracle Real Application Clusters Guard environment. It includes the following sections:
You can customize your Oracle Real Application Clusters Guard installation. Table 5-1 shows the features that can be customized and the important files, scripts, or packages associated with each feature.
For failures in Oracle Real Application Clusters Guard that result in the primary instance or primary role becoming unavailable, Oracle Real Application Clusters Guard automatically executes specific failover or recovery actions. Although Oracle Real Application Clusters Guard can take certain automated actions, it requires manual intervention to repair some types of failures. It is important for those failures to be examined and quickly repaired so that a secondary outage does not occur. For example, a secondary instance may shut down due to a failure of the secondary node. Oracle Real Application Clusters Guard cannot restart the failed node because it requires manual examination of why the node failed, some repair action, and then restarting the failed node. The failure of the secondary node does not cause any downtime because the primary instance and service are still available, but Oracle Real Application Clusters Guard sends a call-home message to the Oracle Real Application Clusters Guard log immediately so that normal operation can be restored quickly.
Oracle Real Application Clusters Guard sends a call-home message to the Oracle Real Application Clusters Guard log for every failure that occurs in Oracle Real Application Clusters Guard, regardless of the type of the failure. Oracle Real Application Clusters Guard also executes a callout to the call-home script. The Oracle Real Application Clusters Guard Setup Utility (PFSSETUP
) generates the script, which is located in $PFS_HOME/user
/pfs_$ORACLE_SERVICE_callhome.sh
.
This script is not executable until you customize it to suit the your environment. For example, you can customize the script so that an e-mail notification results in sending a page to the appropriate administrator.
The following call-home template is part of the call-home script:
# Call_Home Template # CALLHOME_MESSAGE=$1 # # Example: # # mail <userid> << EOF # !!! Alert: $CALLHOME_MESSAGE at `date` !!! # EOF
When there is a failure, this part of the call-home script logs a message in pfs_$ORACLE_SERVICE_
host
.log
similar to the following:
Fri Jul 27 12:48:08 2001 PFS-2019: Info: Real Application Clusters Guard callhome with OracleUp_for_SALES_error_Will_failover now Fri Jul 27 12:48:09 2001 PFS-2019: Info: Real Application Clusters Guard callhome with Failing_over_service_SALES now
It also e-mails the messages to the user ID that you specify when you customize the template.
The heartbeat monitor checks not only whether the primary instance has a heartbeat but also whether it is capable of work. It monitors the work capability by repeatedly running a customized PL/SQL procedure containing a query that should represent the actual work that needs to be done in the instance. The default catpfs.sql
script, which you run when you create the Oracle Real Application Clusters Guard database, prompts the user for a table owner and a table name upon which to run a basic SELECT
statement. Modify the customer_query
package in the catpfs.sql
script to reflect your business needs before running the script.
The customer query, customer_query.test
, is contained in catpfs.sql
and is located in the $ORACLE_HOME/pfs/admin
directory. The contents of the customer_query.test
template are as follows:
REM customer_query package executed by ORACLE_PING create or replace package customer_query as procedure test (total_rows out number); end customer_query; / create or replace package body customer_query as procedure test (total_rows out number) is begin -- Example customer queries: -- select count(*) into total_rows from &&syn_name; -- select max(emp_id) into total_rows from &&syn_name; -- select sum(salary) into total_rows from &&syn_name; end; end customer_query; / /* from ORACLE_PING */ EXEC SQL EXECUTE BEGIN customer_query.test(:number_of_rows); END ; END-EXEC ;
The customer query can be modified to select any single specific value such as a specific row, a row count, or a maximum value. When you write the customer query, consider the following recommendations:
Test the customer query when the system is under heavy load to ensure that it can be completed within the interval defined by the USER_TIMEOUT
value in the ORAPING_CONFIG
table.
See Also:
"Making Online Changes to the ORAPING_CONFIG Table" to find out how to check the value of |
When an instance or pack starts up, shuts down or changes its role from secondary to primary, Oracle Real Application Clusters Guard sends a message to the Oracle Real Application Clusters Guard log. Automatic role change notification occurs when Oracle Real Application Clusters Guard takes automatic actions. Manual role change notification occurs only when PFSCTL
commands are executed.
Table 5-2 shows notifications of role changes.
The notification is implemented by a script called pfs_$ORACLE_SERVICE_notifyrole.sh
. The PFSSETUP
utility generates the script, which resides under the $PFS_HOME/user
directory. The script is not executable until you modify it. You can modify it to perform certain actions before an instance shuts down, for example. The following is the role notification script template:
# Role Notification Template # NOTIFY_ORACLE_SERVICE=$1 NOTIFY_NODE=$2 NOTIFY_ROLE=$3 NOTIFY_STATUS=$4 NOTIFY_LOGGING_DATE=$5 # # --- DO NOT MODIFY ABOVE THIS LINE --- # # Example # case $NOTIFY_STATUS in "planned_up") # Run scripts that you want executed before the instance starts. ;; "up") # Run scripts that you want executed after the instance starts. ;; "planned_down" | "down") # Run scripts that you want executed before the instance is shut down. # WARNING: Scripts executed at this step will affect failover time. ;; "cleanup") # Run scripts that you want executed after the instance is shut down. ;; esac
See Also:
Your platform-specific Oracle Real Application Clusters Guard installation guide for more information about the PFS Installer |
The following examples show the messages that occur on each host:
When the pfsboot
command is entered on HOSTA
, the following messages appear in the Oracle Real Application Clusters Guard log on HOSTA
:
Fri Dec 22 16:31:27 2000 PFS-5555: sales hostA unknown planned_up 2000/12/22-16:31:26 Fri Dec 22 16:32:13 2000 PFS-5555: sales hostA primary up 2000/12/22-16:32:12
The following messages appear in the Oracle Real Application Clusters Guard log on HOSTB
:
Fri Dec 22 16:32:25 2000 PFS-5555: sales hostB unknown planned_up 2000/12/22-16:32:23 Fri Dec 22 16:33:18 2000 PFS-5555: sales hostB secondary up 2000/12/22-16:33:17
When the pfshalt
command is entered on HOSTA
, the following messages appear in the Oracle Real Application Clusters Guard log on HOSTA
:
Fri Dec 22 16:38:41 2000 PFS-5555: sales hostA primary planned_down 2000/12/22-16:38:40 Fri Dec 22 16:38:50 2000 PFS-5555: sales hostA primary down 2000/12/22-16:38:49 Fri Dec 22 16:40:09 2000 PFS-5555: sales hostA primary cleanup 2000/12/22-16:40:08
The following messages appear in the Oracle Real Application Clusters Guard log on HOSTB
:
Fri Dec 22 16:37:56 2000 PFS-5555: sales hostB secondary planned_down 2000/12/22-16:37:54 Fri Dec 22 16:38:04 2000 PFS-5555: sales hostB secondary down 2000/12/22-16:38:04 Fri Dec 22 16:38:27 2000 PFS-5555: sales hostB secondary cleanup 2000/12/22-16:38:26
When the move_primary
command is entered on HOSTA
, the following messages appear in the Oracle Real Application Clusters Guard log on HOSTA
:
Fri Dec 22 11:21:35 2000 PFS-5555: sales hostA primary planned_down 2000/12/22-11:21:35 Fri Dec 22 11:22:15 2000 PFS-5555: sales hostA primary down 2000/12/22-11:22:15 Fri Dec 22 11:22:25 2000 PFS-5555: sales hostA primary cleanup 2000/12/22-11:22:24
The following message appears in the Oracle Real Application Clusters Guard log on HOSTB
:
Fri Dec 22 11:22:10 2000 PFS-5555: sales hostB primary up 2000/12/22-11:22:09
When the restore
command is entered on HOSTA
, the following messages appear on the Oracle Real Application Clusters Guard log on HOSTA
:
Fri Dec 22 12:20:24 2000 PFS-5555: sales hostA unknown planned_up 2000/12/22-12:20:23 Fri Dec 22 12:21:24 2000 PFS-5555: sales hostA secondary up 2000/12/22-12:21:23
No messages appear in the Oracle Real Application Clusters Guard log on HOSTB
.
When automatic failover occurs, the following messages appear in the Oracle Real Application Clusters Guard log on HOSTA
:
Fri Dec 22 15:03:42 2000 PFS-5555: sales hostA primary down 2000/12/22-15:03:41 Fri Dec 22 15:04:51 2000 PFS-5555: sales hostA primary cleanup 2000/12/22-15:04:50
The following message appears in the Oracle Real Application Clusters Guard log on HOSTB
:
Fri Dec 22 15:03:38 2000 PFS-5555: sales hostB primary up 2000/12/22-15:03:37
You can use Oracle Enterprise Manager to administer the Oracle Real Application Clusters Guard database. The following requirements must be met in order to use Oracle Enterprise Manager:
ORATAB
file must be configured for SRVCTL
.
Create an entry for the Oracle9i Real Application Clusters database in the ORATAB
file. Oracle Enterprise Manager uses the ORATAB
file during service discovery to determine:
Use the following syntax for the Oracle9i Real Application Clusters entry:
db_name:$ORACLE_HOME:N
DB_NAME
is the database name given to the Oracle9i Real Application Clusters database. $ORACLE_HOME
is the directory path to the database. N
indicates that the database should not be started at reboot time.
The following example is for a database named SALES
:
SALES:/u01/oracle/901:N
This section contains the following topics:
The library cache includes the shared SQL areas, private SQL areas, PL/SQL procedures and packages, and control structures such as locks and library cache handles. A shared SQL area contains the parse tree and execution plan for a single SQL statement or for similar SQL statements. Oracle saves memory by using one shared SQL area for multiple similar DML statements, particularly when many users execute the same application. A private SQL area contains data such as bind information and runtime buffers. Oracle processes PL/SQL program units (procedures, functions, packages, anonymous blocks, and database triggers) much the same way it processes individual SQL statements. Oracle allocates a shared area to hold the parsed, compiled form of a program unit. Oracle allocates a private area to hold values specific to the session that executes the program unit, including local, global, and package variables and buffers for executing SQL.
Maintaining information about frequently executed SQL and PL/SQL statements in the library cache improves the performance of the Oracle database server. In an Oracle9i Real Application Clusters primary/secondary configuration, the library cache associated with the primary instance contains up-to-date information. If failover occurs, then the benefit of that information is lost unless the library cache on the secondary instance is populated before failover.
You can use the DBMS_LIBCACHE
package to transfer the information in the library cache of the primary instance to the library cache of the secondary instance. This process is called warming the library cache. It improves performance immediately after failover because the new primary library cache does not need to be populated with parsed SQL statements and compiled PL/SQL units.
Figure 5-1 shows the library cache being compiled at the secondary instance, by using SQL statements and PL/SQL units extracted from the primary instance.
DBMS_LIBCACHE
captures and compiles the part of selected cursors that can be shared. It selects cursors based on the amount of shared memory that is used and the frequency with which the associated SQL statements are used. It then populates the library cache on the secondary instance with the compiled cursors.
Execute the DBMS_LIBCACHE
package on the secondary instance:
Installing the DBMS_LIBCACHE
procedure causes the following actions to occur:
PARSER
.PARSER
.PARSER
.LIBC_LINK
that is owned by PARSER
.The DBMS_LIBCACHE
package can be installed at any time, either during installation of Oracle9i Real Application Clusters or later, during normal operation.
Perform the following steps to set up DBMS_LIBCACHE
:
SYS
. Enter the following commands:
$ cd $ORACLE_HOME/pfs/admin $ sqlplus "/ as sysdba"
You should see output similar to the following:
SQL*Plus: Release 9.0.1.0_0 - Production on Fri Feb 9 15:45:54 2001 (c) Copyright 2001 Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.0.1.0_0 - Production With the Partitioning and Real Application Clusters options JServer Release 9.0.1.0_0 - Production SQL>
DBMS_LIBCACHE
by running catlibc.sql
. The catlibc.sql
procedure is found in the $ORACLE_HOME/pfs/admin
directory, which you entered in Step 1. Enter the following command:
SQL> @catlibc.sql
You should see output similar to the following, including the errors:
Package created. drop public synonym dbms_libcache$def * ERROR at line 1: ORA-01432: public synonym to be dropped does not exist Synonym created. Grant succeeded. View created. Grant succeeded. drop public synonym v$sql2 * ERROR at line 1: ORA-01432: public synonym to be dropped does not exist Synonym created. ... Creating the parsing user and database link. Below are the list of online tablespaces in this database. Decide which tablespace you wish to use for the PARSER user. TABLESPACE_NAME ------------------------------ RBS TEMP USERS Please enter the parsing users password and tablespaces. Enter value for parser_password:
PARSER
. Enter the password for PARSER
. For example, the password may be parser
:
parser
You should see output similar to the following:
Enter value for default_tablespace:
PARSER
. For example:
USERS
You should see output similar to the following:
Enter value for temporary_tablespace:
PARSER
. For example:
TEMP
You should see output similar to the following:
User created. Grant succeeded. Enter value for parser_password:
parser
You should see output similar to the following, including the error:
Connected. drop public database link libc_link * ERROR at line 1: ORA-02024: database link not found Please enter the parsing users TNS connect string. Enter value for connect_string:
PARSER
uses this database link to connect to the library cache on the other instance. For example:
parser_service
You should see output similar to the following:
Database link created.
DBMS_LIBCACHE
package. Connect as user SYS
and run dbmslibc.sql
, which is found in the $ORACLE_HOME/pfs/admin
directory. Enter the following commands:
$ cd $ORACLE_HOME/pfs/admin $ sqlplus "/ as sysdba" SQL> @dbmslibc
You should see output similar to the following, including the error:
Package created. drop public synonym dbms_libcache * ERROR at line 1: ORA-01432: public synonym to be dropped does not exist Synonym created. Grant succeeded. Grant succeeded. Package body created.
The main public interface of the DBMS_LIBCACHE
package is the COMPILE_FROM_REMOTE
procedure. Invoke it from the instance on which the library cache needs to be populated, the secondary instance in the context of Oracle Real Application Clusters Guard. While the DBMS_LIBCACHE
package has been designed for an Oracle9i Real Application Clusters configuration, you can use it in other Oracle environments that would benefit from warming the library cache.
Oracle Corporation recommends that you invoke the procedure after the contents of the library cache on the primary instance have stabilized. You can use the COMPILE_FROM_REMOTE
procedure in the following ways:
On the secondary instance, perform the following steps:
PARSER
, by using SQL*Plus:
$ sqlplus parser/parser
SQL> set serveroutput on;
COMPILE_FROM_REMOTE
procedure. The SQL statement should have the following format:
EXECUTE sys.dbms_libcache.compile_from_remote(db_link,username,threshold_ executions,threshold_sharable_mem);
Table 5-3 describes the arguments for executing the COMPILE_FROM_REMOTE
procedure.
Only DB_LINK
is mandatory. The EXECUTE
statement must contain a value for DB_LINK
. Specify values for the other arguments only if their values are different from the default values.For example, suppose you want to specify the parameter values shown in the following table.
Parameter | Value |
---|---|
|
|
|
|
|
|
|
|
Then execute the COMPILE_FROM_REMOTE
procedure with the following SQL statement:
SQL> EXECUTE sys.dbms_libcache.compile_from_remote('LIBC_LINK','APPS',5,800);
Enter the following SQL statement:
SQL> EXECUTE sys.dbms_libcache.compile_from_remote('LIBC_LINK');
You should see output similar to the following:
Total SQL statements to compile=14 Total SQL statements compiled=14
The COMPILE_FROM_REMOTE
procedure is invoked twice because the cursors may be owned by the APPS
user or the GL
user:
SQL> EXECUTE sys.dbms_libcache.compile_from_remote('LIBC_LINK', 'APPS'); SQL> EXECUTE sys.dbms_libcache.compile_from_remote('LIBC_LINK', 'GL');
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|