ASM下裸设备的路径更改是否会影响数据库的执行

通过asm来存储数据库文件,在linux下能够通过asmlib的方式来管理块设备,也能够直接使用裸设备来建立asm磁盘。在asmlib方式下,磁盘设备启动顺序和名称的改变不会影响到asm的使用。但假设直接使用裸设备会怎么样那?我们知道asm会在磁盘中存储与asm有关的元数据,通过这些元数据asm能够了解磁盘的相关信息,因此理论上裸设备名称的改变不会影响asm的正常使用。以下,通过实验来验证一下。

首先看下面。裸设备的配置文件

node1

[root@node1 ~]# cat /etc/udev/rules.d/60-raw.rules 
# Enter raw device bindings here.
#
# An example would be:
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdb8", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sdb9", RUN+="/bin/raw /dev/raw/raw7 %N"
node2:

[root@node2 rules.d]# cat 60-raw.rules 
# Enter raw device bindings here.
#
# An example would be:
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdb8", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sdb9", RUN+="/bin/raw /dev/raw/raw7 %N"
asm下的磁盘信息例如以下:

[oracle@node1 ~]$ export ORACLE_SID=+ASM1
[oracle@node1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 12:55:25 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> col name for a30
SQL> col label for a30
SQL> col path for a30
SQL> set linesize 200
SQL> /

NAME			       LABEL			      PATH
------------------------------ ------------------------------ ------------------------------
DG1_0000						      /dev/raw/raw3
DG2_0000						      /dev/raw/raw4
DG3_0000						      /dev/raw/raw5
DG3_0001						      /dev/raw/raw6
DG4_0000						      /dev/raw/raw7
							      /dev/raw/raw2
							      /dev/raw/raw1

7 rows selected.

SQL> ho ssh node2 
Last login: Sat Aug 30 17:56:54 2014 from node1
[oracle@node2 ~]$ export ORACLE_SID=+ASM2
[oracle@node2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 12:56:38 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> col name for a30
SQL> col label for a30
SQL> col path for a30
SQL> set linesize 200
SQL> select name,label,path from v$asm_disk order by 1;

NAME			       LABEL			      PATH
------------------------------ ------------------------------ ------------------------------
DG1_0000						      /dev/raw/raw3
DG2_0000						      /dev/raw/raw4
DG3_0000						      /dev/raw/raw5
DG3_0001						      /dev/raw/raw6
DG4_0000						      /dev/raw/raw7
							      /dev/raw/raw2
							      /dev/raw/raw1

7 rows selected.


创建測试表:

SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME				     TABLESPACE_NAME
-------------------------------------------- ------------------------------
+DG4/easy/datafile/system.272.856543875      SYSTEM
+DG4/easy/datafile/undotbs1.273.856543885    UNDOTBS1
+DG4/easy/datafile/sysaux.274.856543891      SYSAUX
+DG4/easy/datafile/undotbs2.276.856543901    UNDOTBS2
+DG4/easy/datafile/users.277.856543905	     USERS

SQL> create table t1 (id number,name varchar2(20)) tablespace users;

Table created.

SQL> insert into t1 values(1,111);

1 row created.

SQL> insert into t1 select * from t1;

1 row created.

SQL> /

2 rows created.

SQL> /

4 rows created.

SQL> /

8 rows created.

SQL> /

16 rows created.

SQL> /

32 rows created.

SQL> /

64 rows created.

SQL> commit;

Commit complete.

SQL> select count(*) from t1;

  COUNT(*)
----------
       128

SQL> update t1 set id=rownum,name=rownum;

128 rows updated.

SQL> commit;

Commit complete.

改动裸设备的路径名称并重起集群

[root@node1 ~]# cat /etc/udev/rules.d/60-raw.rules 
# Enter raw device bindings here.
#
# An example would be:
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdb8", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdb9", RUN+="/bin/raw /dev/raw/raw3 %N"
[oracle@node1 ~]$ export ORACLE_SID=+ASM1
[oracle@node1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 13:13:01 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> col name for a30
SQL> col lable for a33
SQL> col path for a33
SQL> set linesize 222
SQL> col label for a31
SQL> /

NAME			       LABEL			       PATH
------------------------------ ------------------------------- ---------------------------------
DG1_0000						       /dev/raw/raw7
DG2_0000						       /dev/raw/raw6
DG3_0000						       /dev/raw/raw5
DG3_0001						       /dev/raw/raw4
DG4_0000						       /dev/raw/raw3
							       /dev/raw/raw1
							       /dev/raw/raw2

7 rows selected.

SQL> ho ssh oracle@node2
Last login: Sun Aug 31 12:56:27 2014 from node1
[oracle@node2 ~]$ export ORACLE_SID=+ASM2
[oracle@node2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 13:14:31 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> col name for a31
SQL> col label for a31
SQL> col path for a31
SQL> set linesize 211
SQL> select name,label,path from v$asm_disk order by 1;

NAME				LABEL				PATH
------------------------------- ------------------------------- -------------------------------
DG1_0000							/dev/raw/raw3
DG2_0000							/dev/raw/raw4
DG3_0000							/dev/raw/raw5
DG3_0001							/dev/raw/raw6
DG4_0000							/dev/raw/raw7
								/dev/raw/raw2
								/dev/raw/raw1

7 rows selected.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
[oracle@node2 ~]$ export ORACLE_SID=easy2
[oracle@node2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 13:15:31 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> select count(*) from t1;

  COUNT(*)
----------
       128

SQL> select min(id),max(id) from t1;

   MIN(ID)    MAX(ID)
---------- ----------
	 1	  128

由此可见,裸设备路径和名称的改变不会影响asm的使用。可是,我们依旧建议保持路径名称的稳定性,方便管理。




转载于:https://www.cnblogs.com/zhchoutai/p/6726879.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值