Wednesday, December 14, 2016

How to use standby backup to restore primary db

How to use standby backup to restore primary db

–Propose: Backup db from physical standby db by using RMAN, recove datafile of primary standby db.
–enviroment:
Three machines:
Machine A: 172.16.100.29 Linux ES3
Machine B: 172.16.100.21 Linux ES3
Machine C: 172.16.100.31 Linux ES3
–step1. build Machine A as primary db and Machine B as standby db
–create another db on Machine C
Machine DB_TNSNAME
A STD1.29
B STD1.21
C STD1.31
–step2. create recovery catalog on Machine C
Machine C:
SQL> conn / as sysdba
SQL> create tablespace rcat datafile ‘/opt/oracle/oradata/rcat01.dbf’ size 50M;
SQL> create user rcat identified by rcat default tablespace rcat temporary tablesapce temp;
SQL> grant connect, resource, recovery_catalog_owner to rcat;
Machine A:
rman catalog=rcat/rcat@STD1.31
RMAN> create catalog tablespace rcat;
RMAN> connect target sys/oracle@STD1.29
RMAN> register database;
RMAN> configure channel 1 device type disk format ‘/opt/oracle/rman/std1_%U’;
RMAN> exit;
–step3.backup standby database
Machine C:
rman catalog=rcat/rcat@STD1.31 target=sys/oracle@STD1.21
RMAN> backup database;
RMAN> exit;
–step4. test recover on primary datafile
–move system tablespace’s file to another space
Machine A:
SQL> shutdown immediate
mv /opt/oracle/oradata/std1/system01.dbf /tmp/system01.dbf
SQL> startup mount
–step5. restore by rman
Machine C:
copy rman backup files from Machine B to Machine A , using the same directory
–set NLS_CHARACTERSET value to be the same as Machine A
export NLS_CHARACTERSET=AL32UTF8
rman catalog=rcat/rcat@STD1.31 target=sys/oracle@STD1.29
RMAN> restore datafile 1;
RMAN> recover datafile 1;
RMAN> exit
–step6.startup primary database
SQL> alter database startup;
–step7.backup from standby database and recover the primary database without redo logs
Machine C:
–1.backup datafiles at standby database
rman catalog=rcat/rcat@STD1_31 target=sys/oracle@STD1_21
RMAN> backup database;
…….
channel ORA_DISK_1: starting piece 1 at 05-AUG-05
channel ORA_DISK_1: finished piece 1 at 05-AUG-05
piece handle=/opt/oracle/rman/std1_06gradfv_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:17
Finished backup at 05-AUG-05
RMAN-06497: WARNING: controlfile is not current, controlfile autobackup skipped
RMAN> exit
shell> rman catalog=rcat/rcat@STD1_31 target=sys/oracle@STD1_29
–2.backup control file from primary db
RMAN> backup current controlfile;
Starting backup at 05-AUG-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current controlfile in backupset
channel ORA_DISK_1: starting piece 1 at 05-AUG-05
channel ORA_DISK_1: finished piece 1 at 05-AUG-05
piece handle=/opt/oracle/rman/std1_03grae2o_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-AUG-05
–3.backup spfile from primary db
RMAN> backup spfile;
Starting backup at 05-AUG-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 05-AUG-05
channel ORA_DISK_1: finished piece 1 at 05-AUG-05
piece handle=/opt/oracle/rman/std1_04grae3f_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-AUG-05
RMAN> exit
–4.delete datafile, control files and spfile from primary db
— copy the backup datafile from Machine B to Machine A
Machine A:
lsnrctl stop
mkdir /tmp/orabak
mv product/9.2.0/dbs/spfilestd1.ora /tmp/orabak/
mv oradata/std1/*.ctl /tmp/orabak/
mv oradata/std1/*.dbf /tmp/orabak/
mv oradata/std1/redo*.log /tmp/orabak/
sftp 172.16.100.21
Connecting to 172.16.100.21…
oracle@172.16.100.21’s password:
sftp> get /opt/oracle/rman/std1_06gradfv_1_1 /opt/oracle/rman/std1_06gradfv_1_1
std1_06gradfv_1_1 100% 231MB 3.3MB/s 01:08
sftp> exit
lsnrctl start
Machine C:
–5.get the dbid from standby db
rman catalog=rcat/rcat@std1_31 target=sys/oracle@std1_21
Recovery Manager: Release 9.2.0.6.0 – Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: STD1 (DBID=3008965527)
connected to recovery catalog database
RMAN> exit
–the dbid id 3008965527
–6.startup primary db with no spfile
rman catalog=rcat/rcat@std1_31 target=sys/oracle@std1_29
Recovery Manager: Release 9.2.0.6.0 – Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
connected to recovery catalog database
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/opt/oracle/product/9.2.0/dbs/initstd1.ora’
trying to start the Oracle instance without parameter files …
Oracle instance started
Total System Global Area 97588624 bytes
Fixed Size 451984 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
RMAN> set dbid=3008965527
executing command: SET DBID
–7.using datafile backup to recove spfile
RMAN> restore spfile;
Starting restore at 05-AUG-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=/opt/oracle/product/9.2.0/dbs/spfilestd1.ora
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/rman/std1_06gradfv_1_1 tag=TAG20050805T100107 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 05-AUG-05
–8.using backup controlfile(std1_03grae2o_1_1) to recover controlfile
RMAN> restore controlfile;
Starting restore at 05-AUG-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring controlfile
output filename=/opt/oracle/product/9.2.0/dbs/cntrlstd1.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/rman/std1_03grae2o_1_1 tag=TAG20050805T100743 params=NULL
channel ORA_DISK_1: restore complete
replicating controlfile
input filename=/opt/oracle/product/9.2.0/dbs/cntrlstd1.dbf
Finished restore at 05-AUG-05
RMAN> shutdown immediate
Oracle instance shut down
RMAN> exit
–9.restart primary database
Machine A:
sqlplus /nolog
SQL> conn / as sysdba
SQL> startup nomount
SQL> show parameter control_files
NAME TYPE VALUE
———————————— ———– ——————————
control_files string /opt/oracle/oradata/physical_s
td1.ctl
SQL> host
mv /opt/oracle/product/9.2.0/dbs/cntrlstd1.dbf /opt/oracle/oradata/physical_std1.ctl
exit
SQL> alter database mount;
Database altered.
–10.restore primary database
Machine C:
rman catalog=rcat/rcat@std1_31 target=sys/oracle@std1_29
RMAN> restore database;
Starting restore at 05-AUG-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /opt/oracle/oradata/std1/system01.dbf
restoring datafile 00002 to /opt/oracle/oradata/std1/undotbs01.dbf
restoring datafile 00003 to /opt/oracle/oradata/std1/indx01.dbf
restoring datafile 00004 to /opt/oracle/oradata/std1/tools01.dbf
restoring datafile 00005 to /opt/oracle/oradata/std1/users01.dbf
restoring datafile 00006 to /opt/oracle/oradata/std1/logmnrts.dbf
restoring datafile 00007 to /opt/oracle/oradata/std1/newlogminer.dbf
restoring datafile 00008 to /opt/oracle/oradata/std1/logmnrts_3.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/rman/std1_06gradfv_1_1 tag=TAG20050805T100107 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 05-AUG-05
–11.recover database
RMAN> recover database;
Starting recover at 05-AUG-05
using channel ORA_DISK_1
starting media recovery
unable to find archive log
archive log thread=1 sequence=14
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/05/2005 10:52:13
RMAN-06054: media recovery requesting unknown log: thread 1 scn 252823
Machine A:
SQL> SELECT max(next_change#) FROM v$archived_log WHERE THREAD#=1 AND dest_id=1;
MAX(NEXT_CHANGE#)
—————–
252823
SQL> SELECT SEQUENCE# FROM v$archived_log WHERE next_change#=252823 AND dest_id=1
2 ;
SEQUENCE#
———-
13
SQL> SELECT first_change#, archived, status FROM v$log WHERE THREAD#=1 ORDER BY First_change#;
FIRST_CHANGE# ARC STATUS
————- — —————-
249961 YES INACTIVE
250066 YES INACTIVE
252823 NO CURRENT
–that mean the change after 252823 is not archived, it’s lost in redo log,
— so we only can recove until 252823
RMAN> recover database until sequence 13 thread 1;
Starting recover at 05-AUG-05
using channel ORA_DISK_1
starting media recovery
media recovery complete
Finished recover at 05-AUG-05
–Appendix scenario:backup and recover the primary database with redo logs
–1.backup primary database
Machine C:
rman catalog=rcat/rcat@std1_31 target=sys/oracle@std1_29
Recovery Manager: Release 9.2.0.6.0 – Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: STD1 (DBID=3008965527)
connected to recovery catalog database
RMAN> backup database;
Starting backup at 05-AUG-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=17 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00001 name=/opt/oracle/oradata/std1/system01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/std1/undotbs01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/std1/indx01.dbf
input datafile fno=00005 name=/opt/oracle/oradata/std1/users01.dbf
input datafile fno=00006 name=/opt/oracle/oradata/std1/logmnrts.dbf
input datafile fno=00007 name=/opt/oracle/oradata/std1/newlogminer.dbf
input datafile fno=00008 name=/opt/oracle/oradata/std1/logmnrts_3.dbf
input datafile fno=00004 name=/opt/oracle/oradata/std1/tools01.dbf
channel ORA_DISK_1: starting piece 1 at 05-AUG-05
channel ORA_DISK_1: finished piece 1 at 05-AUG-05
piece handle=/opt/oracle/rman/std1_05grapd8_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:37
Finished backup at 05-AUG-05
RMAN> exit
Machine A:
SQL> shutdown immediate
SQL> exit
mv /opt/oracle/product/9.2.0/dbs/spfilestd1.ora /tmp/orabak/
mv /opt/oracle/oradata/physical_std1.ctl /tmp/orabak/
mv /opt/oracle/oradata/std1/*.dbf /tmp/orabak/
–remain the redo logs
ls -l /opt/oracle/oradata/std1/*
-rw-r—– 1 oracle dba 10486272 Aug 5 13:25 /opt/oracle/oradata/std1/redo01.log
-rw-r—– 1 oracle dba 10486272 Aug 5 13:13 /opt/oracle/oradata/std1/redo02.log
-rw-r—– 1 oracle dba 10486272 Aug 5 13:10 /opt/oracle/oradata/std1/redo03.log
Machine C:
rman catalog=rcat/rcat@std1_31 target=sys/oracle@std1_29
Recovery Manager: Release 9.2.0.6.0 – Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
connected to recovery catalog database
RMAN> set dbid=3008965527
RMAN> startup nomount
RMAN> restore spfile;
Starting restore at 05-AUG-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=/opt/oracle/product/9.2.0/dbs/spfilestd1.ora
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/rman/std1_05grapd8_1_1 tag=TAG20050805T132104 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 05-AUG-05
RMAN> restore controlfile;
Starting restore at 05-AUG-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring controlfile
output filename=/opt/oracle/product/9.2.0/dbs/cntrlstd1.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/rman/std1_05grapd8_1_1 tag=TAG20050805T132104 params=NULL
channel ORA_DISK_1: restore complete
replicating controlfile
input filename=/opt/oracle/product/9.2.0/dbs/cntrlstd1.dbf
Finished restore at 05-AUG-05
RMAN> shutdown immediate
—
SQL> startup nomount
SQL> show parameter control_files
NAME TYPE VALUE
———————————— ———– ——————————
control_files string /opt/oracle/oradata/physical_s
td1.ctl
SQL> host
mv /opt/oracle/product/9.2.0/dbs/cntrlstd1.dbf /opt/oracle/oradata/physical_std1.ctl
exit
SQL> alter database mount;
RMAN> restore database;
Starting restore at 05-AUG-05
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=14 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /opt/oracle/oradata/std1/system01.dbf
restoring datafile 00002 to /opt/oracle/oradata/std1/undotbs01.dbf
restoring datafile 00003 to /opt/oracle/oradata/std1/indx01.dbf
restoring datafile 00004 to /opt/oracle/oradata/std1/tools01.dbf
restoring datafile 00005 to /opt/oracle/oradata/std1/users01.dbf
restoring datafile 00006 to /opt/oracle/oradata/std1/logmnrts.dbf
restoring datafile 00007 to /opt/oracle/oradata/std1/newlogminer.dbf
restoring datafile 00008 to /opt/oracle/oradata/std1/logmnrts_3.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/rman/std1_05grapd8_1_1 tag=TAG20050805T132104 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 05-AUG-05
RMAN> recover database;
Starting recover at 05-AUG-05
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 8 is already on disk as file /opt/oracle/oradata/std1/redo01.log
archive log filename=/opt/oracle/oradata/std1/redo01.log thread=1 sequence=8
media recovery complete
Finished recover at 05-AUG-05
RMAN> alter database open resetlogs;
database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

QUESTION and ANSWERS
great article – this is the first article I have seen on how to use the standby database to recover the primary. thank you! I do have two questions: 1) is it possible to do this if you are not using a recovery catalog? If so, how would the steps differ? 2) why in step 7 isn’t the control file on the standby current. I would think that if you are using the standby to recover the primary that this would be the current control file. Most likely, your primary has probably been down for a while and datafiles could have been added to your standby. At least this is the situation I am in and I am trying to figure out how to restore the primary from the standby without shutting down the standby. Any advice would be greatly appreciated.
1)Yes, it’s ok without catalog. But you will need to catalog the backupfiles to the primary db control file.
In my example, use this
rman> catalog start with ‘/opt/oracle/rman/std1’;
2)The standby crontolfile is a standby controlfile on the point view of primary. That’s why rman says it is not a current controlfile. A current cotrolfile is always the primary db controlfile. After you active the standby db, its controlfile is current.
You do not need to stop the standby db to do recover. If you have questions, I’d like to help.
At the end we open the primary database with resetlogs, what will be the status of standby database? do you rebuild the standby database. Incase of all control/dbf/redo files lost, best option would be to failover to standby database and rebuild the standby. as the downtime will be very less.
starting with 11g control file can be taken backup from standby database, rman doesn’t throw RMAN-06497: WARNING: controlfile is not current, controlfile autobackup skipped error.
1. The standby database can sync with primary database automatically if you use dataguard. Dataguard will know and recover standby pass the resetlog point.
2. Agree. In case of primary fail, failover to standby is the standard solution to recover db. This post just provides another view.
 If I do not have primary controlfile backup, can we restore the standby controlfile backup to primary?
Also if db_unique_name is DBPRI on primary and dba_unique_name is DBSTBY on standby , is it not going to be an issue if we restore from standby backup as datafile headers may have db_unique_name details.
1. yes, you can restore the standby controlfile.
2. db_unique_name is not a problem. I don’t think it’s in datafile headers. Actually, you can change it in initial file. It’s at instance level.
When backuping my standby database i also backup its controlfile (standby controlfile) …. but i can’t use it to restore on my primary database. i got the following error :
RMAN-06026: some targets not found – aborting restore
RMAN-06023: no backup or copy of datafile 10 found to restore
are you sure i can use the backup of standby controlfile to restore my primary database? i yes how to do it? Thx again
yes. The error means you don’t have backup of datafile# 10. You’d better backup the controlfile and datafiles at the same time.

Friday, August 26, 2016

HowTo: Linux Check IDE / SATA Hard Disk Transfer Speed

HowTo: Linux Check IDE / SATA Hard Disk Transfer Speed


So how do you find out how fast is your hard disk under Linux? Is it running at SATA I (150 MB/s) or SATA II (300 MB/s) speed without opening computer case or chassis?
You can use the hdparm command to check hard disk speed. It provides a command line interface to various hard disk ioctls supported by the stock Linux ATA/IDE/SATA device driver subsystem. Some options may work correctly only with the latest kernels (make sure you have cutting edge kernel installed). I also recommend to compile hdparm with the include files from the latest kernel source code. It provides more accurate result.

Measure Hard Disk Data Transfer Speed

Login as the root and enter the following command:
$ sudo hdparm -tT /dev/sda
OR
$ sudo hdparm -tT /dev/hda
Sample outputs:
/dev/sda:
 Timing cached reads:   7864 MB in  2.00 seconds = 3935.41 MB/sec
 Timing buffered disk reads:  204 MB in  3.00 seconds =  67.98 MB/sec
For meaningful results, this operation should be repeated 2-3 times. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test. Here is a for loop example, to run test 3 time in a row:
for i in 1 2 3; do hdparm -tT /dev/hda; done
Where,
  • -t :perform device read timings
  • -T : perform cache read timings
  • /dev/sda : Hard disk device file
To find out SATA hard disk speed, enter:
sudo hdparm -I /dev/sda | grep -i speed
Output:
    * Gen1 signaling speed (1.5Gb/s)
    * Gen2 signaling speed (3.0Gb/s)
Above output indicate that my hard disk can use both 1.5Gb/s or 3.0Gb/s speed. Please note that your BIOS / Motherboard must have support for SATA-II.

dd Command

You can use the dd command as follows to get speed info too:
dd if=/dev/zero of=/tmp/output.img bs=8k count=256k
rm /tmp/output.img
Sample outputs:
262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 23.6472 seconds, 90.8 MB/s

GUI Tool

You can also use disk utility located at System > Administration > Disk utility menu.

Read Only Benchmark (Safe option)

Then, select > Read only:
Fig.01: Linux Benchmarking Hard Disk Read Only Test Speed
Fig.01: Linux Benchmarking Hard Disk Read Only Test Speed

The above option will not destroy any data.

Read and Write Benchmark (All data will be lost so be careful)

Visit System > Administration > Disk utility menu > Click Benchmark > Click Start Read/Write Benchmark button:
Fig.02:Linux Measuring read rate, write rate and access time
Fig.02:Linux Measuring read rate, write rate and access time

Friday, August 19, 2016

How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x

How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x


What is EPEL

EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux. Epel project is not a part of RHEL/Cent OS but it is designed for major Linux distributions by providing lots of open source packages like networking, sys admin, programming, monitoring and so on. Most of the epel packages are maintained by Fedora repo.

Why we use EPEL repository?

  1. Provides lots of open source packages to install via Yum.
  2. Epel repo is 100% open source and free to use.
  3. It does not provide any core duplicate packages and no compatibility issues.
  4. All epel packages are maintained by Fedora repo.

How To Enable EPEL Repository in RHEL/CentOS 7/6/5?

First, you need to download the file using Wget and then install it using RPM on your system to enable the EPEL repository. Use below links based on your Linux OS versions. (Make sure you must be rootuser).

RHEL/CentOS 7 64 Bit

## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
# rpm -ivh epel-release-7-8.noarch.rpm

RHEL/CentOS 6 32-64 Bit

## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

RHEL/CentOS 5 32-64 Bit

## RHEL/CentOS 5 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
## RHEL/CentOS 5 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm

RHEL/CentOS 4 32-64 Bit

## RHEL/CentOS 4 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm
## RHEL/CentOS 4 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/x86_64/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm

How Do I Verify EPEL Repo?

You need to run the following command to verify that the EPEL repository is enabled. Once you ran the command you will see epel repository.
# yum repolist

Sample Output

Loaded plugins: downloadonly, fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: centos.aol.in
* epel: ftp.cuhk.edu.hk
* extras: centos.aol.in
* rpmforge: be.mirror.eurid.eu
* updates: centos.aol.in
Reducing CentOS-5 Testing to included packages only
Finished
1469 packages excluded due to repository priority protections
repo id                           repo name                                                      status
base                              CentOS-5 - Base                                               2,718+7
epel Extra Packages for Enterprise Linux 5 - i386 4,320+1,408
extras                            CentOS-5 - Extras                                              229+53
rpmforge                          Red Hat Enterprise 5 - RPMforge.net - dag                      11,251
repolist: 19,075

How Do I Use EPEL Repo?

You need to use YUM command for searching and installing packages. For example we search forZabbix package using epel repo, lets see it is available or not under epel.
# yum --enablerepo=epel info zabbix

Sample Output

Available Packages
Name       : zabbix
Arch       : i386
Version    : 1.4.7
Release    : 1.el5
Size       : 1.7 M
Repo : epel
Summary    : Open-source monitoring solution for your IT infrastructure
URL        : http://www.zabbix.com/
License    : GPL
Description: ZABBIX is software that monitors numerous parameters of a network.
Let’s install Zabbix package using epel repo option –enablerepo=epel switch.
# yum --enablerepo=epel install zabbix
Note: The epel configuration file is located under /etc/yum.repos.d/epel.repo.
This way you can install as many as high standard open source packages using EPEL repo.

Alert: After SAN Firmware Upgrade, ASM Diskgroups ( Using ASMLIB) Cannot Be Mounted Due To ORA-15085: ASM disk "" has inconsistent sector size. (Doc ID 1500460.1)




APPLIES TO:

Linux OS
Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.2.0.4 [Release 10.2 to 11.2]
Linux x86-64
Haansoft Linux x86

DESCRIPTION

After upgrade  SAN "IBM NSeries N7950T - Data ONTAP 8.0.2P3" firmware to "BM NSeries N7950T - Data ONTAP 8.1.1" firmware, the ASM diskgroups cannot be mounted due to the next errors:

SYS@+ASM2> alter diskgroup DATA11G mount;
alter diskgroup DATA11G mount
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15017: diskgroup "DATA11G" cannot be mounted
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"DATA11G"
ORA-15085: ASM disk "" has inconsistent sector size.
ORA-15085: ASM disk "" has inconsistent sector size.
ORA-15085: ASM disk "" has inconsistent sector size.
ORA-15085: ASM disk "" has inconsistent sector size.
ORA-15085: ASM disk "" has inconsistent sector size.



Ask Questions, Get Help, And Share Your Experiences With This Article

Would you like to explore this topic further with other Oracle Customers, Oracle Employees, and Industry Experts?

Click here to join the discussion where you can ask questions, get help from others, and share your experiences with this specific article.
Discover discussions about other articles and helpful subjects by clicking here to access the main My Oracle Support Community page for Database Install/Upgrade.

OCCURRENCE

A) Original configuration:
  1. ASM RAC 11.2.0.3 .
  2. ASMLIB API installed
  3. Linux 64-bit
  4. IBM NSeries N7950T - Data ONTAP 8.0.2P3 (firmware upgrade)
  5. Diskgroups were created on 512 bytes sector size disks.


B) The problem started on the new configuration "IBM NSeries N7950T - Data ONTAP 8.1.1":
  1. ASM RAC 11.2.0.3 .
  2. ASMLIB API installed
  3. Linux 64-bit
  4. IBM NSeries N7950T - Data ONTAP 8.1.1 (firmware upgrade)
  5. Diskgroups were created on 512 bytes sector size disks.

Note 1: The problem could occur on any ASM release (10.2.0.1X to 11.2.0.X).
Note 2: The problem could occur on any ASMLIB release.
Note 3: This problem could occur with any other Storage Vendor, if the firmware upgrade modifies/changes the physical_block_size = 4096 bytes (4kb).


C) This problem occurred due to the disks are now presented with "logical_block_size" = 512 bytes and "physical_block_size" = 4096 bytes (4kb) due to the SAN firmware upgrade follows:

Before the the storage device firmware upgrade:

 # cd /sys/block/dm-21/queue
 # more *block_size

 ::::::::::::::
 logical_block_size
 ::::::::::::::
 512
 ::::::::::::::
 physical_block_size
 ::::::::::::::
 512


After the the storage device firmware upgrade:

 # cd /sys/block/dm-21/queue
 # more *block_size

 ::::::::::::::
 logical_block_size
 ::::::::::::::
 512
 ::::::::::::::
 physical_block_size
 ::::::::::::::
 4096

This problem occurred due to the storage device firmware was upgraded. The old firmware reported 512 bytes logical block size / 512 bytes physical block size, then after the upgrade, the new firmware reported 512 bytes logical block size / 4096 bytes physical block size. Consequently, a diskgroup created with 512-byte blocks will be now suddenly running on a device reporting 4096-byte sectors. For this reason ASM will refuse to import/mount the diskgroup(s).

In other words, the logical sector size is presented = 512 bytes and the physical sector size is presented = 4096 bytes (4kb), this is not supported by ASMLIB API at this moment.


E) Despite ASM diskgroups were created on 512 bytes sector size disks, ASM detects the ASMLIB disks with a sector size = 4096 bytes (4kb) instead of a sector size = 512 bytes, this inconsistency generates the problem (ORA-15085: ASM disk "" has inconsistent sector size.):
 +ASM> select group_Number ,disk_number,path, sector_size from v$asm_disk
.
 GROUP_NUMBER DISK_NUMBER PATH                           SECTOR_SIZE
 ------------ ----------- ------------------------------ -----------
 ...
            0          75 ORCL:TMSTS01_LUN010                   4096


E) But if the ASMLIB is disabled/bypassed (ASM_DISKSTRING = '/dev/oracleasm/disks/*'), then the disks are presented/detected with a sector size = 512 bytes:

 +ASM> select group_Number ,disk_number,path, sector_size from v$asm_disk
.
 GROUP_NUMBER DISK_NUMBER PATH                                     SECTOR_SIZE
 ------------ ----------- ---------------------------------------- -----------
 ...
            0          75 /dev/oracleasm/disks/TMSTS01_LUN010                  512


D) This problem is due to the SAN Firware upgrade and due to the next ASMLIB bug (ASMLIB enhancement):
  • oracleasm driver (ASMLIB) as of today works with the expectation that logical block size and physical block size are 512/512 bytes. This particular storage/firmware appears doesn't do that, so the configuration won't work with oracleasm driver.

  • We understand that 4K sector size disks need to be supported, so we are working on an ASMLIB enhancement fix.

  • Therefore, at this moment this SAN firmware upgrade is not certified and is not supported with ASMLIB.


SYMPTOMS


Error Description:

15085, 00000, "ASM disk \"%s\" has inconsistent sector size."
// *Cause:  An attempt to mount a diskgroup failed because a disk reported
//          inconsistent sector size value.
// *Action: Use disks with sector size consistent with Diskgroup sector size,
//          or make sure the operating system can accurately report the disk 
//          sector size.
//

WORKAROUND



********* Warning !!!!!  ********* : Never set the "_disk_sector_size_override"=TRUE parameter in the ASM instance(s) as a workaround, since this parameter will corrupt the ASM diskgroups.

Workaround 1

Therefore, the only valid workarounds are as follow:

1) Downgrade/rollback the SAN firmware upgrade.

2) Or disable/bypass the ASMLIB as follows:

ASM_DISKSTRING = '/dev/oracleasm/disks/*'

Workaround 2

NetApp has also provided a workaround for versions 8.0.5, 8.1.3 and 8.2 of Data ONTAP 7-Mode.

The workaround allows specified LUNs to continue do not report the logical blocks per physical block value.

This work around should only be applied to LUNs used by Oracle ASMlib with the symptoms described in this article.

Example:

From the Data ONTAP 7-Mode CLI, enter the following commands:
> lun set report-physical-size <path> disable

PATCHES


3) Or install the new “oracleasm-support-2.1.8-1” ASMLIB RPM package (which contains the permanent fix) as follows:

Step #1: Shutdown the ASM instance(s):

a) On RAC configurations you need to stop the CRS stack on all the nodes (as root user):
# <Grid Infrastructure Oracle Home>/bin/crsctl stop crs

b) On Restart/Standalone configurations you need to stop the HAS stack on all the nodes (as root user):
# <Grid Infrastructure Oracle Home>/bin/crsctl stop has


Step #2: Stop the ASMLIB API on all the nodes as root user:
# /etc/init.d/oracleasm stop

Step #3: Obtain and install the new “oracleasm-support-2.1.8-1” ASMLIB RPM package via  "Oracle Unbreakable Linux Network" as follows:

[grid@asmlnx1 sbin]$ su -
Password:
[root@asmlnx1 ~]# yum update oracleasm-support
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, refresh-packagekit, security, tmprepo, verify, versionlock
Loading support for kernel ABI
ol6_UEK_latest                                                                                               | 1.2 kB     00:00   
ol6_UEK_latest/primary                                                                                       | 7.0 MB     00:24   
ol6_UEK_latest                                                                                                              162/162
ol6_latest                                                                                                   | 1.4 kB     00:00   
ol6_latest/primary                                                                                           |  27 MB     01:18   
ol6_latest                                                                                                              21277/21277
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package oracleasm-support.x86_64 0:2.1.5-1.el6 will be updated
---> Package oracleasm-support.x86_64 0:2.1.8-1.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                              Arch                      Version                         Repository                     Size
====================================================================================================================================
Updating:
 oracleasm-support                    x86_64                    2.1.8-1.el6                     ol6_latest                     73 k

Transaction Summary
====================================================================================================================================
Upgrade       1 Package(s)

Total download size: 73 k
Is this ok [y/N]: Y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 73 k
oracleasm-support-2.1.8-1.el6.x86_64.rpm                                                                     |  73 kB     00:00   
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Retrieving key from http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
Importing GPG key 0xEC551F03:
 Userid: "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
 From  : http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
Is this ok [y/N]: Y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Updating   : oracleasm-support-2.1.8-1.el6.x86_64                                                                             1/2
warning: /etc/sysconfig/oracleasm created as /etc/sysconfig/oracleasm.rpmnew
  Cleanup    : oracleasm-support-2.1.5-1.el6.x86_64                                                                             2/2
  Verifying  : oracleasm-support-2.1.8-1.el6.x86_64                                                                             1/2
  Verifying  : oracleasm-support-2.1.5-1.el6.x86_64                                                                             2/2

Updated:
  oracleasm-support.x86_64 0:2.1.8-1.el6                                                                                          

Complete!
[root@asmlnx1 ~]#

Note 1: Alternatively, you can download the new “oracleasm-support-2.1.8-1” ASMLIB RPM package from the following sites:

Oracle ASMLib  

And also from the "Oracle Unbreakable Linux Network":

Getting Oracle ASMLib via the Unbreakable Linux Network   


Step #4: Verify the current configuration in the  “/etc/sysconfig/oracleasm” file (the “ORACLEASM_USE_LOGICAL_BLOCK_SIZE” parameter is not set):

[root@asmlnx1 ~]# cat /etc/sysconfig/oracleasm
#
# This is a configuration file for automatic loading of the Oracle
# Automatic Storage Management library kernel driver.  It is generated
# By running /etc/init.d/oracleasm configure.  Please use that method
# to modify this file
#

# ORACLEASM_ENABELED: 'true' means to load the driver on boot.
ORACLEASM_ENABLED=true

# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.
ORACLEASM_UID=grid

# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.
ORACLEASM_GID=asmadmin

# ORACLEASM_SCANBOOT: 'true' means scan for ASM disks on boot.
ORACLEASM_SCANBOOT=true

# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER=""

# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE=""


Step #5: Then configure the new “ORACLEASM_USE_LOGICAL_BLOCK_SIZE” feature:
[root@asmlnx1 ~]# /usr/sbin/oracleasm configure -p
Writing Oracle ASM library driver configuration: done

Step #6: Check the new configuration in the  “/etc/sysconfig/oracleasm” file:
[root@asmlnx1 ~]# cat /etc/sysconfig/oracleasm
#
# This is a configuration file for automatic loading of the Oracle
# Automatic Storage Management library kernel driver.  It is generated
# By running /etc/init.d/oracleasm configure.  Please use that method
# to modify this file
#

# ORACLEASM_ENABLED: 'true' means to load the driver on boot.
ORACLEASM_ENABLED=true

# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.
ORACLEASM_UID=grid

# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.
ORACLEASM_GID=asmadmin

# ORACLEASM_SCANBOOT: 'true' means scan for ASM disks on boot.
ORACLEASM_SCANBOOT=true

# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER=""

# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE=""

# ORACLEASM_USE_LOGICAL_BLOCK_SIZE: 'true' means use the logical block size
# reported by the underlying disk instead of the physical. The default
# is 'false'
ORACLEASM_USE_LOGICAL_BLOCK_SIZE=false

Step #7: By default “ORACLEASM_USE_LOGICAL_BLOCK_SIZE” is set = “FALSE”, therefore you will need to set it to “TRUE”:

[root@asmlnx1 ~]# /usr/sbin/oracleasm configure -b
Writing Oracle ASM library driver configuration: done


Step #8: Check the new configuration in the  “/etc/sysconfig/oracleasm” file (now "ORACLEASM_USE_LOGICAL_BLOCK_SIZE" is set to "TRUE"):

[root@asmlnx1 ~]# cat /etc/sysconfig/oracleasm
#
# This is a configuration file for automatic loading of the Oracle
# Automatic Storage Management library kernel driver.  It is generated
# By running /etc/init.d/oracleasm configure.  Please use that method
# to modify this file
#

# ORACLEASM_ENABLED: 'true' means to load the driver on boot.
ORACLEASM_ENABLED=true

# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.
ORACLEASM_UID=grid

# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.
ORACLEASM_GID=asmadmin

# ORACLEASM_SCANBOOT: 'true' means scan for ASM disks on boot.
ORACLEASM_SCANBOOT=true

# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER=""

# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE=""

# ORACLEASM_USE_LOGICAL_BLOCK_SIZE: 'true' means use the logical block size
# reported by the underlying disk instead of the physical. The default
# is 'false'
ORACLEASM_USE_LOGICAL_BLOCK_SIZE=true

Note 2: Alternatively you manually set “ORACLEASM_USE_LOGICAL_BLOCK_SIZE” to 'FALSE' or 'TRUE' in “/etc/sysconfig/oracleasm”, where 'TRUE' means to use the “logical block size” and 'FALSE' the “physical block size”. The default is 'FALSE'.

Step #9: Start the ASMLIB API on all the nodes as root user:

# /etc/init.d/oracleasm start


Step #10: Start the ASM instance(s):on all the nodes as root user:

a) On RAC configurations you need to start the CRS stack on all the nodes (as root user):
# <Grid Infrastructure Oracle Home>/bin/crsctl start crs

b) On Restart/Standalone configurations you need to start the HAS stack on all the nodes (as root user):

# <Grid Infrastructure Oracle Home>/bin/crsctl start has



Appendix A: After implement the “oracleasm-support-2.1.8” RPM fix, the SECTOR_SIZE is v$ASM_DISK will be 4096 as follows:


  
SQL> SELECT NAME, PATH, SECTOR_SIZE FROM V$ASM_DISK;

NAME                           PATH                                               SECTOR_SIZE
------------------------------ -------------------------------------------------- -----------
ASMDISK2                       ORCL:ASMDISK2                                              4096
ASMDISK3                       ORCL:ASMDISK3                                              4096
ASMDISK4                       ORCL:ASMDISK4                                              4096
ASMDISK5                       ORCL:ASMDISK5                                              4096
ASMDISK6                       ORCL:ASMDISK6                                              4096
  
  
Appendix B: Apart from “oracleasm-support-2.1.8” RPM, if you are an Oracle Linux customer, then you will need uek2 kernel 2.6.39-400.4.0 and above to implement this functionality. If you are a SUSE Linux customer then you will need SLES11 kernels.

  

  DAILY CHECKLIST Oracle Database instance is running or not select name,open_mode from V$database; Note: Check the Oracle databases are ru...