Redhat 下raw device建庫介紹(ZT)

paulyibinyi發表於2009-05-05

Redhat 下raw device建庫介紹:

1、 Vmware下先虛擬一塊新的磁碟,大小選擇6G;啟動redhat;


2、 在redhat下可以檢視新磁碟情況:fdisk –l

看到新加的硬碟資訊為:

Disk /dev/sdb: 6442MB *****

3、 先對磁碟/dev/sdb進行分割槽:

fdisk /dev/sdb

m是檢視幫助資訊

n建立新的分割槽:(d是刪除分割槽)

選擇是primary partition(1-4), extended

分割槽partition號,開始磁碟柱面,結束磁碟柱面;

建立後,可以選擇p,顯示分割槽資訊;

最後w,儲存退出;

4、 建立pv(pvcreate / pvremove/ pvdisplay)

fdisk –l可以看到新的分割槽情況,此時可看到一個device boot: /dev/sdb1

pvcreate /dev/sdb1

5、 建立vg (vgcreate/ vgremove/ vgdisplay)

vgcreate oravg /dev/sdb1

6、 建立lv(lvcreate/ lvremove /lvdisplay)

注意建立LV時必須比在將來資料庫使用時多分配出一些空間:

A、建庫時檔案大小如果與LV大小相同會報錯;

B、LV不能自動擴充套件;

[root@liqlx4 ~]# lvdisplay

[root@liqlx4 ~]# lvcreate -L 10m -n lv_spfile oravg

Rounding up size to full physical extent 12.00 MB

Logical volume "lv_spfile" created

[root@liqlx4 ~]# lvcreate -L 50m -n lv_control1 oravg

Rounding up size to full physical extent 52.00 MB

Logical volume "lv_control1" created

[root@liqlx4 ~]# lvcreate -L 50m -n lv_control2 oravg

Rounding up size to full physical extent 52.00 MB

Logical volume "lv_control2" created

[root@liqlx4 ~]# lvcreate -L 210m -n lv_redo111 oravg

Rounding up size to full physical extent 212.00 MB

Logical volume "lv_redo111" created

[root@liqlx4 ~]# lvcreate -L 210m -n lv_redo121 oravg

Rounding up size to full physical extent 212.00 MB

Logical volume "lv_redo121" created

[root@liqlx4 ~]# lvcreate -L 210m -n lv_redo131 oravg

Rounding up size to full physical extent 212.00 MB

Logical volume "lv_redo131" created

[root@liqlx4 ~]# lvcreate -L 1036m -n lv_system1 oravg

Logical volume "lv_system1" created

[root@liqlx4 ~]# lvcreate -L 1036m -n lv_temp1 oravg

Logical volume "lv_temp1" created

[root@liqlx4 ~]# lvcreate -L 520m -n lv_user1 oravg

Logical volume "lv_user1" created

[root@liqlx4 ~]# lvcreate -L 396m -n lv_sysaux1 oravg

Logical volume "lv_sysaux1" created

[root@liqlx4 ~]# lvcreate -L 1036m -n lv_undotbs1 oravg

Logical volume "lv_undotbs1" created

[root@liqlx4 ~]#

7、 將lv繫結對應的raw裝置:

[root@liqlx4 ~]# cd /dev/raw

bash: cd: /dev/raw: No such file or directory

[root@liqlx4 ~]# cd /dev

[root@liqlx4 dev]# ls raw

ls: raw: No such file or directory

[root@liqlx4 dev]# raw /dev/raw/raw1 /dev/oravg/lv_spfile

/dev/raw/raw1: bound to major 253, minor 0

[root@liqlx4 dev]# ls raw

raw1

[root@liqlx4 dev]# pwd

/dev

[root@liqlx4 dev]# cd raw

[root@liqlx4 raw]# ls

raw1

[root@liqlx4 raw]# pwd

/dev/raw

[root@liqlx4 raw]#

[root@liqlx4 raw]# raw /dev/raw/raw2 /dev/oravg/lv_control1

/dev/raw/raw2: bound to major 253, minor 1

[root@liqlx4 raw]# raw /dev/raw/raw3 /dev/oravg/lv_control2

/dev/raw/raw3: bound to major 253, minor 2

[root@liqlx4 raw]# raw /dev/raw/raw4 /dev/oravg/lv_redo111

/dev/raw/raw4: bound to major 253, minor 3

[root@liqlx4 raw]# raw /dev/raw/raw5 /dev/oravg/lv_redo121

