Monday, July 23, 2018

How to install Oracle sample schemas


-- There are sample schemas which are not installed by default when you install an Oracle database, you can later use the related scripts in "$ORACLE_HOME/demo/schemas" folder to create them. You can use these schemas mostly during an SQL lesson or while practicing your SQL writing skills.

-- Below is the example of how to create HR schema, you can use the same procedure install the other sample schemas

[oracle@exatestdbadm01] /home/oracle > cd $ORACLE_HOME/demo/schema/human_resources
[oracle@exatestdbadm01] /u01/app/12.2.0.1/grid/demo/schema/human_resources > ls -l
total 100
-rw-r--r-- 1 grid oinstall  1132 Oct 13  2002 hr_analz.sql
-rw-r--r-- 1 grid oinstall  2733 Aug 29  2002 hr_code.sql
-rw-r--r-- 1 grid oinstall  7186 Aug 29  2002 hr_comnt.sql
-rw-r--r-- 1 grid oinstall  9381 Aug 29  2002 hr_cre.sql
-rw-r--r-- 1 grid oinstall  2609 Nov  9  2015 hr_drop_new.sql
-rw-r--r-- 1 grid oinstall  2611 Mar 30  2016 hr_drop.sql
-rw-r--r-- 1 grid oinstall  1345 Aug 29  2002 hr_idx.sql
-rw-r--r-- 1 grid oinstall  5046 Nov  9  2015 hr_main_new.sql
-rw-r--r-- 1 grid oinstall  4755 Mar 30  2016 hr_main.sql
-rw-r--r-- 1 grid oinstall 44288 Aug 16  2008 hr_popul.sql
[oracle@exatestdbadm01] /u01/app/12.2.0.1/grid/demo/schema/human_resources > sql

SQL*Plus: Release 12.1.0.2.0 Production on Fri Jul 20 17:02:04 2018

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


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

SYS@INSISTST1 > @?/demo/schema/human_resources/hr_main.sql

specify password for HR as parameter 1:
Enter value for 1: ahe1234_

specify default tablespeace for HR as parameter 2:
Enter value for 2: users

specify temporary tablespace for HR as parameter 3:
Enter value for 3: temp

specify log path as parameter 4:
Enter value for 4: $ORACLE_HOME/demo/schema/log/


PL/SQL procedure successfully completed.


User created.


User altered.

...

PL/SQL procedure successfully completed.

SYS@INSISTST1 >

Wednesday, July 18, 2018

ORA-15221: ASM operation requires compatible.asm of 12.1.0.0.0 or higher


-- Recently we setup a new virtual Oracle Linux server and installed Oracle ASM and database on it, after a while after various restarts of server we realized that the spfile and password file is missing in locations in ASM disk groups

-- First we tried to create the password file in ASM where it should be and we got the following error

[root@ahemonprddb01 ~]# su - grid
[grid@ahemonprddb01] /home/grid > orapwd file='+DATA' force=y entries=10 password=xxxxxx asm=y

OPW-00010: Could not create the password file.
ORA-15056: additional error message
ORA-15221: ASM operation requires compatible.asm of 12.1.0.0.0 or higher
ORA-06512: at line 4

-- It says that the "compatible.asm" parameter for the related diskgroup "+DATA" should be at least "12.1", we are going to change this parameter for all the diskgroups "+DATA" and "+RECO"

[grid@ahemonprddb01] /home/grid > sql

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jul 17 16:23:07 2018

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


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

SYS@+ASM > desc v$asm_diskgroup
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 GROUP_NUMBER                                       NUMBER
 NAME                                               VARCHAR2(30)
 SECTOR_SIZE                                        NUMBER
 BLOCK_SIZE                                         NUMBER
 ALLOCATION_UNIT_SIZE                               NUMBER
 STATE                                              VARCHAR2(11)
 TYPE                                               VARCHAR2(6)
 TOTAL_MB                                           NUMBER
 FREE_MB                                            NUMBER
 HOT_USED_MB                                        NUMBER
 COLD_USED_MB                                       NUMBER
 REQUIRED_MIRROR_FREE_MB                            NUMBER
 USABLE_FILE_MB                                     NUMBER
 OFFLINE_DISKS                                      NUMBER
 COMPATIBILITY                                      VARCHAR2(60)
 DATABASE_COMPATIBILITY                             VARCHAR2(60)
 VOTING_FILES                                       VARCHAR2(1)
 CON_ID                                             NUMBER

