您好,登錄后才能下訂單哦!
本篇內容主要講解“怎么在RedHat AS3上安裝ASM”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“怎么在RedHat AS3上安裝ASM”吧!
==操作系統版本
[root@TCLUX3245 root]# uname -a
Linux TCLUX3245 2.4.21-47.0.1.ELsmp #1 SMP Fri Oct 13 17:56:20 EDT 2006 i686 i686 i386 GNU/Linux
==去oracle網站下載相應的rpm包,其中oracleasm-2.4.21-47.0.1.ELsmp-1.0.5-1.i686.rpm 要跟根據#uname -r結果一致,其余兩個包個版本之間通用。地址:http://www.oracle.com/technology/tech/linux/asmlib/index.html
[root@TCLUX3245 root]# uname -r
2.4.21-47.0.1.ELsmp
[root@TCLUX3245 asm_lib]# pwd
/10ginstaller/asm_lib
[root@TCLUX3245 asm_lib]# ls -l
total 136
-rw-r--r-- 1 root root 94176 Mar 28 23:42 oracleasm-2.4.21-47.0.1.ELsmp-1.0.5-1.i686.rpm
-rw-r--r-- 1 oracle dba 13638 Mar 28 00:46 oracleasmlib-2.0.2-1.i386.rpm
-rw-r--r-- 1 oracle dba 22402 Mar 28 00:46 oracleasm-support-2.0.3-1.i386.rpm
==安裝包,中間不能有報錯,否則在配置系統reboot后自動啟動ASM kernel module時會出錯(Loading module "oracleasm": Unable to load module "oracleasm" [FAILED]')。其原因多半是因為oracleasm-2.4.21-47.0.1.ELsmp-1.0.5-1.i686.rpm沒有下載對,卸載后重新安裝正確的rpm包就可以解決。
[root@TCLUX3245 asm_lib]# rpm -ivh *.rpm
......
......
==配置system reboot后自動啟動ASM kernel module
[root@TCLUX3245 asm_lib]# /etc/init.d/oracleasm configure
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) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
==在unix/linux中,所有設備都是文件,所以我們可以建幾個文件來模擬多塊硬盤。先用dd建若干個文件,大小為1G
root@TCLUX3245 dev]# mkdir /asmdisks
[root@TCLUX3245 dev]# dd if=/dev/sda2 of=/asmdisks/disk1 bs=1024k count=1000
dd if=/dev/sda2 of=/asmdisks/disk2 bs=1024k count=1000
dd if=/dev/sda2 of=/asmdisks/disk3 bs=1024k count=1000
dd if=/dev/sda2 of=/asmdisks/disk4 bs=1024k count=1000
dd if=/dev/sda2 of=/asmdisks/disk5 bs=1024k count=1000
==用losetup命令,使這些文件在linux看來是某個存儲設備
[root@TCLUX3245 dev]# /sbin/losetup /dev/loop1 /asmdisks/disk1
/sbin/losetup /dev/loop2 /asmdisks/disk2
/sbin/losetup /dev/loop3 /asmdisks/disk3
/sbin/losetup /dev/loop4 /asmdisks/disk4
/sbin/losetup /dev/loop5 /asmdisks/disk5
==運行oracleasm命令,使這些存儲設備變成asm的備用盤
root@TCLUX3245 asm_lib]# /etc/init.d/oracleasm createdisk ASMD1 /dev/loop1
Marking disk "/dev/loop1" as an ASM disk: [ OK ]
/etc/init.d/oracleasm createdisk ASMD2 /dev/loop2
/etc/init.d/oracleasm createdisk ASMD3 /dev/loop3
/etc/init.d/oracleasm createdisk ASMD4 /dev/loop4
/etc/init.d/oracleasm createdisk ASMD5 /dev/loop5
******[root@TCLUX3245 bin]# pwd
******/ddms01/dms/oracle/10.2.0/bin
******[root@TCLUX3245 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.
****** tclux3245
******CSS is active on all nodes.
******Oracle CSS service is installed and running under init(1M)
==編輯asm init文件
[oracle@TCLUX3245 dbs]$ cat init+ASM.ora
INSTANCE_TYPE=ASM
DB_UNIQUE_NAME=+ASM
LARGE_POOL_SIZE=8M
ASM_DISKSTRING='ORCL:*'
==啟動ASM Instance,并創建disk group
[oracle@TCLUX3245 dbs]$ export ORACLE_SID=+ASM
[oracle@TCLUX3245 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 29 16:07:05 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
SQL> startup nomount
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
SQL> create diskgroup DGROUP1 normal redundancy disk 'ORCL:ASMD1','ORCL:ASMD2','ORCL:ASMD3','ORCL:ASMD4','ORCL:ASMD5';
Diskgroup created.
SQL> col path format a20
SQL> select path,mount_status from v$asm_disk
PATH MOUNT_S
-------------------- -------
ORCL:ASMD1 CACHED
ORCL:ASMD2 CACHED
ORCL:ASMD3 CACHED
ORCL:ASMD4 CACHED
ORCL:ASMD5 CACHED
SQL> shutdown
ASM diskgroups dismounted
==在init+ASM.ora中加入一行ASM_DISKGROUPS='DGROUP1',這樣asm instance就可以直接啟動了
INSTANCE_TYPE=ASM
DB_UNIQUE_NAME=+ASM
LARGE_POOL_SIZE=8M
ASM_DISKSTRING='ORCL:*'
ASM_DISKGROUPS='DGROUP1'
SQL> shutdown
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
==把創建asm備用磁盤的那些命令加到/etc/rc.local文件里,這樣每次系統reboot后,那些/asmdisks/diski文件就自動變成asm備用磁盤了。
[root@TCLUX3245 etc]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/sbin/losetup /dev/loop1 /asmdisks/disk1
/sbin/losetup /dev/loop2 /asmdisks/disk2
/sbin/losetup /dev/loop3 /asmdisks/disk3
/sbin/losetup /dev/loop4 /asmdisks/disk4
/sbin/losetup /dev/loop5 /asmdisks/disk5
/etc/init.d/oracleasm createdisk ASMD1 /dev/loop1
/etc/init.d/oracleasm createdisk ASMD2 /dev/loop2
/etc/init.d/oracleasm createdisk ASMD3 /dev/loop3
/etc/init.d/oracleasm createdisk ASMD4 /dev/loop4
/etc/init.d/oracleasm createdisk ASMD5 /dev/loop5
======================================================
自此,完成了ASM instance和ASM diskgroup的創建,并且每次系統重啟后ASM diskgroup都會自動創建。下面創建數據庫。
======================================================
==創建initSID.ora文件
[oracle@TCLUX3245 dbs]$ pwd
/ddms01/dms/oracle/10.2.0/dbs
[oracle@TCLUX3245 dbs]$ cat initO01DMS0.ora
db_name=O01DMS0
sga_target=256M
db_create_file_dest=+DGROUP1
==創建spfile和數據庫
[oracle@TCLUX3245 dbs]$ echo $ORACLE_SID
O01DMS0
[oracle@TCLUX3245 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 29 18:05:00 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 268435456 bytes
Fixed Size 1218868 bytes
Variable Size 88082124 bytes
Database Buffers 171966464 bytes
Redo Buffers 7168000 bytes
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /ddms01/dms/oracle/10.2.0/dbs/
spfileO01DMS0.ora
SQL> create database;
Database created.
SQL> create temporary tablespace TEMP;
Tablespace created.
SQL> create undo tablespace UNDOTBS1;
Tablespace created.
SQL> @?/rdbms/admin/catalog.sql
.......
SQL> @?/rdbms/admin/catproc.sql
......
SQL> alter database default temporary tablespace TEMP;
Database altered.
SQL> alter system set undo_tablespace=UNDOTBS1 scope=spfile;
System altered.
SQL> alter system set undo_management=AUTO scope=spfile;
System altered.
SQL> startup force
ORACLE instance started.
Total System Global Area 268435456 bytes
Fixed Size 1218868 bytes
Variable Size 96470732 bytes
Database Buffers 163577856 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL> select file_name,bytes/1024/1024 MB from dba_data_files;
FILE_NAME MB
-------------------------------------------------- ----------
+DGROUP1/o01dms0/datafile/system.259.618516577 200
+DGROUP1/o01dms0/datafile/sysaux.260.618516593 100
+DGROUP1/o01dms0/datafile/undotbs1.262.618516647 100
SQL> select file_name,bytes/1024/1024 MB from dba_temp_files;
FILE_NAME MB
-------------------------------------------------- ----------
+DGROUP1/o01dms0/tempfile/temp.261.618516635 100
SQL> select a.group#,MEMBER,bytes/1024/1024 MB from v$logfile a,v$log b
2 where a.group#=b.group#;
GROUP# MEMBER MB
---------- -------------------------------------------------- ----------
1 +DGROUP1/o01dms0/onlinelog/group_1.257.618516495 100
2 +DGROUP1/o01dms0/onlinelog/group_2.258.618516537 100
SQL> select BLOCK_SIZE*FILE_SIZE_BLKS from v$controlfile;
BLOCK_SIZE*FILE_SIZE_BLKS
-------------------------
6062080
==datafile, redo log file, control file一共所占空間為 705.78125MB
SQL> select 200+100+100+100+100+100+6062080/1024/1024 MB from dual;
MB
----------
705.78125
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@TCLUX3245 oracle]$ export ORACLE_SID=+ASM
[oracle@TCLUX3245 oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 30 11:24:22 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select PATH,MOUNT_STATUS,NAME,TOTAL_MB,FREE_MB from v$asm_disk;
PATH MOUNT_S NAME TOTAL_MB FREE_MB
-------------------- ------- ------------ ---------- ----------
ORCL:ASMD1 CACHED ASMD1 1000 673
ORCL:ASMD2 CACHED ASMD2 1000 675
ORCL:ASMD3 CACHED ASMD3 1000 675
ORCL:ASMD4 CACHED ASMD4 1000 676
ORCL:ASMD5 CACHED ASMD5 1000 675
==DiskGroup中一共使用掉的空間為 1626MB
SQL> select 5*1000-673-675-675-676-675 MB from dual;
MB
--------
1626
1626MB>2*705.78125MB
注意前面創建diskgroup的腳本
SQL> create diskgroup DGROUP1 normal redundancy disk ...;
其中NORMAL REDUNDANCY: requires the existence of at least two failure groups。每個diskgroup里面的文件都有一份冗余,再加上創建asm備用盤時需要的一些額外空間,就造成了七百多兆文件占用了1.6G的空間。
到此,相信大家對“怎么在RedHat AS3上安裝ASM”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。