/dev/raw/raw5: bound to major 253, minor 4

[root@liqlx4 raw]# raw /dev/raw/raw6 /dev/oravg/lv_redo131

/dev/raw/raw6: bound to major 253, minor 5

[root@liqlx4 raw]# raw /dev/raw/raw7 /dev/oravg/lv_system1

/dev/raw/raw7: bound to major 253, minor 6

[root@liqlx4 raw]# raw /dev/raw/raw8 /dev/oravg/lv_temp1

/dev/raw/raw8: bound to major 253, minor 7

[root@liqlx4 raw]# raw /dev/raw/raw9 /dev/oravg/lv_user1

/dev/raw/raw9: bound to major 253, minor 8

[root@liqlx4 raw]# raw /dev/raw/raw10 /dev/oravg/lv_sysaux1

/dev/raw/raw10: bound to major 253, minor 9

[root@liqlx4 raw]# raw /dev/raw/raw11 /dev/oravg/lv_undotbs1

/dev/raw/raw11: bound to major 253, minor 10

8、 配置系統自動載入裸裝置:

[root@liqlx4 raw]# cd /etc/sysconfig

[root@liqlx4 sysconfig]# vi rawdevices

/dev/raw/raw1 /dev/oravg/lv_spfile

/dev/raw/raw2 /dev/oravg/lv_control1

/dev/raw/raw3 /dev/oravg/lv_control2

/dev/raw/raw4 /dev/oravg/lv_redo111

/dev/raw/raw5 /dev/oravg/lv_redo121

/dev/raw/raw6 /dev/oravg/lv_redo131

/dev/raw/raw7 /dev/oravg/lv_system1

/dev/raw/raw8 /dev/oravg/lv_temp1

/dev/raw/raw9 /dev/oravg/lv_user1

/dev/raw/raw10 /dev/oravg/lv_sysaux1

/dev/raw/raw11 /dev/oravg/lv_undotbs1


9、 將相應RAW授權給ORACLE使用者:

chown –R oracle:oinstall /dev/raw/*

chmod 777 /dev/raw/*

配置自動授權:

[root@liqlx4 rc.d]# pwd

/etc/rc.d

[root@liqlx4 rc.d]# vi rc.local

chown -R oracle:oinstall /dev/raw/*

chmod 777 /dev/raw/*


10、編寫ORACLE裸裝置配置檔案,DBCA得到建庫指令碼:

建立DBCA 裸裝置的dbca_raw_config配置檔案:

控制檔案資訊:


資料檔案資訊:


選擇生成指令碼:

 

指令碼生成完畢:


[oracle@liqlx4 dbs]$ pwd

/u01/app/oracle/product/ora10g/dbs

[oracle@liqlx4 dbs]$ vi dbca_raw_config

spfile=/dev/raw/raw1

control1=/dev/raw/raw2

control2=/dev/raw/raw3

redo1_1=/dev/raw/raw4

redo2_1=/dev/raw/raw5

redo3_1=/dev/raw/raw6

system=/dev/raw/raw7

temp=/dev/raw/raw8

users=/dev/raw/raw9

sysaux=/dev/raw/raw10

undotbs1=/dev/raw/raw11


dbca得到建庫指令碼;

11、執行建庫指令碼:

cd $ORACLE_BASE/admin/lx4raw10g/scripts

sh lx4raw10g.sh

12、進入資料庫檢視資料庫狀態是否正常:

Sqlplus “/ as sysdba”

SPFILE檔案:

SQL> show parameter pfile;


NAME TYPE

------------------------------------ ----------------------

VALUE

------------------------------

spfile string

/dev/raw/raw1

控制檔案:

SQL> select name from v$controlfile;


NAME

--------------------------------------------------------------------------------

/dev/raw/raw2

/dev/raw/raw3


SQL> select member from v$logfile order by group#;


MEMBER

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/dev/raw/raw4

/dev/raw/raw5

/dev/raw/raw6


資料表空間:

TABLESPACE_NAME FILE_NAME

--------------- ------------------------------

SYSAUX /dev/raw/raw10

UNDOTBS1 /dev/raw/raw11

SYSTEM /dev/raw/raw7

USERS /dev/raw/raw9


臨時表空間:

TABLESPACE_NAME FILE_NAME

--------------- ------------------------------

TEMP /dev/raw/raw8


至此,裸裝置全庫建立完畢,狀態正常。

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-592694/,如需轉載,請註明出處,否則將追究法律責任。

相關文章