Saturday, June 13, 2015

How to deinstall or remove Oracle Database Software (Binaries) from server/machine/laptop!

Here I have showed in Windows but you can use same steps for Linux or Unix etc.

Summary :

Please open CMD as a Administrator (right button click on CMD icon then Open as a Administrator)

1) Go to the Oracle_home path or directory 
          Example of oracle_home dir,  C:\app\product\11.2.0\db_1\

like :   CMD> cd  C:\app\product\11.2.0\db_1    (enter)
 
2) Go to deinstall folder like below 

         C:\app\product\11.2.0\db_1>  deinstall  (enter)

3) Execute the deinstall  ( windows batch file) like below 

         C:\app\product\11.2.0\db_1\deinstall> deinstall     (enter)

4) Then follow instruction and proceed

5) After execution the script, restart the machine the remove the oracle installation folders .

Practical example: -

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Windows\system32>
C:\Windows\system32>
C:\Windows\system32>cd C:\app\product\11.2.0\db_1\deinstall

C:\app\product\11.2.0\db_1\deinstall>
C:\app\product\11.2.0\db_1\deinstall>
C:\app\product\11.2.0\db_1\deinstall>deinstall
Checking for required files and bootstrapping ...
Please wait ...
14 File(s) copied
610 File(s) copied
1 file(s) copied.
1 file(s) copied.
Location of logs C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\
logs\

############ ORACLE DEINSTALL & DECONFIG TOOL START ############


######################## CHECK OPERATION START ########################
Install check configuration START


Checking for existence of the Oracle home location C:\app\product\11.2.0\db_1
Oracle Home type selected for de-install is: SIDB
Oracle Base selected for de-install is: C:\app
Checking for existence of central inventory location C:\Program Files\Oracle\Inv
entory

Install check configuration END

Checking Windows and .NET products configuration START


The following Windows and .NET products will be deconfigured from the Oracle hom
e : asp.net,ode.net,odp.net,ntoledb,oramts

Checking Windows and .NET products configuration END


Network Configuration check config START

Network de-configuration trace file location: C:\Users\my\AppData\Local\Temp\Ora
Deinstall2015-06-13_12-59-45\logs\netdc_check3782178887990698751.log

Specify all Single Instance listeners that are to be de-configured [LISTENER]:

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\
logs\databasedc_check1200720910770180178.log

Use comma as separator when specifying list of values as input

Specify the list of database names that are configured in this Oracle home [HALIMDB]:

###### For Database 'HALIMDB' ######

Single Instance Database
The diagnostic destination location of the database: C:\APP\diag\rdbms\halimdb
Storage type used by the Database: FS
Database file location: C:\APP\ORADATA\HALIMDB,C:\APP\FLASH_RECOVERY_AREA\HALIMDB
Flash recovery area location: C:\app\flash_recovery_area\HALIMDB
database spfile location: C:\APP\PRODUCT\11.2.0\DB_1\DATABASE\SPFILEHALIMDB.ORA

The details of database(s) HALIMDB have been discovered automatically. Do you still want to modify the details
of HALIMDB database(s)? [n]:

Database Check Configuration END

Enterprise Manager Configuration Assistant START

EMCA de-configuration trace file location: C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\logs
\emcadc_check.log

Checking configuration for database HALIMDB
Enterprise Manager Configuration Assistant END
Oracle Configuration Manager check START
OCM check log file location : C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\logs\\ocm_check32
69.log
Oracle Configuration Manager check END

######################### CHECK OPERATION END #########################


####################### CHECK OPERATION SUMMARY #######################
Oracle Home selected for de-install is: C:\app\product\11.2.0\db_1
Inventory Location where the Oracle home registered is: C:\Program Files\Oracle\Inventory
The following Windows and .NET products will be deconfigured from the Oracle home : asp.net,ode.net,odp.net,nt
oledb,oramts
Following Single Instance listener(s) will be de-configured: LISTENER
The following databases were selected for de-configuration : HALIMDB
Database unique name : HALIMDB
Storage used : FS
Will update the Enterprise Manager configuration for the following database(s): HALIMDB
No Enterprise Manager ASM targets to update
No Enterprise Manager listener targets to migrate
Checking the config status for CCR
Oracle Home exists with CCR directory, but CCR is not configured
CCR check is finished
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: 'C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\logs
\deinstall_deconfig2015-06-13_01-00-08-PM.out'
Any error messages from this session will be written to: 'C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-1
3_12-59-45\logs\deinstall_deconfig2015-06-13_01-00-08-PM.err'

######################## CLEAN OPERATION START ########################

