Wednesday, September 28, 2011

Oracle ASM: ORA-01078: failure in processing system parameters and ORA-29701: unable to connect to Cluster Synchronization Service

Recently we had a power outage in our lab which caused all the Linux servers running Oracle database, switches, storage to go down. When the power was restored the servers, storages, and switches were brought up cleanly.

I noticed that Oracle ASM instance was down, so I tried to manually start it and got the ORA-01078 and ORA-29701 error messages.



sh-3.2$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 28 15:20:59 2011

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

Connected to an idle instance.

SQL> startup;
ORA-01078: failure in processing system parameters
ORA-29701: unable to connect to Cluster Synchronization Service
SQL>



-bash-3.2$ . ./.bash_profile_grid
-bash-3.2$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/grid
-bash-3.2$ which crsctl
/u01/app/oracle/product/11.2.0/grid/bin/crsctl

Tried to use crsctl to start all the Oracle resources

-bash-3.2$ crsctl start resource -all
CRS-5702: Resource 'ora.LISTENER.lsnr' is already running on 'isvx7'
CRS-2672: Attempting to start 'ora.cssd' on 'isvx7'
CRS-2679: Attempting to clean 'ora.diskmon' on 'isvx7'
CRS-2681: Clean of 'ora.diskmon' on 'isvx7' succeeded
CRS-2672: Attempting to start 'ora.diskmon' on 'isvx7'
CRS-2676: Start of 'ora.diskmon' on 'isvx7' succeeded
CRS-2676: Start of 'ora.cssd' on 'isvx7' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'isvx7'
CRS-2676: Start of 'ora.asm' on 'isvx7' succeeded
CRS-2672: Attempting to start 'ora.DATA.dg' on 'isvx7'
ORA-15032: not all alterations performed
ORA-15017: diskgroup "DATA" cannot be mounted
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"
CRS-2674: Start of 'ora.DATA.dg' on 'isvx7' failed
CRS-2679: Attempting to clean 'ora.DATA.dg' on 'isvx7'
CRS-2681: Clean of 'ora.DATA.dg' on 'isvx7' succeeded
CRS-4000: Command Start failed, or completed with errors.
-bash-3.2$

On the Linux server running Oracle

