Monday 27 June 2016

DBMS_REDEFINITION

Convert non-partition table to partition table using Oracle redefinition.

Goals
1.       To convert the non-partition table to partition table
2.      No/minimal application downtime
3.      Dependent objects should also get created
4.      Option to convert current non-primary key global index to local indexes
5.       
I’ve used scott schema to redefine a table. Scott will need special privileges for using DBMS_REDEFINITION Package
SQL> grant create any table, alter any table, drop any table,lock any table, select any table, create any trigger, create any index to scott;
Check the existing table & it’s associated attributes
desc EMP
Name                                      Null?    Type
----------------------------------------- -------- -------------
EMPNO                                     NOT NULL NUMBER
NAME                                               VARCHAR2(100)
DEPTNO                                    NOT NULL NUMBER
SQL> select table_name, index_name from user_indexes
/
TABLE_NAME                     INDEX_NAME
------------------------------ ------------------------------
EMP                            IDX_DEPTNO
EMP                            SYS_C004149
SQL> select  constraint_name, constraint_type, table_name 
from user_constraints
/
CONSTRAINT_NAME                C TABLE_NAME
------------------------------ - ------------------------------SYS_C004149                    P EMP
SYS_C004150                    C EMP
Now perform the following steps to redefine the table
STEP 1
Check to make sure that the table can use the online redefinition feature
SQL> EXEC DBMS_REDEFINITION.CAN_REDEF_TABLE('SCOTT','EMP');
PL/SQL procedure successfully completed.

STEP 2
Create a interim partitioned table  (this table will eventually become actual table)

SQL> create table tmp_emp (empno number, ename varchar2(100), 
deptno number) 
partition by list (deptno) 
partition p_10 values (10), 
partition p_20 values (20), 
partition p_30 values (30),
partition p_40 values (40),
partition p_50 values (50),
partition p_60 values (60))
/
I’m creating a local index on the interim table & not copying as part of dependent objects, which is a global index.
SQL> create index idx_deptno_lcl on tmp_emp(deptno) local
/
SQL> desc tmp_emp
Name                                      Null?    Type
----------------------------------------- -------- --------------
EMPNO                                              NUMBER
NAME                                               VARCHAR2(100)
DEPTNO                                             NUMBER
SQL> select table_name, partition_name high_value from user_tab_partitions
/
TABLE_NAME                     HIGH_VALUE
------------------------------ ------------------------------
TMP_EMP                        P_60
TMP_EMP                        P_50
TMP_EMP                        P_40
TMP_EMP                        P_30
TMP_EMP                        P_20
TMP_EMP                        P_10

6 rows selected.

STEP 3
Start the online redefinition process
SQL>EXEC DBMS_REDEFINITION.START_REDEF_TABLE ('SCOTT','EMP','TMP_EMP');
PL/SQL procedure successfully completed.

STEP 4
Copy dependent objects
We will use DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS
SQL> VARIABLE v_num NUMBER;
SQL> EXEC DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS ('SCOTT','EMP','TMP_EMP', 0,TRUE,TRUE,TRUE,FALSE,:v_num,FALSE);

PL/SQL procedure successfully completed.
SQL> PRINT  v_num
 V_NUM
----------         
0

Check the associated attributes for interim table
SQL>  select table_name, index_name from user_indexes
/
TABLE_NAME                     INDEX_NAME
------------------------------ ------------------------------
TMP_EMP                        IDX_DEPTNO_LCL
TMP_EMP                        TMP$$_SYS_C0041490
EMP                            IDX_DEPTNO
EMP                            SYS_C004149
SQL> select  constraint_name, constraint_type, table_name from user_constraints
/
CONSTRAINT_NAME                C TABLE_NAME
------------------------------ - ------------------------------
TMP$$_SYS_C0041370             P TMP_EMP
SYS_C004137                    P EMP
SYS_C004138                    C EMPTMP
$$_SYS_C0041380             C TMP_EMP

STEP 5
Resync the table. This will copy the initial data from the EMP to TMP_EMP table.

