How To Uninstall Deinstall Oracle Home 12c in linux

Deinsatll / Uninstall Oracle Software from Linux Process

Login in Server as Oracle user and run deinstall under ORACLE_HOME/deinstall destination as mentioned below.

While deinstall the software it prompt you about your databases and db related information,  provide accordingly to continue the software uninstall.


[root@dbsrv1 ~]# su - oracle

[oracle@dbsrv1 ~]$ cd $ORACLE_HOME

[oracle@dbsrv1 12.1.0]$ ls
addnode     bin          clone  cv        deinstall    dv       instantclient  jdk   log      nls   OPatch       ord   plsql    R         root.sh       sqlj      sysman  wwg
admin       ccr          crs    dbhadoop  demo         has      inventory      jlib  md       oc4j  opmn         oui   plugins  racg      scheduler     sqlpatch  ucp     xdk
apex        cdata        css    dbs       diagnostics  hs       javavm         ldap  mgw      odbc  oracore      owm   precomp  rdbms     slax          sqlplus   usm
assistants  cfgtoollogs  ctx    dc_ocm    dmu          install  jdbc           lib   network  olap  oraInst.loc  perl  QOpatch  relnotes  sqldeveloper  srvm      utl

[oracle@dbsrv1 12.1.0]$ cd deinstall/


[oracle@dbsrv1 deinstall]$ ls
bootstrap_files.lst  bootstrap.pl  deinstall  deinstall.pl  deinstall.xml  jlib  readme.txt  response  sshUserSetup.sh  utl