Enterprise Manager Configuration Assistant START

EMCA de-configuration trace file location: C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\logs
\emcadc_clean.log

Updating Enterprise Manager Database Control configuration for database HALIMDB
Updating Enterprise Manager ASM targets (if any)
Updating Enterprise Manager listener targets (if any)
Enterprise Manager Configuration Assistant END
Database de-configuration trace file location: C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\
logs\databasedc_clean2337324818903439886.log
Database Clean Configuration START HALIMDB
This operation may take few minutes.
Database Clean Configuration END HALIMDB

Network Configuration clean config START

Network de-configuration trace file location: C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\l
ogs\netdc_clean1302827479082610407.log

De-configuring Single Instance listener(s): LISTENER

De-configuring listener: LISTENER
Stopping listener: LISTENER
Listener stopped successfully.
Deleting listener: LISTENER
Listener deleted successfully.
Listener de-configured successfully.

De-configuring Listener configuration file...
Listener configuration file de-configured successfully.

De-configuring Naming Methods configuration file...
Naming Methods configuration file de-configured successfully.

De-configuring Local Net Service Names configuration file...
Local Net Service Names configuration file de-configured successfully.

De-configuring backup files...
Backup files de-configured successfully.

The network configuration has been cleaned up successfully.

Network Configuration clean config END

Oracle Configuration Manager clean START
OCM clean log file location : C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\logs\\ocm_clean32
69.log
Oracle Configuration Manager clean END
Removing Windows and .NET products configuration START


Removing Windows and .NET products configuration END
Oracle Universal Installer clean START

Removing service 'OracleOraDb11g_home1ClrAgent' on the local node : Done

Detach Oracle home 'C:\app\product\11.2.0\db_1' from the central inventory on the local node : Done

Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracell11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraclient11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracommon11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracore11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orageneric11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orahasgen11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraldapclnt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oran11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orancds11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orancrypt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranhost11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranl11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranldap11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orannzsbb11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranro11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orantcp11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orantns11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocr11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocrb11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocrutl11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraperf.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraperf11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraplp11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orapls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\ORASLAX11.DLL'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasnls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasql11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraunls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orauts.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oravsn11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraxml11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orazt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraztkg11.dll'. The file is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\BIN'. The directory is not empty.
Failed to delete the file 'C:\app\product\11.2.0\db_1\dbs\perf11.ora'. The file is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\dbs'. The directory is not empty.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\deinstall'. The directory is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1'. The directory is not empty.
Delete directory 'C:\app\product\11.2.0\db_1' on the local node : Failed <<<<

Delete directory 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Oracle - OraDb11g_home1' on the local n
ode : Done

Removing oracle home 'C:\app\product\11.2.0\db_1' from PATH variable on the local node : Done

Delete directory 'C:\Program Files\Oracle\Inventory' on the local node : Done

Delete directory 'C:\Program Files\Oracle' on the local node : Done

Delete Registry key 'HKEY_LOCAL_MACHINE\Software\Oracle\inst_loc' on the local node : Done

Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracell11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraclient11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracommon11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracore11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orageneric11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orahasgen11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraldapclnt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oran11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orancds11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orancrypt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranhost11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranl11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranldap11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orannzsbb11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranro11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orantcp11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orantns11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocr11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocrb11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocrutl11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraperf.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraperf11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraplp11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orapls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\ORASLAX11.DLL'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasnls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasql11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraunls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orauts.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oravsn11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraxml11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orazt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraztkg11.dll'. The file is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\BIN'. The directory is not empty.
Failed to delete the file 'C:\app\product\11.2.0\db_1\dbs\perf11.ora'. The file is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\dbs'. The directory is not empty.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\deinstall'. The directory is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1'. The directory is not empty.
Failed to delete the directory 'C:\app\product\11.2.0'. The directory is not empty.
Failed to delete the directory 'C:\app\product'. The directory is not empty.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracell11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraclient11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracommon11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oracore11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orageneric11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orahasgen11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraldapclnt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oran11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orancds11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orancrypt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranhost11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranl11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranldap11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orannzsbb11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oranro11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orantcp11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orantns11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocr11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocrb11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraocrutl11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraperf.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraperf11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraplp11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orapls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\ORASLAX11.DLL'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasnls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasql11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraunls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orauts.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oravsn11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraxml11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orazt11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraztkg11.dll'. The file is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\BIN'. The directory is not empty.
Failed to delete the file 'C:\app\product\11.2.0\db_1\dbs\perf11.ora'. The file is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\dbs'. The directory is not empty.
Failed to delete the directory 'C:\app\product\11.2.0\db_1\deinstall'. The directory is in use.
Failed to delete the directory 'C:\app\product\11.2.0\db_1'. The directory is not empty.
Failed to delete the directory 'C:\app\product\11.2.0'. The directory is not empty.
Failed to delete the directory 'C:\app\product'. The directory is not empty.
Failed to delete the directory 'C:\app'. The directory is not empty.
Delete directory 'C:\app' on the local node : Failed <<<<

Oracle Universal Installer cleanup completed with errors.

Oracle Universal Installer clean END


Oracle install clean START


Oracle install clean END

Moved default properties file C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\response\deinstal
l_OraDb11g_home1.rsp as C:\Users\my\AppData\Local\Temp\OraDeinstall2015-06-13_12-59-45\response\deinstall_OraD
b11g_home1.rsp4

######################### CLEAN OPERATION END #########################


####################### CLEAN OPERATION SUMMARY #######################
Updated Enterprise Manager configuration for database HALIMDB
Successfully de-configured the following database instances : HALIMDB
Following Single Instance listener(s) were de-configured successfully: LISTENER
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
Removed asp.net configuration
Removed ode.net configuration
Removed odp.net configuration
Removed ntoledb configuration
Removed oramts configuration
Successfully removed service 'OracleOraDb11g_home1ClrAgent' on the local node.
Successfully detached Oracle home 'C:\app\product\11.2.0\db_1' from the central inventory on the local node.
Failed to delete directory 'C:\app\product\11.2.0\db_1' on the local node.
Successfully deleted directory 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Oracle - OraDb11g_home1'
on the local node.
Successfully removed oracle home 'C:\app\product\11.2.0\db_1' from PATH variable on the local node.
Successfully deleted directory 'C:\Program Files\Oracle\Inventory' on the local node.
Successfully deleted directory 'C:\Program Files\Oracle' on the local node.
Successfully deleted Registry key 'HKEY_LOCAL_MACHINE\Software\Oracle\inst_loc' on the local node.
Failed to delete directory 'C:\app' on the local node.
Oracle Universal Installer cleanup completed with errors.

Oracle install successfully cleaned up the temporary directories.
#######################################################################


############# ORACLE DEINSTALL & DECONFIG TOOL END #############

1 dir(s) moved.
1 dir(s) moved.
1 dir(s) moved.

C:\app\product\11.2.0\db_1\deinstall>
C:\app\product\11.2.0\db_1\deinstall>
C:\app\product\11.2.0\db_1\deinstall>




Then restarted the machine/server/laptop 

Then remove the oracle folders or drives using following steps

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Windows\system32>
C:\Windows\system32>
C:\Windows\system32>cd ..

C:\Windows>cd ..

C:\>
C:\>
C:\>rmdir /S app
app, Are you sure (Y/N)? y

C:\>
C:\>
C:\>

after removing the app folder all following files are removed.


Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\ORASLAX11.DLL'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasnls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orasql11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\oraunls11.dll'. The file is in use.
Failed to delete the file 'C:\app\product\11.2.0\db_1\BIN\orauts.dll'. The file is in use.



All are done, no Oracle binaries are here..... cheers . Thanks Halim.

Wednesday, June 10, 2015

ORA-02292: integrity constraint (constraint_name) violated - child record found

I know this is very simple thing but lot of time I am facing this question from newbies that's why this thread.

Solution for this error,  you have to drop your current foreign key constraint and create new one with  one of below options

ON DELETE SET NULL
or
ON DELETE CASCADE

but before applying that you have to understand your business domain. because ON DELETE CASCADE  will delete the referencing rows from that child tables and ON DELETE SET NULL will set a null value on that referencing column's rows.

Just a simple practical example-

CREATE TABLE FAMILY (FAMILY_ID NUMBER);


CREATE TABLE MEMBER
(
   MEMBER_ID   NUMBER,
   FAMILY_ID   NUMBER
);


-- Primary Key Constraints for Table FAMILY

ALTER TABLE FAMILY ADD (
  CONSTRAINT FAMILY_PK
  PRIMARY KEY
  (FAMILY_ID)
  ENABLE VALIDATE);


-- Foreign Key Constraints for Table MEMBER


ALTER TABLE MEMBER ADD (
  CONSTRAINT MEMBER_FAMILY_FK
  FOREIGN KEY (FAMILY_ID)
  REFERENCES FAMILY (FAMILY_ID)
  ENABLE VALIDATE);

INSERT INTO FAMILY (FAMILY_ID)
     VALUES (1);

INSERT INTO FAMILY (FAMILY_ID)
     VALUES (2);