SQL> EXEC DBMS_REDEFINITION.SYNC_INTERIM_TABLE('SCOTT','EMP','TMP_EMP');

PL/SQL procedure successfully completed.
SQL> select count(*) from emp;
COUNT(*)
----------        
91
SQL> select count(*) from tmp_emp
/
 COUNT(*)
----------        
91

Now add some rows in the original table EMP.
SQL> set serveroutput on 
declarev1 varchar2(100);
begin
for i in 101..10000
loop
v1:='insert into emp 
values ('||i||','||chr(39)||'ename'||i||chr(39)||',60)';
execute immediate v1;
end loop;
exception
when others then
dbms_output.put_line(substr(sqlerrm,1,50));
end;
/
SQL> select count(*) from emp
/
 COUNT(*)
----------      
9991
SQL>  select count(*) from tmp_emp
/
COUNT(*)
----------        
91
Again resync the table to make sure that the data is correctly getting copied to interim table
SQL> EXEC DBMS_REDEFINITION.SYNC_INTERIM_TABLE('SCOTT','EMP','TMP_EMP');

PL/SQL procedure successfully completed.
SQL>  select count(*) from tmp_emp
/
COUNT(*)
----------      
9991

STEP 6
Finish the online redefinition. Here the redefinition process will be over and interim table will become original table.
SQL> select count(*) from tmp_emp
/
 COUNT(*)
----------
      9991
Just to simulate the load on original table, I’ve added another set of rows from one session & started the finish procedure from another session. Till the point, the insert is not complete & commit is not issued, finish procedure will wait.  So ideally one should execute this procedure, when load on the system is low.
declare
v1 varchar2(100);
begin
for i in 10001..20000
loop
v1:='insert into emp 
values ('||i||','||chr(39)||'name'||i||chr(39)||',60)';
execute immediate v1;
end loop;
exception
when others then
dbms_output.put_line(substr(sqlerrm,1,50));
end;
/
SQL> commit;
Commit complete.
SQL> EXEC DBMS_REDEFINITION.FINISH_REDEF_TABLE('SCOTT','EMP','TMP_EMP');
SQL>  select count(*) from tmp_emp;
 COUNT(*)
----------    
19991
SQL> desc emp 
Name                                      Null?    Type 
----------------------------------------- -------- ------------- 
EMPNO                                              NUMBER 
NAME                                               VARCHAR2(100) 
DEPTNO                                             NUMBER
SQL> select table_name, index_name from user_indexes
/
TABLE_NAME                     INDEX_NAME
------------------------------ ------------------------------
TMP_EMP                        IDX_DEPTNO
TMP_EMP                        SYS_C004149
EMP                            IDX_DEPTNO_LCL
EMP                            TMP$$_SYS_C0041490
SQL> select  constraint_name, constraint_type, table_name from user_constraints;
CONSTRAINT_NAME                C TABLE_NAME
------------------------------ - ------------------------------
SYS_C004149                    P EMP
TMP$$_SYS_C0041490             P TMP_EMP
SYS_C004150                    C EMPTMP
$$_SYS_C0041500             C TMP_EMP

STEP 7
Cross verify the table constraints

SQL> insert into emp values (11,'dsdsd',60);

insert into emp values (11,'dsdsd',60)*ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C004149) violated
SQL>  insert into emp values (NULL,'dsdsd',60); 

insert into emp values (NULL,'dsdsd',60)  *ERROR at line 1:
ORA-01400: cannot insert NULL into ("SCOTT"."EMP"."EMPNO")

SQL> insert into emp values (11111,'lllll',NULL);

insert into emp values (11111,'lllll',NULL)  *ERROR at line 1:
ORA-01400: cannot insert NULL into ("SCOTT"."EMP"."DEPTNO")

STEP 8
Rename the constraints to required a meaningful name
SQL> ALTER INDEX TMP$$_SYS_C0041540 rename to pk_empno; 
If we want to abort the redefinition process in between, we can use abort procedure
SQL> EXEC DBMS_REDEFINITION.ABORT_REDEF_TABLE ('SCOTT','EMP','TMP_EMP',NULL);

Limitations to the redefinition

