Chinaunix首页 | 论坛 | 博客
  • 博客访问: 109668
  • 博文数量: 55
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 630
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-13 10:59
文章分类
文章存档

2011年(1)

2009年(37)

2008年(17)

我的朋友

分类: Oracle

2009-09-04 18:20:35

    今天花了若干小时加若干分钟,尝试了一把,用 DBCA创建数据时选择裸设备,头一次尝鲜,难免花费那么一点时间,呵呵。
    我本地空间有限,所在就用虚拟机里的空间,采用 ISCSI的方式共享一个分区。关于这个步骤,简单地写一下。

虚拟机里的设置
[rac2@root ~]# cat /etc/ietd.conf |  grep -v "#"
Target iqn.2009-06.rhgfs:storage
        Lun 0 Path=/dev/sdc1,Type=fileio
[rac2@root ~]#
[rac2@root ~]# /etc/init.d/iscsi-target start

客户端添加以下内容到 /etc/iscsi/iscsid.conf里即可
DiscoveryAddress  = 192.168.228.149
        Continuous = yes
[root@max ~]# /etc/init.d/iscsid  start

客户端可以看到多了一个盘符



[root@max ~]# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20482843+  83  Linux
/dev/sda2            2551        2681     1052257+  82  Linux swap / Solaris
/dev/sda3            2682        5721    24418800   83  Linux
/dev/sda4            5722        9729    32194260   83  Linux

Disk /dev/sdb: 2147 MB, 2147411968 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes

再对其进行分区
[root@max ~]# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20482843+  83  Linux
/dev/sda2            2551        2681     1052257+  82  Linux swap / Solaris
/dev/sda3            2682        5721    24418800   83  Linux
/dev/sda4            5722        9729    32194260   83  Linux

Disk /dev/sdb: 2147 MB, 2147411968 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1           6       12431   83  Linux
/dev/sdb2               7          12       12462   83  Linux
/dev/sdb3              13          18       12462   83  Linux
/dev/sdb4              19        1009     2058307    5  Extended
/dev/sdb5              19          43       51894   83  Linux
/dev/sdb6              44          68       51894   83  Linux
/dev/sdb7              69          93       51894   83  Linux
/dev/sdb8              94         376      587760   83  Linux
/dev/sdb9             377         518      294903   83  Linux
/dev/sdb10            519         566       99665   83  Linux
/dev/sdb11            567         572       12431   83  Linux
/dev/sdb12            573         578       12431   83  Linux
/dev/sdb13            579        1009      895156   83  Linux
[root@max ~]# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2550    20482843+  83  Linux
/dev/sda2            2551        2681     1052257+  82  Linux swap / Solaris
/dev/sda3            2682        5721    24418800   83  Linux
/dev/sda4            5722        9729    32194260   83  Linux

Disk /dev/sdb: 2147 MB, 2147411968 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1           6       12431   83  Linux
/dev/sdb2               7          12       12462   83  Linux
/dev/sdb3              13          18       12462   83  Linux
/dev/sdb4              19        1009     2058307    5  Extended
/dev/sdb5              19          43       51894   83  Linux
/dev/sdb6              44          68       51894   83  Linux
/dev/sdb7              69          93       51894   83  Linux
/dev/sdb8              94         376      587760   83  Linux
/dev/sdb9             377         518      294903   83  Linux
/dev/sdb10            519         566       99665   83  Linux
/dev/sdb11            567         572       12431   83  Linux
/dev/sdb12            573         578       12431   83  Linux
/dev/sdb13            579        1009      895156   83  Linux
采用如下方式把以上分区绑到裸设备上
[root@max ~]# raw /dev/raw/raw1 /dev/sdb1
[root@max ~]# raw -qa
/dev/raw/raw1:  bound to major 8, minor 17
/dev/raw/raw2:  bound to major 8, minor 18
/dev/raw/raw3:  bound to major 8, minor 19
/dev/raw/raw4:  bound to major 8, minor 20
/dev/raw/raw5:  bound to major 8, minor 21
/dev/raw/raw6:  bound to major 8, minor 22
/dev/raw/raw7:  bound to major 8, minor 23
/dev/raw/raw8:  bound to major 8, minor 24
/dev/raw/raw9:  bound to major 8, minor 25
/dev/raw/raw10: bound to major 8, minor 26
/dev/raw/raw11: bound to major 8, minor 27
/dev/raw/raw12: bound to major 8, minor 28
/dev/raw/raw13: bound to major 8, minor 29
注意修改其权限 为 oracle 用户 dba 组

