ADRCI: discover its advantages

ADRCI: discover its advantages

Published on: Category: Oracle

In this article, Qualogy’s Pierre van der Ven shares his insights on ADRCI.

In my opinion, ADRCI is one of the most underestimated tools Oracle delivers. As a DBA, I use it a lot for features I will describe in this blog, the main feature being monitoring. In this blog, I will also  summarize what I think are the most important options. Be aware that I will not cover all features.

What is ADRCI?

According to Oracle documentation: ‘The ADR Command Interpreter (ADRCI) is a command-line tool that you use to manage Oracle Database diagnostic data.’. ADR is the abbreviation of Automatic Diagnostic Repository.

Why should you use it?

With ADRCI you can handle diagnostic data. Of course you can perform these actions manually, but why not use a tool that is actually made for it?

ADRCI’s main functions are:
- monitoring
- purging
- creating incident packages

How do you start?

When your ORACLE_HOME has been set, you can start the interactive mode by typing “adrci”:

  1. >adrci
  2.  
  3. ADRCI: Release 12.2.0.1.0 - Production on Fri Oct 5 12:33:50 2018
  4. Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
  5. ADR base = "/u01/app/oracle"
  6. adrci>

For this blog, I only use the interactive mode. When you want to use the automatic mode, search for “batch mode”.

How do you set the environment in ADRCI?

When ADRCI has been started, check which homes are available. If the home you expected is not in there, exit ADRCI (adrci> exit), change the directory to where the ADR-related files are, and start ADRCI again.

Setting the home can usually be done by following these steps:

  1. >adrci
  2.  
  3. ADRCI: Release 12.2.0.1.0 - Production on Mon Feb 4 14:30:47 2019
  4.  
  5. Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
  6.  
  7. ADR base = "/u01/app/oracle"
  8. adrci> show homes
  9. ADR Homes:
  10. diag/rdbms/db1/db1
  11. diag/rdbms/db2/db2
  12. adrci> set home diag/rdbms/db1/db1
  13. adrci>

Monitoring

This depends on your definition of monitoring and what you want to check. Using ADRCI, it can be divided into health checks or looking at the log-files.

Let’s start with the health checks. Oracle created a lot of documentation regarding ADRCI and health checks. To find these, open https://docs.oracle.com and search for ADRCI. This page explains how to show health check reports and what is in them. It is simply too detailed to dive into in this blog. Read the Oracle documentation, and you know what is done automatically and how to retrieve it.

Let’s take a look at the logs. After you start “adrci” and set the home to your desired home, there are several commands you could use (be aware that this overview is far from complete):

Purging

According to ADRCI, this is purging: ‘Purge the diagnostic data in the current ADR home. If no option is specified, the default purging policy will be used.’

To see the current purge-policy, use show control or the query below:

  1. adrci> select SHORTP_POLICY,LONGP_POLICY from ADR_CONTROL;
  2.  
  3. SHORTP_POLICY LONGP_POLICY
  4. -------------------- --------------------
  5. 720 8760
  6. 1 row fetched
  7.  
  8. adrci>

This returns a lot of information. For now, the SHORTP_POLICY and LONGP_POLICY are the ones we are looking for. The mentioned value is hours.

SHORT_POLICY is about:

  • Trace files, including the files stored in the cdmp_timestamp subdirectories
  • Core dump files
  • Packaging information

LONG_POLICY is about:

  • Incident information
  • Incident dumps
  • Alert logs

You are probably wondering when exactly the purge is done. This is what Oracle documentation tells us:
‘Some Oracle products, such as Oracle Database, automatically purge diagnostic data at the end of its life cycle. Other products and components require you to purge diagnostic data manually with this command. You can also use this command to purge data that is due to be automatically purged.’

So for the database, Oracle will run the purge automatically. But you can also start it manually by just typing ‘purge’ at the adrci-prompt.

When the diagnostic-directory is full, you can temporarily change the purge-policies, start the purge, and change the purge-policy back. Be aware however, that you will lose a lot of diagnostics files if you do this.

  1. adrci> set control (SHORTP_POLICY=24);
  2. adrci> set control (LONGP_POLICY=168);
  3. adrci> purge
  4. adrci> set control (SHORTP_POLICY=720);
  5. adrci> set control (LONGP_POLICY=8760);

Creating an incident package

When you encounter an incident in OEM that needs more investigation, it is quite easy to create an incident package and upload it to Oracle support. If you do this, you will probably have all the files together that Oracle support needs to investigate your incident.

To find the incident number, go to “adrci” and check the incidents:

  1. adrci> show incident
  2.  
  3. INCIDENT_ID PROBLEM_KEY CREATE_TIME
  4. -------------------- --------------------- ----------------------------------------
  5. 6713 ORA 4036 2019-01-08 15:42:28.671000 +01:00
  6. 7842 ORA 600 [koxsi2sz1] 2019-01-30 15:57:29.397000 +01:00
  7. 7946 ORA 600 [koxsi2sz1] 2019-02-04 11:16:06.413000 +01:00
  8. 7947 ORA 600 [koxsi2sz1] 2019-02-04 11:25:53.368000 +01:00
  9. 7948 ORA 600 [koxsi2sz1] 2019-02-04 11:26:33.738000 +01:00
  10. 5 rows fetched
  11.  
  12. adrci>

Look for the incident you want to create a package for, then create it. 

  1. adrci> ips pack incident 7948 in /tmp
  2. Generated package 1 in file /tmp/ORA600kox_20190204134814_COM_1.zip, mode complete
  3. adrci>

Upload the generated ZIP-file to Oracle support. When you open the ZIP, you will see it gathered the files from several diagnostic-directories (ie trace, alert, etc.)

Conclusion

We all need to look up parameters in the database every once in a while. Either to find the belonging logfiles, or to manually collect a lot of logfiles on request of Oracle support. So make your life easier, and give ADRCI a try. When you get used to it, you will love it.

References

https://docs.oracle.com

https://docs.oracle.com/en/database/oracle/oracle-database/18/admin/managing-diagnostic-data.html#GUID-6C071BBB-C74F-4D0B-8134-5CD44F6F3259

Pierre van der Ven
About the author Pierre van der Ven

Pierre van der Ven is an enthusiastic and result-oriented colleague with ICT-workexperience since 1998. His knowledge and experience are mainly in the field of Oracle databases. In recent years, Pierre has grown his knowledge of SQL Server.

More posts by Pierre van der Ven
Comments
Reply