Maison > base de données > tutoriel mysql > 在oracle 10 g 下安装ASM【未曾亲自试验】

在oracle 10 g 下安装ASM【未曾亲自试验】

WBOY
Libérer: 2016-06-07 15:45:25
original
1081 Les gens l'ont consulté

环境: oracle 版本:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 操作系统:Red Hat Enterprise Li nux Server release 5.5 (Tikanga) 1、首先安装oracle数据库 软件 ,然后向虚拟机中添加三块2G的硬盘,重启虚拟机 2、 安装 软件包: 2.1

环境:

oracle版本:Oracle Database10g Enterprise Edition Release 10.2.0.1.0

操作系统:Red Hat Enterprise LinuxServer release 5.5 (Tikanga)

1、 首先安装oracle数据库软件,然后向虚拟机中添加三块2G的硬盘,重启虚拟机

2、 安装软件包:

2.1、查看好系统版本,本机是redhat 5,内核版本如下:

[root@server3 dev]# uname -a

Linux server32.6.18-194.el5#1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux

2.2、上oracle官方网站,搜索关键字oracle asm red hat 5。去下载如下asm的三个rpm软件包(本机器下载的是标红的三个软件包,安装包一定要下载正确的版本否则第五步会出错,导致后续配置无法进行):

http://www.oracle.com/technetwork/topics/linux/downloads/rhel5-084877.html

Intel IA32 (x86) Architecture

Library and Tools

·        oracleasm-support-2.1.3-1.el5.i386.rpm

·        oracleasmlib-2.0.4-1.el5.i386.rpm

Drivers for kernel 2.6.18-194.el5

·        oracleasm-2.6.18-194.el5xen-2.0.5-1.el5.i686.rpm

·        oracleasm-2.6.18-194.el5debug-2.0.5-1.el5.i686.rpm

·        oracleasm-2.6.18-194.el5PAE-2.0.5-1.el5.i686.rpm

·        oracleasm-2.6.18-194.el5-debuginfo-2.0.5-1.el5.i686.rpm

·        oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm

 

2.3、安装上述的三个rpm软件包:

[root@server3 asm]# rpm -ivh *.rpm

warning: oracleasm-2.6.18-194.11.3.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159

Preparing... ########################################### [100%]

 1:oracleasm-support########################################### [ 33%]

 2:oracleasm-2.6.18-194.el###################################### [ 67%]

     3:oracleasmlib ########################################### [100%]

3、 对在1中添加进来的三个磁盘进行分区(我们添加了sdb、sdc和sdd。注意:这里是仅进行分区,而不需要进行格式化。

[root@server3 dev]# ls sd*

sda sda1 sda2 sdb sdc sdd

[root@server3 dev]# fdisk /dev/sdb

Command (m for help):n

Command action

  e  extended

  p  primary partition (1-4)

p

Partition number (1-4):1            

First cylinder (1-261, default 1):1  

Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):261

 

Command (m for help):w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

同样执行如下的命令,来对sdc和sdd进行分区:

[root@server3 dev]# fdisk /dev/sdc

[root@server3 dev]# fdisk /dev/sdd

 

查看并确认分区的情况:

[root@server3 dev]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot     Start        End     Blocks  Id System

/dev/sda1  *          1         13     104391  83 Linux

/dev/sda2             14       2610   20860402+ 8e Linux LVM

 

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

  Device Boot     Start        End     Blocks  Id System

/dev/sdb1              1        261    2096451  83 Linux

 

Disk /dev/sdc: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

  Device Boot     Start        End     Blocks  Id System

/dev/sdc1              1        261    2096451  83 Linux

 

Disk /dev/sdd: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

  Device Boot     Start        End     Blocks  Id System

/dev/sdd1              1        261    2096451  83 Linux

 

4、 配置ASM:

[root@server3 asm]# /etc/init.d/oracleasm configure

Configuring the Oracle ASM library driver.

 

This will configure the on-boot properties of the Oracle ASM library

driver. The following questions will determine whether the driver is

loaded on boot and what permissions it will have. The current values

will be shown in brackets ('[]'). Hitting without typing an

answer will keep that current value. Ctrl-C will abort.

 

Default user to own the driver interface [ ]:oracle

Default group to own the driver interface [ ]:oinstall

Start Oracle ASM library driver on boot (y/n) [y]:

Scan for Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver:                    [ OK ]

Scanning the system for Oracle ASMLib disks:              [ OK ]

5、 系统添加磁盘:

[root@server3 asm]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1

Marking disk "VOL1" as an ASM disk:                       [ OK ]

[root@server3 asm]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1

Marking disk "VOL2" as an ASM disk:                       [ OK ]

[root@server3 asm]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1

Marking disk "VOL3" as an ASM disk:                       [ OK ]

 

6、 创建ASM初始化文件init+ASM.ora,在$ORACLE_HOME/dbs目录下(可以理解为是ASM实例的pfile文件):

[oracle@localhost db_1]$ cat>>/opt/ora10g/product/10.2.0/db_1/dbs/init+ASM.ora

