Check oracle environment variables ORACLE_HOME, and PATH. Open cmd as an administrator and then run the following separately:
echo %ORACLE_HOME%
echo %PATH%
%ORACLE_HOME% should output like C:\Users\HP\Oracle\homes\OraDB21Home2.
%PATH% should include like C:\Users\HP\Oracle\homes\OraDB21Home2\bin
If they are not, set :
set ORACLE_HOME=C:\Users\HP\Oracle\homes\OraDB21Home2
set PATH=%ORACLE_HOME%\bin;%PATH%
Run the oradim command:
oradim -STARTUP -SID YOUR_SID
Put your SID instead of YOUR_SID, which is in the command above
If the specified service doesn't exist, run this to recreate:
oradim -NEW -SID YOUR_SID -STARTMODE AUTO -PFILE "C:\Users\HP\Oracle\homes\OraDB21Home2\database\initXE.ora"
Change YOUR_SID and the path specified in the command above. YOUR_SID to your sid, path : "YOUR_ORACLE_HOME_PATH\database\initXE.ora". And then run the oradim command again.
Now you can test SQL Developer