Thursday, September 10, 2015

emctl is not working in oracle 12c and How to manually configure EM Express

From oracle 12c, there is no command like “emctl start dbconsole” because, in 12c there is no DBCONSOLE ( no middle-tier for EM). In replace Oracle has introduced EM Express.

What is EM Express and its Architecture?

Oracle Enterprise Manager Database Express, also referred to as EM Express, is a web-based tool for managing Oracle Database 12c. Built inside the database server, it offers support for basic administrative tasks such as storage and user management, and provides comprehensive solutions for performance diagnostics and tuning.. 
EM Express is designed to be lightweight and to incur minimal overhead on the database server. In order to achieve this goal, EM Express is built inside the Oracle Database and only uses internal infrastructure components. . such as XDB and SQL*Net. It does not require any separate middle-tier components.

Since EM Express is built inside the database, the database has to be open in order to use EM Express, and EM Express cannot perform actions outside the database.

EM Express does not have background tasks or processes that periodically collect information. Instead, it utilizes data that is already collected by the database. Data is requested only when the user interacts with the UI and all UI processing is done in the browser, thus minimizing load on the database server.

By default EM Express will install by DBCA while you will create a database in oracle 12C, you just need invoke it via

https://full-database-hostname:portnumber/em/

for this you need to know the port number. 


How can I find the HTTP/HTTPS port for EM Express

from SQL*Plus:
SQL> select dbms_xdb.getHttpPort() from dual; ---http port

GETHTTPPORT
-----------
       5500

SQL> select dbms_xdb_config.getHttpsPort() from dual;--https

GETHTTPSPORT
------------
        5500


Privilige for EM express

EM_EXPRESS_BASIC or EM_EXPRESS_ALL role

SQL> grant EM_EXPRESS_BASIC to scott ;
  


By default EM Express is installed by DBCA when you will create a database but still you can configure your OWN. Please see in below.



Manually configure the EM Express in Oracle 12c


  1. Configure and start the Oracle Listener.
  2) Assign local_listener parameter value ( If listener is         running     on a nonstandard port. for example, not 1521)
The local_listener entry references a TNSNAMES entry that points to the correct listener.
So you can set it like : 

SQL> alter system set local_listener = orcl ; --(orcl is the tnsnames)

or 
 
SQL> alter system set local_listener = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1526)) (CONNECT_DATA=(SERVICE_NAME=service_name)(SERVER=DEDICATED)))' ;


  1. Enable the TCP dispatcher by adding the following entry to the init.ora file for the database you want to manage using EM Express:
dispatchers="(PROTOCOL=TCP)(SERVICE=ORCLXDB)" ---here ORCL is the SID name .
SQL> alter system set dispatchers="(PROTOCOL=TCP)(SERVICE=ORCLXDB)" ;


  1. Then Restart the database so that the changes made can take effect.

  1. Set the HTTPS/HTTP port for EM Express
Connect with SYS then,
      For a Non-Container Database : 

      SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500);

      For Container Database: 
      SQL> alter session set container=CDB$ROOT;
      SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5507);
        For PDB (plug-gable Database)
        SQL> alter session set container=PDB1;
        SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5508);
6) Use the following command to confirm that the port has registered with the listener:
cmd> lsnrctl status | grep -i 5507 ---(port number)
7) For accessing to EM express

https://full_database-hostname:portnumber/em/

For example:
https://myserver.test.com:5500/em/

Cheers...Halim


Thursday, July 9, 2015

Daily Oracle DBA Checklist - For Production




Daily Production Oracle DBA checklist
                                              

Here I’ve mentioned lot of Daily activities of a production Oracle DBA (based on my experience). Actually it totally depends on your Database’s characteristics, Size of Database, environment etc. you may have something more to check. So please keep in mind.
And here I am telling you to check that’s mean not to check all by manually. It will take lot of times.  DBAs should try to avoid manually checking anything daily or weekly. Maximum checks should be automated, and should alert the DBA only if there is an error (by email, SMS). But for these, DBA need’s good knowledge on shell scripting, PowerShell, DOS, PL/SQL, OEM or other monitoring tools.
 
Here are the (in general) Daily Production DBA job checklist-


1) Checking all instances status, Make sure all are up and running 

     How: Log in to each instance, run any query to make sure databases are available and running. Such as
            $ export ORACLE_SID=orcl
            $ sqlplus /nolog
            SQL> select host_name from v$instance ; 

2) Check alert log entries for any error or any new things (at least daily two times for all databases)

i) When you enter into office 
ii) When you are leaving office  
And when any complain comes about database slowness or anything

3) Verify success of databases RMAN/export/any other backups.

                                    i)  Check the RMAN/export logs for any error.

                                    ii) Check the backup size for confirmation and daily backup size growth.  

           

4. Verify success of database backup archiving to tape (or let system admin know to back it up.)

5) Verify Auto control file backup successful 

6) Verify success of all schedule job

7) Verify enough spaces are there for -

                                    i) Space of Tablespaces (if autoextend = no)
                                    ii) Space in OS Hard disk/ Storage LUN
                                    iii) Archive log space/ flash_recovery_area locations

8) Check to all objects status to make sure all are 'VALID'

9) If you have a Standby Database, check the status of standby database and gap between primary. 

10) Review contention for CPU, memory, network, and disk resources.

                        In linux can use -  top, netstat, vmstat  etc. commands
                        In Sun Solaris can use – prstat, vmstat ,netstat etc. 

10) Checks for blocking locks , killed sessions etc. 

11) Check connected sessions (average count) to verify there are no abnormalities (sometimes parallel thread exceeds your process parameter’s value) 

                        i) Check top session’s information.
                        ii) Top SQL statements

12) Troubleshooting if any issue reported 

13) Spend sometimes to increase and upgrade your knowledge 

Oh, Next time I will try to write with how to do all checks...(Automated way)

 Cheers.... Halim

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