ocfs2console: o2cb_ctl: Unable to access cluster service while creating node

For the first time, during configuring the nodes, ocfs2console fails with message:
“o2cb_ctl: Unable to access cluster service while creating node”
TODO:
– Quit ocfs2console
– Stop the service
– Remove file /etc/ocfs2/cluster.conf
– Restart ocfs2console
– Configure the nodes again

[root@rac1 ~]#  /etc/init.d/ocfs2 stop
Stopping Oracle Cluster File System (OCFS2) [ OK ]

[root@rac1 ~]# /etc/init.d/o2cb offline ocfs2

[root@rac1 ~]# /etc/init.d/o2cb unload
Unmounting ocfs2_dlmfs filesystem: OK
Unloading module "ocfs2_dlmfs": OK
Unmounting configfs filesystem: OK
Unloading module "configfs": OK

[root@rac1 ~]# rm -f /etc/ocfs2/cluster.conf
[root@rac1 ~]# /usr/sbin/ocfs2console &

RAC TO SINGLE NODE STEPS

Take RMAN backup of the production RAC database

1-
RMAN> run{
allocate channel c1 type disk format ‘/tmp/%U’;
backup database;
backup archivelog all;

backup controlfile ;
}

2-Create Pfile from RAC for single Node Using SQLPLUS :
 SQL>create pfile ” from spfile ;

3-Open pfile that you create it and modify the following parameters manually:
%dest, control_files
log_archive_dest_1
cluster_database_instances

4-Use the pfile created above to STARTUP NOMOUNT the database on the new host
$ sqlplus / as sysdba
SQL> startup nomount;

5-rman target /
A-restore controlfile from ‘/tmp/’;
OR
  restore controlfile from ‘/media/moh_1509/MEPSLIVE_20110919_762231895_3885.ctl’




B-ALTER DATABASE MOUNT ;
C.catalog backuppiece  ‘.bkp’ repeat it for all of backupset .
D.catalog backuppiece  ‘.arch’ repeat it for all of ARCHIVELOG.

E.
run
{
set newname for datafile 1 to ”;
set newname for datafile 2 to  ”;
set newname for datafile 3 to ”;
set newname for datafile 4 to  ”;
set newname for datafile 5 to  ”;
set newname for datafile 6 to  ”;
     restore database;
     switch datafile all;
}

NOTE : datafile number must be taken from the production system .

F.
sqlplus / as sysdba

alter database rename file ” to ”;
alter database rename file ” to ”;
alter database rename file ” to ”;

G.
alter database clear logfile group 1;
alter database clear logfile group 2;
alter database clear logfile group 3;

Then Delete unnecessary Redolog .

6.RMAN TARGET /
RMAN>RECOVER DATABASE ;

7.SQL> alter database open resetlogs;

If open database fail with error ORA-38856
then, Set the following parameter in the init.ora file:

_no_recovery_through_resetlogs=TRUE

8. 
SQL> select THREAD#, STATUS, ENABLED 2 from v$thread;

SQL> select group# from v$log where THREAD#=2;
SQL> alter database disable thread 2;

9.DROP REDO LOG FROM NEW SINGLE NODE BY :
 SQL> alter database clear unarchived logfile group ;  
SQL>alter database drop logfile group ;

After doing this you can remove undo tablespace for other instance 

10.To Remove it :
 SQL> show parameter undo;
SQL> select tablespace_name from dba_tablespaces where contents=’UNDO’;
SQL> drop tablespace UNDOTBS2 including contents and datafiles; 

Now you have single node instance 🙂

Thank you
Osama Mustafa

Change Listener Port For Oracle RAC

I think its useful to document this since maybe i will need it too 🙂

Environment

2 Node , Linux  …..

RAC database name: ORCL
Node 1 vip: myhost1-vip
Node 2 vip: myhost2-vip
Instance 1: ORCL1
Instance 2: ORCL2
Version: 11.1.0.7
New port: 1522

STEPS :

1) First, use netca to adjust the the listener port from 1521 to 1522. It’s a good idea to use netca to do this cluster-wide and keep the OCR in check.  
NOTE: This will shutdown the listeners across both nodes.

2)

2) In the tnsnames.ora for ASM and RDBMS, ensure the following entry exists (they’ll probably be there but with the 1521 port, so adjust accordingly):

LISTENERS_ORCL=
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost1-vip)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost2-vip)(PORT = 1522))
)

LISTENER_ORCL2=
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost2-vip)(PORT = 1522))

LISTENER_ORCL1=
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost1-vip)(PORT = 1522))

3)
Connect to each instance and set the local_listener to parameter to either LISTENER_MYRACDB1 or 2 depending on the instance you connect to. Ensure you do this so it applies to the instance you are connected to only, and does not apply globally.

e.g. if connected to ORCL1

alter system set local_listener=’LISTENER_ORCL1′ sid=’ORCL1′;

4) Set the remote_listener parameter to LISTENERS_MYRACDB across all instances

e.g. alter system set remote_listener=’LISTENERS_ORCL’;

5) Repeat the above for both ASM instances

6) You should be able to start the listener on each node now.

e.g. srvctl start listener -n myhost1 

Thank you

Note :

On Single node instance all you need to do is
1-stop the listener
lsnrctl stop