新建一个文本文件,添加如下内容
[root@max ~]# cat /tmp/raw.txt
control1=/dev/raw/raw1
control2=/dev/raw/raw2
control3=/dev/raw/raw3
redo1_1=/dev/raw/raw5
redo2_1=/dev/raw/raw6
redo3_1=/dev/raw/raw7
system=/dev/raw/raw8
sysaux=/dev/raw/raw9
temp=/dev/raw/raw10
users=/dev/raw/raw11
undotbs1=/dev/raw/raw13
为数据库必备的数据文件做个链接(如果不做链接的话,我始终没有做出来,呵呵)
[root@max ~]# cd /opt/oracle/oradata/max
[root@max max]# ls
[root@max max]# ln -s /dev/raw/raw1 control1.ctl
[root@max max]# ln -s /dev/raw/raw2 control1.ct2
[root@max max]# ln -s /dev/raw/raw3 control1.ct3
[root@max max]# ln -s /dev/raw/raw5 redo01.log
[root@max max]# ln -s /dev/raw/raw6 redo02.log
[root@max max]# ln -s /dev/raw/raw7 redo03.log
[root@max max]# ln -s /dev/raw/raw8 system01.dbf
[root@max max]# ln -s /dev/raw/raw9 sysaux01.dbf
[root@max max]# ln -s /dev/raw/raw10  temp01.dbf
[root@max max]# ln -s /dev/raw/raw11 users01.dbf
[root@max max]# ln -s /dev/raw/raw13 undotbs01.dbf
[root@max max]# ls
control1.ct2  control1.ctl  redo02.log  sysaux01.dbf  temp01.dbf     users01.dbf
control1.ct3  redo01.log    redo03.log  system01.dbf  undotbs01.dbf
[root@max max]# ll
总计 0
lrwxrwxrwx 1 root root 13 09-04 16:23 control1.ct2 -> /dev/raw/raw2
lrwxrwxrwx 1 root root 13 09-04 16:23 control1.ct3 -> /dev/raw/raw3
lrwxrwxrwx 1 root root 13 09-04 16:23 control1.ctl -> /dev/raw/raw1
lrwxrwxrwx 1 root root 13 09-04 16:24 redo01.log -> /dev/raw/raw5
lrwxrwxrwx 1 root root 13 09-04 16:24 redo02.log -> /dev/raw/raw6
lrwxrwxrwx 1 root root 13 09-04 16:24 redo03.log -> /dev/raw/raw7
lrwxrwxrwx 1 root root 13 09-04 16:25 sysaux01.dbf -> /dev/raw/raw9
lrwxrwxrwx 1 root root 13 09-04 16:24 system01.dbf -> /dev/raw/raw8
lrwxrwxrwx 1 root root 14 09-04 16:25 temp01.dbf -> /dev/raw/raw10
lrwxrwxrwx 1 root root 14 09-04 16:25 undotbs01.dbf -> /dev/raw/raw13
lrwxrwxrwx 1 root root 14 09-04 16:25 users01.dbf -> /dev/raw/raw11


至此,就可以用dbca来创建实例了,中途选“裸设备”即可,如果 报 spfile 错误的话,就用 pfile 即可。一路顺来,和平常一样。
   
SQL> select instance_name,host_name,status,logins from v$instance
  2  ;

INSTANCE_NAME                    HOST_NAME                                                                                                     STATUS
-------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ------------------------
LOGINS
--------------------
max                              max.com                                                                                                       OPEN
ALLOWED



SQL> select file_name,tablespace_name,bytes/1024/1024 M from dba_data_files;

FILE_NAME            TABLESPACE_NAME               M
-------------------- -------------------- ----------
/dev/raw/raw11       USERS                         5
/dev/raw/raw9        SYSAUX                      230
/dev/raw/raw13       UNDOTBS1                     25
/dev/raw/raw8        SYSTEM                      480


SQL> select * from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';

PROPERTY_NAME
------------------------------------------------------------
PROPERTY_VALUE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DEFAULT_TEMP_TABLESPACE
TEMP
Name of default temporary tablespace

 打完收工。



































阅读(674) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~