Skip to main content

OCI VMDB System : Delete old Oracle Home post database upgrade using dbcli

After the database upgrade from 12c to 19c, you will find two Oracle Homes on the server. Follow below steps to delete 12c oracle home


=> Find the database home ID of 12c oracle home


[root@sitdb ~]# dbcli list-dbhomes

ID                                       Name                 DB Version                               Home Location                                 Status
---------------------------------------- -------------------- ---------------------------------------- --------------------------------------------- ----------
6f64870a-8b63-4530-8a9d-132438e273a5     OraDB12102_home1     12.1.0.2.220719                          /u01/app/oracle/product/12.1.0.2/dbhome_1     Configured
03f77e36-98c1-4f0d-ac7f-923e9073a654     OraDB19000_home1     19.15.0.0.0                              /u01/app/oracle/product/19.0.0.0/dbhome_1     Configured
[root@sitdb ~]# 

=> Run delete command 

dbcli delete-dbhome -i 6f64870a-8b63-4530-8a9d-132438e273a5

=> [root@sitdb log]# dbcli delete-dbhome -i 6f64870a-8b63-4530-8a9d-132438e273a5

Job details
----------------------------------------------------------------
                     ID:  9b02b85f-6123-4def-a738-5062701483bb
            Description:  Database Home OraDB12102_home1 Deletion with id 6f64870a-8b63-4530-8a9d-132438e273a5
                 Status:  Running
                Created:  September 6, 2022 3:38:50 PM GST
               Progress:  0%
                Message:
             Error Code:
Task Name                                                                Start Time                          End Time                            Status
------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------


[root@sitdb log]# dbcli describe-job -i 9b02b85f-6123-4def-a738-5062701483bb

Job details
----------------------------------------------------------------
                     ID:  9b02b85f-6123-4def-a738-5062701483bb
            Description:  Database Home OraDB12102_home1 Deletion with id 6f64870a-8b63-4530-8a9d-132438e273a5
                 Status:  Failure
                Created:  September 6, 2022 3:38:50 PM GST
               Progress:  5%
                Message:  DCS-10329:Failed to delete database home with id : 6f64870a-8b63-4530-8a9d-132438e273a5.
             Error Code:  DCS-10329
                  Cause:  Failed to delete database home.
                 Action:  Contact Oracle support for assistance.
Task Name                                                                Start Time                          End Time                            Status
------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------
DbHome service deletion for 6f64870a-8b63-4530-8a9d-132438e273a5         September 6, 2022 3:38:50 PM GST    September 6, 2022 3:39:10 PM GST    Failure
DbHome service deletion for 6f64870a-8b63-4530-8a9d-132438e273a5         September 6, 2022 3:38:50 PM GST    September 6, 2022 3:39:10 PM GST    Failure
Delete dbhome with ID: 6f64870a-8b63-4530-8a9d-132438e273a5              September 6, 2022 3:38:51 PM GST    September 6, 2022 3:39:09 PM GST    Failure


[root@sitdb log]#

=> Failed due to below perl errors 

com.oracle.dcs.commons.utils.CommonsUtils: perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-16"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.

Fix: Delete all patches from 12c home 

unset 19c environment and set 12c environment 

unset ORACLE_HOME
unset ORACLE_UNQNAME
unset LD_LIBRARY_PATH
unset ORACLE_SID
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/oracle/.local/bin:/home/oracle/bin
export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

[oracle@sitdb dbhome_1]$ opatch lspatches
33066573;
31413047;
21923026;
33613829;
34421053;
34269744;
34006650;
34006614;
32327201;
31335037;
30432084;
33912892;DATABASE PERL UPDATE IN 12.1.0.2.0 TO V5.32-1 (CVE-2022-23990 - LIBEXPAT UPDATE)
34086863;Database PSU 12.1.0.2.220719,Oracle JavaVM Component (JUL2022)
34113570;JDK BUNDLE PATCH 12.1.0.2.220719
34057733;Database Bundle Patch : 12.1.0.2.220719 (34057733)
32758932;OCW PATCH SET UPDATE 12.1.0.2.210720 (32758932)
OPatch succeeded.

[oracle@sitdb dbhome_1]$

opatch nrollback -id 33066573,31413047,21923026,33613829,34421053,34269744,34006650,34006614,32327201,31335037,30432084,33912892,34086863,34113570,34057733,32758932

[oracle@sitdb dbhome_1]$ opatch lspatches

There are no Interim patches installed in this Oracle Home "/u01/app/oracle/product/12.1.0.2/dbhome_1".
OPatch succeeded.

[oracle@sitdb dbhome_1]$

=> oracle home status will be still in deleting state. Update it backup to configured state before issuing delete command