> *.asm_diskstring='ORCL:VOL*'

> *.background_dump_dest='/opt/ora10g/admin/+ASM/bdump'

> *.core_dump_dest='/opt/ora10g/admin/+ASM/cdump'

> *.instance_type='asm'

> *.large_pool_size=24M

> *.remote_login_passwordfile='SHARED'

> *.user_dump_dest='/opt/ora10g/admin/+ASM/udump'

> EOF

注:/opt/ora10g/product/10.2.0/db_1/是本机器的$ORACLE_HOME路径。

 

7、创建结构目录

[oracle@server3 db_1]$ mkdir -p /opt/ora10g/admin/+ASM/udump

[oracle@server3 db_1]$ mkdir -p /opt/ora10g/admin/+ASM/bdump

[oracle@server3 db_1]$ mkdir -p /opt/ora10g/admin/+ASM/cdump

 

8、创建asm实例的密码文件:

[oracle@localhost dbs]$ orapwd file=orapw+ASM password=minnow

 

9、我们来测试一个asm实例能否启动:

[oracle@server3 ~]$ sqlplus

 

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 31 20:10:11 2010

 

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

 

Enter user-name:sys as sysdba

Enter password:

Connected to an idle instance.

 

SQL> startup

ORA-29701: unable to connect to Cluster Manager

 

10、下面来添加CSS,以解决9中出现的问题。

[oracle@localhost dbs]$ localconfig add

You must be logged in as root to run /opt/ora10g/product/10.2.0/db_1//bin/localconfig.

Log in as root and restart /opt/ora10g/product/10.2.0/db_1//bin/localconfig execution.

提示需要以root来执行命令:

[root@localhost ~]# /opt/ora10g/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.

       localhost

CSS is active on all nodes.

Oracle CSS service is installed and running under init(1M)

 

11、我们再启动以下ASM实例,由于我们没有创建磁盘组,所以提示没有mount diskgroup正常:

[root@server3 ~]# su - oracle

[oracle@server3 ~]$ echo $ORACLE_SID

+ASM

[oracle@server3 ~]$ sqlplus

 

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 31 20:16:46 2010

 

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

 

Enter user-name: sys as sysdba

Enter password:

Connected to an idle instance.

 

SQL> startup

ASM instance started

 

Total System Global Area  96468992 bytes

Fixed Size                 1217908 bytes

Variable Size             70085260 bytes

ASM Cache                 25165824 bytes

ORA-15110: no diskgroups mounted

 

12、下面,可以执行dbca,开始创建数据库了:

第一步的时候,选择新建数据:

在oracle 10 g 下安装ASM【未曾亲自试验】

第三步的时候,数据库实例的SID要和ASM中的asm_diskstring参数中的SID一致本例中是SID)

在oracle 10 g 下安装ASM【未曾亲自试验】

第六步时。指定存储项为ASM:

在oracle 10 g 下安装ASM【未曾亲自试验】

 

点击Next的时候,提示需要关闭asm实例:

在oracle 10 g 下安装ASM【未曾亲自试验】

第七步时,点击Create New创建新的Disk Group:

在oracle 10 g 下安装ASM【未曾亲自试验】

给新的磁盘组取名为DATA1,并把三块硬盘都加入到改组,冗余项选择normal:

在oracle 10 g 下安装ASM【未曾亲自试验】

经过上述操作后,一个磁盘组DATA1已经创建好,并且已经加载上:

在oracle 10 g 下安装ASM【未曾亲自试验】

指定数据文件创建的位置,默认创建在DATA1磁盘组下:

在oracle 10 g 下安装ASM【未曾亲自试验】

第九步,指定Flash Recovery Area的位置和大小,按照默认的即可:

在oracle 10 g 下安装ASM【未曾亲自试验】

第十步,选择安装样例数据库:

在oracle 10 g 下安装ASM【未曾亲自试验】

第十一步,字符集我们可以进行如下的选择:

在oracle 10 g 下安装ASM【未曾亲自试验】

第十二步,查看数据库存储相关信息:

在oracle 10 g 下安装ASM【未曾亲自试验】

第十三步,点击Finish来结束配置过程,进行数据库的创建

在oracle 10 g 下安装ASM【未曾亲自试验】

在oracle 10 g 下安装ASM【未曾亲自试验】

安装过程中的截图:

在oracle 10 g 下安装ASM【未曾亲自试验】 

安装完成后的截图:

在oracle 10 g 下安装ASM【未曾亲自试验】

至此,单机上安装ASM已经完成。




我们现在可以登陆asm实例,查看下一些相关的视图:

[oracle@server3 ~]$ echo $ORACLE_SID

+ASM

[oracle@server3 ~]$ sqlplus

 

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 31 20:56:29 2010

 

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

 

Enter user-name: sys as sysdba

Enter password:

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

 

SQL> SELECT GROUP_NUMBER,INSTANCE_NAME,DB_NAME,STATUS

 2 FROM v$asm_client;

 