[oracle@dbsrv1 deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/

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


######################### CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /u01/app/oracle/product/12.1.0
Oracle Home type selected for deinstall is: Oracle Single Instance Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
Checking for sufficient temp space availability on node(s) : 'dbsrv1.testdbsrv1.com'

## [END] Install check configuration ##


Network Configuration check config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2018-06-13_09-37-04-PM.log

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2018-06-13_09-37-05-PM.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 [testdb,asmdb1]: testdb,asmdb1

###### For Database 'testdb' ######

Specify the type of this database (1.Single Instance Database|2.Oracle Restart Enabled Database) [1]: 1
Specify the diagnostic destination location of the database [/u01/app/oracle/diag/rdbms/testdb]:
Specify the storage type used by the Database ASM|FS []:
Specify the storage type used by the Database ASM|FS []: FS

Specify the list of directories if any database files exist on a shared file system. If 'testdb' subdirectory is found, then it will be deleted. Otherwise, the specified directory will be deleted. Alternatively, you can specify list of database files with full path [ ]: /u01/oradata/testdb

Specify the fast recovery area location, if it is configured on the file system. If 'testdb' subdirectory is found, then it will be deleted. []:

Specify the database spfile location [ ]:


###### For Database 'asmdb1' ######

Specify the type of this database (1.Single Instance Database|2.Oracle Restart Enabled Database) [2]: 1
Specify the diagnostic destination location of the database [/u01/app/oracle/diag/rdbms/asmdb1]:
Specify the storage type used by the Database ASM|FS []: ASM


Database Check Configuration END
Oracle Configuration Manager check START
OCM check log file location : /u01/app/oraInventory/logs//ocm_check2459.log
Oracle Configuration Manager check END

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


####################### CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /u01/app/oracle/product/12.1.0
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
The following databases were selected for de-configuration : testdb,asmdb1
Database unique name : testdb
Storage used : FS
Database unique name : asmdb1
Storage used : ASM
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: '/u01/app/oraInventory/logs/deinstall_deconfig2018-06-13_09-36-57-PM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2018-06-13_09-36-57-PM.err'

######################## CLEAN OPERATION START ########################
Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_clean2018-06-13_09-45-56-PM.log
Database Clean Configuration START testdb
This operation may take few minutes.
Database Clean Configuration END testdb
Database Clean Configuration START asmdb1
This operation may take few minutes.
Database Clean Configuration END asmdb1

Network Configuration clean config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_clean2018-06-13_09-46-41-PM.log

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 : /u01/app/oraInventory/logs//ocm_clean2459.log
Oracle Configuration Manager clean END
Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START

Detach Oracle home '/u01/app/oracle/product/12.1.0' from the central inventory on the local node : Done

Delete directory '/u01/app/oracle/product/12.1.0' on the local node : Done

Delete directory '/u01/app/oracle' on the local node : Done

Oracle Universal Installer cleanup was successful.

Oracle Universal Installer clean END


## [START] Oracle install clean ##

Clean install operation removing temporary directory '/tmp/deinstall2018-06-13_09-36-18PM' on node 'dbsrv1'

## [END] Oracle install clean ##


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


####################### CLEAN OPERATION SUMMARY #######################
Successfully de-configured the following database instances : testdb,asmdb1
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
Successfully detached Oracle home '/u01/app/oracle/product/12.1.0' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/12.1.0' on the local node.
Successfully deleted directory '/u01/app/oracle' on the local node.
Oracle Universal Installer cleanup was successful.

Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


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

[oracle@dbsrv1 deinstall]$

ORA-15260: permission denied on ASM disk group

ORA-15260: permission denied on ASM disk group

When you get this type of error please check your SQL connectivity.

To create ASM DISKGROUP you must connect as SYSASM instead SYSDBA.


[grid@dbsrv1 ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 12.1.0.1.0 Production on Wed Jun 13 15:56:22 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Automatic Storage Management option

SQL> CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/ASMDISK2','/dev/oracleasm/disks/ASMDISK3','/dev/oracleasm/disks/ASMDISK4','/dev/oracleasm/disks/ASMDISK5';
CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/ASMDISK2','/dev/oracleasm/disks/ASMDISK3','/dev/oracleasm/disks/ASMDISK4','/dev/oracleasm/disks/ASMDISK5'
*
ERROR at line 1:
ORA-15260: permission denied on ASM disk group


[grid@dbsrv1 ~]$ sqlplus '/as sysasm'   <--  connect as " SYSASM "

SQL*Plus: Release 12.1.0.1.0 Production on Wed Jun 13 15:58:37 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Automatic Storage Management option

SQL> CREATE DISKGROUP DATA EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/ASMDISK2','/dev/oracleasm/disks/ASMDISK3','/dev/oracleasm/disks/ASMDISK4','/dev/oracleasm/disks/ASMDISK5';

Diskgroup created.


Hope your issue has been resolved.

Steps To Create Container Database (CDB) Manually in Oracle 12c

Oracle 12c database is MULTITENANTE CONTAINER DATABASE space for creating pluggable databases.
(Eg Pluggable databases are applications like any OLTP databases etc..)

Oracle 12c database is Multi-tenant  container database in which a seed database called pdb$seed comes with it, Using which we can create pluggable database. in one container 253 pdbs can be created including pdbseed.

Follow below steps to create Multitenante Container Database manually.

Step 1 : Specify an instance identifier (SID) & Environment variables.

The maximum number of characters for ORACLE_SID is 12, only letters and digits are permitted.

[oracle@server1 ~]$ vi cdb1.sh  or bash_profile

export ORACLE_SID=cdb1
export ORACLE_HOME=/soft/app/oracle/product/12.1.1
export ORACLE_BASE=/soft/app/oracle
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin:$PATH:.
export LD_LIBRARY_PATH=$ORACLRE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

Step 2 : Ensure that the required environment variables are set.

echo $ORACLE_SID
echo $ORACLE_HOME
echo $PATH

Step 3 : Create the initialization parameter file under ORACLE_HOME dbs location

[oracle@server1 ~]$ cd $ORACLE_HOME/dbs

[oracle@server1 dbs]$ cp  init.ora  initcdb1.ora   ( cdb1 is SID )

After copied open new initcdb1 parameter file and edit as specified below

[oracle@server1 dbs]$ vi initcdb1.ora
db_name='CDB1'
enable_pluggable_database=true
memory_target=1G
processes = 150
audit_file_dest='$ORACLE_BASE/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
#db_recovery_file_dest='<ORACLE_BASE>/fast_recovery_area'
#db_recovery_file_dest_size=2G
diagnostic_dest='/u01/oradata/cdb1'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = /u01/oradata/cdb1/control1.ctl
compatible ='12.0.0'


Step 4 : Create directory structure to store database physical file.

[oracle@server1 ~]$ mkdir  -p  /u01/oradata/cdb1
[oracle@server1 ~]$ mkdir  -p  /u01/oradata/cdb1/pdbseed


Step 5 : Create database creation script.

[oracle@server1 ~]$ vi createcdb1.sql
create database cdb1
datafile '/u01/oradata/cdb1/system.dbf' size 1024M extent management local
sysaux datafile '/u01/oradata/cdb1/sysaux.dbf' size 1024M
undo tablespace undotbs1 datafile '/u01/oradata/cdb1/untotbs.dbf' size 500M
default temporary tablespace temp tempfile '/u01/oradata/cdb1/temp.dbf' size 500M
default tablespace users datafile '/u01/oradata/cdb1/users.dbf' size 500M
logfile
group 1('/u01/oradata/cdb1/redo1a.log') size 10M,
group 2('/u01/oradata/cdb1/redo21.log') size 10M
ENABLE PLUGGABLE DATABASE
SEED FILE_NAME_CONVERT=('/u01/oradata/cdb1','/u01/oradata/cdb1/pdbseed');

Step 5 : Startup the database using below steps

[oracle@server1 ~]$ sqlplus '/as sysdba'

SQL*Plus: Release 12.1.0.1.0 Production on Wed Jan 24 20:02:22 2018

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> startup nomount

SQL> @createcdb1.sql

Database Created

Step 6 : Verifying CDB was created

SQL> select NAME,OPEN_MODE,CDB from v$database;

NAME      OPEN_MODE            CDB
--------- -------------------- ---
CDB1      READ WRITE           YES

SQL> select DBID, CON_ID, NAME, OPEN_MODE from v$database;

      DBID     CON_ID NAME      OPEN_MODE
---------- ---------- --------- --------------------
 939984158          0 CDB1      READ WRITE



Step 7 :  Build data dictionary views

Run the script necessary to build data dictionary views, synonyms and PL/SQL packages, and to support proper functioning of SQL*Plus

[oracle@server1 ~]$ vi postcdb.sql

@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
conn system/manager
@$ORACLE_HOME/sqlplus/admin/pupbld.sql


SQL> @postcdb.sql

--
--
--
--



Notice that the con id is 0 for the  whole container cdb1

At this point you should have two containers in your CDB database. The Root container and Seed Pluggable database. Check with below query.

SQL> select CON_ID, NAME from v$containers;

    CON_ID NAME
---------- ------------------------------
         1 CDB$ROOT
         2 PDB$SEED



Step 7 :  Build data dictionary views on PDB$SEED

Run the script necessary to build data dictionary views, synonyms, PL/SQL packages and to support proper functioning of SQL*Plus in pdb$seed.

SQL> alter session set "_oracle_script"=true;

Session altered.

SQL> SELECT con_id,dbid,NAME,OPEN_MODE from v$pdbs;

    CON_ID       DBID NAME                           OPEN_MODE
---------- ---------- ------------------------------ ----------
         2 4208911838 PDB$SEED                       READ ONLY

SQL> alter pluggable database pdb$seed close;

Pluggable database altered.

SQL> alter pluggable database pdb$seed open;

Pluggable database altered.

SQL>


[oracle@server1 ~]$ vi postpdb.sql
@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catblock.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
@$ORACLE_HOME/rdbms/admin/catoctk.sql
@$ORACLE_HOME/rdbms/admin/owminst.plb
conn system/manager
@$ORACLE_HOME/sqlplus/admin/pupbld.sql


SQL>@postpdb.sql


SQL> alter session set "_oracle_script"=false;

Session altered.

SQL> select OPEN_MODE from v$database;

OPEN_MODE
--------------------
READ WRITE


SQL> select con_id, dbid, NAME, OPEN_MODE from v$pdbs;

    CON_ID       DBID NAME                           OPEN_MODE
---------- ---------- ------------------------------ ----------
         2 4208911838 PDB$SEED                       READ WRITE




RAC Oracle Clusterware Startup Sequence 12c

12c Oracle Clusterware Startup Sequence - Oracle clusterware startup automatically when the RAC node starts. Startup sequence process tuns through different levels, in below figure you can find how multiple level startup process to start the full grid infrastructure stack also how the resources that clusterware manage.

This tutorial will describe startup sequence of oracle 12c RAC clusterware which is installed on Unix / Linux platform.

Oracle RAC 12c Clusterware Startup Sequence
Oracle 12c RAC Clusterware Startup Sequence


Once your Operating system finish the boot scrap pocess it reads /etc/init.d file via the initialisation daemon names init or init.d. In the init tab file is the one it triggers oracle high availability service daemon.

$cat /etc/inittab | grep init.d | grep -v grep
h1:35:respawn:/etc/init.d/init.ohasd run  >/dev/null  2>&1 </dev/null
Oracle Linux 6.x and Red Hat Linux 6.x have deprecated inittab.  init.ohasd is configured in startup in /etc/init/oracle-ohasd.conf:

$cat /etc/init/oracle-ohasd.conf

 start on runLevel [35]
start on tunLevel [!35]
respawn
exec /etc/init.d/init.ohasd run > /dev/null  2>&1 <dev/null
this start up " init.ohasd run " , which in turn starts up the ohasd.bin background process :

$ps  -ef  | grep  ohasd  | grep  -v grep
root  4056  1  1  Feb19   ?     01:54:34 /u01/app/12.1.0/grid/bin/ohsd.bin  reboot
root  2715  1   0 Feb19  ?     00:00:00  /bin/sh   /etc/init.d/init.ohsd  run

OHASD ( Oracle High Availability Service Daemon )  - we also call it as oracle restart

First /etc/init triggers OHASD, once ohasd is started on Level 0, it is responsible for starting the rest of clusterware and the resources that clusterware manages directly or indirectly through Levels 1- 4.

Level 1 - Ohasd on it own triggers four agent process

  • cssdmonitor : CSS Monitor
  • OHASD orarootagent : High Availability Service stack Oracle root agent
  • OHASD oraagent : High Availability Service stack Oracle Agent
  • cssdagent : CSS Agent


Level 2 - On this level, OHASD ora agent trigger five processes

  • mDNSD : mDNS daemon process
  • GIPCD : Grid Interprocess Comunication
  • GPnPD : GPnP Profile daemon
  • EVMD : Even Monitor Daemon
  • ASM : Resources for monitoring ASM Instances
Then, OHASD oraclerootagent trigger following processes 

  • CRSD : CRS daemon
  • CTSSD : Cluster Time Synchronisation Service Daemon 
  • Diskmon : Disk Monitor Daemon ( Exadata Server Storage )
  • ACFS : ( ASM Cluster File System ) Drivers
Next, the cssdagent starts the CSSD ( CSS daemon ) process.

Level 3 - The CRSD spawns two CRSD agents : CRSD orarootagent and CRSD oracleagent.

Level 4 - On this levael, the CRSD orarootagent is responsible for starting he following resources :

  • Network resource : for the public network
  • SCAN VIPs
  • Node VIPs : VIPs for each node
  • ACFS Registry
  • GNS VIP : VIP for GNS if you use the GNS option
Then, the CRSD orarootagent is responsible for starting the rest of the resources as follow 
  • ASM Resources : ASM instances(s) resource
  • Diskgroup : Used for managing / monitoring ASM diskgroups
  • Disk Resource : Used for managing and monitoring the DB and instances
  • SCAN Listener : Listener for SCAN listening on SCAN VIP
  • Listener : Node Listener listening on the Node VIP
  • Services : Database Services
  • ONS
  • eONS : Enhanced ONS
  • GSD : For 9i backword compatibility
  • GNS : performs name resolution ( Optional )





Ora 12154 tns error in oracle 12c 11g and 10g

Error ( Ora 12154 ) Message is : TNS:could not resolve the connect identifier specified.

One of my client has faced ora 12154 error while he configuring the database connectivity network using tnsnames.ora file with the provided details ( Service Name, Hostname, Port Number ) but he is facing issue, when we verified all the details which provided seems to be fine but customer still facing the issue, we did lot of digging to resolve the issue while i was searching in google i found most of the people are facing the same issue what i am looking, so that's why i decided to share the my tns error resolving log with you.

we have faced many ora 12154 tns error issues, i have copied all the logs and sharing one by one, i believe your situation suits any one of them, also i have mentioned in detailed description how to give tnsnames.ora configuration. In case if i miss anything please comment below i will paste on same page that will help to others.  

Below is one scenario where customer had done the mistake, instead of giving oradb1 he has mentioned wrong service name oradb11 due to connectivity failed  

---------------------------------------------------------------------------------------------------------
[oracle@rsrvt134 admin]$ tnsping oradb1

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 20-AUG-2017 00:01:49

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rsrvt134.oraclenet.com)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = oradb11)))
OK (10 msec)

