搜索
首页数据库mysql教程在oracle 10 g 下安装ASM【未曾亲自试验】

环境: 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>


声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
说明InnoDB重做日志和撤消日志的作用。说明InnoDB重做日志和撤消日志的作用。Apr 15, 2025 am 12:16 AM

InnoDB使用redologs和undologs确保数据一致性和可靠性。1.redologs记录数据页修改,确保崩溃恢复和事务持久性。2.undologs记录数据原始值,支持事务回滚和MVCC。

在解释输出(类型,键,行,额外)中要查找的关键指标是什么?在解释输出(类型,键,行,额外)中要查找的关键指标是什么?Apr 15, 2025 am 12:15 AM

EXPLAIN命令的关键指标包括type、key、rows和Extra。1)type反映查询的访问类型,值越高效率越高,如const优于ALL。2)key显示使用的索引,NULL表示无索引。3)rows预估扫描行数,影响查询性能。4)Extra提供额外信息,如Usingfilesort提示需要优化。

在解释中使用临时状态以及如何避免它是什么?在解释中使用临时状态以及如何避免它是什么?Apr 15, 2025 am 12:14 AM

Usingtemporary在MySQL查询中表示需要创建临时表,常见于使用DISTINCT、GROUPBY或非索引列的ORDERBY。可以通过优化索引和重写查询避免其出现,提升查询性能。具体来说,Usingtemporary出现在EXPLAIN输出中时,意味着MySQL需要创建临时表来处理查询。这通常发生在以下情况:1)使用DISTINCT或GROUPBY时进行去重或分组;2)ORDERBY包含非索引列时进行排序;3)使用复杂的子查询或联接操作。优化方法包括:1)为ORDERBY和GROUPB

描述不同的SQL交易隔离级别(读取未读取,读取,可重复的读取,可序列化)及其在MySQL/InnoDB中的含义。描述不同的SQL交易隔离级别(读取未读取,读取,可重复的读取,可序列化)及其在MySQL/InnoDB中的含义。Apr 15, 2025 am 12:11 AM

MySQL/InnoDB支持四种事务隔离级别:ReadUncommitted、ReadCommitted、RepeatableRead和Serializable。1.ReadUncommitted允许读取未提交数据,可能导致脏读。2.ReadCommitted避免脏读,但可能发生不可重复读。3.RepeatableRead是默认级别,避免脏读和不可重复读,但可能发生幻读。4.Serializable避免所有并发问题,但降低并发性。选择合适的隔离级别需平衡数据一致性和性能需求。

MySQL与其他数据库:比较选项MySQL与其他数据库:比较选项Apr 15, 2025 am 12:08 AM

MySQL适合Web应用和内容管理系统,因其开源、高性能和易用性而受欢迎。1)与PostgreSQL相比,MySQL在简单查询和高并发读操作上表现更好。2)相较Oracle,MySQL因开源和低成本更受中小企业青睐。3)对比MicrosoftSQLServer,MySQL更适合跨平台应用。4)与MongoDB不同,MySQL更适用于结构化数据和事务处理。

MySQL索引基数如何影响查询性能?MySQL索引基数如何影响查询性能?Apr 14, 2025 am 12:18 AM

MySQL索引基数对查询性能有显着影响:1.高基数索引能更有效地缩小数据范围,提高查询效率;2.低基数索引可能导致全表扫描,降低查询性能;3.在联合索引中,应将高基数列放在前面以优化查询。

MySQL:新用户的资源和教程MySQL:新用户的资源和教程Apr 14, 2025 am 12:16 AM

MySQL学习路径包括基础知识、核心概念、使用示例和优化技巧。1)了解表、行、列、SQL查询等基础概念。2)学习MySQL的定义、工作原理和优势。3)掌握基本CRUD操作和高级用法,如索引和存储过程。4)熟悉常见错误调试和性能优化建议,如合理使用索引和优化查询。通过这些步骤,你将全面掌握MySQL的使用和优化。

现实世界Mysql:示例和用例现实世界Mysql:示例和用例Apr 14, 2025 am 12:15 AM

MySQL在现实世界的应用包括基础数据库设计和复杂查询优化。1)基本用法:用于存储和管理用户数据,如插入、查询、更新和删除用户信息。2)高级用法:处理复杂业务逻辑,如电子商务平台的订单和库存管理。3)性能优化:通过合理使用索引、分区表和查询缓存来提升性能。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
4 周前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
1 个月前By尊渡假赌尊渡假赌尊渡假赌

热工具

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。

Dreamweaver Mac版

Dreamweaver Mac版

视觉化网页开发工具

安全考试浏览器

安全考试浏览器

Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

MinGW - 适用于 Windows 的极简 GNU

MinGW - 适用于 Windows 的极简 GNU

这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。