OCA/OCP Oracle Database 11g All-in-One Exam Guide 966 The Support Workbench and the Automatic Diagnostic Repository offer wizards for diagnosing and repairing problems, and for working with Oracle Support Services. This material is not extensively examined, but it is possible that general knowledge of procedures could be tested. If you do not have a MetaLink account, you cannot complete the exercises for this chapter—for this reason, it includes screen shots to illustrate every step in using Database Control to set up a job to download and apply a patch. TIP MetaLink has recently been rebadged as My Oracle Support, with an alternative user interface that requires the Adobe Flash player. Some Oracle professionals prefer the Flash interface, but others prefer the “classic” interface; try them both, and make up your own mind. MetaLink is the external interface of Oracle Support Services: a searchable database containing millions of articles on technical issues, and facilities for locating and downloading patches and for raising SRs (Service Requests). An SR is a request for an Oracle Support Services analyst to assist with a problem. To raise an SR, you must have a MetaLink account associated with a valid CSI (Customer Support Identifier) number issued by Oracle Corporation. The Enterprise Manager Support Workbench The Enterprise Manager Support Workbench is a graphical tool giving access to the Automatic Diagnostic Repository (the ADR) with facilities for gathering information, packaging it, and sending it to Oracle Support Services. The Automatic Diagnostic Repository (ADR) The ADR is a central storage point for all diagnostic information. This includes various dumps and trace files, the alert log, and health monitor reports. It is a file-based repository. All instances (RDBMS instances and also ASM instances) create their own directory structure within the ADR. The location of the ADR is determined by the instance parameter DIAGNOSTIC_ DEST. This will default to the ORACLE_BASE environment variable (which is a registry variable on Windows systems) or, if this has not been set, to the ORACLE_HOME/log directory. Within DIAGNOSTIC_DEST, there will be a directory for ADR_BASE: this is DIAGNOSTIC_DEST/diag. In ADR_BASE there are directories for each Oracle product, such as the RDBMS, or database listeners. Within each product directory, there will be directories for each instance of the product: this is ADR_HOME for the instance. For a database instance, ADR_HOME is ORACLE_BASE/diag/rdbms/database_name/instance_name Chapter 27: The Intelligent Infrastructure 967 PART III where database_name is the name of the database and instance_name is the name of the instance. For example: /u01/app/oracle/diag/rdbms/orcl11g/orcl11g Within ADR_HOME there will be a directory structure for the various files that make up the ADR for the instance. Some of the files are formatted with XML tags and are not intended to be viewed directly with editors; some are binary data; others are plain text. The directory ADR_HOME/trace is used as the default value for the instance parameters USER_DUMP_DEST (trace files generated by user sessions) and BACKGROUND_DUMP_DEST (the alert log and trace files generated by background processes). There is another copy of the alert log, formatted with XML tags, in ADR_ HOME/alert. Problems and Incidents A problem is a critical error in the database or the instance. Examples include internal Oracle errors (errors reported with the error code ORA-600) and operating system errors. Each problem has a problem key, which is a text string including the error code and any parameters. An incident is an occurrence of a problem. Incidents are considered to have the same root cause if their problem keys match. When an incident occurs, it is reported in the alert log and Enterprise Manager gathers diagnostic data about the incident in the form of dump files (incident dumps) and stores these in an ADR subdirectory created for that incident. An incident package is a collection of data regarding one or more incidents and problems, formatted for upload to Oracle Support Services as part of an SR. The ADR Command-Line Interface (ADRCI) There is a command-line tool for managing the ADR: the ADRCI. This tool can display details of all problems and incidents, and generate reports and incident packages. Figure 27-1 shows the launching of the ADRCI on Windows, and then running the HELP command. In Figure 27-1, note that ADRCI has detected ADR_BASE. A simple ADRCI session might use these commands: set home diag/rdbms/orcl1g/orcl11g show problem ips create package problem 8 The SET HOME command points the ADRCI toward one ADR_HOME, the path being relative to ADR_BASE. The SHOW PROBLEM command will list all known problems for that ADR_HOME, identified by PROBLEM_ID number. The IPS CREATE PACKAGE command will generate an incident package for the nominated problem in the directory ADR_HOME/incpkg. In most cases, the ADRCI will not be needed: Database Control has an interface to the ADR that is usually easier to use. All-in-1 / OCA/OCP Oracle Database 11g All-in-One / Watson, Ramklass / 162-918-1 OCA/OCP Oracle Database 11g All-in-One Exam Guide 968 The Support Workbench Enterprise Manager Database Control database home page displays all critical alerts. Clicking any of them will take you to the Support Workbench, shown in Figure 27-2. Figure 27-2 shows that there have been eight problems with a total of 127 incidents, but only one problem is still active. This is the problem number 5, which generated an ORA-600 error. From the Support Workbench, you can select a problem, view the details, and create an incident package by clicking the appropriate buttons. TIP SRs used to be called TARs (Technical Assistant Requests), and you will still hear many DBAs using phrases such as “raising a tar.” To create an SR regarding a problem, select the problem’s check box and click View to reach the Problem Details window, shown in Figure 27-3. Figure 27-1 The ADRCI utility Chapter 27: The Intelligent Infrastructure 969 PART III Figure 27-2 The Support Workbench Figure 27-3 Problem Details, with links for using MetaLink OCA/OCP Oracle Database 11g All-in-One Exam Guide 970 The links shown in the Oracle Support tab of the Problem Details window will launch wizards for creating an incident package, and then raising an SR to which the package can be attached. EXAM TIP The Support Workbench is a tool for interfacing with MetaLink and for packaging diagnostic information. Exercise 27-1: Use the Support Workbench In this exercise, you will investigate any problems that may have been recorded in the ADR. 1. Connect to your database with Database Control as user SYSTEM. 2. Open the Support Workbench: from the database home page, choose the Software And Support tab, then the Support Workbench link in the Support section. 3. The default display is to show problems in the last 24 hours. In the View drop-down box, choose All to see all problems that are known to the ADR, as shown here: 4. Investigate any problems shown by clicking the links to show the details of the problem. Chapter 27: The Intelligent Infrastructure 971 PART III Patches In some environments, patching can take up a considerable amount of time. It is, however, a vital task. Some patches will be to fix problems in the Oracle code that cause some features not to work as documented: applying these is optional, only necessary if your installation happens to have hit the problem. Others are to fix security issues and are not optional at all. Patches can be applied using a command-line utility, or with Enterprise Manager. Types of Patch Patches are shipped in three forms: • Interim patches These are written to fix one specific problem, for an exact release level of the database. They are not necessarily fully integration or regression tested. • CPU (Critical Patch Update) patches These are cumulative patches for a specific release level and include all dependent patches. CPUs are fully integration and regression tested. • Patch sets A patch set is a cumulative set of product fixes that will increment the release level of the product (as reported by a query against V$VERSION), for instance, from 11.1.0.6 to 11.1.0.7. If you have hit a problem, and research with MetaLink and with other resources identifies the problem as a known bug with a patch to fix it, this patch can be installed as an interim patch. Otherwise, do not install interim patches. CPUs are usually issued every three months and will often include patches for security problems. These should be installed, particularly if your systems have to comply with security standards enforced by local jurisdictions. Applying a patch set is a much bigger operation that may change the behavior of the product, rather than merely fixing problems. Applying patch sets should not be embarked upon without full testing. To apply patches, use the Opatch utility. This can be invoked from the command line, or through Database Control. TIP Many DBAs try to avoid installing interim patches. They will fix a problem, but applying several may be problematic because of the lack of integration testing. CPUs and patch sets are much safer. Integration with MetaLink and the Patch Advisor Database Control includes a Patch Advisor that will identify what CPUs and what Oracle-recommended patches should be applied to the database. This requires configuring a connection to MetaLink and scheduling a job to make the check. An account with MetaLink and an Internet connection from the server machine are prerequisites for doing this. OCA/OCP Oracle Database 11g All-in-One Exam Guide 972 To configure MetaLink integration, click the Setup link at the top right of the Database Control database home page and then the Patching Setup link in the Overview Of Setup section. In the Patching Setup window, enter your MetaLink username and password. These will be associated with the username you used when connecting to Database Control. If there is a proxy server between the database server and the Internet, the Proxy And Connection Settings tab will let you configure this. To schedule a job for checking what patches are needed, from the database home page click the Jobs link in the Related Links section. In the Create Job drop-down box choose Refresh From MetaLink and click GO. Give the job a name, schedule it to run with whatever frequency you think appropriate, and submit the job. Once the job has run, the Patch Advisor should be available. To reach the Patch Advisor, from the database home page select the Software And Support tab, then the Patch Advisor link in the Database Software Patching section. This will show all the recommended patches for the database, as of the last time the job was run. Applying Patches Patches can be applied with the Opatch utility, or with Database Control; the Database Control method in fact uses Opatch behind the scenes. The Opatch utility is installed into the directory ORACLE_HOME/Opatch and launched by running the executable file opatch (or opatch.bat on Windows). The prerequisites are that the ORACLE_ HOME environment variable must be set (note that on Windows it is not sufficient to have this as a registry variable; it must be set within the operating system session); the Java Runtime Environment 1.4 or later must be available; a few standard operating system utilities must be available. To test the prerequisites, use the LSINVENTORY command as in Figure 27-4. In Figure 27-4, Opatch is being run on a Windows system. The utility was invoked by specifying the full path, using the ORACLE_HOME environment variable, and the LSINVENTORY command. This shows summary information regarding what has been installed, including any interim patches (none, in the example). To obtain much more detailed information, use the -detail switch: %ORACLE_HOME%\Opatch\opatch lsinventory -detail All patches will come with a README.TXT file of instructions detailing how to install the patch. These instructions will include detail on whether the database should be open or shut down while the patch is applied. To apply a patch once it is downloaded from MetaLink and expanded (it will have come as a ZIP file), run Opatch as follows: opatch apply path_to_patch where path_to_patch is the directory where the patch was expanded. Chapter 27: The Intelligent Infrastructure 973 PART III To apply a patch with Database Control, the patch must first be downloaded to a staging area. The staging area is a location where the patch is staged—stored locally, prior to application. To reach the wizard that will stage and apply the patch, from the database home page select the Software And Support tab, and then the Stage Patch link in the Database Software Patching section. This will launch a six-step wizard: • Select patch • Select destination • Set credentials • Stage or apply • Schedule • Summary The wizard will connect to MetaLink using stored credentials, download the patch, and create a job to apply the patch. The illustrations that follow show examples of using the wizard to apply a patch. Figure 27-4 Using Opatch to inspect the inventoried software OCA/OCP Oracle Database 11g All-in-One Exam Guide 97 4 1. First, enter the patch number and operating system (some patches come in versions that are operating system specific). 2. Choose the targets to which the patch should be applied. The choice will be limited to targets appropriate for the patch (in the example, database instances). Chapter 27: The Intelligent Infrastructure 975 PART III 3. Provide credentials. These will be either operating system credentials, database credentials, or both depending on the patch. 4. Decide whether to apply the patch or only stage it for future use. . the ADRCI will not be needed: Database Control has an interface to the ADR that is usually easier to use. All-in-1 / OCA/ OCP Oracle Database 11g All-in-One / Watson, Ramklass / 162-918-1 OCA/ OCP. 162-918-1 OCA/ OCP Oracle Database 11g All-in-One Exam Guide 968 The Support Workbench Enterprise Manager Database Control database home page displays all critical alerts. Clicking any of them will take you. is ORACLE_ BASE/diag/rdbms /database_ name/instance_name Chapter 27: The Intelligent Infrastructure 967 PART III where database_ name is the name of the database and instance_name is the name of the instance. For example: /u01/app /oracle/ diag/rdbms/orcl11g/orcl11g Within