1.       Cannot belong to SYS or SYSTEM Schema.
2.      The table to be redefined online should not be using User-defined data types
3.      Should not be a clustered table.
4.      Should not have MV Logs or MVs defined
5.      Table owner cannot be changed, as part of re-definition
6.      Additional space requirement for the interim table (same as original table)



Error / Solutions

SQL> insert into scott.emp values(123,'Demo','Clerk',321,sysdate,2000,10,10);
insert into scott.emp values(123,'Demo','Clerk',321,sysdate,2000,10,10)
                  *
ERROR at line 1:
ORA-04098: trigger 'SCOTT.TEST_EMP' is invalid and failed re-validation


Solution:-

SQL>  select TRIGGER_NAME,TABLE_OWNER,TABLE_NAME from user_triggers

SQL> drop trigger TEST_EMP;

Trigger dropped.

SQL> select * from user_triggers;

Saturday 25 June 2016

Feature Enable


Just illustration for fun .....
It in fact violates the license.

This Document is only for study purpose, don't use it in production Server, It's a crime for without licencing use the feature.

All Features are enable in EE (Enterprise Edition).

Actually some features not enabled, if you are using Oracle SE (Standard Edition). Follow the point to see the feature is enable or not in  (SE) .

--In my case

1. Login as sys

# List of all features.
select * from v$option;

# See the Partition feature is enabled or not. In my case (SE)
select * from v$option where parameter='Partitioning';

2. Create Partition table.

CREATE TABLE invoices
(invoice_no    NUMBER NOT NULL,
invoice_date  DATE   NOT NULL,
comments      VARCHAR2(500))
PARTITION BY HASH (invoice_no)
PARTITIONS 4
STORE IN (users, users, users, users);

3. Getting error: 

ORA-00439: feature not enabled: Partitioning while trying to create table with partition.

4. I have solution for linux and unix systems here:

shutdown database
$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk part_on
$ make -f ins_rdbms.mk ioracle


# If Using Windows then below the step:
  if you indeed have the Oracle Enterprise Edition AND the license option for partitioning, you need to enable it through the OUI (Oracle Universal Installer).

  Shutdown the database, open the OUI from your Oracle Home, and install "Partitioning".

5. startup 


6. Verify it.
select * from v$option where parameter='Partitioning';

7. Create Partition table.

CREATE TABLE invoices
(invoice_no    NUMBER NOT NULL,
invoice_date  DATE   NOT NULL,
comments      VARCHAR2(500))
PARTITION BY HASH (invoice_no)
PARTITIONS 4
STORE IN (users, users, users, users);

Table created.

Thursday 23 June 2016

CLEAN OEM ALERTS

Some times OEM show lots of alerts. But alerts will be available on OEM alert tab,  after fixed the issues, and It's creating a confusion the alert was fixed or not. 
So it's very simple to delete the entry after fix the alert > issue on OEM. 
Below the steps you have to follow.

==============
Clean OEM Alerts
==============

1. MGMT_CURRENT_SEVERITY  table show for the TARGET_GUID, METRIC_GUID and KEY_VALUE. 

SELECT TARGET_GUID, METRIC_GUID,KEY_VALUE from MGMT_CURRENT_SEVERITY;


2. Connect to db user SYSMAN and execute:
exec EM_SEVERITY.delete_current_severity(TARGET_GUID,METRIC_GUID,KEY_VALUE);


for example:
exec EM_SEVERITY.delete_current_severity('0DEB8E6980695B7548CF98871084AD10','F95BA0D95585002889E1ABF92B2DA7C3','SYS');


3. Wait a few minutes.
Commit.


4. Verify it on OEM and table also

SELECT TARGET_GUID, METRIC_GUID,KEY_VALUE from MGMT_CURRENT_SEVERITY;

or

OEM.


Enjoy.....!!!!

Friday 17 June 2016

OCR/VOTING DISK RECOVERY WITHOUT ANY BACKUP OF OCR/OLR/VOTING DISK - PART III


3rd Method Different disk of OCR & VOTEDISK then doing this activity again.

