Home Database Mysql Tutorial Linux安装单实例Oracle11g ASM

Linux安装单实例Oracle11g ASM

Jun 07, 2016 pm 03:50 PM
asm linux Install Example

环境: OS:Redhat 5.5 64Bit DB:Oracle 11.2.0.3 64Bit Grid/Database VM 虚拟机 说明:在Oracle10g 版本中两种是在一个介质中,11g是分为两个介质。 步骤: 1:Linux系统磁盘管理(磁盘组、裸设备等) 2:Grid软件安装 3:Database软件安装 4:ASM管理 一

环境:

OS:Redhat 5.5 64Bit

DB:Oracle 11.2.0.3 64Bit  Grid/Database

VM 虚拟机

说明:在Oracle10g 版本中两种是在一个介质中,11g是分为两个介质。


步骤:

1:Linux系统磁盘管理(磁盘组、裸设备等)

2:Grid软件安装

3:Database软件安装

4:ASM管理


一:Linux系统磁盘管理

一般情况下,我们都是在我的虚拟机做实验,所以,我一开始规划了硬盘存储比如40GB,安装完Linux操作系统,系统只有一个sda,而且默认情况下这个容量不能再分配空间了,我们需要再添加一块硬盘,使用fdisk命令如下

[root@asm ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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        5221    41833260   8e  Linux LVM

Disk /dev/sdb: 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/sdb1               1         974     7823623+  83  Linux
/dev/sdb2             975        1948     7823655   83  Linux
Copy after login
新添加的一块磁盘 sdb 20GB ,我们就在这个磁盘上进行测试,我可以在sdb磁盘上创建分区,设置分区大小比如创建sdb1(8G),sdb2(8G)
root@asm ~]# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
----------输入m 查看帮助
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
-------------输入p查看
Command (m for help): p

Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf9f81f26

   Device Boot      Start         End      Blocks   Id  System
-----------输入n新建分区(e是扩展分区,p是主要分区)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Copy after login
-----------创建主分区,输入分区号1,设置大小+8G
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +8G

Command (m for help): p

Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf9f81f26

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1045     8393931   83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1046-2610, default 1046): 
Using default value 1046
Last cylinder, +cylinders or +size{K,M,G} (1046-2610, default 2610): +8G       

Command (m for help): p

Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf9f81f26

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1045     8393931   83  Linux
/dev/sdb2            1046        2090     8393962+  83  Linux
-----------输入w保存
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
Copy after login

Copy after login
创建了两个分区,我们需要进行一个操作partprobe。

原因:linux上,在安装系统之后,创建分区并且在不重新启动机器的情况下系统能够识别这些分区需要使用partprobe。

到目前为止,我们的这些分区

1:可以直接Mount路径进行文件系统的存储

使用分区,要进行格式化,比如下面是格式化为ext3的文件系统mkfs.ext3  /dev/sdb1

2:Oracle数据库挂接裸设备

下面是怎么将分区文件映射为裸设备,我们需要在如下文件添加记录

[root@asm ~]# more /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw
2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
KERNEL=="raw*", OWNER="grid" GROUP="dba", MODE="0660"
Copy after login
前两行是将我新创建的分区映射为不同的raw

然后是将我的文件权限赋予grid用户(后面安装Grid需要创建)

执行完毕,保存文件需要重启一下服务 start_udev

然后查看raw路径

[root@asm ~]# ls /dev/raw
raw1  raw2
Copy after login

二:安装Grid软件

其实安装Grid软件,比较简单,如果安装过DB软件,基本上一样,在安装界面有几个需要注意

1:创建grid用户  所属dba组

2:安装软件,在安装过程中需要注意如下界面

Linux安装单实例Oracle11g ASM

创建ASM磁盘组,名字griddg,选择相关的裸设备raw1

Linux安装单实例Oracle11g ASM

剩下的基本默认安装即可

3:配置一下grid用户的环境变量


安装完毕之后,可以查看操作系统是否有asm进程

