#ATR(15)
Informative Note:
- Consider, we are having Old SAP S/4 HANA 1709 System which no longer required for business purposes. Our requirement is to reuse SAP S/4 HANA Server for SAP ECC Installation (Oracle database). This blog created to provide information on how to uninstall SAP S/4 HANA System using SWPM (Both ABAP and DB) and make system ready for ECC installation (Oracle Database). Instead of decommissioning/reinitializing server from scratch OR requesting new server for SAP installation, we can uninstall SAP if no longer used and reuse same server for our current business requirements. This method will also benefit clients to have lesser billability.
- Steps will be similar for any kind of SAP System Uninstallation.
Prerequisites: Knowledge on SWPM
SWPM Extraction:
- Download SWPM 2.0 and extract on your server.


- Start SWPM as usual. I’m using SAPINST with GUI_HOSTNAME (IP address).


- Make sure to stop all APP and DB services before running SWPM. We can start services if SWPM needs during execution.

- Select “Uninstall – SAP Systems or Single Instances”

DEFINE PARAMETER:

- SWPM will automatically detect and fetch SAP Profile Path.

- In my case, I don’t need SAP System as well as OS users.

- I’m using SWPM to remove database as well in single turn.
- Another method: We can also use hdblcm to unregister and remove database from OS level itself.

- We can continue our SWPM with “Remove database” option selected.


………………………..
Error 1: DB host is undefined.

- We can see clearly in SWPM logs that NW.DBHost() returns nothing and no hostname assigned.
.
- SWPM will pick all details via ABAP Profile path only which we provided. We could see SAPDBHOST already provided in Default profile.

- I have started system to check OS01 transaction and found out DB server details not fetched by ABAP system.

- While checking RZ10 profile, Incorrect entry maintained for SAPDBHOST even though OS level entry maintained separately. RZ10 – Default profile also have latest profile version only.

- Edited parameter and restarted system. After restart, I could see DB server details fetched successfully in OS01 transaction as well.


- Relaunch SWPM after stopping all APP and DB services. You can continue with existing SWPM process itself instead of starting new run.
……………………….

……………………………….
- I’m removing HANA Client as well.


- No need to keep database content/data in my scenario since entire SAP system needs to be deleted.

……………………………….
Error 2:

- Start system and retry step once.
………………………………
Error 3:

- Check with hana client hdbsql command whether connection to port 30213/30215 possible.



- Connectivity checks done via 30213 SYSTEM DB port to ensure database online or not. But SWPM seeks TENANT SYSTEM User password only to connect tenant database via port 30215. Hence, provide Tenant SYSTEM user password. I have provided the same and crossed error step successfully.

……………………………….
- Provide password for the SYSTEM DB SYSTEM user now.

- Define parameter completed.
REVIEW PARAMETER:
- Review parameters just show summary of our selected parameters.


EXECUTE SERVICE
- Started executing service.

- You can find all process/steps in Tasklist as usual.



- Uninstallation completed successfully.
SAP Host Agent Uninstallation:
- Host Agent uninstallation should be automatically done by SWPM.

- It might be missed since we have stopped hostagent services before running SWPM. Hostagent not detected by SWPM.
- We can uninstall hostagent manually using command “saphostexec -uninstall command”


- Remove sapadm user as well.

Uninstallation checks:
1) Check SAP User/Directories deletion:
- /hana/shared
- /usr/sap
- /sapmnt/

- User - SIDADM, SAPADM (Already deleted after hostagent uninstallation)

- All SAP users/Directories were deleted by SWPM successfully.
Recreating /oracle volume:
- We need to delete /hana volume and create new volume with /oracle path since our requirement is to reuse server for SAP ECC with Oracle database.
- Delete /hana files/folder

- We can crosscheck Logical and Physical volume details via lvs, pvs and vgs command. I’m just showing with vgs to avoid confusion.
- Viewers -> Please comment if you need detailed LVM blog separately from my end, I will post it.


- Currently, Only 20 GB free. We just need to delete /hana (498 GB) and recreate same LVM volume size with /oracle (500 GB). VG free should be ~18 GB post LVM operation.

- Vi /etc/fstab -> Comment rhel-hana before unmounting.

- Once lvm hana deleted, do the below steps for creating oracle lvm and mounting /oracle directory.

- Add new line in FS entry – vi /etc/fstab

- Check using df -kh command. We can see /oracle directory mounted with our oracle LVM with 500 GB. VG free - ~18 GB as expected.

- We have reused our SAP server to install new SAP System with Oracle Database.
Additional:
- Remove System from SAP Solution Manager/FRUN if connected
- Remove licenses and SAP System Entries from our SAP Support Portal/SAP for Me
- Remove RFC Connection if configured in other system.
- Remove system from CUA if configured
Thanks for Visiting !
Please do connect and follow my Linked In Profile - https://www.linkedin.com/in/ajaytr66/
AJAY TR - ATR - SAP BASIS ADMINISTRATOR