[root@sitdb ~]# su - mysql

Last login: Wed Aug 24 09:53:41 +04 2022

[mysql@sitdb ~]$ /opt/oracle/mysql_compact/mysql-shell/bin/mysqlsh

MySQL Shell 8.0.21-commercial
Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
 MySQL  JS > \sql
Switching to SQL mode... Commands end with ;
 MySQL  SQL > \connect root@localhost:3306
Creating a session to 'root@localhost:3306'
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 12
Server version: 8.0.21-commercial MySQL Enterprise Server - Commercial
No default schema selected; type \use <schema> to set one.
 MySQL  localhost:3306 ssl  SQL > \use metastore
Default schema set to `metastore`.
Fetching table and column names from `metastore` for auto-completion... Press ^C to stop.
 MySQL  localhost:3306 ssl  metastore  SQL > 
MySQL  localhost:3306 ssl  metastore  SQL > select * from DatabaseHome;
+--------------------------------------+----------------------------+----------------------------+------------------+------------+-----------+-------------------------------------------+-----------------+---------------+------+-----------------+
| id                                   | updatedTime                | createTime                 | name             | status     | dbEdition | dbHomeLocation                            | dbVersion       | isCustomClone | ocid | unifiedAuditing |
+--------------------------------------+----------------------------+----------------------------+------------------+------------+-----------+-------------------------------------------+-----------------+---------------+------+-----------------+
| 03f77e36-98c1-4f0d-ac7f-923e9073a654 | 2022-09-06 10:16:17.755000 | 2022-09-06 10:06:54.962000 | OraDB19000_home1 | Configured | EE        | /u01/app/oracle/product/19.0.0.0/dbhome_1 | 19.15.0.0.0     | 0             | NULL | false           |
| 6f64870a-8b63-4530-8a9d-132438e273a5 | 2022-09-06 15:38:51.746000 | 2022-08-24 09:56:58.041000 | OraDB12102_home1 | Deleting   | EE        | /u01/app/oracle/product/12.1.0.2/dbhome_1 | 12.1.0.2.220719 | 0             | NULL | false           |
+--------------------------------------+----------------------------+----------------------------+------------------+------------+-----------+-------------------------------------------+-----------------+---------------+------+-----------------+
2 rows in set (0.0023 sec)
 MySQL  localhost:3306 ssl  metastore  SQL > update DatabaseHome set status='Configured' where id='6f64870a-8b63-4530-8a9d-132438e273a5';