[grid@asm ~]$ ps -ef | grep  asm
avahi     3322     1  0 11:03 ?        00:00:00 avahi-daemon: running [asm.local]
grid     26982     1  0 12:51 ?        00:00:00 asm_pmon_+ASM
grid     26984     1  0 12:51 ?        00:00:00 asm_psp0_+ASM
grid     26986     1  0 12:51 ?        00:00:00 asm_vktm_+ASM
grid     26990     1  0 12:51 ?        00:00:00 asm_gen0_+ASM
grid     26992     1  0 12:51 ?        00:00:00 asm_diag_+ASM
grid     26994     1  0 12:51 ?        00:00:00 asm_dia0_+ASM
grid     26996     1  0 12:51 ?        00:00:00 asm_mman_+ASM
grid     26998     1  0 12:51 ?        00:00:00 asm_dbw0_+ASM
grid     27000     1  0 12:51 ?        00:00:00 asm_lgwr_+ASM
grid     27002     1  0 12:51 ?        00:00:00 asm_ckpt_+ASM
grid     27004     1  0 12:51 ?        00:00:00 asm_smon_+ASM
grid     27006     1  0 12:51 ?        00:00:00 asm_rbal_+ASM
grid     27008     1  0 12:51 ?        00:00:00 asm_gmon_+ASM
grid     27010     1  0 12:51 ?        00:00:00 asm_mmon_+ASM
grid     27012     1  0 12:51 ?        00:00:00 asm_mmnl_+ASM
grid     27081 27056  0 12:56 pts/4    00:00:00 grep asm
Copy after login
同样,也可以连接sqlplus,查询相关视图信息
login as: grid
grid@192.168.100.203's password:
Last login: Wed Dec 11 12:36:47 2013 from 192.168.100.111
-----------这里面必须使用sysasm来登录而不能使用sysdba
[grid@asm ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 11 13:07:41 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option

SQL> set line 2000
SQL> set long 2000
---------查看磁盘状态,现在是两个裸设备Raw1和raw2,raw1已经被使用了创建griddg磁盘组了
SQL> select name,path from v$asm_disk;

NAME                           PATH
------------------------------ ------------------
                               /dev/raw/raw2
GRIDDG_0000                    /dev/raw/raw1


-----------查看磁盘组状态,可以看到griddg是mounted状态
SQL> select name ,state from v$asm_diskgroup;

NAME                           STATE
------------------------------ -----------
GRIDDG                         MOUNTED

Copy after login

关于ASM的相关视图,可以参考如下

Linux安装单实例Oracle11g ASM


同样,ASM也提供了ASMCMD命令来让用户更好的管理ASM

[grid@asm ~]$ asmcmd
ASMCMD> help

            asmcmd [-V] [-v <errors>] [--privilege <s ysasm>] [-p] [command]
asmcmd_no_conn_str

        Starts asmcmd or executes the command

        asmcmd [-V] [-v <errors>] [--privilege <sysas m>] [-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
        SYSASM.  The user must be a member of the OSASM group.

        Specifying the -V option prints the asmcmd version number and
        exits immediately.

        Specifying the -v option prints extra information that can help
        advanced users diagnose problems.

        Specify the --privilege option to choose the type of connection. There a                                                                                                              re
        only two possibilities: connecting as SYSASM or as SYSDBA.
        The default value if this option is unspecified is SYSASM.

        Specifying the -p option allows the current directory to be displayed
        in the command prompt, like so:

        ASMCMD [+DATA/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:
        --------

        md_backup, md_restore

        lsattr, setattr

        cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
        mkdir, pwd, rm, rmalias

        chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
        offline, online, rebal, remap, umount

        dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
        spmove, spset, startup

        chtmpl, lstmpl, mktmpl, rmtmpl

        chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
        mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

        volcreate, voldelete, voldisable, volenable, volinfo
        volresize, volset, volstat
</sysas></errors></s></errors>
Copy after login

三:安装DB软件

在安装DB软件之前,需要使用ASMCA来创建数据磁盘组

Linux安装单实例Oracle11g ASM


点击创建

Linux安装单实例Oracle11g ASM

创建完毕之后,我们就可以安装DB软件了

安装DB软件,我们选择先安装软件,后建库的模式

Linux安装单实例Oracle11g ASM

安装完软件,配置好oracle用户的环境变量,然后执行dbca,选择自定义建库模式

Linux安装单实例Oracle11g ASM

在选择数据库存储的时候 选择ASM,然后选择区域即可

Linux安装单实例Oracle11g ASM

我们可以使用sqlplus连接,查看文件存储位置来确认是否建库完毕

[oracle@asm ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 11 17:58:29 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DATADG/orcl/datafile/system.260.833896429
+DATADG/orcl/datafile/sysaux.261.833896455
+DATADG/orcl/datafile/undotbs1.262.833896477
+DATADG/orcl/datafile/users.264.833896499
Copy after login


Statement of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

How to use VSCode How to use VSCode Apr 15, 2025 pm 11:21 PM

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages ​​and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

See all articles