[oracle@rsrvt134 admin]$ sqlplus kkasari/password@oradb1

SQL*Plus: Release 12.1.0.2.0 Production on Sun Aug 20 00:01:52 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Enter user-name:

( Answer is corrected the service name to oradb11 to oradb1 )

SQL>  show parameter service_name

Name                        Type                                 Value
-----------                   ------------                         -----------------


service_name            string                                ORADB1
------------------------------------------------------------------------------------------------------------------


To configure oracle database remote connectivity we need four details...


  • Tns Service Name
  • Host Name
  • Port Number
  • Database Service Name
Tns Service name -  you can choose any name, it would be good if the name is related and meaning full to related with database name.

Hostname -  Specify server ( IP Address / Hostname ) name where the database exists.

Port Number - Port number must match with the server side listener port number, be careful when you have multiple listener entries in a single file.

Service Name - Maximum database name is the service name in case if you have any doubt please check with using below parameter.

SQL>  show parameter service_name

Name                        Type                                 Value
-----------                   ------------                         -----------------
service_name            string                                ORADB1


TNS File ( tnsnames.ora )
---------------------------------

oradb1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rsrvt134.oraclenet.com)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVER = DEDICATED ) - Optional 
      (SERVICE_NAME = oradb1)
    )
  )

Archive Log Destination Full Oracle Databse

