ASM下裸裝置的路徑更改是否會影響資料庫的運行,asm會影響

來源:互聯網
上載者:User

ASM下裸裝置的路徑更改是否會影響資料庫的運行,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 sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 12:55:25 2014Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing optionsSQL> col name for a30SQL> col label for a30SQL> col path for a30SQL> set linesize 200SQL> /NAME       LABEL      PATH------------------------------ ------------------------------ ------------------------------DG1_0000      /dev/raw/raw3DG2_0000      /dev/raw/raw4DG3_0000      /dev/raw/raw5DG3_0001      /dev/raw/raw6DG4_0000      /dev/raw/raw7      /dev/raw/raw2      /dev/raw/raw17 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 sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 12:56:38 2014Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing optionsSQL> col name for a30SQL> col label for a30SQL> col path for a30SQL> set linesize 200SQL> select name,label,path from v$asm_disk order by 1;NAME       LABEL      PATH------------------------------ ------------------------------ ------------------------------DG1_0000      /dev/raw/raw3DG2_0000      /dev/raw/raw4DG3_0000      /dev/raw/raw5DG3_0001      /dev/raw/raw6DG4_0000      /dev/raw/raw7      /dev/raw/raw2      /dev/raw/raw17 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     USERSSQL> 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(*)----------       128SQL> 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 sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 13:13:01 2014Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing optionsSQL> col name for a30SQL> col lable for a33SQL> col path for a33SQL> set linesize 222SQL> col label for a31SQL> /NAME       LABEL       PATH------------------------------ ------------------------------- ---------------------------------DG1_0000       /dev/raw/raw7DG2_0000       /dev/raw/raw6DG3_0000       /dev/raw/raw5DG3_0001       /dev/raw/raw4DG4_0000       /dev/raw/raw3       /dev/raw/raw1       /dev/raw/raw27 rows selected.SQL> ho ssh oracle@node2Last login: Sun Aug 31 12:56:27 2014 from node1[oracle@node2 ~]$ export ORACLE_SID=+ASM2[oracle@node2 ~]$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 13:14:31 2014Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing optionsSQL> col name for a31SQL> col label for a31SQL> col path for a31SQL> set linesize 211SQL> select name,label,path from v$asm_disk order by 1;NAMELABELPATH------------------------------- ------------------------------- -------------------------------DG1_0000/dev/raw/raw3DG2_0000/dev/raw/raw4DG3_0000/dev/raw/raw5DG3_0001/dev/raw/raw6DG4_0000/dev/raw/raw7/dev/raw/raw2/dev/raw/raw17 rows selected.SQL> exitDisconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing options[oracle@node2 ~]$ export ORACLE_SID=easy2[oracle@node2 ~]$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 31 13:15:31 2014Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, OLAP, Data Miningand Real Application Testing optionsSQL> select count(*) from t1;  COUNT(*)----------       128SQL> select min(id),max(id) from t1;   MIN(ID)    MAX(ID)---------- ---------- 1  128

由此可見,裸裝置路徑和名稱的改變不會影響asm的使用,但是,我們依然建議保持路徑名稱的穩定性,方便管理。





想在Linux的環境下在ASM上建立Oracle資料庫,可是沒有ASM磁碟,應該怎做?

正好剛整理了一個這方面的資料,先貼給你吧.
準備ASM環境
ASM使用一個名叫“+ASM”的資料庫執行個體來管理ASM磁碟,因此在配置ASM磁碟之前,需要先啟動ASM執行個體。另外還需要注意,ASM 執行個體必須要先於資料庫執行個體啟動,和資料庫執行個體同步運行,遲於資料庫執行個體關閉。ASM 執行個體的建立和刪除可以用DBCA 工具來操作。在DBCA的第一個介面選擇配置自動儲存管理就可以進入ASM配置的介面。
根據提示運行指令碼就可以配置和啟動CSS(Cluster Synchronization Service)了,注意要以root的身份運行這個指令碼,運行情況如下:
# /u01/app/oracle/product/10.2.0/db_1/bin/localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
s1
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
ASM可以使用裸裝置或者ASMLib方式, 因為裸裝置的維護更羅嗦一些,本文只討論ASMLib方式。為了在Linux系統中使用ASMLib方式準備ASM磁碟,需要安裝相關的軟體,下載連結如下:

www.oracle.com/...x.html
下載時注意選擇自己的作業系統和核心的版本,我下載到的是以下三個軟體:
oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.4-1.el5.i386.rpm
這裡特別需要注意第一個軟體要和你的Linux核心的版本一致。(其實我的核心版本是2.6.18-155.el5,但是在官方網站找不到完全對應的版本,只好使用這個2.6.18-164.el5的版本了,後面會講怎麼解決這個問題。)接下來進行軟體的安裝,只需要使用rpm命令即可。

# rpm -ivh oracleasm*
現在安裝oracleasm模組可能會報錯,......餘下全文>>
 
oracle rac 一般要是在生產上安裝的話是用ASM還是裸裝置

11g已經不再支援裸裝置,oracle正在逐步強制使用asm,當然檔案系統始終支援
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.