SYS@+ASM > set lines 200
SYS@+ASM > select GROUP_NUMBER,NAME,TOTAL_MB,STATE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;

GROUP_NUMBER NAME                             TOTAL_MB STATE       COMPATIBILITY                                                DATABASE_COMPATIBILITY
------------ ------------------------------ ---------- ----------- ------------------------------------------------------------ ------------------------------------------------------------
           2 RECO                               511992 MOUNTED     10.1.0.0.0                                                   10.1.0.0.0
           1 DATA                              2047968 MOUNTED     10.1.0.0.0                                                   10.1.0.0.0

SYS@+ASM > sho parameter compatible
SYS@+ASM > select group_number, name, value from v$asm_attribute where group_number=2 and name like 'compatible%' order by name;

no rows selected

SYS@+ASM > ALTER DISKGROUP data SET ATTRIBUTE 'compatible.asm' = '12.1';

Diskgroup altered.

SYS@+ASM > ALTER DISKGROUP data SET ATTRIBUTE 'compatible.rdbms' = '12.1';

Diskgroup altered.

SYS@+ASM > ALTER DISKGROUP reco SET ATTRIBUTE 'compatible.asm' = '12.1';

Diskgroup altered.

SYS@+ASM > ALTER DISKGROUP reco SET ATTRIBUTE 'compatible.rdbms' = '12.1';

Diskgroup altered.

SYS@+ASM > select GROUP_NUMBER,NAME,TOTAL_MB,STATE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;

GROUP_NUMBER NAME                             TOTAL_MB STATE       COMPATIBILITY                                                DATABASE_COMPATIBILITY
------------ ------------------------------ ---------- ----------- ------------------------------------------------------------ ------------------------------------------------------------
           2 RECO                               511992 MOUNTED     12.1.0.0.0                                                   12.1.0.0.0
           1 DATA                              2047968 MOUNTED     12.1.0.0.0                                                   12.1.0.0.0

SYS@+ASM > select group_number, name, value from v$asm_attribute where name like 'compatible%' order by name;

GROUP_NUMBER
------------
NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
           2
compatible.asm
12.1.0.0.0

           1
compatible.asm
12.1.0.0.0

GROUP_NUMBER
------------
NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

           2
compatible.rdbms
12.1

           1
compatible.rdbms

GROUP_NUMBER
------------
NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
12.1


SYS@+ASM >

----------------------

-- Lets try to create the password file again

-- First check srvctl for the value of password file

[grid@ahemonprddb01] /home/grid > srvctl config asm
ASM home:
Password file:
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.977067015
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[grid@ahemonprddb01] /home/grid > orapwd file='+DATA' force=y entries=10 password=xxxxxx asm=y
[grid@ahemonprddb01] /home/grid > srvctl config asm
ASM home:
Password file: +DATA/ASM/PASSWORD/pwdasm.296.981736577
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.977067015
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[grid@ahemonprddb01] /home/grid >

-- Check that the new password file is in the correct location in ASM

ASMCMD [+data] > ls
AHEMON/
ASM/
ASMCMD [+data] > cd asm
ASMCMD [+data/asm] > ls
PASSWORD/
ASMCMD [+data/asm] > cd password
ASMCMD [+data/asm/password] > ls
pwdasm.296.981736577
ASMCMD [+data/asm/password] > ls -l
Type      Redund  Striped  Time             Sys  Name
PASSWORD  UNPROT  COARSE   JUL 17 16:00:00  Y    pwdasm.296.981736577
ASMCMD [+data/asm/password] >

------------

-- Now we are going to create the ASM spfile

[grid@ahemonprddb01] /home/grid > srvctl config asm
ASM home:
Password file: +DATA/ASM/PASSWORD/pwdasm.296.981736577
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.977067015
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[grid@ahemonprddb01] /home/grid > sql

