Thursday, November 29, 2012

Renaming the DB name(Standalone)


====================================================================
In this post i would be changing the DB name of a single instance DB from TESTDB to RENAMEDB
====================================================================

-- check TESTDB is primary role and read write mode

[oracle@subhen-db01 ~]$ . oraenv
ORACLE_SID = [oracle] ? TESTDB
The Oracle base has been set to /oracle/app
[oracle@subhen-db01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Nov 30 15:57:45 2012

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
TESTDB    READ WRITE           PRIMARY

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

-- stop the database and start it in mount mode

[oracle@subhen-db01 ~]$ srvctl stop database -d TESTDB -o immediate
[oracle@subhen-db01 ~]$ srvctl start database -d TESTDB -o MOUNT
[oracle@subhen-db01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Nov 30 16:02:32 2012

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
TESTDB    MOUNTED              PRIMARY

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

-- starting with NID utility

[oracle@subhen-db01 ~]$ nid -help

DBNEWID: Release 11.2.0.3.0 - Production on Fri Nov 30 16:05:51 2012

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Keyword     Description                    (Default)
----------------------------------------------------
TARGET      Username/Password              (NONE)
DBNAME      New database name              (NONE)
LOGFILE     Output Log                     (NONE)
REVERT      Revert failed change           NO
SETNAME     Set a new database name only   NO
APPEND      Append to output log           NO
HELP        Displays these messages        NO

[oracle@subhen-db01 ~]$ nid TARGET=sys@TESTDB DBNAME=RENAMEDB

DBNEWID: Release 11.2.0.3.0 - Production on Fri Nov 30 16:07:24 2012

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Password:
Connected to database TESTDB (DBID=2584054004)

Connected to server version 11.2.0

Control Files in database:
    +DATA01/testdb/controlfile/current.827.800725877

Change database ID and database name TESTDB to RENAMEDB? (Y/[N]) => y

Proceeding with operation
Changing database ID from 2584054004 to 257482690
Changing database name from TESTDB to RENAMEDB
    Control File +DATA01/testdb/controlfile/current.827.800725877 - modified
    Datafile +DATA01/testdb/datafile/system.278.80072581 - dbid changed, wrote new name
    Datafile +DATA01/testdb/datafile/sysaux.394.80072581 - dbid changed, wrote new name
    Datafile +DATA01/testdb/datafile/undotbs1.838.80072581 - dbid changed, wrote new name
    Datafile +DATA01/testdb/datafile/users.463.80072581 - dbid changed, wrote new name
    Datafile +DATA01/testdb/tempfile/temp.555.80072589 - dbid changed, wrote new name
    Control File +DATA01/testdb/controlfile/current.827.800725877 - dbid changed, wrote new name
    Instance shut down

Database name changed to RENAMEDB.
Modify parameter file and generate a new password file before restarting.
Database ID for database RENAMEDB changed to 257482690.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

-- starting with the new database RENAMEDB and change the parameter file to include the DBname as RENAMEDB

[oracle@subhen-db01 ~]$ export ORACLE_SID=RENAMEDB
[oracle@subhen-db01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Nov 30 16:08:53 2012

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

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/app/database/11.2.0.3/dbhome_1/dbs/initRENAMEDB.ora'
SQL> exit

-- here i will create a pfile from the spfile of TESTDB(earlier database)
Disconnected
[oracle@subhen-db01 ~]$ ps -fe|grep pmon
oracle    5258   911  0 16:09 pts/2    00:00:00 grep pmon

oracle   19437     1  0 Jul24 ?        00:00:03 asm_pmon_+ASM

[oracle@subhen-db01 ~]$ . oraenv
ORACLE_SID = [RENAMEDB] ? +ASM
The Oracle base remains unchanged with value /oracle/app
[oracle@subhen-db01 ~]$ asmcmd
ASMCMD> ls
DATA01/
ASMCMD> cd *
ASMCMD> ls
ASM/
BLAINT1/
BLAINT2/
BLAOID1/
BLAOID2/
TESTDB/
ASMCMD> cd TESTDB/
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileTESTDB.ora
ASMCMD> pwd
+DATA01/TESTDB
ASMCMD> exit

[oracle@subhen-db01 ~]$ export ORACLE_SID=RENAMEDB
[oracle@subhen-db01 ~]$ export ORACLE_HOME=/oracle/app/database/11.2.0.3/dbhome_1
[oracle@subhen-db01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Nov 30 16:11:00 2012

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

Connected to an idle instance.

SQL> create pfile='/tmp/initRENAME.ora' from spfile='+DATA01/TESTDB/spfileTESTDB.ora';

File created.

SQL> exit
Disconnected
-- modify the parameters like db_name='RENAMEDB' and start the database

[oracle@subhen-db01 ~]$ vi /tmp/initRENAME.ora
[oracle@subhen-db01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Nov 30 16:14:44 2012

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

Connected to an idle instance.

SQL> startup nomount pfile='/tmp/initRENAME.ora'
ORACLE instance started.

Total System Global Area 2355015680 bytes
Fixed Size                  2230592 bytes
Variable Size             536872640 bytes
Database Buffers         1795162112 bytes
Redo Buffers               20750336 bytes
SQL> alter database mount;

Database altered.

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;

Database altered.

SQL> select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
RENAMEDB  READ WRITE           PRIMARY

note: control file and other locations still refer to the old locations

Wednesday, November 28, 2012

ODI_REPO(componentID - ODI) RCU schema creation using 11.1.1.15.0


[oracle@subhen-db09 ~]$ /oracle/source/OFM11gR1/ofm_rcu_linux_11.1.1.5.0/rcuHome/bin/rcu -silent -createRepository -databaseType ORACLE  -connectString  subhen-dbscan.espdev.aurdev.national.com.au:1621:ORCL -dbUser sys -dbRole sysdba -schemaPrefix CIS -component ODI -f < /home/oracle/password_ODI.txt

Processing command line ....
Repository Creation Utility - Checking Prerequisites
Checking Global Prerequisites







Repository Creation Utility - Checking Prerequisites
Checking Component Prerequisites
Repository Creation Utility - Creating Tablespaces
Validating and Creating Tablespaces
Repository Creation Utility - Create
Repository Create in progress.
Percent Complete: 0
Percent Complete: 0
Percent Complete: 10
Percent Complete: 10
Percent Complete: 10
Percent Complete: 50
Percent Complete: 100
Repository Creation Utility: Create - Completion Summary
Database details:
Host Name                       : subhen-dbscan.espdev.aurdev.national.com.au
Port                            : 1621
Service Name                    : ORCL
Connected As                    : sys
Prefix for (prefixable) Schema Owners : CIS
RCU Logfile                     : /oracle/app/logdir.2012-11-29_11-00/rcu.log
Component schemas created:
Component                       Status  Logfile
Master and Work Repository              Success /oracle/app/logdir.2012-11-29_11-00/odi.log

Repository Creation Utility - Create : Operation Completed
[oracle@subhen-db09 ~]$ sleep 2d

[oracle@subhen-db09 ~]$ cat /home/oracle/password_ODI.txt
<sys DB password >
Cis321
001
Cis321
D
001
WORKREP
Cis321
[oracle@subhen-db09 ~]$ sleep 2d

Tuesday, November 27, 2012

Dataguard Broker troubleshoot:Error: ORA-16664: unable to receive the result from a database

I had recently created a 2node RAC standby database from a 2 node RAC primary database .Also configured for dataguard broker , but while checking the status of the configuration through "show configuration" it was showing the errors like 

*********************************
Error stack from primary database
*********************************
[oracle@subhen-db07 ~]$ . oraenv
ORACLE_SID = [ORCL1] ? ORCL1
The Oracle base for ORACLE_HOME=/oracle/app/database/11.2.0.3/dbhome_1 is /oracle/app
[oracle@subhen-db07 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys@ORCL
Password:
Connected.
DGMGRL> show configuration

Configuration - ORCLdg

  Protection Mode: MaxAvailability
  Databases:
    ORCL  - Primary database
    ORCLB - Physical standby database
      Error: ORA-16664: unable to receive the result from a database

Fast-Start Failover: DISABLED

Configuration Status:
ERROR

DGMGRL> exit

****************************
Error stack from standby database
****************************
[oracle@standby-db07 ~]$ . oraenv
ORACLE_SID = [oracle] ? ORCLB1
The Oracle base has been set to /oracle/app
[oracle@standby-db07 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys@ORCLB
Password:
Connected.
DGMGRL> show configuration

Configuration - ORCLdg

  Protection Mode: MaxAvailability
  Databases:
    ORCL  - Primary database
    ORCLB - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
ORA-01017: invalid username/password; logon denied
ORA-16625: cannot reach database "ORCL"
DGM-17017: unable to determine configuration status

****************************
Solution for the above errors
*************************
Copy the password file from one of the primary instance hosts to other standby sites( note: don't create password files at standby host using ORAPW utility)
*****************************************************
After copying the password file from primary over to standby host
***************************************************
[oracle@subhen-db07 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys@ORCL
Password:
Connected.
DGMGRL> show configuration

Configuration - orcldg

  Protection Mode: MaxAvailability
  Databases:
    ORCL  - Primary database
    ORCLB - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS


Friday, November 23, 2012

GOLDEN GATE configuration from schema to schema replication within the same database


Here i am going to show how to replicate schema1 to schema2 using ORACLE goldengate only DML replication.(in the same database)

Prerequisites: Oracle Goledengate software is assumed to be installed
               Manager process started(if not check the bottom of post how to start manager process)
               TNS entries are there for ASM and database (if not check the bottom of post)
               supplemental logging is enabled at database level(if not check the bottom of post)
source schema: SCHEMA1
destination schema: SCHEMA2
HOST NAME:subhendb01
DATABASE NAME:ORCL

-- create golden_data tablespace
create tablespace ggate_data datafile size 100m autoextend on;
-- create golden gate user i.e. ggate_schema1
create user ggate_schema1 identified by <pwd>
temporary tablespace TEMP
default tablespace ggate_data
quota unlimited on ggate_data;

grant CREATE SESSION to ggate_schema1;
grant ALTER SESSION to ggate_schema1;
grant RESOURCE to ggate_schema1;
grant SELECT ANY DICTIONARY to ggate_schema1;
grant EXECUTE on DBMS_FLASHBACK to ggate_schema1;


--Encrypt passwords for GGate user and ASM user for extract parameter file

--Create encrypted password for user ggate_schema1

GGSCI (subhendb01.***.***.****.***) 39> encrypt password <pwd>
No key specified, using default key...

Encrypted password:  AACAAAAAAAAAAAJABDJBJFYAFAVBTEYGXFLIVHDDGANENIWA
--- Use it for the USERID line in the parameter file

Create encrypted password for ASM user

GGSCI (subhendb01.***.***.****.***) 15> encrypt password <pwd>

No key specified, using default key...

Encrypted password:  AACAAAAAAAAAAAJAIEJANCHETDCCSJLCUCUEPFYGGJBFJGIH

--- Use it for the TRANLOGOPTIONS ASMUSER line in the parameter file


--Configure 'continuous' EXTRACT group

[oracle@subhendb01 11.1_11g]$ . oraenv
ORACLE_SID = [oracle] ? ORCL_1
The Oracle base for ORACLE_HOME=/oracle/app/database/11.2.0.3/dbhome_1 is /oracle/app
[oracle@subhendb01 11.1_11g]$ ./ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.0.0 Build 078
Linux, x64, 64bit (optimized), Oracle 11 on Jul 28 2010 13:13:42

Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved.



GGSCI (subhendb01.***.***.****.***) 1>ADD EXTRACT EXT_schema1, TRANLOG, THREADS 3, BEGIN NOW

GGSCI (subhendb01.***.***.****.***) 2>ADD EXTTRAIL ./dirdat/ep, EXTRACT EXT_schema1

GGSCI (subhendb01.***.***.****.***) 3> edit params EXT_SCHEMA1

...............
EXTRACT EXT_schema1
SETENV (ORACLE_HOME = "/oracle/app/database/11.2.0.3/dbhome_1")
SETENV (ORACLE_SID = "ORCL_1")
USERID ggate_schema1, PASSWORD AACAAAAAAAAAAAJABDJBJFYAFAVBTEYGXFLIVHDDGANENIWA, &
ENCRYPTKEY DEFAULT
TRANLOGOPTIONS ASMUSER sys@+ASM, ASMPASSWORD AACAAAAAAAAAAAHAWAEJQDPACDHGNHSE, &
ENCRYPTKEY DEFAULT
TRANLOGOPTIONS PURGEORPHANEDTRANSACTIONS
DISCARDFILE ./discard/ext_schema1_discard.dsc, append, megabytes 10
GETUPDATEBEFORES
NOCOMPRESSDELETES
RMTHOST subhendb01, mgrport 7840
rmttrail ./dirdat/ep
table NWHADS_schema1.*;


--For replication schema NWHADS_schema2
--Create GGATE_DATA tablespace and  ggate_rep_schema2 user, if not exists

create user ggate_rep_schema2 identified by <pwd>
temporary tablespace TEMP
default tablespace ggate_data
quota unlimited on ggate_data;

grant CREATE SESSION to ggate_rep_schema2;
grant ALTER SESSION to ggate_rep_schema2;
grant RESOURCE to ggate_rep_schema2;
grant SELECT ANY DICTIONARY to ggate_rep_schema2;
grant EXECUTE on DBMS_FLASHBACK to ggate_rep_schema2;


--Create a checkpoint table, if not already exists

-- Create global parameter file with the table name

GGSCI (subhendb01.***.***.****.***) 3> edit params ./GLOBALS
……
CHECKPOINTTABLE ggate_schema1.cp_table
CHECKPOINTTABLE ggate_rep_schema2.cp_table
…..

GGSCI (subhendb01.***.***.****.***) 4>DBLOGIN USERID ggate_schema1, PASSWORD <pwd>
GGSCI (subhendb01.***.***.****.***) 4>ADD CHECKPOINTTABLE ggate_schema1.cp_table

… Successfully created checkpoint table ggate_schema1.cp_table.

GGSCI (subhendb01.***.***.****.***) 4>DBLOGIN USERID ggate_rep_schema2, PASSWORD <pwd>
GGSCI (subhendb01.***.***.****.***) 4>ADD CHECKPOINTTABLE ggate_rep_schema2.cp_table


… Successfully created checkpoint table ggate_rep_schema2.cp_table.


--Create the replicated schema tablespace and owner

grant CREATE SESSION to NWHADS_schema2;
grant DEBUG CONNECT SESSION to NWHADS_schema2;
grant CREATE TABLE to NWHADS_schema2;
grant CREATE VIEW to NWHADS_schema2;
grant CREATE SYNONYM to NWHADS_schema2;
grant CREATE SEQUENCE to NWHADS_schema2;
grant CREATE TRIGGER to NWHADS_schema2;
grant CREATE TYPE to NWHADS_schema2;
grant CREATE PROCEDURE to NWHADS_schema2;
grant CREATE LIBRARY to NWHADS_schema2;
grant CREATE DATABASE LINK to NWHADS_schema2;



--Configure 'continuous' REPLICAT group

--GGSCI (subhendb01.***.***.****.***) 1> ADD REPLICAT REP_schema2, EXTTRAIL ./dirdat/ep, BEGIN NOW
edit params REP_schema2
……………………………………
REPLICAT REP_schema2
SETENV (ORACLE_HOME = "/oracle/app/database/11.2.0.3/dbhome_1")
SETENV (ORACLE_SID = "ORCL_1")
USERID ggate_rep_schema2, PASSWORD AACAAAAAAAAAAAJABDJBJFYAFAVBTEYGXFLIVHDDGANENIWA, &
ENCRYPTKEY DEFAULT
ASSUMETARGETDEFS
EXTTRAIL ./dirdat/ep
DBOPTIONS  DEFERREFCONST
INSERTALLRECORDS
GETUPDATEBEFORES
REPERROR (DEFAULT, ABEND)
DDLERROR DEFAULT IGNORE
discardfile ./discard/rep_schema1_discard.dsc, append, megabytes 10
map NWHADS_schema1.*, target NWHADS_schema2.*;
………………………


GGSCI (subhendb01.***.***.****.***) 4> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     EXT_SCHEMA1    00:00:00      00:00:03
REPLICAT    RUNNING     REP_SCHEMA2    00:00:00      00:00:08


=========================
start of manager process
==========================

--  Check ports are free, e.g.:

netstat -a|grep " 78[4-7][0-9] "

./ggsci

EDIT PARAMS MGR    

PORT 7840
DYNAMICPORTLIST 7841-7870
AUTOSTART EXTRACT *
AUTOSTART REPLICAT *
AUTORESTART EXTRACT *
AUTORESTART REPLICAT *
PURGEOLDEXTRACTS ./DIRDAT/*, USECHECKPOINTS, MINKEEPDAYS 5

--save and exit

-- Test MGR restart

 START MGR
 STOP MGR
 START MGR
……………………………………
Manager started.

==================================
Configuration of tnsnames.ora file
==================================

The ASM service entry must be present in tnsnames.ora in the DB Oracle home:
………………………………………
+ASM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = subhendb01v.***.***.****.***)(PORT = 1621))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = +ASM)
    )
  ) ………………………………………
Verify TNS connectivity

sqlplus sys/<pwd>@+ASM as sysdba

The source database service entry must be present in tnsnames.ora in the DB Oracle home:
………………………………………
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = subhendbscan.***.***.****.***)(PORT = 1621))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL)
    )
  ) ………………………………………….

Verify TNS connectivity

sqlplus sys/<pwd>@ORCL as sysdba

=============================================
ENABLE SUPPLEMENTAL LOGGING AT DATABASE LEVEL
=============================================


As sys or system : enable minimal supplemental logging at the database level. This is
required to process updates to primary keys and chained rows.

--- Check status

SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM GV$DATABASE;

SUPPLEME
--------
NO
NO
NO

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

Database altered.

--- To start the supplemental logging, switch the log files on all instances

SQL> alter system archive log current;

System altered.

--- Verify

SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM GV$DATABASE;

SUPPLEME
--------
YES
YES
YES


Tuesday, November 6, 2012

Recreating the failed diskgroup with the same name



*************************
Not able to drop diskgroup
**************************

[oracle@subdb01 ~]$ asmcmd umount FRA
ORA-15032: not all alterations performed
ORA-15001: diskgroup "FRA" does not exist or is not mounted (DBD ERROR: OCIStmtExecute)
[oracle@subdb01 ~]$ asmcmd dropdg -f -r FRA
ORA-15039: diskgroup not dropped
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "FRA" (DBD ERROR: OCIStmtExecute)

****************************
ERROR description
**************************

Our disk headers were overwritten by mistake so it was complaining about duplicate paths

SQL> CREATE DISKGROUP FRA EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/DISK01' ,
'/dev/oracleasm/disks/DISK02' , '/dev/oracleasm/disks/DISK03'
NOTE: Assigning number (5,0) to disk (/dev/oracleasm/disks/DISK01)
NOTE: Assigning number (5,1) to disk (/dev/oracleasm/disks/DISK02)
NOTE: Assigning number (5,2) to disk (/dev/oracleasm/disks/DISK03)
WARNING: detected duplicate paths to the same disk:
'/dev/oracleasm/disks/DISK06' and
'/dev/oracleasm/disks/DISK02'
More trace information dumped to '/oracle/app/diag/asm/+asm/+ASM1/trace/+ASM1_ora_8000.trc'
WARNING: detected duplicate paths to the same disk:
'/dev/oracleasm/disks/DISK09' and
'/dev/oracleasm/disks/DISK05'
More trace information dumped to '/oracle/app/diag/asm/+asm/+ASM1/trace/+ASM1_ora_8000.trc'
WARNING: detected duplicate paths to the same disk:
'/dev/oracleasm/disks/DISK07' and
'/dev/oracleasm/disks/DISK03'
More trace information dumped to '/oracle/app/diag/asm/+asm/+ASM1/trace/+ASM1_ora_8000.trc'
WARNING: detected duplicate paths to the same disk:
'/dev/oracleasm/disks/DISK08' and
'/dev/oracleasm/disks/DISK04'
More trace information dumped to '/oracle/app/diag/asm/+asm/+ASM1/trace/+ASM1_ora_8000.trc'
NOTE: erasing header on grp 5 disk FRA_0000
Thu Oct 25 21:51:04 2012
GMON dismounting group 5 at 422 for pid 51, osid 8000
NOTE: Disk in mode 0x8 marked for de-assignment
NOTE: Disk in mode 0x8 marked for de-assignment
NOTE: Disk in mode 0x8 marked for de-assignment
ERROR: diskgroup FRA was not created
ORA-15018: diskgroup cannot be created
ORA-15020: discovered duplicate ASM disk "FRA_0005"
ERROR: CREATE DISKGROUP FRA EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/DISK01' ,
'/dev/oracleasm/disks/DISK02' , '/dev/oracleasm/disks/DISK03'

*************************************
Creating disk group with force option
*************************************
So as above disk 2,3,4,5 was showing overwritten with duplicate information

so to relebel them in ASMLIB please follow the below steps


Action Plan
---------------------
1. Relable the affected devices using the following command.

# /etc/init.d/oracleasm force-renamedisk /dev/oracleasm/disks/DISK02 DISK02
# /etc/init.d/oracleasm force-renamedisk /dev/oracleasm/disks/DISK03 DISK03
# /etc/init.d/oracleasm force-renamedisk /dev/oracleasm/disks/DISK04 DISK04
# /etc/init.d/oracleasm force-renamedisk /dev/oracleasm/disks/DISK05 DISK05

2. And run scandisks command from all nodes.


# /etc/init.d/oracleasm scandisks

3. Create DUMMY diskgroup with all 9 devices belonged to FRA diskgroup in the following way.

SQL> CREATE DISKGROUP DUMMY EXTERNAL REDUNDANCY DISK
'/dev/oracleasm/disks/DISK01' ,
'/dev/oracleasm/disks/DISK02' force,
'/dev/oracleasm/disks/DISK03' force,
'/dev/oracleasm/disks/DISK04' force,
'/dev/oracleasm/disks/DISK05' force,
'/dev/oracleasm/disks/DISK06' force,
'/dev/oracleasm/disks/DISK07' force,
'/dev/oracleasm/disks/DISK08' force,
'/dev/oracleasm/disks/DISK09' force;

4. Once DUMMY diskgroup can be created properly, drop it.
SQL> drop diskgroup DUMMY including contents;

5. And then recreate FRA with the following command.
SQL> CREATE DISKGROUP FRA EXTERNAL REDUNDANCY DISK
'/dev/oracleasm/disks/DISK01' ,
'/dev/oracleasm/disks/DISK02' ,
'/dev/oracleasm/disks/DISK03' ,
'/dev/oracleasm/disks/DISK04' ,
'/dev/oracleasm/disks/DISK05' ,
'/dev/oracleasm/disks/DISK06' ,
'/dev/oracleasm/disks/DISK07' ,
'/dev/oracleasm/disks/DISK08' ,
'/dev/oracleasm/disks/DISK09' ;

Creating a spfile from memory and starting the DB with the new spfile



Currently we had a situation where the database was showing started with spfile but the spfile physically was not there present at ASM location

i.e. show parameter pfile --- shows DB started with spfile but the same ASM file doesn't exist at its location.


SQL> show parameter pfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/devnwwfw/spfiledevnwwfw.ora                                        



Current configuration of database

[oracle@subdb02 ~]$ srvctl config database -d DEVNWWFW
Database unique name: DEVNWWFW
Database name: DEVNWWFW
Oracle home: /oracle/app/database/11.2.0.3/dbhome_1
Oracle user: oracle
Spfile: +DATA/DEVNWWFW/spfileDEVNWWFW.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: KXD2BUPOOL
Database instances:
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC

Database is policy managed

No SPFILE found

ASMCMD> cd +DATA/DEVNWWFW
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
TEMPFILE/
ASMCMD> pwd
+DATA/DEVNWWFW
ASMCMD> exit



This was a part of 4 node cluster and when one node crashed and it denied to come up then this issue was noticed

Solution:

Step1(create a pfile from memory):

From a different node(instance) which is up please create a pfile;


SQL> create pfile='/tmp/DEVNWWFW.ora' from spfile='+DATA/devnwwfw/spfiledevnwwfw.ora';
create pfile='/tmp/DEVNWWFW.ora' from spfile='+DATA/devnwwfw/spfiledevnwwfw.ora'
*
ERROR at line 1:
ORA-01565: error in identifying file '+DATA/devnwwfw/spfiledevnwwfw.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATA/devnwwfw/spfiledevnwwfw.ora
ORA-15173: entry 'spfiledevnwwfw.ora' does not exist in directory 'devnwwfw'


SQL> create pfile='/tmp/DEVNWWFW.ora' from memory;

File created.

Step 2(create a new spfile with different name):

Create a new spfile with different name as it is not allowing us to create with same one as per the error above


[oracle@subdb02 ~]$ echo $ORACLE_SID
DEVNWWFW_2
[oracle@subdb02 ~]$ srvctl stop database -d DEVNWWFW -o immediate
[oracle@subdb02 ~]$ echo $ORACLE_SID
DEVNWWFW_2
[oracle@subdb02 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 31 18:12:03 2012

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

Connected to an idle instance.

SQL> create spfile='+DATA/devnwwfw/spfiledevnwwfw1.ora' from pfile='/tmp/DEVNWWFW_new.ora';

File created.



Step3( using srvctl modify the database to start with new spfile):


[oracle@subdb02 ~]$ srvctl modify database -d DEVNWWFW -p +DATA/devnwwfw/spfiledevnwwfw1.ora
[oracle@subdb02 ~]$  srvctl config database -d DEVNWWFW
Database unique name: DEVNWWFW
Database name: DEVNWWFW
Oracle home: /oracle/app/database/11.2.0.3/dbhome_1
Oracle user: oracle
Spfile: +DATA/devnwwfw/spfiledevnwwfw1.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: KXD2BUPOOL
Database instances:
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Database is policy managed

Step4(start the database with new spfile):


[oracle@subdb02 ~]$ srvctl start database -d DEVNWWFW
[oracle@subdb02 ~]$  srvctl status database -d DEVNWWFW
Instance DEVNWWFW_1 is running on node subdb01
Instance DEVNWWFW_2 is running on node subdb02
Instance DEVNWWFW_3 is running on node subdb03

step5(check if it started with new spfile and the ASM location also):


SQL> show parameter pfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/devnwwfw/spfiledevnwwfw1.ora                                          


ASMCMD> cd +DATA/devnwwfw/
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
TEMPFILE/
spfiledevnwwfw1.ora








Sunday, November 4, 2012

Adding 4th node in 3 node RAC cluster


We had a 3 node existing cluster , here i am going to add a 4th node to it , to increase its capacity....
Here are the steps followed for the activity

[oracle@subdb01 bin]$export IGNORE_PREADDNODE_CHECKS=Y

[oracle@subdb01 bin]$ ./addNode.sh -silent "CLUSTER_NEW_NODES={subdb04}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={subdb04v}"
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 1895 MB    Passed
Oracle Universal Installer, Version 11.2.0.3.0 Production
Copyright (C) 1999, 2011, Oracle. All rights reserved.


Performing tests to see whether nodes subdb02,subdb03,subdb04 are available
............................................................... 100% Done.

.
-----------------------------------------------------------------------------
Cluster Node Addition Summary
Global Settings
   Source: /oracle/grid/11.2.0.3
   New Nodes
Space Requirements
   New Nodes
      subdb04
         /oracle: Required 11.62GB : Available 77.68GB
Installed Products
   Product Names
      Oracle Grid Infrastructure 11.2.0.3.0
      Sun JDK 1.5.0.30.03
      Installer SDK Component 11.2.0.3.0
      Oracle One-Off Patch Installer 11.2.0.1.7
      Oracle Universal Installer 11.2.0.3.0
      Oracle USM Deconfiguration 11.2.0.3.0
      Oracle Configuration Manager Deconfiguration 10.3.1.0.0
      Enterprise Manager Common Core Files 10.2.0.4.4
      Oracle DBCA Deconfiguration 11.2.0.3.0
      Oracle RAC Deconfiguration 11.2.0.3.0
      Oracle Quality of Service Management (Server) 11.2.0.3.0
      Installation Plugin Files 11.2.0.3.0
      Universal Storage Manager Files 11.2.0.3.0
      Oracle Text Required Support Files 11.2.0.3.0
      Automatic Storage Management Assistant 11.2.0.3.0
      Oracle Database 11g Multimedia Files 11.2.0.3.0
      Oracle Multimedia Java Advanced Imaging 11.2.0.3.0
      Oracle Globalization Support 11.2.0.3.0
      Oracle Multimedia Locator RDBMS Files 11.2.0.3.0
      Oracle Core Required Support Files 11.2.0.3.0
      Bali Share 1.1.18.0.0
      Oracle Database Deconfiguration 11.2.0.3.0
      Oracle Quality of Service Management (Client) 11.2.0.3.0
      Expat libraries 2.0.1.0.1
      Oracle Containers for Java 11.2.0.3.0
      Perl Modules 5.10.0.0.1
      Secure Socket Layer 11.2.0.3.0
      Oracle JDBC/OCI Instant Client 11.2.0.3.0
      Oracle Multimedia Client Option 11.2.0.3.0
      LDAP Required Support Files 11.2.0.3.0
      Character Set Migration Utility 11.2.0.3.0
      Perl Interpreter 5.10.0.0.2
      PL/SQL Embedded Gateway 11.2.0.3.0
      OLAP SQL Scripts 11.2.0.3.0
      Database SQL Scripts 11.2.0.3.0
      Oracle Extended Windowing Toolkit 3.4.47.0.0
      SSL Required Support Files for InstantClient 11.2.0.3.0
      SQL*Plus Files for Instant Client 11.2.0.3.0
      Oracle Net Required Support Files 11.2.0.3.0
      Oracle Database User Interface 2.2.13.0.0
      RDBMS Required Support Files for Instant Client 11.2.0.3.0
      RDBMS Required Support Files Runtime 11.2.0.3.0
      XML Parser for Java 11.2.0.3.0
      Oracle Security Developer Tools 11.2.0.3.0
      Oracle Wallet Manager 11.2.0.3.0
      Enterprise Manager plugin Common Files 11.2.0.3.0
      Platform Required Support Files 11.2.0.3.0
      Oracle JFC Extended Windowing Toolkit 4.2.36.0.0
      RDBMS Required Support Files 11.2.0.3.0
      Oracle Ice Browser 5.2.3.6.0
      Oracle Help For Java 4.2.9.0.0
      Enterprise Manager Common Files 10.2.0.4.3
      Deinstallation Tool 11.2.0.3.0
      Oracle Java Client 11.2.0.3.0
      Cluster Verification Utility Files 11.2.0.3.0
      Oracle Notification Service (eONS) 11.2.0.3.0
      Oracle LDAP administration 11.2.0.3.0
      Cluster Verification Utility Common Files 11.2.0.3.0
      Oracle Clusterware RDBMS Files 11.2.0.3.0
      Oracle Locale Builder 11.2.0.3.0
      Oracle Globalization Support 11.2.0.3.0
      Buildtools Common Files 11.2.0.3.0
      Oracle RAC Required Support Files-HAS 11.2.0.3.0
      SQL*Plus Required Support Files 11.2.0.3.0
      XDK Required Support Files 11.2.0.3.0
      Agent Required Support Files 10.2.0.4.3
      Parser Generator Required Support Files 11.2.0.3.0
      Precompiler Required Support Files 11.2.0.3.0
      Installation Common Files 11.2.0.3.0
      Required Support Files 11.2.0.3.0
      Oracle JDBC/THIN Interfaces 11.2.0.3.0
      Oracle Multimedia Locator 11.2.0.3.0
      Oracle Multimedia 11.2.0.3.0
      HAS Common Files 11.2.0.3.0
      Assistant Common Files 11.2.0.3.0
      PL/SQL 11.2.0.3.0
      HAS Files for DB 11.2.0.3.0
      Oracle Recovery Manager 11.2.0.3.0
      Oracle Database Utilities 11.2.0.3.0
      Oracle Notification Service 11.2.0.3.0
      SQL*Plus 11.2.0.3.0
      Oracle Netca Client 11.2.0.3.0
      Oracle Net 11.2.0.3.0
      Oracle JVM 11.2.0.3.0
      Oracle Internet Directory Client 11.2.0.3.0
      Oracle Net Listener 11.2.0.3.0
      Cluster Ready Services Files 11.2.0.3.0
      Oracle Database 11g 11.2.0.3.0
-----------------------------------------------------------------------------


Instantiating scripts for add node (Tuesday, October 23, 2012 2:12:36 PM EST)
.                                                                 1% Done.
Instantiation of add node scripts complete

Copying to remote nodes (Tuesday, October 23, 2012 2:12:38 PM EST)
...............................................................................................                                 96% Done.
Home copied to new nodes

Saving inventory on nodes (Tuesday, October 23, 2012 2:50:24 PM EST)
.                                                               100% Done.
Save inventory complete
WARNING:
The following configuration scripts need to be executed as the "root" user in each new cluster node. Each script in the list below is followed by a list of nodes.
/oracle/grid/11.2.0.3/root.sh #On nodes subdb04
To execute the configuration scripts:
    1. Open a terminal window
    2. Log in as "root"
    3. Run the scripts in each cluster node

The Cluster Node Addition of /oracle/grid/11.2.0.3 was successful.
Please check '/tmp/silentInstall.log' for more details.

====================================================================
Incase there was something wrong went and you want to clear up the things then please follow the steps below
====================================================================


http://docs.oracle.com/cd/E14072_01/rac.112/e10717/adddelclusterware.htm#BEIFDCAF

1) ensure grid home is set in both node1 and node 4

on node1
==========
[oracle@subdb01 bin]$ . oraenv
ORACLE_SID = [STGEXT_1] ? +ASM1
The Oracle base for ORACLE_HOME=/oracle/grid/11.2.0.3 is /oracle/app
[oracle@subdb01 bin]$ echo $ORACLE_HOME
/oracle/grid/11.2.0.3



on node4
===========
export ORACLE_HOME=/oracle/grid/11.2.0.3

2)

3)from 4th node

/oracle/grid/11.2.0.3/crs/install/rootcrs.pl -deconfig -force

4) from 1st node

   crsctl delete node -n subdb04

5) from 4th node
./runInstaller -updateNodeList ORACLE_HOME=/oracle/grid/11.2.0.3 "CLUSTER_NODES={subdb04}" CRS=TRUE -local

6) on 4th node <manually clear up grid_home>
    cd /oracle/grid/11.2.0.3

     rm -rf $GRID_HOME instead of deinstall util and retry addnode.sh again

7) on first node

./runInstaller -updateNodeList ORACLE_HOME=/oracle/grid/11.2.0.3 "CLUSTER_NODES={subdb01,subdb02,subdb03}" CRS=TRUE


==============================
Root.sh script execution  on node 4
==============================
We had some issues in root.sh script execution reason was because ACL was enabled.(Note: for ACL you can find a + sign in the file system and we asked our UNIX admin to disable it). We had some other issues also for ASM was not coming up , by the mean time we in process of fixing it.



[root@subdb04 subdb04]# /oracle/grid/11.2.0.3/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/grid/11.2.0.3

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

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 script.
Now product-specific root actions will be performed.
Using configuration parameter file: /oracle/grid/11.2.0.3/crs/install/crsconfig_params
User ignored Prerequisites during installation
OLR initialization - successful
Adding Clusterware entries to inittab
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node subdb01, number 1, and is terminating
An active cluster was found during exclusive startup, restarting to join the cluster
Start of resource "ora.asm" failed
CRS-2672: Attempting to start 'ora.asm' on 'subdb04'
CRS-5017: The resource action "ora.asm start" encountered the following error:
ORA-29702: error occurred in Cluster Group Service operation
. For details refer to "(:CLSN00107:)" in "/oracle/grid/11.2.0.3/log/subdb04/agent/ohasd/oraagent_oracle/oraagent_oracle.log".
CRS-2674: Start of 'ora.asm' on 'subdb04' failed
CRS-2679: Attempting to clean 'ora.asm' on 'subdb04'
CRS-2681: Clean of 'ora.asm' on 'subdb04' succeeded
CRS-4000: Command Start failed, or completed with errors.
Failed to start Oracle Grid Infrastructure stack
Failed to start ASM at /oracle/grid/11.2.0.3/crs/install/crsconfig_lib.pm line 1272.
/oracle/grid/11.2.0.3/perl/bin/perl -I/oracle/grid/11.2.0.3/perl/lib -I/oracle/grid/11.2.0.3/crs/install /oracle/grid/11.2.0.3/crs/install/rootcrs.pl execution failed