Oracle Database - Archive log Destination Full



             One of the routine task in DBA's life is Archive destination get's fill 100%, maximum cases this will occur due to scheduled archive backup jobs fail, when archive destination gets fill database will be in hung state and not available to users, even it will not allow us to connect as SYS and RMAN user as well. 


If it allows as a RMAN user, we can take archive log backup with delete input and  we can solve the problem easily but Oracle will not allow as RMAN user as well, then what to do and how to resolve this problem. In this case follow below simple steps and resolve the problem.


Note : Don't shutdown or reboot the database, when you move the archive log automatically it comes to normal state



Step 1 -  Go to the archie destination and move some old archive file's to temporary location 

]$ cd  /oradba/app/oracle/admin/dbname/arch

arch]$ ls -ltr 

arch]$ mv  *1098657.dbf   to  /d01



Step 2 - Once completed the moving archive log to temporary location, check the database status, it automatically come to normal status

]$ sqlplus '/as sysdba'

SQL> select name,open_mode from v$database



Step 3 - Perform archive log backup with catalog , this catalog automatically detects temporary archive log location archive log files and take the backup

]$ rman target  /


RMAN> CATALOG START WITH  '/d01;

RMAN> backup archivelog all delete input;


Hope this will solve your archive log full issue.




Older Posts