INSERT INTO FAMILY (FAMILY_ID)
     VALUES (3);

INSERT INTO FAMILY (FAMILY_ID)
     VALUES (4);

INSERT INTO FAMILY (FAMILY_ID)
     VALUES (5);

COMMIT;


INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 1);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 1);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 1);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 5);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 5);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 5);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 3);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 3);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 3);

INSERT INTO MEMBER (MEMBER_ID, FAMILY_ID)
     VALUES (1, 2);

COMMIT;



DELETE FROM family  WHERE family_id = 5               ---it will generate an error
                        
                        



     ORA-02292: integrity constraint (CRIC.MEMBER_FAMILY_FK) violated - child record found



Solution:-

1) drop foreign key (before drop please please backup the old script if your are not sure about relationship )


ALTER TABLE MEMBER
   DROP CONSTRAINTS MEMBER_FAMILY_FK


2) create like below


 ALTER TABLE MEMBER
 ADD (CONSTRAINT MEMBER_FAMILY_FK FOREIGN KEY (family_id)
 REFERENCES family (family_id)
 ON DELETE SET NULL ) ---- on delete cascade );



DELETE FROM family   WHERE family_id = 5  --in this time no error


rollback;

Cheers......Halim

Friday, March 13, 2015

Add a user account to a ora_dba group in Windows 8 !

I know this is a very silly thing, but lots of student asking this question so many times specially in Windows 8, How can they add a user account to a group.

Lacking of this ORA_DBA group privileges , you will face following error message when you will try to log-in internally like
 
SQL > connect / as sysdba

ORA-01031: insufficient privileges 

so, you have to add your current OS user (oracle software installation OS user)  to "ora_dba" group in windows (dba group in unix system).

1)  Open CMD prompt window the administrative privileges.

To start a command prompt window with Windows Administrator privileges:

    On your desktop, create a shortcut for the command prompt window. An icon for that shortcut appears on the desktop.

    Right-click the icon for the newly created shortcut, and specify Run as administrator.

When you open this window, the title bar reads Administrator: Command Prompt. Commands run from within this window are run with Administrator privileges.

then
2)  CMD commands to do that in Windows 8

--check the users

cmd> net user

--for checking the group

cmd> net localgroup

--add user111 to ora_dba group

cmd> net localgroup ora_dba your_oracle_user_name /add

--for help
cmd> net help localgroup

------------------------------------***--------------------------------

Friday, February 27, 2015

Windows PowerShell script to check the website status!



Description:
This is a small PowerShell script; you can run it from your any windows machine to check your or any website’s status in every 30 seconds/ any at frequency. (you can change it to your desire time)
And if it (script) found that the specific webpage is down then it will send you an email that your web site is down.
But you need a SMTP server and internet connection. 

Use case:  

If is there any scenarios come like, your webpage is going down any how without your knowledge and you are getting so many complain about it. Then you can implement this script to monitor your site and take necessary actions. 

Here I have used web page as an "https://www.facebook.com/" and it will check the status of this page or link in every 30 seconds.  

The Script:

 Begin {  
   $web = New-Object System.Net.WebClient  
   $web.UseDefaultCredentials = $True  
   $flag = $false  
   $url = "https://www.facebook.com/"  
   }  
 Process {  
   While ($flag -eq $false) {  
     Try {  
       $web.DownloadString($url)  
       clear  
     Write-Host -ForegroundColor Green "$(Get-Date): Facebook is up!"  
     Start-Sleep -Seconds 30  
      ##  $flag = $True  
       }  
     Catch { Write-host -fore Red "$(Get-Date): Facebook is down..."   
      ## email sending----------------  
     $emailFrom = "Halim@test.com"  
     # Use commas for multiple addresses  
     $emailTo = "Halim@test.com,halim1@test.com"  
     $subject = "Facebook May be Down(Test email notification system) !!"  
     $body = "Facebook May be Down. Please Check! (This is just a test email)" # Details: $($_.Exception)"  
     $smtpServer = "192.168.10.199" # your smtp server's IP or name.   
     $smtp = new-object Net.Mail.SmtpClient($smtpServer)  
     $smtp.Send($emailFrom, $emailTo, $subject, $body)    
     $flag = $True  
     ##exit   
        ## -----------------------  
           }  
                }  
      }    
 End {  
   Write-Host -fore yellow "Email send & This process need to run again for further monitoring"  
   }  


How  to execute or run :
            1) Go to search or run and type “PowerShell”  enter  or go to the following exe,  then click
                %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
           2)  Copy & paste the code on it, then enter.


Thanks
Halim

