search
HomeDatabaseMysql Tutorial在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>


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the role of InnoDB redo logs and undo logs.Explain the role of InnoDB redo logs and undo logs.Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

What are the key metrics to look for in an EXPLAIN output (type, key, rows, Extra)?What are the key metrics to look for in an EXPLAIN output (type, key, rows, Extra)?Apr 15, 2025 am 12:15 AM

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

What is the Using temporary status in EXPLAIN and how to avoid it?What is the Using temporary status in EXPLAIN and how to avoid it?Apr 15, 2025 am 12:14 AM

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB

Describe the different SQL transaction isolation levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable) and their implications in MySQL/InnoDB.Describe the different SQL transaction isolation levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable) and their implications in MySQL/InnoDB.Apr 15, 2025 am 12:11 AM

MySQL/InnoDB supports four transaction isolation levels: ReadUncommitted, ReadCommitted, RepeatableRead and Serializable. 1.ReadUncommitted allows reading of uncommitted data, which may cause dirty reading. 2. ReadCommitted avoids dirty reading, but non-repeatable reading may occur. 3.RepeatableRead is the default level, avoiding dirty reading and non-repeatable reading, but phantom reading may occur. 4. Serializable avoids all concurrency problems but reduces concurrency. Choosing the appropriate isolation level requires balancing data consistency and performance requirements.

MySQL vs. Other Databases: Comparing the OptionsMySQL vs. Other Databases: Comparing the OptionsApr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

How does MySQL index cardinality affect query performance?How does MySQL index cardinality affect query performance?Apr 14, 2025 am 12:18 AM

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

MySQL: Resources and Tutorials for New UsersMySQL: Resources and Tutorials for New UsersApr 14, 2025 am 12:16 AM

The MySQL learning path includes basic knowledge, core concepts, usage examples, and optimization techniques. 1) Understand basic concepts such as tables, rows, columns, and SQL queries. 2) Learn the definition, working principles and advantages of MySQL. 3) Master basic CRUD operations and advanced usage, such as indexes and stored procedures. 4) Familiar with common error debugging and performance optimization suggestions, such as rational use of indexes and optimization queries. Through these steps, you will have a full grasp of the use and optimization of MySQL.

Real-World MySQL: Examples and Use CasesReal-World MySQL: Examples and Use CasesApr 14, 2025 am 12:15 AM

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.