Oracle Database 26ai Complete Deletion Guide: How to Use the deinstall Command

26ai_en

Are you looking for a safe and reliable way to uninstall Oracle? Manual deletion using rm -rf can leave configuration files and inventory information behind, causing trouble during reinstallation. Using the official deinstall tool allows for a clean environment reset that maintains system integrity.

In this article, we explain the complete deletion procedure with logs, using Oracle Database 26ai Free (Linux) as an example.

Note: The procedures in this article are generally common to other versions such as Oracle Database 19c / 21c / 23ai. Additionally, this verification was performed on the 26ai Free version. In future official releases (Enterprise Edition, etc.), some paths or screen behaviors may differ slightly.

Conclusion: The Quickest Steps to Delete an Oracle Database

The overall process of deletion using the deinstall command is as follows:

  1. Preparation: Stop the database and listener, and take backups.
  2. Tool Execution: Run $ORACLE_HOME/deinstall/deinstall.
  3. Interactive Input: Respond to confirmations for the listener and database names (basically, just keep pressing Enter).
  4. Post-Processing: Delete configuration files and directories as the root user, following the on-screen instructions.

1. What is the deinstall Tool?

Mechanism and Benefits

The deinstall tool is a dedicated deletion tool introduced in Oracle Database 11gR2. While previous versions used the OUI (Oracle Universal Installer), it is now standard to use this standalone tool located under $ORACLE_HOME.

  • What it does: Deletes software binaries, updates the Central Inventory (oraInventory), removes listener settings, and provides instructions to delete configuration files under /etc (such as oratab).
  • Important Notes: Since database files (the data itself) are also subject to deletion, be sure to backup necessary data using Data Pump (expdp) or RMAN beforehand.

2. Uninstallation Steps and Execution Example

Here, we will explain the steps based on actual logs, taking Oracle Database 26ai Free on an Oracle Linux environment as an example.

Step 1: Checking Environment Variables and Starting the Tool

Perform the work as the installation owner (usually the oracle user).

# 1. Check user
[oracle@19c-gg23ait ~]$ whoami
oracle

# 2. Change directory (to deinstall under ORACLE_HOME)
[oracle@19c-gg23ait ~]$ cd $ORACLE_HOME/deinstall
[oracle@19c-gg23ait deinstall]$ pwd
/opt/oracle/product/26ai/dbhomeFree/deinstall

# 3. Execute the tool
[oracle@19c-gg23ais deinstall]$ ./deinstall

Step 2: Checking Configuration in Interactive Mode

When the tool starts, a configuration check runs, and several questions are displayed. The values in square brackets [] are the defaults. If there are no changes, simply press the Enter key.

Explanation of Execution Log:

Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2026-01-26_09-57-39AM/logs/

############ ORACLE DECONFIG TOOL START ############

## (Omitted: Home directory and inventory location are automatically detected) ##

Network Configuration check config START
# Confirmation of listener deletion. The default detected [LISTENER] is targeted for deletion.
Specify all Single Instance listeners that are to be de-configured. Enter .(dot) to deselect all. [LISTENER]: 
Network Configuration check config END

Database Check Configuration START
# List of configured database names. Automatically detected ones are displayed here.
Specify the list of database names that are configured in this Oracle home []:
Database Check Configuration END

####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /opt/oracle/product/26ai/dbhomeFree
Inventory Location where the Oracle home registered is: /opt/oracle/oraInventory
Following Single Instance listener(s) will be de-configured: LISTENER

# Final confirmation. Enter 'y' to proceed.
Do you want to continue (y - yes, n - no)? [n]: y

Step 3: Progress and Completion of the Deletion Process

Once you enter y, the listener stop/deletion, database de-configuration, and software deletion proceed automatically.

De-configuring listener: LISTENER
    Stopping listener: LISTENER
...
Listener de-configured successfully.
...
Oracle database home OraDBHome26aiFree is de-configured successfully.

############ ORACLE DEINSTALL TOOL START ############
# (Omitted: Binary deletion phase by OUI starts here)
Detach Oracle home 'OraDBHome26aiFree' from the central inventory on the local node : Done
Delete directory '/opt/oracle/product/26ai/dbhomeFree' on the local node : Done

