建立raw device tablespace報Linux Error: 13: Permission denied

wisdomone1發表於2013-06-21

---查詢oracle使用者的使用者組
[root@rhel5 ~]# id oracle
uid=502(oracle) gid=102(oinstall) groups=102(oinstall),103(dba)

---給新建的卷組vg2授權
[root@rhel5 ~]# chown -Rf oracle:oinstall /dev/vg2
[root@rhel5 ~]# chmod -Rf 777 /dev/vg2

---切到oracle
[root@rhel5 ~]# su - oracle
-bash-3.2$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 21 10:02:56 2013

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             159386712 bytes
Database Buffers          146800640 bytes
Redo Buffers                6336512 bytes
Database mounted.
Database opened.

SQL> select file#,name from v$datafile

     FILE# NAME
---------- --------------------------------------------------
         1 /oracle/app/oracle/oradata/zxy/system01.dbf
         2 /oracle/app/oracle/oradata/zxy/sysaux01.dbf
         3 /oracle/app/oracle/oradata/zxy/undotbs01.dbf
         4 /oracle/app/oracle/oradata/zxy/users01.dbf
         5 /oracle/newwisdomone.dbf
         6 /oracle/rawfile
         7 /oracle/rawfile2
         8 /oracle/tbs_mod1.dbf
         9 /oracle/tbs_mod2_newposition.dbf

9 rows selected.

---建立裸裝置表空間報許可權不足
SQL> create tablespace tbs_top datafile '/dev/vg2/lv2' size 30m;
create tablespace tbs_top datafile '/dev/vg2/lv2' size 30m
*
ERROR at line 1:
ORA-01119: error in creating database file '/dev/vg2/lv2'
ORA-27041: unable to open file
Linux Error: 13: Permission denied
Additional information: 1

---確認卷組vg2的許可權與使用者組,是正確的
[root@rhel5 ~]# ls -l /dev/vg2
total 0
lrwxrwxrwx 1 oracle oinstall 19 Jun 21 09:59 lv2 -> /dev/mapper/vg2-lv2 ----注意:這裡lv2是個連結檔案
[root@rhel5 ~]# ls -l /oracle/tbs_mod2_newposition.dbf
-rw-r----- 1 oracle oinstall 26222592 Jun 21 10:03 /oracle/tbs_mod2_newposition.dbf
[root@rhel5 ~]# ls -l /dev/vg2/lv2
lrwxrwxrwx 1 oracle oinstall 19 Jun 21 09:59 /dev/vg2/lv2 -> /dev/mapper/vg2-lv2

----檢視lv2連結檔案對應的真正檔案
[root@rhel5 ~]# ls -l /dev/mapper/vg2-lv2
brw-rw---- 1 root disk 253, 1 Jun 21 09:59 /dev/mapper/vg2-lv2 --可以看到還是root:disk


----給lv2對應的真正檔案授權
[root@rhel5 ~]# chown -Rf oracle:oinstall /dev/mapper/vg2-lv2
[root@rhel5 ~]# ls -l /dev/mapper/vg2-lv2
brw-rw---- 1 oracle oinstall 253, 1 Jun 21 09:59 /dev/mapper/vg2-lv2


[root@rhel5 ~]# chmod -Rf 777 /dev/mapper/vg2-lv2
[root@rhel5 ~]# su - oracle
-bash-3.2$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 21 10:07:28 2013

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


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

---建立裸裝置表空間成功
SQL> create tablespace tbs_top datafile '/dev/vg2/lv2' size 30m;

Tablespace created.


---為了防止重啟主機反覆授權直接新增裸裝置的連結及真正檔案到/etc/profile中
[root@rhel5 ~]# tail -5 /etc/profile
chown -Rf oracle:oinstall /dev/mapper/vg2-lv2
chmod -Rf 777 /dev/mapper/vg2-lv2
chown -Rf oracle:oinstall /dev/vg2
chmod -Rf 777 /dev/vg2

 

小結:

      1,連結與真正裝置檔案都要進行授權

      2,上述授權指令碼寫入到/etc/profile中

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

相關文章