Query OK, 1 row affected (0.0125 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 MySQL  localhost:3306 ssl  metastore  SQL > commit;
Query OK, 0 rows affected (0.0002 sec)
 MySQL  localhost:3306 ssl  metastore  SQL >  select * from DatabaseHome;
+--------------------------------------+----------------------------+----------------------------+------------------+------------+-----------+-------------------------------------------+-----------------+---------------+------+-----------------+
| id                                   | updatedTime                | createTime                 | name             | status     | dbEdition | dbHomeLocation                            | dbVersion       | isCustomClone | ocid | unifiedAuditing |
+--------------------------------------+----------------------------+----------------------------+------------------+------------+-----------+-------------------------------------------+-----------------+---------------+------+-----------------+
| 03f77e36-98c1-4f0d-ac7f-923e9073a654 | 2022-09-06 10:16:17.755000 | 2022-09-06 10:06:54.962000 | OraDB19000_home1 | Configured | EE        | /u01/app/oracle/product/19.0.0.0/dbhome_1 | 19.15.0.0.0     | 0             | NULL | false           |
| 6f64870a-8b63-4530-8a9d-132438e273a5 | 2022-09-06 15:38:51.746000 | 2022-08-24 09:56:58.041000 | OraDB12102_home1 | Configured | EE        | /u01/app/oracle/product/12.1.0.2/dbhome_1 | 12.1.0.2.220719 | 0             | NULL | false           |
+--------------------------------------+----------------------------+----------------------------+------------------+------------+-----------+-------------------------------------------+-----------------+---------------+------+-----------------+
2 rows in set (0.0010 sec)
 MySQL  localhost:3306 ssl  metastore  SQL >
 MySQL  localhost:3306 ssl  metastore  SQL > \quit
Bye!

[mysql@sitdb ~]$ exit

[root@sitdb ~]# dbcli list-dbhomes

ID                                       Name                 DB Version                               Home Location                                 Status
---------------------------------------- -------------------- ---------------------------------------- --------------------------------------------- ----------
6f64870a-8b63-4530-8a9d-132438e273a5     OraDB12102_home1     12.1.0.2.220719                          /u01/app/oracle/product/12.1.0.2/dbhome_1     Configured
03f77e36-98c1-4f0d-ac7f-923e9073a654     OraDB19000_home1     19.15.0.0.0                              /u01/app/oracle/product/19.0.0.0/dbhome_1     Configured

[root@sitdb ~]#

=> Now run the delete command with force option

[root@sitdb ~]#  dbcli delete-dbhome -i 6f64870a-8b63-4530-8a9d-132438e273a5  --force

Job details
----------------------------------------------------------------
                     ID:  3784213a-f374-4d07-aec1-603bdc4e55d8
            Description:  Database Home OraDB12102_home1 Deletion with id 6f64870a-8b63-4530-8a9d-132438e273a5
                 Status:  Running
                Created:  September 12, 2022 1:39:51 PM GST
               Progress:  0%
                Message:
             Error Code:
Task Name                                                                Start Time                          End Time                            Status
------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------
[root@sitdb ~]#

[root@sitdb ~]# dbcli describe-job -i 3784213a-f374-4d07-aec1-603bdc4e55d8

Job details
----------------------------------------------------------------
                     ID:  3784213a-f374-4d07-aec1-603bdc4e55d8
            Description:  Database Home OraDB12102_home1 Deletion with id 6f64870a-8b63-4530-8a9d-132438e273a5
                 Status:  Success
                Created:  September 12, 2022 1:39:51 PM GST
               Progress:  100%
                Message:
             Error Code:
Task Name                                                                Start Time                          End Time                            Status
------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------
Delete dbhome with ID: 6f64870a-8b63-4530-8a9d-132438e273a5              September 12, 2022 1:39:53 PM GST   September 12, 2022 1:41:11 PM GST   Success
[root@sitdb ~]# dbcli list-dbhomes
ID                                       Name                 DB Version                               Home Location                                 Status
---------------------------------------- -------------------- ---------------------------------------- --------------------------------------------- ----------
03f77e36-98c1-4f0d-ac7f-923e9073a654     OraDB19000_home1     19.15.0.0.0                              /u01/app/oracle/product/19.0.0.0/dbhome_1     Configured
[root@sitdb ~]#

Comments

Popular posts from this blog

Data Safe - Introduction

Oracle Data Safe - Practical Guide Oracle Data Safe learner guide Oracle Data Safe Assess risk, discover sensitive data, audit activity, and mask safely It focuses on what Data Safe helps you do operationally: review security posture, find risky identities, centralize auditing, locate sensitive data, and produce safer non-production copies. Contents 01 Why Data Safe matters 02 Where it fits 03 Capability map 04 Assessments 05 Activity Auditing 06 Discovery and Masking 07 Operating model 08 First 30 days 09 Knowledge check Section 01 Why Data Safe matters Database security work is often fragmented. One process checks configuration drift, another stores audit logs, another team scans for PII, and another team writes masking logic for test refreshes. Data Safe is useful because it turns those separate jobs into one security workflow. Key idea The best way to think about Data Safe is as a control plane for database security posture: assess the target, identify risky accounts, d...

Testing Different Access Paths : Concatenated Index

Oracle Concatenated Indexes - Practical Deep Dive Oracle concatenated index deep dive Concatenated Indexes How composite indexes really work, why column order matters, and when skip scan changes the story Concatenated indexes, also called composite indexes, are easy to explain badly and surprisingly rich to explain well. The usual summary is “Oracle can use the index only when the leading column is present,” but that is only the starting point. To design them properly, you need to think about leading portions, equality versus range predicates, ordering requirements, skip scan eligibility, covering behavior, and whether one composite index can replace several single-column indexes in a given workload. Contents 01 What concatenated indexes are 02 Leading edge and leading portion 03 Why column order matters 04 Skip scan and when it helps 05 Access patterns and plan reading 06 Covering and sort elimination 07 Design rules that actually hold 08 Common mistakes 09 End-to-end demo 1...

Database Replay - Real Application Testing (RAT)

Oracle Database Replay and RAT - Practical Deep Dive Oracle Database Replay deep dive Database Replay and Real Application Testing How to validate upgrades, patches, migrations, and risky changes with real workload behavior Database Replay is one of the most practical risk-reduction tools in the Oracle DBA toolbox. Instead of trusting synthetic benchmarks, isolated SQL tests, or intuition, you capture a real production workload, restore a test system to the same logical starting point, replay that workload, and analyze whether performance, errors, timing, and transactional behavior still look safe. Contents 01 What RAT actually is 02 Why Database Replay matters 03 End-to-end workflow 04 Capture design and prerequisites 05 Preprocess, calibrate, replay 06 Reading the results well 07 Pitfalls and unreplayable work 08 Database Replay vs SPA 09 Practical playbooks 10 Knowledge check Section 01 What Real Application Testing actually is Real Application Testing, usually shortened...