ORA-24247: network access denied by access control list (ACL)

Easy solution for this error....
Problem:
You may face above error, when you will use several PL/SQL APIs (UTL_TCP, UTL_SMTP, UTL_MAIL, UTL_HTTP and UTL_INADDR)  utilities in Oracle database 11g or higher version. This is a new security policy, implemented by Oracle in latest versions. but you can pass it via following steps

1) Connect with super user (SYS user)

2) Create following " Pro_add_me_to_acl_list" procedure (This procedure is for "Drop ACL", "Create_ACL" and "Assign_ACL" with the package "DBMS_NETWORK_ACL_ADMIN" )
or
you can do same thing without creating the procedure see here  http://oracle-base.com/articles/11g/fine-grained-access-to-network-services-11gr1.php

(But this procedure will simplify you activity)

3) and then execute the procedure with appropriate parameters .

Here it is in live example :

 SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 27 15:14:58 2015  
 Copyright (c) 1982, 2010, Oracle. All rights reserved.  
            STEP-#1   
 SQL>  
 SQL> conn sys@orcl_dev_linux as sysdba  
 Enter password:  
 Connected.  
 SQL>  
 SQL>  
 SQL> show user  
 USER is "SYS"  
 SQL>  
            STEP-#2   
 SQL>  
 SQL> CREATE OR REPLACE PROCEDURE Pro_add_me_to_acl_list (aacl     VARCHAR2,  
  2                           acomment   VARCHAR2,  
  3                           aprincipal  VARCHAR2,  
  4                           aisgrant   BOOLEAN,  
  5                           aprivilege  VARCHAR2,  
  6                           aserver    VARCHAR2,  
  7                           aport     NUMBER)  
  8 IS  
  9 BEGIN  
  10   BEGIN  
  11    DBMS_NETWORK_ACL_ADMIN.DROP_ACL (aacl);  
  12    DBMS_OUTPUT.put_line ('ACL dropped.....');  
  13   EXCEPTION  
  14    WHEN OTHERS  
  15    THEN  
  16      DBMS_OUTPUT.put_line ('Error dropping ACL: ' || aacl);  
  17      DBMS_OUTPUT.put_line (SQLERRM);  
  18   END;  
  19  
  20   BEGIN  
  21    DBMS_NETWORK_ACL_ADMIN.CREATE_ACL (aacl,  
  22                      acomment,  
  23                      aprincipal,  
  24                      aisgrant,  
  25                      aprivilege);  
  26    DBMS_OUTPUT.put_line ('ACL created.....');  
  27   EXCEPTION  
  28    WHEN OTHERS  
  29    THEN  
  30      DBMS_OUTPUT.put_line ('Error creating ACL: ' || aacl);  
  31      DBMS_OUTPUT.put_line (SQLERRM);  
  32   END;  
  33  
  34   BEGIN  
  35    DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL (aacl, aserver, aport);  
  36    DBMS_OUTPUT.put_line ('ACL assigned.....');  
  37   EXCEPTION  
  38    WHEN OTHERS  
  39    THEN  
  40      DBMS_OUTPUT.put_line ('Error assigning ACL: ' || aacl);  
  41      DBMS_OUTPUT.put_line (SQLERRM);  
  42   END;  
  43  
  44   COMMIT;  
  45   DBMS_OUTPUT.put_line ('ACL commited.....');  
  46 END;  
  47  
  48 /  
 Procedure created.  
 SQL>  
 SQL>  
 SQL>  
 SQL> COLUMN host FORMAT A30  
 SQL> COLUMN acl FORMAT A30  
 SQL>  
 SQL> SELECT host, lower_port, upper_port, acl  
  2 FROM  dba_network_acls;  
 HOST              LOWER_PORT UPPER_PORT  
 ------------------------------ ---------- ----------  
 ACL  
 ------------------------------  
 <smtp_server>             25     25  
 /sys/acls/smtp-gate-permission  
 s.xml  
 your_smtp_server_name_or_ip             25     25  
 /sys/acls/mailserver_acl.xml  
                
                       STEP-#3  
 SQL>  
 SQL>  
 SQL> BEGIN  
  2   Pro_add_me_to_acl_list ('mailserver_acl.xml',  
  3               'ACL for used Email Server to connect',  
  4               'HR',            --(user name/schema)  
  5               TRUE,  
  6               'connect',  
  7               'your_smtp_server_name_or_ip', --(your exchange mail server name)  
  8               25);             --default port number  
  9 END;  
  10  
  11 /  
 PL/SQL procedure successfully completed.  
 SQL>  
 SQL>  


Thanks
Halim