Alert Log using ADRCI in Oracle with Examples
In this article, I am going to discuss Alert Log using ADRCI in Oracle with Examples. Please read our previous article where we discussed Alert Log Files in Oracle with Examples.
Alert Log using ADRCI in Oracle
Until now we have seen the alert log file using the text editor. Now, we will try to view the alert log using the ADRCI. ADRCI is an oracle utility. Before learning how to view the alert logs in ADRCI let’s try to have a quick look at some of the few commands in the VI editor. Open a terminal and move to the Desktop location and create a file.
So, we are in the Desktop folder. Let’s try to create a file using the command “touch abc.txt”.
So, the file was created. Let’s try to open the file from the file manager and enter some random text that includes upper case, lower case, and both upper-case and lower-case sentences.
Now, we can the data in the file abc.txt. Let’s try to open the file using the vi-editor using the command “vi abc.txt”.
Now, we can see the data present in the file abc.txt. Let’s try to learn a few commands in operating a text file in the vi editor.
Case 1: Bottom of the page.
If we need to go to the bottom of the page, we need to use the controls “SHIFT + G”. We need to enter the Shift and G letter which takes the cursor to the bottom of the file.
Case 2: Last Occurrence
In our text file abc.txt we can see there is dotnet word in many lines. If we need to find out the last occurrence of the word dotnet there is control for it. Press the ESC button and the console takes you to the command line interface, and then use the command”? and the word you are looking for”.
So, from the output, you can see the word dotnet occurred 5 times from the bottom of the page. If we press n then the cursor will move to the next occurrence of the word that we are searching.
Note: The Search in the VI editor is case-sensitive.
Now, Let’s try to search for the capital word and see the search results.
If we press n then it moves to the next occurrence of the word DOTNET that is present upwards.
Case 3: First Occurrence
If we need to search the first occurrence of any word then press the ESC button and the VI editor will move to the command line interface and then use “/dotnet”. The VI editor will search for the first occurrence of the word “dotnet”.
If we press n then the cursor moves to the next occurrence. So, the main concept here is if we use the ‘?’ symbol to search for any word then the VI editor shows the last occurrence of the word and if we use ‘/’ then the VI editor will show the first occurrence of the word. Let’s go ahead and quit the VI editor using the command “:q!” and press enter.
Now, let us come back to our topic and learn about alert logs using ADRCI. The full form of ADRCI is Automatic Diagnostic Repository Command Interpreter. This is the Oracle utility that works as a command line interface used to manage the Oracle database diagnostic data. We can connect to this utility by issuing the command ADRCI in the Linux terminal which is shown below.
Now, we in the ADRCI utility. We can see the ADR base as /u01/app/oracle. So, as we are connected to the ADRCI, let’s issue a command “show alert” which shows all the directories in the ADR.
This shows all the options for the alert log location. We need to select the option which has the path /diag/rdbms/jayadb/jayadb/, you may have a different option but this is the path you need to select to open the alert log. So, we have to select option 2.
So, once we select option 2 the alert log file will be opened using the VI editor.
So, we can see the alert log has been opened. Let’s go to the last line of this alert log using the control “Shift + G”.
So, we are at the bottom of the file. Let’s try to find out when was the last time the database was started. We need to press the ESC button first and then “?Starting ORACLE” and press enter.
We can see the cursor has been moved to the date 29-10-2022. We can press the n button to move the cursor to the next occurrence of the word “Starting ORACLE”.
Now, Let’s try to search for the first occurrence. Let’s try to search for the word “ALTER DATABASE” for the first occurrence we need to press the ESC button and then use “/ALTER DATABASE”.
So, we can see the first ALTER DATABASE statement was done on 22-07-2022. That is the date when we created the database. So, this is the tool we used to open the alert log file but the good practice is using the text editor which is easy and quick in terms of searching. We can exit from the ADRCI using the letter q.
So, in the further topics, we can use both ADRCI and text editor to view the files related to the database.
In the next article, I am going to discuss Trace Files Purging in Oracle with Examples. Here, in this article, I try to explain Alert Log using ADRCI in Oracle with Examples and I hope you enjoy this Alert Log using ADRCI in Oracle with Examples article.
About the Author: Pranaya Rout
Pranaya Rout has published more than 3,000 articles in his 11-year career. Pranaya Rout has very good experience with Microsoft Technologies, Including C#, VB, ASP.NET MVC, ASP.NET Web API, EF, EF Core, ADO.NET, LINQ, SQL Server, MYSQL, Oracle, ASP.NET Core, Cloud Computing, Microservices, Design Patterns and still learning new technologies.