2-Go to $ORACLE_HOME/network/admin/listener.ora
modified the port for new one .

3-start the listener
lsnrctl start

DONE

Osama mustafa
Oracle Database consultant

Create Enterprise manager for RAC (Real Application Cluster)

Hi All ,

Sometimes we need to create enterprise manager for Rac Environment , its the same way for One instance with different Command . 

We are here talk about 10g , 11g database .
you follow the below steps to create or recreate enterprise manager LET’S START :

if you already have RAC – enterprise manager and you need to recreate then start from here

**Stop Dbconsole for the both nodes :

Commands :

On Node-1
emctl stop dbconsole .
On Node 2 :
emctl stop dbconsole .

**Drop dbconsole with re posterity from node 1 :

Command :

$emca -deconfig dbcontrol db -repos drop -cluster

“you will wait for while until repos been dropped”.

**recreate dbconsole with re posterity from node 1 “if you don’t have EM for your Rac start from here”
Command :

$emca -config dbcontrol db -repos create -cluster 

“follow the instsruction and fill the information such as DB SID,Listener Port , Crs Name”

To know your CRS NAME :
$CRS_HOME/bin/cemutlo -n

the output will be your crs name .

Thank you
Osama mustafa 

crsctl start crs does not work in 10gR2

How to start crs in oracle 10g , its simple first we need to check if its really exists or not :

1-./crsctl start crs

Attempting to start CRS stack
The CRS stack will be started shortly

2- ./crsctl check crs

Failure 1 contacting CSS daemon
Cannot communicate with CRS
Cannot communicate with EVM

3- ./srvctl status nodeapps -n

PRKH-1010 : Unable to communicate with CRS services.
[Communications Error(Native: prsr_initCLSS:[3])]


4- ./srvctl start nodeapps -n

PRKH-1010 : Unable to communicate with CRS services.
[Communications Error(Native: prsr_initCLSS:[3])]

5- ./srvctl status nodeapps -n

PRKH-1010 : Unable to communicate with CRS services.
[Communications Error(Native: prsr_initCLSS:[3])]

6- ./crsctl check crs

Failure 1 contacting CSS daemon
Cannot communicate with CRS
Cannot communicate with EVM

--------------------------------------------------------------
if you see the crs is still not working (start) so what is the solution if "srvctl" not working .

What can i do ????
its so simple just one command to fix this issue :

./crsctl start resources

Steps To Shutdown/Start Oracle RAC

Hi Again

I will mention steps to shutdown Oracle Real Application Cluster First :
You need to shutdown all the services like the following :

On Linux :
**Change to $ORACLE_HOME/crs/bin

shutdown emctl stop dbconsole .

1- ./srvctl stop database -d .

To check database name :

select DB_name from v$database ;

2-./srvctl stop asm -n

To check node name :
Hostname on terminal .

3-./srvctl stop nodeapps

4-./crsctl stop -all

these steps to stop RAC services on linux :

Windows :

** change to $ORACLE_HOME/crs/bin
1-srvctl.exe stop database -d
2-srvctl.exe stop asm -n
3-srvctl stop nodeapps
4-crsctl.exe stop -all .

Startup RAC services :

1-./srvctl start nodeapps
2-./srvctl start asm -n .
3-./srvctl start database -a .
4-./crsctl start -all .

emctl start dbconsole .

windows the same but without “./” just srvctl.exe

Check Rac Status

hi All Again ,

As Oracle Database administrator its your job to check rac status on your server, i know its little creepy when we heard about RAC,DG but its all about the command and how , when to use it ? !!!

Sure you need to be careful when you are using commands such as “crs , Srvtl” and stuff like that .

I will make it easy for you save this command in the notepad (you can find in the end of this article)
so everytime you need to check RAC status and you need to do is choose your command :

Let start

*To check RAC STATUS ON OS :
Use :
crs_stat -t

*Check Node Availability :
Status nodeapps -n

*Check your ASM :
srvctl status asm -n

ok but i need to check database status how ?
*for Database status :
srvctl status database -d esxrac

And what about service for this database is it work fineeeeee :
* Database Services :
srvctl status service -d esxrac

And Finally
* Cluster Status :
crsctl check crs

As we see its all about command if you how to use it RAC will be easy otherwise don’t use it if you don’t know anything about it because it maybe destroy everything . BE CAREFUL

Where you Go its not the end , i need to check RAC inside the Database (SQL) :
lets Begin 🙂

I need to check Rac Instance if it works fine in normal database we use v$instance
here in rac just add gv$instance .
** select instance_name, host_name, archiver, thread#, status
from gv$instance ;

What About datafiles :
**select file_name, bytes/1024/1024 from dba_data_files ;

Getting the status of all the groups, type, membership :
**select group#, type, member, is_recovery_dest_file from v$logfile order by group#

But , Wait what about ASM we need to check it too :
To check ASM Disk :
**select group_number, name,allocation_unit_size alloc_unit_size,state,type,total_mb,usable_file_mb
from v$asm_diskgroup;

Information About ASM instance :
select group_number, file_number, bytes/1024/1024/1024 GB, type, striped, modification_date from v$asm_file
where TYPE != ‘ARCHIVELOG’

Thank You very Much , just Bookmark my blog all i keep post everything useful for DBA’s

And you can Download notepad from HERE