Step 4: Cleanup of Remnants by the root User (Important)

At the end of the process, instructions are displayed to delete directories that could not be removed due to insufficient privileges, or system-wide configuration files. These must be executed manually by the root user.

Instructions output in the log:

Run rm -r /etc/oraInst.loc as root on node(s) 19c-gg23ais at the end of the session.
Run 'rm -r /opt/ORCLfmap' as root on node(s) '19c-gg23ais' at the end of the session.
Run 'rm -r /etc/oratab' as root on node(s) '19c-gg23ais' at the end of the session.
Review the permissions and contents of '/opt/oracle' on nodes(s) '19c-gg23ais'.
If there are no Oracle home(s) associated with '/opt/oracle', manually delete '/opt/oracle' and its contents.

Actual Execution Commands: Open another terminal or use su - to execute.

[oracle@19c-gg23ais deinstall]$ su -
Password: 
[root@19c-gg23ais ~]# rm -rf /etc/oraInst.loc
[root@19c-gg23ais ~]# rm -rf /etc/oratab
[root@19c-gg23ais ~]# rm -rf /opt/ORCLfmap
# Confirm that under /opt/oracle is empty or unnecessary, then delete
[root@19c-gg23ais ~]# rm -rf /opt/oracle

Caution: When deleting /opt/oracle, ensure that no other Oracle products (such as Clients) are installed on the same server.

3. Troubleshooting (ORA Errors, etc.)

Here are common problems that occur during uninstallation and how to deal with them.

Error / PhenomenonCause and Solution
Failed to delete directory …Insufficient privileges or file in use.This is often because files requiring root privileges are included. It is not a problem if you manually run rm as the root user after the tool finishes.
Device or resource busyProcesses are remaining.Identify the accessing process with fuser -u /u01/app/oracle, kill it, and then retry.
Listener does not stopManually stop it with the lsnrctl stop command, then re-execute deinstall.

4. Reference: Deletion Steps in a Windows Environment

For Windows, the basic flow is the same, but the commands and preparation differ.

  1. Preparation:
    • Stop the database.
    • Stop all Oracle-related services (OracleServiceORCL, OracleOraDB...TNSListener, etc.) from the Windows “Services” management tool (services.msc).
  2. Starting the Tool:
    • Open the Command Prompt as “Run as administrator”.
    • Navigate to cd %ORACLE_HOME%\deinstall.
    • Execute deinstall.bat.
  3. Execution:
    • The interactive mode proceeds similarly to the Linux version.
    • Finally, deletion of registry keys and services is also performed automatically.
  4. Remnants Disposal:
    • After restarting the server, if folders like C:\Program Files\Oracle or %ORACLE_HOME% remain, delete them manually from Explorer.

5. FAQ: Frequently Asked Questions

Q1. Can I use deinstall even in an environment where installation failed? A. Yes, you can. Even if the installation terminated halfway, information might have been written to oraInventory. Before manually deleting folders, try running deinstall first. This returns the system to a clean state.

Q2. During deletion, it says “Database not found in the specified home”. A. Check the registration in /etc/oratab. If you created the database manually, the tool may not recognize the DB if there is no entry in oratab. In that case, explicitly specify the database name at the prompt, or proceed with only binary deletion (delete data files later via OS commands).

Q3. Is the procedure the same for deleting the Client? A. It is basically the same. For Oracle Client, execute $ORACLE_HOME/deinstall/deinstall as well. The process is common, except that the database deletion process is skipped.

Summary

Always start the deletion of Oracle Database with the deinstall command.

  1. Execute $ORACLE_HOME/deinstall/deinstall.
  2. Answer y in interactive mode and wait for automatic deletion.
  3. Manually delete the paths displayed at the end as the root user.
  4. Do not forget to delete /etc/oratab and /etc/oraInst.loc.

By following these steps, you can prevent the situation where “previous settings interfere and cause errors” during the next installation.

[reference]
About Oracle Deinstallation Options

コメント

Copied title and URL