GROUP_NUMBER  INSTANCE_NAME   DB_NAME  STATUS

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

          1                         ORCL                 ORCL              CONNECTED

 

查看ASM中的数据文件:

SQL> set linesize 500

SQL> SELECT FILE_NUMBER,BLOCKS,BLOCK_SIZE/1024 BLOCK_KB,BYTES/1024/1024 AS MB,SPACE/1024/1024 AS MB,TYPE FROM v$asm_file;

FILE_NUMBER    BLOCKS  BLOCK_KB        MB        MB TYPE

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

       256     61441         8 480.007813       965 DATAFILE

       257     30721         8 240.007813       485 DATAFILE

       258      4481         8 35.0078125        75 DATAFILE

       259       641         8 5.0078125        12 DATAFILE

       260       431        16  6.734375        24 CONTROLFILE

       261       431        16  6.734375        24 CONTROLFILE

       262    102401        .5 50.0004883       115 ONLINELOG

       263    102401        .5 50.0004883       115 ONLINELOG

       264    102401        .5 50.0004883       115 ONLINELOG

       265    102401        .5 50.0004883       115 ONLINELOG

       266    102401        .5 50.0004883       115 ONLINELOG

 

FILE_NUMBER    BLOCKS  BLOCK_KB        MB        MB TYPE

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

       267    102401        .5 50.0004883       115 ONLINELOG

       268      2561         8 20.0078125        42 TEMPFILE

       269     12801         8 100.007813       205 DATAFILE

       270         5        .5 .002441406         2 PARAMETERFILE

 

登陆ORCL实例

[oracle@server3 ~]$ export ORACLE_SID=ORCL

[oracle@server3 ~]$ sqlplus

 

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 31 20:53:52 2010

 

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

 

Enter user-name: sys as sysdba

Enter password:

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select instance_name from v$instance;

 

INSTANCE_NAME

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

ORCL


查看表空间及其所对应的文件名。发现具体的路径不详,由ASM自动给我们的文件命名进行管理

SQL> select FILE_NAME ,TABLESPACE_NAME from dba_data_files;

FILE_NAME                                         TABLESPACE_NAME

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

+DATA1/orcl/datafile/users.259.728512919          USERS

+DATA1/orcl/datafile/sysaux.257.728512919         SYSAUX

+DATA1/orcl/datafile/undotbs1.258.728512919       UNDOTBS1

+DATA1/orcl/datafile/system.256.728512919         SYSTEM

+DATA1/orcl/datafile/example.269.728513077        EXAMPLE

 

用命令行添加新硬盘:

1、以root命令来运行oracleasm命令

[root@server3 dev]# /etc/init.d/oracleasm createdisk VOL4 /dev/sde1

Marking disk "VOL4" as an ASM disk: [ OK ]

2、登陆至ASM实例中,输入如下命令,需要有add failgroup子句:

SQL> alter diskgroup DATA1add failgroupVOL4 disk 'ORCL:VOL4';

 

可以看到,添加好了VOL4之后,会进行“重平衡”,每个磁盘的使用容量是相同的:

SQL> SELECT GROUP_NUMBER,DISK_NUMBER,NAME,TOTAL_MB,FREE_MB

 2 FROM v$asm_disk;

GROUP_NUMBER         DISK_NUMBER     NAME      TOTAL_MB   FREE_MB

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

          1          0                         VOL1         2047      1377

          1          1                         VOL2         2047      1376

          1          2                         VOL3         2047      1376

          1          3                         VOL4         2047      1377

 

Asm工具初体验

[oracle@server3 ~]$ asmcmd

ASMCMD>

ASMCMD> ls -l +DATA1/ORCL/DATAFILE

Type     Redund Striped Time            Sys Name

DATAFILE MIRROR COARSE  SEP 01 13:00:00 Y   EXAMPLE.269.728513077

DATAFILE MIRROR COARSE  SEP 01 14:00:00 Y   SYSAUX.257.728512919

DATAFILE MIRROR COARSE  SEP 01 13:00:00 Y   SYSTEM.256.728512919

DATAFILE MIRROR COARSE  SEP 01 13:00:00 Y   UNDOTBS1.258.728512919

DATAFILE MIRROR COARSE  SEP 01 13:00:00 Y   USERS.259.728512919

ASMCMD> help

       asmcmd [-p] [command]

 

       The environment variables ORACLE_HOME and ORACLE_SID determine the

       instance to which the program connects, and ASMCMD establishes a

       bequeath connection to it, in the same manner as a SQLPLUS / AS

       SYSDBA. The user must be a member of the SYSDBA group.

 

       Specifying the -p option allows the current directory to be displayed

       in the command prompt, like so:

 

       ASMCMD [+DATAFILE/ORCL/CONTROLFILE] >

 

       [command] specifies one of the following commands, along with its

       parameters.

 

       Type "help [command]" to get help on a specific ASMCMD command.

 

       commands:

       --------

       cd

       du

       find

       help

       ls

       lsct

       lsdg

       mkalias

       mkdir

       pwd

       rm

       rmalias

ASMCMD>


Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal