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

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