1. 程式人生 > >Linux安裝單例項Oracle11g ASM

Linux安裝單例項Oracle11g 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命令如下

[[email protected]
~]# 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
新新增的一塊磁碟 sdb 20GB ,我們就在這個磁碟上進行測試,我可以在sdb磁碟上建立分割槽,設定分割槽大小比如建立sdb1(8G),sdb2(8G)
[email protected] ~]# 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)
-----------建立主分割槽,輸入分割槽號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.

建立了兩個分割槽,我們需要進行一個操作partprobe。

原因:linux上,在安裝系統之後,建立分割槽並且在不重新啟動機器的情況下系統能夠識別這些分割槽需要使用partprobe。

到目前為止,我們的這些分割槽

1:可以直接Mount路徑進行檔案系統的儲存

使用分割槽,要進行格式化,比如下面是格式化為ext3的檔案系統mkfs.ext3  /dev/sdb1

2:Oracle資料庫掛接裸裝置

下面是怎麼將分割槽檔案對映為裸裝置,我們需要在如下檔案新增記錄

[[email protected] ~]# 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"
前兩行是將我新建立的分割槽對映為不同的raw

然後是將我的檔案許可權賦予grid使用者(後面安裝Grid需要建立)

執行完畢,儲存檔案需要重啟一下服務 start_udev

然後檢視raw路徑

[[email protected] ~]# ls /dev/raw
raw1  raw2

二:安裝Grid軟體

其實安裝Grid軟體,比較簡單,如果安裝過DB軟體,基本上一樣,在安裝介面有幾個需要注意

1:建立grid使用者  所屬dba組

2:安裝軟體,在安裝過程中需要注意如下介面


建立ASM磁碟組,名字griddg,選擇相關的裸裝置raw1


剩下的基本預設安裝即可

3:配置一下grid使用者的環境變數

安裝完畢之後,可以檢視作業系統是否有asm程序

[[email protected] ~]$ 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
同樣,也可以連線sqlplus,查詢相關檢視資訊
login as: grid
[email protected]'s password:
Last login: Wed Dec 11 12:36:47 2013 from 192.168.100.111
-----------這裡面必須使用sysasm來登入而不能使用sysdba
[[email protected] ~]$ 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


關於ASM的相關檢視,可以參考如下


同樣,ASM也提供了ASMCMD命令來讓使用者更好的管理ASM

[[email protected] ~]$ asmcmd
ASMCMD> help

            asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <s                                                                                                              ysasm|sysdba>] [-p] [command]
asmcmd_no_conn_str

        Starts asmcmd or executes the command

        asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <sysas                                                                                                              m|sysdba>] [-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

三:安裝DB軟體

在安裝DB軟體之前,需要使用ASMCA來建立資料磁碟組


點選建立


建立完畢之後,我們就可以安裝DB軟體了

安裝DB軟體,我們選擇先安裝軟體,後建庫的模式


安裝完軟體,配置好oracle使用者的環境變數,然後執行dbca,選擇自定義建庫模式


在選擇資料庫儲存的時候 選擇ASM,然後選擇區域即可


我們可以使用sqlplus連線,檢視檔案儲存位置來確認是否建庫完畢

[[email protected] ~]$ 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

相關推薦

Linux安裝例項Oracle11g ASM

環境:OS:Redhat 5.5 64BitDB:Oracle 11.2.0.3 64Bit  Grid/DatabaseVM 虛擬機器說明:在Oracle10g 版本中兩種是在一個介質中,11g是分為兩個介質。步驟:1:Linux系統磁碟管理(磁碟組、裸裝置等)2:Grid

Linux系統下MySQL安裝(例項)

1、安裝依賴包 #yum -y  install gcc gcc-c++ ncurses-devel perl cmake bison 2、建立使用者 # groupadd mysql # useradd mysql –g mysql –s /sbin/nologi

centos6.5下編譯安裝例項MySQL5.1

MySQL5.1版本安裝3步曲: 1)         ./configure 2)         make 3)     &nbs

Linux下靜默安裝 oracle參考連結(for例項、for RAC叢集)

1. http://www.dbdream.com.cn/2012/03/03/linux%e7%8e%af%e5%a2%83%e4%b8%8b%e9%9d%99%e9%bb%98%e5%bb%ba%e5%ba%93oracle11gr2/ 2.http://www.dbd

使用DBCA安裝ASM例項出現的PRCR-1079和ORA-12547的解決方法

oracle和grid使用者下$ORACLE_HOME/bin/oracle的許可權是否為"-rwsr-s--x"且屬於oinstall組: [oracle@rtest bin]$ ls -ltr $ORACLE_HOME/bin/oracle -r-xrws--x1 oracleasmadmin2323

redhat5下安裝Oracle 11gR2實例+ASM

