搜尋
首頁資料庫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漢化版

中文版,非常好用

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。