Note: Same name of oracleasm disk possible Only . other asm Disk name this secenario Not Possible
Now getting start with 3r method in my case OCR (DISK1 : OCR) and Voting (DISK2: VOTE) Disk is Different mount point and
Both Disk are failure in my case.
Then 2 more disk add and create new diskgroup (DISK6: DEMO_OCR) (DISK7: DEMO_VOTE) and try to mounting.

https://oraclehandson.wordpress.com/2010/08/05/recovering-lost-ocr-voting-disk-in-11gr2/
-------------------------------------------------------------------------------------------------------------------------------------------------------------------

[root@rac1 ~]# crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.DATA.dg    ora....up.type OFFLINE   OFFLINE
ora...._OCR.dg ora....up.type ONLINE    ONLINE    rac1
ora....VOTE.dg ora....up.type ONLINE    ONLINE    rac1
ora.FRA.dg     ora....up.type OFFLINE   OFFLINE
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac1
ora.OCR.dg     ora....up.type ONLINE    ONLINE    rac1
ora.OCR_1.dg   ora....up.type OFFLINE   OFFLINE
ora.VOTE.dg    ora....up.type ONLINE    ONLINE    rac1
ora.asm        ora.asm.type   ONLINE    ONLINE    rac1
ora.eons       ora.eons.type  ONLINE    ONLINE    rac1
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE
ora....network ora....rk.type ONLINE    ONLINE    rac1
ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE
ora.ons        ora.ons.type   ONLINE    ONLINE    rac1
ora....SM1.asm application    ONLINE    ONLINE    rac1
ora....C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    OFFLINE   OFFLINE
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1
ora.racdb.db   ora....se.type OFFLINE   OFFLINE
ora....ry.acfs ora....fs.type ONLINE    ONLINE    rac1
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac1