baseurl disk nbsp mnt tab sof ask ima mem 一、環境: 主機:redhat5 數據庫:Oracle 11gR2 硬盤:一個100G+八個2G 內存:4g 二、搭建yum倉庫 [root@oracle ~]# mkdir

Linux安裝Oracle11g說明文檔

linuxoracle安裝Linux安裝Oracle11G說明文檔 一、 安裝軟件環境準備: n Centos-6.5-X64.iso n SecureCRT.exe n FileZilla.exe n linux.x64_11gR2_database_1of2.zip n lin

linux安裝Oracle11G

stop 登錄 shm bit create onf aps 建庫 util linux安裝Oracle11G 0、下載Orcle11G http://www.cnblogs.com/mmzs/p/9030823.html 1、上傳文件到服務器或虛擬機的/ins

Linux 安裝Oracle11g的簡單步驟記錄

環境:CentOS、Redhat 步驟: 1、配置本地yum源,安裝依賴包: yum -y install gcc elfutils-libelf-devel gcc-c++ libaio-devel libstdc++-devel sysstat unixODBC unixODBC

centos部署oracle rac例項11.2.0.3資料庫(使用asm磁碟)

部署oracle rac單例項資料庫,需要安裝grid和datavase兩部分,所以首先建立兩個使用者oracle和grid,因為不能使用root使用者進行安裝,在安裝之前首先需要修改一些系統引數和安裝一些庫。 1.建立使用者和使用者組   首先是官方推薦的使用者和使用者組清單:

Linux 安裝Oracle11g完整安裝圖文教程另附基本操作(轉載),另附plsql遠端連線方法

1) 寫在前面:  Good Good Study,Day Day up 2) 最近自己在搗鼓虛擬機器上安裝oracle,花了自己前前後後大概1周時間,差點放棄.還好堅持到了最後; 3) Linux 安裝Oracle11g完整安裝圖文教程 主要參考

oper-O11gR2+ASM+RAC使用duplicate快速複製一個庫到例項

環境: 源庫:O11gR2+ASM+RAC+rhel6.4 目標庫:O11gR2+rhel6.4單例項 步驟 1、配置靜態監聽 源庫:/u01/app/11.2.0/grid_1/network/admin/listener.ora SID_LIST_LISTENER = (SID_LI

Oracle 12c 例項安裝

準備工作 實驗環境:Redhat 6.6   Oracle 12c 12.2.0.1 1、官網下載 https://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-linux-122

一、ElasticSearch例項安裝與啟動

1、下載 官方下載地址:https://www.elastic.co/downloads/elasticsearch window選擇windows版本下載: 2、啟動 下載之後,進入bin目錄敲命令.\elasticsearch啟動es PS D:\softwar

Linux安裝Memcached基於記憶體的快取及加速叢集部署防止點現象

關於實現 memcached 快取叢集可以有多種方式,一種是使用 Repcached(memcached同步補丁),Repcached 優點主要是資料冗餘,兩臺 memcached 都可以進行讀寫操作,缺點是隻支援單對單,指支援 1.2.x 版本,所以受到的侷限性

centos7安裝zookeeper-例項

下載zookeeper,http://mirrors.hust.edu.cn/apache/zookeeper/ ,我這裡下載的是3.4.6 建立zookeeper資料夾,並將下載好的檔案上傳,然後解壓,同時刪除壓縮檔案 cd /usr/local mkdir zookee

mysql例項二進位制安裝

單例項安裝 新的虛擬機器安裝mysql前的準備: 1.配置IP, 2.關閉防火牆 3.將mysql安裝包加到/usr/local目錄下 4.將準備好的my.cnf配置檔案放到/etc目錄下,並將/etc目錄下原有的my.cnf刪除或改名 5.檢查系統裡面存在的my

CENTOS下二進位制安裝Mysql(例項

二進位制安裝(單例項) 第一步建立使用者和組 groupadd mysql 建立mysql組 useradd -r -g mysql -s /bin/false mysql 建立使用者mysql並設定為系統使用者放在mysql組中,shell指令碼放在/bin/false路徑下 第二步解壓安

linux 安裝zookeeper節點

解壓壓縮包到 /usr/local/ tar -zxvf zookeeper-3.4.13.tar.gz 在安裝目錄下建立data和logs資料夾 mkdir data mkdir logs 新增myid檔案,內容為1,也就是本機zookeeper的id vim /usr/loc

linux 核心編譯驅動模組ko的配置以及載入模組解除安裝模組例項測試

linux 核心編譯驅動模組ko的配置以及載入模組、解除安裝模組例項測試一、要讓linux系統支援動態載入驅動模組必須先對linux 核心進行相關的配置,不然編譯不過,載入模組也會載入失敗甚至導致裝置重啟。1、勾選核心Enable loadable module suppor