-- Above value is the name of the missing spfile, we are going to create a new one

ASMCMD [+data/asm] > ls
PASSWORD/


SQL*Plus: Release 12.1.0.2.0 Production on Tue Jul 17 16:38:09 2018

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


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

SYS@+ASM > sho parameter pfile

NAME                                 TYPE
------------------------------------ -----------
VALUE
------------------------------------------------------------
spfile                               string

-- First create a dummy init.ora file for +ASM

[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > cat init+ASM.ora
+ASM.__oracle_base='/u01/app/grid'
+ASM.asm_diskgroups='DATA','RECO'
*.asm_diskstring='/dev/oracleasm/disks/*'
*.asm_power_limit=1
*.large_pool_size=12M
*.remote_login_passwordfile='EXCLUSIVE'
[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs >

-- Create the new spfile from the dummy pfle with the below command

create spfile='+DATA' from pfile='/u01/app/oracle/product/12.1.0/grid/dbs/init+ASM.ora';

[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > sql

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jul 17 16:46:30 2018

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


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

SYS@+ASM > create spfile='+DATA' from pfile='/u01/app/oracle/product/12.1.0/grid/dbs/init+ASM.ora';

File created.

SYS@+ASM > sho parameter pfile

NAME                                 TYPE
------------------------------------ -----------
VALUE
------------------------------------------------------------
spfile                               string

SYS@+ASM >

-- Check if the spfile is created in the correct location in ASM

ASMCMD [+data/asm] > ls
ASMPARAMETERFILE/
PASSWORD/
ASMCMD [+data/asm] > cd ASMPARAMETERFILE/
ASMCMD [+data/asm/ASMPARAMETERFILE] > ls -l
Type              Redund  Striped  Time             Sys  Name
ASMPARAMETERFILE  UNPROT  COARSE   JUL 17 16:00:00  Y    REGISTRY.253.981737195
ASMCMD [+data/asm/ASMPARAMETERFILE] >

-- Check the srvctl and see that the name od the spfile is now the new spfile

[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > srvctl config asm
ASM home:
Password file: +DATA/ASM/PASSWORD/pwdasm.296.981736577
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.981737195
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs >

[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > ls -l
total 16
-rw-rw----. 1 grid oinstall 1359 Jul 17 11:59 ab_+ASM.dat
-rw-rw----. 1 grid oinstall 1544 Jul 17 11:59 hc_+ASM.dat
-rw-r--r--. 1 grid oinstall  193 Jul 17 16:42 init+ASM.ora
-rw-r--r--. 1 grid oinstall 2992 Feb  3  2012 init.ora

-- We can now remove the dummy pfile

[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > rm init+ASM.ora
[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs >

--

-- Check the alert log file while creating the new spfile

[grid@ahemonprddb01] /u01/app/oracle/diag/asm/+asm/+ASM/trace > tail -f alert_+ASM.log
...
NOTE: Physical metadata for diskgroup 1 (DATA) was replicated.
Tue Jul 17 16:36:16 2018
NOTE: Advanced to new COD format for group DATA
Tue Jul 17 16:46:33 2018
NOTE: updated gpnp profile ASM SPFILE to
NOTE: Using default ASM root directory ASM
NOTE: updated gpnp profile ASM diskstring:
NOTE: updated gpnp profile ASM diskstring: /dev/oracleasm/disks/*
NOTE: updated gpnp profile ASM SPFILE to +DATA/ASM/ASMPARAMETERFILE/registry.253.981737195


----------------

-- For the changes about spfile to take effect we need to restart the database and the ASM

[oracle@ahemonprddb01] /home/oracle/uural > srvctl stop database -d AHEMON -o abort

[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > srvctl stop asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2529: Unable to act on 'ora.asm' because that would require stopping or relocating 'ora.DATA.dg', but the force option was not specified
[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > srvctl stop asm -f
[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > srvctl start asm
[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs >

[oracle@ahemonprddb01] /home/oracle/uural > srvctl start database -d AHEMON


[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > srvctl config asm
ASM home:
Password file: +DATA/ASM/PASSWORD/pwdasm.296.981736577
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.981737195
ASM diskgroup discovery string: /dev/oracleasm/disks/*
[grid@ahemonprddb01] /u01/app/oracle/product/12.1.0/grid/dbs > sql

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jul 17 18:49:40 2018

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


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

SYS@+ASM > sho parameter pfile

NAME                                 TYPE
------------------------------------ -----------
VALUE
------------------------------------------------------------
spfile                               string
+DATA/ASM/ASMPARAMETERFILE/registry.253.981737195
SYS@+ASM >


-----

SYS@+ASM > select group_number, name, value from v$asm_attribute where name like 'compatible%' order by name;

GROUP_NUMBER
------------
NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
           2
compatible.asm
12.1.0.0.0

           1
compatible.asm
12.1.0.0.0

GROUP_NUMBER
------------
NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------

           2
compatible.rdbms
12.1

           1
compatible.rdbms

GROUP_NUMBER
------------
NAME
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
12.1


SYS@+ASM >

---------------

SYS@+ASM > select GROUP_NUMBER,NAME,TOTAL_MB,STATE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;

GROUP_NUMBER NAME                             TOTAL_MB STATE
------------ ------------------------------ ---------- -----------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY
------------------------------------------------------------
           2 RECO                               511992 MOUNTED
12.1.0.0.0
12.1.0.0.0

           1 DATA                              2047968 MOUNTED
12.1.0.0.0
12.1.0.0.0

GROUP_NUMBER NAME                             TOTAL_MB STATE
------------ ------------------------------ ---------- -----------
COMPATIBILITY
------------------------------------------------------------
DATABASE_COMPATIBILITY
------------------------------------------------------------


SYS@+ASM >

----------------







Thursday, June 28, 2018

How to remove an Oracle RAC database


-- you can follow the below steps to remove an existing Oracle RAC database manually

-- Oracle binaries are set up with "oracle" OS user so first switch to this user

[root@exatestdbadm01 ~]# su - oracle
[oracle@exatestdbadm01 ~]$ . profile_insistst
[oracle@exatestdbadm01 ~]$ env|grep ORA
ORACLE_SID=INSISTST1
ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/dbhome_1
[oracle@exatestdbadm01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Jul 19 13:24:03 2016

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

-- first set the "cluster_database" parameter to "FALSE"

SQL> alter system set cluster_database=false scope=spfile;

System altered.

SQL> create pfile from spfile;       

File created.

SQL> shutdown immediate

Database dismounted.
ORACLE instance shut down.

SQL> startup mount exclusive restrict pfile='/u01/app/oracle/product/12.1.0.1/dbhome_1/dbs/initINSISTST1.ora';
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2702112 bytes
Variable Size            1035994336 bytes
Database Buffers         1086324736 bytes
Redo Buffers               12865536 bytes
Database mounted.
SQL> select name from v$database;

NAME
---------
INSISTST

SQL> drop database;

Database dropped.

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> exit

-- remove the related database files in "dbs" folder

[oracle@exatestdbadm01 dbs]$ pwd
/u01/app/oracle/product/12.1.0.1/dbhome_1/dbs

[oracle@exatestdbadm01 dbs]$ ls -l
total 2477628
-rw-r----- 1 oracle oinstall  22773760 May 10 15:19 c-1909097454-20160510-01
-rw-r----- 1 oracle oinstall  36896768 Jun  2 09:26 c-1909097454-20160602-02
-rw-r----- 1 oracle oinstall  36896768 Jun  2 10:01 c-1909097454-20160602-03
-rw-r----- 1 oracle oinstall  56524800 Jun  7 17:55 c-1909097454-20160607-02
-rw-r----- 1 oracle oinstall 147521536 Jun 16 10:28 c-1909097454-20160616-02
-rw-r----- 1 oracle oinstall 147554304 Jun 17 15:50 c-1909097454-20160617-04
-rw-r----- 1 oracle oinstall 162234368 Jun 27 01:55 c-1909097454-20160627-00
-rw-r----- 1 oracle oinstall 270073856 Jul  1 15:04 c-1909097454-20160701-02
-rw-r----- 1 oracle oinstall 270073856 Jul  8 09:52 c-1909097454-20160708-00
-rw-r----- 1 oracle oinstall 270073856 Jul 12 14:38 c-1909097454-20160712-02
-rw-r----- 1 oracle oinstall 270073856 Jul 12 17:34 c-1909097454-20160712-03
-rw-r----- 1 oracle asmadmin 281608192 Jul 18 12:01 c-1909097454-20160718-02
-rw-r----- 1 oracle asmadmin 281608192 Jul 18 14:22 c-1909097454-20160718-04
-rw-rw---- 1 oracle asmadmin      1544 Jul 15 19:48 hc_fenikstd1.dat
-rw-rw---- 1 oracle asmadmin      1544 Jul 19 13:40 hc_INSISTST1.dat
-rw-rw---- 1 oracle asmadmin      1544 Jul 19 11:16 hc_INSISTST.dat
-rw-rw---- 1 oracle asmadmin    524288 Jul 19 13:45 id_fenikstd1.dat
-rw-rw---- 1 oracle asmadmin    524288 Jul 19 13:30 id_INSISTST1.dat
-rw-rw---- 1 oracle asmadmin    524288 Jul 19 11:16 id_INSISTST.dat
-rw-r----- 1 oracle oinstall      1976 Jun  1 14:13 initfenikstd1.ora
-rw-r----- 1 oracle oinstall       722 Jul 19 13:37 initINSISTST1.ora
-rw-r--r-- 1 oracle oinstall      2992 Feb  3  2012 init.ora
-rw-r----- 1 oracle oinstall 281526272 Jul 19 07:39 snapcf_fenikstd1.f
-rw-r----- 1 oracle asmadmin      2560 Jul 19 13:37 spfileINSISTST1.ora
[oracle@exatestdbadm01 dbs]$ rm *INSISTST*
[oracle@exatestdbadm01 dbs]$ ls -l
total 2476588
-rw-r----- 1 oracle oinstall  22773760 May 10 15:19 c-1909097454-20160510-01
-rw-r----- 1 oracle oinstall  36896768 Jun  2 09:26 c-1909097454-20160602-02
-rw-r----- 1 oracle oinstall  36896768 Jun  2 10:01 c-1909097454-20160602-03
-rw-r----- 1 oracle oinstall  56524800 Jun  7 17:55 c-1909097454-20160607-02
-rw-r----- 1 oracle oinstall 147521536 Jun 16 10:28 c-1909097454-20160616-02
-rw-r----- 1 oracle oinstall 147554304 Jun 17 15:50 c-1909097454-20160617-04
-rw-r----- 1 oracle oinstall 162234368 Jun 27 01:55 c-1909097454-20160627-00
-rw-r----- 1 oracle oinstall 270073856 Jul  1 15:04 c-1909097454-20160701-02
-rw-r----- 1 oracle oinstall 270073856 Jul  8 09:52 c-1909097454-20160708-00
-rw-r----- 1 oracle oinstall 270073856 Jul 12 14:38 c-1909097454-20160712-02
-rw-r----- 1 oracle oinstall 270073856 Jul 12 17:34 c-1909097454-20160712-03
-rw-r----- 1 oracle asmadmin 281608192 Jul 18 12:01 c-1909097454-20160718-02
-rw-r----- 1 oracle asmadmin 281608192 Jul 18 14:22 c-1909097454-20160718-04
-rw-rw---- 1 oracle asmadmin      1544 Jul 15 19:48 hc_fenikstd1.dat
-rw-rw---- 1 oracle asmadmin    524288 Jul 19 13:46 id_fenikstd1.dat
-rw-r----- 1 oracle oinstall      1976 Jun  1 14:13 initfenikstd1.ora
-rw-r--r-- 1 oracle oinstall      2992 Feb  3  2012 init.ora
-rw-r----- 1 oracle oinstall 281526272 Jul 19 07:39 snapcf_fenikstd1.f
[oracle@exatestdbadm01 dbs]$ pwd
/u01/app/oracle/product/12.1.0.1/dbhome_1/dbs

-- remove the folders belonging to this database under "$ORACLE_BASE/admin" folder

[oracle@exatestdbadm01 dbs]$ cd /u01/app/oracle
[oracle@exatestdbadm01 oracle]$ cd admin
[oracle@exatestdbadm01 admin]$ ls
cdc  clcdc  DBFSDB  DRAHEODS  fenikstd  INSISDET  INSISDUV  INSISTST  NECOTEST  scripts
[oracle@exatestdbadm01 admin]$ rm -rf INSISTST
[oracle@exatestdbadm01 admin]$ ls -l
total 36
drwxr-xr-x 3 oracle oinstall 4096 Jul  3  2015 cdc
drwxr-xr-x 3 oracle oinstall 4096 Jul  6  2015 clcdc
drwxr-x--- 6 oracle oinstall 4096 May 14  2015 DBFSDB
drwxr-xr-x 3 oracle oinstall 4096 Dec 24  2015 DRAHEODS
drwxr-xr-x 7 oracle asmadmin 4096 Mar 11 11:30 fenikstd
drwxr-x--- 4 oracle oinstall 4096 Jun 15  2015 INSISDET
drwxr-xr-x 3 oracle asmadmin 4096 Jun 12  2015 INSISDUV
drwxr-x--- 7 oracle oinstall 4096 Jun 15  2015 NECOTEST
drwxr-xr-x 4 oracle oinstall 4096 May 30 17:40 scripts

-- remove the audit files beloging to this database "INSISTST"

[oracle@exatestdbadm01] /home/oracle > cd $ORACLE_HOME/rdbms/audit
[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/audit > ls -l *INSISTST* | wc -l
483
[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/audit > ls -l *INSISTST* | head -10
-rw-r----- 1 oracle asmadmin 876 Jun 22  2017 INSISTST1_ora_100036_20170622130128627210143795.aud
-rw-r----- 1 oracle asmadmin 876 Aug 10  2016 INSISTST1_ora_100184_20160810195249674576143795.aud
-rw-r----- 1 oracle asmadmin 867 Jul 21  2016 INSISTST1_ora_101085_20160721180141680820143795.aud
-rw-r----- 1 oracle asmadmin 876 Nov 17  2016 INSISTST1_ora_103568_20161117195645299824143795.aud
-rw-r----- 1 oracle asmadmin 876 Nov  3  2016 INSISTST1_ora_104181_20161103125604823090143795.aud
-rw-r----- 1 oracle asmadmin 876 May 12  2017 INSISTST1_ora_104912_20170512150603904131143795.aud
-rw-r----- 1 oracle asmadmin 868 Dec  1  2017 INSISTST1_ora_105013_20171201234204022596143795.aud
-rw-r----- 1 oracle asmadmin 876 Feb 19  2017 INSISTST1_ora_105642_20170219020355095097143795.aud
-rw-r----- 1 oracle asmadmin 876 Dec  1  2016 INSISTST1_ora_105707_20161201200625717435143795.aud
-rw-r----- 1 oracle asmadmin 876 Jan 31  2017 INSISTST1_ora_106908_20170131000531231798143795.aud
[oracle@exatestdbadm01] /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/audit > rm -f INSISTST*

-- remove the database service

[grid@exatestdbadm01 ~]$ crsctl status resource -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATAC1.dg
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.DBFS_DG.dg
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER_BAN.lsnr
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER_EBS.lsnr
               ONLINE  INTERMEDIATE exatestdbadm01           Not All Endpoints Re
                                                             gistered,STABLE
               ONLINE  INTERMEDIATE exatestdbadm02           Not All Endpoints Re
                                                             gistered,STABLE
ora.RECOC1.CLOUDFS.advm
               ONLINE  ONLINE       exatestdbadm01           Volume device /dev/a
                                                             sm/cloudfs-444 is on
                                                             line,STABLE
               ONLINE  ONLINE       exatestdbadm02           Volume device /dev/a
                                                             sm/cloudfs-444 is on
                                                             line,STABLE
ora.RECOC1.dg
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.asm
               ONLINE  ONLINE       exatestdbadm01           Started,STABLE
               ONLINE  ONLINE       exatestdbadm02           Started,STABLE
ora.net1.network
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.net2.network
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.ons
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.recoc1.cloudfs.acfs
               ONLINE  ONLINE       exatestdbadm01           mounted on /cloudfs,
                                                             STABLE
               ONLINE  ONLINE       exatestdbadm02           mounted on /cloudfs,
                                                             STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.MGMTLSNR
      1        ONLINE  OFFLINE                               169.254.8.18,STABLE
ora.cvu
      1        ONLINE  OFFLINE                               STABLE
ora.dbfsdb.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.exatestdbadm01.vip
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.exatestdbadm01_2.vip
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.exatestdbadm02.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.exatestdbadm02_2.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.fenikstd.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.insistst.db
      1        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.mgmtdb
      1        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.msdp.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.necotest.db
      1        OFFLINE OFFLINE                               STABLE
      2        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.oc4j
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.upgmsdp.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
--------------------------------------------------------------------------------

-- GI setup is owner by the "grid" OS user

[grid@exatestdbadm01 ~]$ srvctl remove database -d INSISTST
PRCD-1229 : An attempt to access configuration of database INSISTST was rejected because its version 12.1.0.1.0 differs from the program version 12.1.0.2.0. Instead run the program from /u01/app/oracle/product/12.1.0.1/dbhome_1.

-- we need to switch to database owner OS user that is "oracle"

[grid@exatestdbadm01 ~]$ exit
logout
[root@exatestdbadm01 ~]# su - oracle
[oracle@exatestdbadm01 ~]$ . profile_insistst
[oracle@exatestdbadm01 ~]$ srvctl remove database -d INSISTST
Remove the database INSISTST? (y/[n]) y
[oracle@exatestdbadm01 ~]$ exit
logout

--check the srvctl and see that the "INSISTST" database has gone

[root@exatestdbadm01 ~]# su - grid
[grid@exatestdbadm01 ~]$ crsctl status resource -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATAC1.dg
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.DBFS_DG.dg
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER_BAN.lsnr
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER_EBS.lsnr
               ONLINE  INTERMEDIATE exatestdbadm01           Not All Endpoints Re
                                                             gistered,STABLE
               ONLINE  INTERMEDIATE exatestdbadm02           Not All Endpoints Re
                                                             gistered,STABLE
ora.RECOC1.CLOUDFS.advm
               ONLINE  ONLINE       exatestdbadm01           Volume device /dev/a
                                                             sm/cloudfs-444 is on
                                                             line,STABLE
               ONLINE  ONLINE       exatestdbadm02           Volume device /dev/a
                                                             sm/cloudfs-444 is on
                                                             line,STABLE
ora.RECOC1.dg
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.asm
               ONLINE  ONLINE       exatestdbadm01           Started,STABLE
               ONLINE  ONLINE       exatestdbadm02           Started,STABLE
ora.net1.network
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.net2.network
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.ons
               ONLINE  ONLINE       exatestdbadm01           STABLE
               ONLINE  ONLINE       exatestdbadm02           STABLE
ora.recoc1.cloudfs.acfs
               ONLINE  ONLINE       exatestdbadm01           mounted on /cloudfs,
                                                             STABLE
               ONLINE  ONLINE       exatestdbadm02           mounted on /cloudfs,
                                                             STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.MGMTLSNR
      1        ONLINE  OFFLINE                               169.254.8.18,STABLE
ora.cvu
      1        ONLINE  OFFLINE                               STABLE
ora.dbfsdb.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.exatestdbadm01.vip
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.exatestdbadm01_2.vip
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.exatestdbadm02.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.exatestdbadm02_2.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.fenikstd.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.msdp.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
ora.necotest.db
      1        OFFLINE OFFLINE                               STABLE
      2        OFFLINE OFFLINE                               Instance Shutdown,ST
                                                             ABLE
ora.oc4j
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       exatestdbadm01           STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       exatestdbadm02           STABLE
ora.upgmsdp.db
      1        ONLINE  ONLINE       exatestdbadm01           Open,STABLE
      2        ONLINE  ONLINE       exatestdbadm02           Open,STABLE
--------------------------------------------------------------------------------