[root@isvx7 ~]# multipath -d -l
mulipath.conf line 111, invalid keyword: prio
mpath144 (36005076802828000c000000000000050) dm-3 IBM,2145
[size=300G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 5:0:3:3 sdaf 65:240 [active][undef]
 \_ 6:0:3:3 sdag 66:0   [active][undef]
 \_ 5:0:0:3 sdh  8:112  [active][undef]
 \_ 6:0:0:3 sdi  8:128  [active][undef]
 \_ 6:0:1:3 sdp  8:240  [active][undef]
 \_ 5:0:1:3 sdq  65:0   [active][undef]
 \_ 5:0:2:3 sdx  65:112 [active][undef]
 \_ 6:0:2:3 sdy  65:128 [active][undef]
mpath143 (36005076802828000c000000000000053) dm-2 IBM,2145
[size=300G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 5:0:3:2 sdad 65:208 [active][undef]
 \_ 6:0:3:2 sdae 65:224 [active][undef]
 \_ 5:0:0:2 sdf  8:80   [active][undef]
 \_ 6:0:0:2 sdg  8:96   [active][undef]
 \_ 5:0:1:2 sdn  8:208  [active][undef]
 \_ 6:0:1:2 sdo  8:224  [active][undef]
 \_ 5:0:2:2 sdv  65:80  [active][undef]
 \_ 6:0:2:2 sdw  65:96  [active][undef]
mpath142 (36005076802828000c000000000000052) dm-1 IBM,2145
[size=300G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 5:0:3:1 sdab 65:176 [active][undef]
 \_ 6:0:3:1 sdac 65:192 [active][undef]
 \_ 5:0:0:1 sdc  8:32   [active][undef]
 \_ 6:0:0:1 sde  8:64   [active][undef]
 \_ 6:0:1:1 sdl  8:176  [active][undef]
 \_ 5:0:1:1 sdm  8:192  [active][undef]
 \_ 5:0:2:1 sdt  65:48  [active][undef]
 \_ 6:0:2:1 sdu  65:64  [active][undef]
mpath141 (36005076802828000c000000000000051) dm-0 IBM,2145
[size=300G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 5:0:3:0 sdaa 65:160 [active][undef]
 \_ 5:0:0:0 sdb  8:16   [active][undef]
 \_ 6:0:0:0 sdd  8:48   [active][undef]
 \_ 6:0:1:0 sdj  8:144  [active][undef]
 \_ 5:0:1:0 sdk  8:160  [active][undef]
 \_ 6:0:2:0 sdr  65:16  [active][undef]
 \_ 5:0:2:0 sds  65:32  [active][undef]
 \_ 6:0:3:0 sdz  65:144 [active][undef]

When I looked at the owner and group of the disks, I noticed that the they had changed to owner root and group disk. No wonder Oracle is not seeing them.

[root@isvx7 ~]# ls -l /dev/mapper/mpath141
brw-rw---- 1 root disk 253, 0 Sep 28 09:57 /dev/mapper/mpath141
[root@isvx7 ~]# ls -l /dev/mapper/mpath142
brw-rw---- 1 root disk 253, 1 Sep 28 09:57 /dev/mapper/mpath142
[root@isvx7 ~]# ls -l /dev/mapper/mpath143
brw-rw---- 1 root disk 253, 2 Sep 28 09:57 /dev/mapper/mpath143
[root@isvx7 ~]# ls -l /dev/mapper/mpath144
brw-rw---- 1 root disk 253, 3 Sep 28 09:57 /dev/mapper/mpath144
Changed the owner and group of the volumes to oracle and dba

[root@isvx7 ~]# chown -R oracle:dba /dev/mapper/mpath141
[root@isvx7 ~]# chown -R oracle:dba /dev/mapper/mpath142
[root@isvx7 ~]# chown -R oracle:dba /dev/mapper/mpath143
[root@isvx7 ~]# chown -R oracle:dba /dev/mapper/mpath144
[root@isvx7 ~]# ls -l /dev/mapper/mpath143
brw-rw---- 1 oracle dba 253, 2 Sep 28 09:57 /dev/mapper/mpath143
[root@isvx7 ~]#

When I brought up asmca. I saw that the my +DATA diskgroup could now be seen, but was not mounted. I mounted the diskgroup, and everything worked fine after that.



Friday, August 26, 2011

Shrinking the results file to generate graphs using Excel

Here is an example of running swingbench using the clarbench client, and redirecting the results to the file
results_400users_aix_run2_phase1.txt and the error log to swing.err

bash-3.2$./charbench -c swingconfig.xml -a -v users,tpm,tps,resp > results_400users_aix_run2_phase1.txt 2> swing.err

This run was run for a period of 24 hours which generated a result file with 86279 lines
-rw-r--r--    1 oracle   oinstall    2523482 Aug 21 13:58 results_400users_aix_run2_phase1.txt

Author  :        Dominic Giles
Version :        2.4.0.764

Results will be written to results.xml.

Time            Users   TPM     TPS     Response
1:58:42 PM      0       0       0       0
1:58:43 PM      0       0       0       0
1:58:44 PM      0       0       0       0
1:58:45 PM      0       0       0       0
..........    .    .    .    .
..........    .    .    .    .
..........    .    .    .    .
..........    .    .    .    .
1:58:37 PM      398     37324   443     518
1:58:38 PM      398     37297   783     518
1:58:39 PM      398     37519   849     518
1:58:40 PM      398     37622   644     518
1:58:41 PM      398     37740   748     518
1:58:42 PM      398     37806   501     518
1:58:43 PM      -1      37787   781     518

Completed Run.


The problem I found with was that when I tried to create open the results with Excel spreadsheeti, Excel did not
like it as it had far more number of lines than what it would like.

So one way to get around this is to shrink the file. You see that there is a line entry for every second, and
this could definitely be reduced ie. we use 1 data line for every 10 lines.

This can be done with a simple perl script. What this scripts does is read the source file and transfers every
10th line to the shrunk file 


#!/usr/bin/perl
#
# Usage: ./shrink_results.pl <source_file> <shrunk_file>
#


$source_file=$ARGV[0];
$destin_file=$ARGV[1];

if ( ! open RESULT, "<$source_file") {
        usage();
        die "The result file does not exist!";
        exit (1);
        }

open SHRUNK, ">$destin_file" or die "Cannot open file the save the shrunk result
s.\n";

sub usage {
        print STDERR "Usage: ./shrink_results.pl result_file shrunk_file\n";
}

my $lnum = 1;
my $multi = 1;
while ($line = <RESULT>) {
        chomp($line);
        if ($lnum == 10*$multi) {
                print SHRUNK "$line\n";
                $multi++;
        }
        $lnum++;
}

close SHRUNK;
close RESULT;


bash-3.2$ ./shrink_results.pl results_400users_aix_run2_phase1.txt results_400users_aix_run2_phase1_shrunk.txt

This created a shrunk file with only 8627 lines:
bash-3.2$ ls -l results_400users_aix_run2_phase1*.txt
-rw-r--r--    1 oracle   oinstall    2523482 Aug 21 13:58 results_400users_aix_run2_phase1.txt
-rw-r--r--    1 oracle   oinstall     252333 Aug 23 22:25 results_400users_aix_run2_phase1_shrunk.txt

Excel liked the new shrunk file, and the graphs were created.

Thursday, August 25, 2011

ORA-01261 and ORA-01262 while using dbca to create a database

I was using dbca to create a database on my server with Oracle ASM as the storage for the database files.

My ASM diskgroup was called DATA, so while using the dbca GUI to create the database I entered "DATA" as below for the database area.



I then clicked the Next button on the screen, and moved to the next screen. I then entered some information on the next couple of screens and on clicking Finish, then creation of the database started.

This is when I saw the ORA-01261 and the ORA-01262 error messages as shown below.

 At this point click on the Abort button and start over again. This time when you are asked for the storage type for the database files, enter "+DATA" as shown below.

Things worked fine after there.

Tuesday, August 16, 2011

What are the Oracle backgroud processes

To find out the information on the Oracle backgroud processes there are a couple of ways.

One would be to look use the OS command to find information on the Oracle process/database instance.
"testasm" is the instance name in this case.



isvp14_ora> ps -ef | grep _testasm
  oracle  9568370        1   0 15:05:04      -  0:02 ora_smon_testasm
  oracle 19071098        1   0 15:05:04      -  0:01 oracle+ASM_asmb_testasm (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
  oracle 19333214        1   0 15:05:03      -  0:08 ora_ckpt_testasm
  oracle 19529820        1   0 15:05:03      -  0:15 ora_lgwr_testasm
  oracle 19595362        1   0 15:05:03      -  0:40 ora_dbw0_testasm
  oracle 19660900        1   0 15:05:03      -  0:01 ora_mman_testasm
  oracle 19726434        1   0 15:05:03      -  0:33 ora_dia0_testasm
  oracle 19857512        1   0 15:05:03      -  0:00 ora_psp0_testasm
  oracle 19923050        1   0 15:05:03      -  0:00 ora_gen0_testasm
  oracle 20316278        1   0 15:05:04      -  0:00 ora_s000_testasm
  oracle 20381826        1   0 15:05:03      -  0:22 ora_vktm_testasm
  oracle 20578446        1   0 15:05:03      -  0:04 ora_pmon_testasm
  oracle 20775082        1   0 15:05:04      -  0:00 ora_d000_testasm
  oracle 25296902        1   0 15:05:14      -  0:06 ora_cjq0_testasm
  oracle 25559076        1   0 15:05:23      -  0:00 ora_q001_testasm
  oracle 25821214        1   0 15:05:13      -  0:00 ora_qmnc_testasm
  oracle 25886744        1   0 15:05:04      -  0:00 ora_mark_testasm
  oracle 25952282        1   0 15:05:04      -  0:06 ora_mmon_testasm
  oracle 26017820        1   0 15:05:04      -  0:00 ora_asmb_testasm
  oracle 26083358        1   0 15:05:04      -  0:00 ora_rbal_testasm
  oracle 26214454        1   0 15:05:04      -  0:14 ora_mmnl_testasm
  oracle 26280002        1   0 15:05:03      -  0:00 ora_diag_testasm
  oracle 26345516        1   0 15:10:14      -  0:00 ora_smco_testasm
  oracle 26411078        1   0 15:05:03      -  0:00 ora_dbrm_testasm
  oracle 26476590        1   0 15:05:04      -  0:00 ora_reco_testasm
  oracle 35258456        1   0 09:31:30      -  0:00 ora_w000_testasm
  oracle 41156862        1   0 15:05:23      -  0:00 ora_q000_testasm
isvp14_ora>


or we could use the information in the v$process table for more accurate information.



SQL> select program from v$process where BACKGROUND=1;

PROGRAM
------------------------------------------------
oracle@isvp14_ora.storage.tucson.com (PMON)
oracle@isvp14_ora.storage.tucson.com (VKTM)
oracle@isvp14_ora.storage.tucson.com (GEN0)
oracle@isvp14_ora.storage.tucson.com (DIAG)
oracle@isvp14_ora.storage.tucson.com (DBRM)
oracle@isvp14_ora.storage.tucson.com (PSP0)
oracle@isvp14_ora.storage.tucson.com (DIA0)
oracle@isvp14_ora.storage.tucson.com (MMAN)
oracle@isvp14_ora.storage.tucson.com (DBW0)
oracle@isvp14_ora.storage.tucson.com (LGWR)
oracle@isvp14_ora.storage.tucson.com (CKPT)

PROGRAM
------------------------------------------------
oracle@isvp14_ora.storage.tucson.com (SMON)
oracle@isvp14_ora.storage.tucson.com (RECO)
oracle@isvp14_ora.storage.tucson.com (RBAL)
oracle@isvp14_ora.storage.tucson.com (ASMB)
oracle@isvp14_ora.storage.tucson.com (MMON)
oracle@isvp14_ora.storage.tucson.com (MMNL)
oracle@isvp14_ora.storage.tucson.com (MARK)
oracle@isvp14_ora.storage.tucson.com (W000)
oracle@isvp14_ora.storage.tucson.com (Q000)
oracle@isvp14_ora.storage.tucson.com (QMNC)
oracle@isvp14_ora.storage.tucson.com (SMCO)

PROGRAM
------------------------------------------------
oracle@isvp14_ora.storage.tucson.com (CJQ0)
oracle@isvp14_ora.storage.tucson.com (Q001)

24 rows selected.


SQL>

Thursday, July 21, 2011

ORA-00018: maximum number of sessions exceeded

Again, while running my charbench client against the swingbench Order Entry schema I got the following error message:

ORA-00018: maximum number of sessions exceeded

On googling I found an excellent thread which explains how connections, sessions, and processes are related in Oracle.
http://asktom.oracle.com/pls/asktom/f?p=100:11:413703333046318::::P11_QUESTION_ID:5671284058977

Here is what I did to find out my current value of session, and then increase its value.




SQL> show parameter sessions;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size integer 0
java_soft_sessionspace_limit integer 0
license_max_sessions integer 0
license_sessions_warning integer 0
sessions integer 400
shared_server_sessions integer
SQL> alter system set sessions=800 scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 3540881408 bytes
Fixed Size 2211864 bytes
Variable Size 1644171240 bytes
Database Buffers 1879048192 bytes
Redo Buffers 15450112 bytes
Database mounted.
Database opened.
SQL> show parameter sessions;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size integer 0
java_soft_sessionspace_limit integer 0
license_max_sessions integer 0
license_sessions_warning integer 0
sessions integer 800
shared_server_sessions integer
SQL>

Wednesday, July 20, 2011

ORA-12516, TNS:listener could not find available handler with matching protocol stack

My charbench client was running fine with 100 users against an Oracle 11g R2 database created using swingbench, but when I tried to run the client with 200 users I got the following error message:


Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack


On checking to see the vaule of the process for the database I noticed that it was set to 150.


SQL> show parameter processes;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 150



SQL> show parameter spfile;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/testasm/spfiletestasm.or
a
SQL> alter system set PROCESSES=250 scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 3540881408 bytes
Fixed Size 2211864 bytes
Variable Size 1644171240 bytes
Database Buffers 1879048192 bytes
Redo Buffers 15450112 bytes
Database mounted.
Database opened.
SQL> show parameter processes;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 250
SQL>


The charbench client proceeded file with 200 users after the above change to the PROCESSES parameter.

Thursday, July 14, 2011

ORA-09817: Write to audit file failed.

While trying to connect to our 11gR2 Oracle database this morning I got the
ORA-09817: Write to audit file failed. error message.


bash-3.2$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 14 10:29:19 2011

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

ERROR:
ORA-09817: Write to audit file failed.
IBM AIX RISC System/6000 Error: 28: No space left on device
Additional information: 12
ORA-09945: Unable to initialize the audit trail file
IBM AIX RISC System/6000 Error: 28: No space left on device


Enter user-name:



On doing a "df -m" at I noticed that the / had run out of space. It's on / that I had our ORACLE_HOME, so I seemed that that might have caused the problem.


$ df -m
Filesystem MB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 25600.00 0.00 100% 70464 95% /


I increased the size of / from 25G to 50G by doing the following:



isvp14_ora> chfs -a size=50G /
Filesystem size changed to 104857600
isvp14_ora> df -m
Filesystem MB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 51200.00 25596.05 51% 70465 2% /


Now, I tried to connect to the database again, and everything worked fine.



bash-3.2$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 14 10:34:32 2011

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


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

SQL>