[root@rac1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   3de994e77be74f60bf4ad8cd59eb79ff (ORCL:DISK2) [VOTE]
Located 1 voting disk(s).


[root@rac1 ~]# crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   3de994e77be74f60bf4ad8cd59eb79ff (ORCL:DISK2) [VOTE]
Located 1 voting disk(s).


[root@rac1 ~]# crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.DEMO_OCR.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.DEMO_VOTE.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.VOTE.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1'
CRS-4549: Unexpected disconnect while executing shutdown request.
CRS-2675: Stop of 'ora.crsd' on 'rac1' failed
CRS-2679: Attempting to clean 'ora.crsd' on 'rac1'
CRS-4548: Unable to connect to CRSD
CRS-2678: 'ora.crsd' on 'rac1' has experienced an unrecoverable failure
CRS-0267: Human intervention required to resume its availability.
CRS-2795: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has failed
CRS-4687: Shutdown command has completed with error(s).
CRS-4000: Command Stop failed, or completed with errors.

[root@rac1 ~]#

[root@rac1 ~]# crsctl stat res -t
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4000: Command Status failed, or completed with errors.


[root@rac1 ~]# crsctl check has
CRS-4638: Oracle High Availability Services is online


[root@rac1 ~]# crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online


[root@rac1 disks]#

[root@rac1 disks]# ps -ef|grep smon
oracle    5068     1  0 18:32 ?        00:00:00 asm_smon_+ASM1
root     10735  4371  0 20:03 pts/1    00:00:00 grep smon
oracle   10895     1  0 19:42 ?        00:00:01 ora_smon_racdb1

[root@rac1 disks]# su - oracle

-bash-3.2$ db_env

-bash-3.2$ sqlplus sys as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 17 20:04:35 2016
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Enter password:
Connected.
SQL> !
[oracle@rac1 ~]$ ps -ef|grep smon
oracle    5068     1  0 18:32 ?        00:00:00 asm_smon_+ASM1
oracle   10895     1  0 19:42 ?        00:00:02 ora_smon_racdb1
oracle   12337 12195  0 20:05 pts/1    00:00:00 grep smon

SQL> shutdown abort
ORACLE instance shut down.
SQL>

root# reboot



[root@rac1 install]# ./rootcrs.pl -deconfig -force -verbose
2016-03-22 21:44:01: Parsing the host name
2016-03-22 21:44:01: Checking for super user privileges
2016-03-22 21:44:01: User has super user privileges
Using configuration parameter file: ./crsconfig_params
PRCR-1035 : Failed to look up CRS resource ora.cluster_vip.type for 1
PRCR-1068 : Failed to query resources
Cannot communicate with crsd
PRCR-1070 : Failed to check if resource ora.gsd is registered
Cannot communicate with crsd
PRCR-1070 : Failed to check if resource ora.ons is registered
Cannot communicate with crsd
PRCR-1070 : Failed to check if resource ora.eons is registered
Cannot communicate with crsd

ACFS-9200: Supported
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-4548: Unable to connect to CRSD
CRS-2675: Stop of 'ora.crsd' on 'rac1' failed
CRS-2679: Attempting to clean 'ora.crsd' on 'rac1'
CRS-4548: Unable to connect to CRSD
CRS-2678: 'ora.crsd' on 'rac1' has experienced an unrecoverable failure
CRS-0267: Human intervention required to resume its availability.
CRS-2795: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has failed
CRS-4687: Shutdown command has completed with error(s).
CRS-4000: Command Stop failed, or completed with errors.
You must kill crs processes or reboot the system to properly
cleanup the processes started by Oracle clusterware
Successfully deconfigured Oracle clusterware stack on this node

--------------------------------------------------------------------------------------------------------------
$GRID_HOME/crs/install/crsconfig_params.
Just in case, we want to change the location, we can edit following variables
--------------------------------------------------------------------------------------------------------------
OCR_LOCATIONS=NO_VAL
VOTING_DISKS=NO_VAL

## In my case set DISKGROUP.
OCR_LOCATIONS=DEMO_OCR
VOTING_DISKS=DEMO_VOTE

(NOTE: If ASM not Up and not getting any diskgroup then giving you these parameter after setting up all replace with asm)
As above the values of parameter which i'll show in my case if any error then follow below the method.

CRS_VOTING_DISKS=/tmp/vote/vote.dat
CRS_OCR_LOCATIONS=/tmp/ocr/ocr.dat



[root@rac1 grid]# ./root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
2016-03-22 22:03:36: Parsing the host name
2016-03-22 22:03:36: Checking for super user privileges
2016-03-22 22:03:36: User has super user privileges
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting
CRS-2672: Attempting to start 'ora.gipcd' on 'rac1'
CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'
CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1'
CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac1'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac1'
CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.ctssd' on 'rac1'
CRS-2676: Start of 'ora.ctssd' on 'rac1' succeeded

DiskGroup OCR creation failed with the following message:
ORA-15018: diskgroup cannot be created
ORA-15031: disk specification 'ORCL:DISK1' matches no disks


Configuration of ASM failed, see logs for details
Did not succssfully configure and start ASM
CRS-2500: Cannot stop resource 'ora.crsd' as it is not running
CRS-4000: Command Stop failed, or completed with errors.
Command return code of 1 (256) from command: /u01/app/11.2.0/grid/bin/crsctl stop resource ora.crsd -init
Stop of resource "ora.crsd -init" failed
Failed to stop CRSD
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'rac1'
CRS-2677: Stop of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
Initial cluster configuration failed.  See /u01/app/11.2.0/grid/cfgtoollogs/crsconfig/rootcrs_rac1.log for details



[root@rac1 install]# ./rootcrs.pl -deconfig -force -verbose

---------------------------------------------------------------------------------------------------------------------------------------------------------------
Edit crsconfig_params parameter because in my case ASM_DISK_GROUP=OCR that will change to DEMO_OCR
ASM_DISKS=ORCL:DISK1 to DISK6
---------------------------------------------------------------------------------------------------------------------------------------------------------------
ASM_DISK_GROUP=DEMO_OCRL
ASM_DISKS=ORCL:DISK6


--------- FAILED AGAIN

[root@rac1 grid]# ./root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
2016-03-22 22:21:37: Parsing the host name
2016-03-22 22:21:37: Checking for super user privileges
2016-03-22 22:21:37: User has super user privileges
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting
CRS-2672: Attempting to start 'ora.gipcd' on 'rac1'
CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'
CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1'
CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac1'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac1'
CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.ctssd' on 'rac1'
CRS-2676: Start of 'ora.ctssd' on 'rac1' succeeded

Disk Group DEMO_OCR already exists. Cannot be created again

Configuration of ASM failed, see logs for details
Did not succssfully configure and start ASM
CRS-2500: Cannot stop resource 'ora.crsd' as it is not running
CRS-4000: Command Stop failed, or completed with errors.
Command return code of 1 (256) from command: /u01/app/11.2.0/grid/bin/crsctl stop resource ora.crsd -init
Stop of resource "ora.crsd -init" failed
Failed to stop CRSD
CRS-2500: Cannot stop resource 'ora.asm' as it is not running
CRS-4000: Command Stop failed, or completed with errors.
Command return code of 1 (256) from command: /u01/app/11.2.0/grid/bin/crsctl stop resource ora.asm -init
Stop of resource "ora.asm -init" failed
Failed to stop ASM
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'rac1'
CRS-2677: Stop of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
Initial cluster configuration failed.  See /u01/app/11.2.0/grid/cfgtoollogs/crsconfig/rootcrs_rac1.log for details


## Again change the parameter because ASM is not coming up and no any diskgroup find.
CRS_VOTING_DISKS=/tmp/vote/vote.dat
CRS_OCR_LOCATIONS=/tmp/ocr/ocr.dat


./root.sh
Failed again
-----------------------------------------------------------------------------------------------------------------------------------------------------------
CRS-2672: Attempting to start 'ora.ctssd' on 'rac1'
CRS-2676: Start of 'ora.ctssd' on 'rac1' succeeded

DiskGroup OCR creation failed with the following message:
ORA-15018: diskgroup cannot be created
ORA-15031: disk specification 'ORCL:DISK1' matches no disks


Configuration of ASM failed, see logs for details
Did not succssfully configure and start ASM
CRS-2500: Cannot stop resource 'ora.crsd' as it is not running
CRS-4000: Command Stop failed, or completed with errors.
Command return code of 1 (256) from command: /u01/app/11.2.0/grid/bin/crsctl stop resource ora.crsd -init
Stop of resource "ora.crsd -init" failed
Failed to stop CRSD
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'rac1'
CRS-2677: Stop of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
Initial cluster configuration failed.  See /u01/app/11.2.0/grid/cfgtoollogs/crsconfig/rootcrs_rac1.log for details



./rootcrs.pl -deconfig -force -verbose
./roothas.pl -delete -force -verbose



2016-03-23 18:41:54: Configuring ASM via ASMCA
2016-03-23 18:41:55: Executing as oracle: /u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName OCR -diskList ORCL:DISK1 -redunda
ncy EXTERNAL -configureLocalASM
2016-03-23 18:41:55: Running as user oracle: /u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName OCR -diskList ORCL:DISK1 -redu
ndancy EXTERNAL -configureLocalASM
2016-03-23 18:41:55:   Invoking "/u01/app/11.2.0/grid/bin/asmca -silent -diskGroupName OCR -diskList ORCL:DISK1 -redundancy EXTER
NAL -configureLocalASM" as user "oracle"
2016-03-23 18:45:31: Configuration of ASM failed, see logs for details
2016-03-23 18:45:31: Did not succssfully configure and start ASM
2016-03-23 18:45:31: Exiting exclusive mode
2016-03-23 18:45:32: Command return code of 1 (256) from command: /u01/app/11.2.0/grid/bin/crsctl stop resource ora.crsd -init
2016-03-23 18:45:32: Stop of resource "ora.crsd -init" failed
2016-03-23 18:45:32: Failed to stop CRSD
2016-03-23 18:46:27: Initial cluster configuration failed.  See /u01/app/11.2.0/grid/cfgtoollogs/crsconfig/rootcrs_rac1.log for details



Status: Total OCR Failure.


Reference: 

    1st Method
    2nd Method