oracle-asm,acfs

两个类比
asm与lvm比较
asm实例与oracle实例比较

ASM是OMF的一个扩展,通过ASM和OMF的结合,oracle在上层将数据文件进行自我管理,在底层将存储进行自我管理。同时,ASM模式下,备份恢复只能由rman来承担,真正做到了“3M融合”。同时也是向上兼容的体现,简化RAC中存储端的配置。

oracle将extents播撒在它所管理的磁盘组的磁盘上,与LVM基本对应。
ASM diskgroup          VG
ASM disk            PV
ASM file              LV

ASM实例和oracle实例都是由SGA和一堆后台进程构成,但他们所面对的对象是不同的,oracle实例管理的是数据库,而ASM实例用于对磁盘组的管理。
启动和停止实例的命令也基本一样。
 NOMOUNT :仅启动实例
 MOUNT 、OPEN:启动实例并加载磁盘,注意加载的是磁盘组,OPEN选项对于ASM实例无意义,等同于MOUNT
 FORCE :相当于先执行shutdown abort,然后再startup
但是,ASM 实例没有数据字典之类的东东存储用户系统。

[root@rac02 ~]# acfsutil --help

Usage: acfsutil [-h] command ...   # (Version 11.2.0.1.0.0)

             -h - help

 Command Subcmd Arguments
-------- ------ ----------------------------------------------------------------
help - display this message
version - display ACFS version information
info fs - Display all ACFS file systems
info fs [<path> ...] - Display specific ACFS file sys
info fs -o <item> <path> - Display specific file sys item:
info fs -o freespace, totalspace,
info fs -o mountpoints, volumes,
info fs -o available, ismountpoint,
info fs -o isavailable, iscorrupt,
info fs -o isadvm, diskgroup,
info fs -o redundancy, resizeincrement,
info fs -o stripewidth, stripecolumns,
info fs -o primaryvolume
info file <path> [<path> ...] - Display specific file info
info id <file-identifier> <mountpoint> -
info id Display the pathname associated with the given
info id ACFS file identifier and mountpoint.
rmfs <device> - Remove unmounted ACFS file sys
size [-|+]nnn[K|M|G|T|P] [-d <device>] <path> - Resize file system
registry [-l] - Display registry contents
registry -l <mountpoint> - Display a specific mount point
registry -l <device> - Display a specific device
registry -m <device> - Display a specific mount point associated with a device
registry -a [-f] [-o <opts>] [-n <nodes>] <device> <mountpoint> - Add a mount point
registry -d [<mountpoint> | <device>] - Delete a mount point or a device
tune AcfsMaxOpenFiles - Maximum number of open files
tune (Windows only)
snap create <snap_name> <mountpoint> - create a file system snapshot
snap delete <snap_name> <mountpoint> - delete a file system snapshot
[root@rac02 ~]# acfsutil registry -l
Device : /dev/asm/archlv- : Mount Point : /archive : Options : none : Nodes : all : Disk Group : ARCH : Volume : ARCHLV
[root@rac02 ~]# acfsutil info fs
/archive
ACFS Version: 11.2.0.1.0.0
flags: MountPoint,Available
mount time: Wed Nov ::
volumes:
total size:
total free:
primary volume: /dev/asm/archlv-
label:
flags: Primary,Available,ADVM
on-disk version: 39.0
allocation unit:
major, minor: ,
size:
free:
ADVM diskgroup ARCH
ADVM resize increment:
ADVM redundancy: unprotected
ADVM stripe columns:
ADVM stripe width:
number of snapshots:
snapshot space usage:

####oracle ASM     安装这三个包
[root@rac01 /]# rpm -qa|grep oracl
oracleasm-2.6.18-308.el5-2.0.5-1.el5
oracleasm-support-2.1.8-1.el5
oracleasmlib-2.0.4-1.el5
[root@rac01 /]# find / -name oracleasm
/sys/module/oracleasm
/lib/modules/2.6.18-308.el5/kernel/drivers/addon/oracleasm
/proc/fs/oracleasm
/usr/lib/oracleasm
/usr/sbin/oracleasm
/etc/rc.d/init.d/oracleasm
/etc/sysconfig/oracleasm
/dev/oracleasm
/var/log/oracleasm ####配置ASMlib,再使用ASMlib之前,必须运行配置脚本准备驱动程序
/etc/init.d/oracleasm configure
/etc/init.d/oracleasm enable
####检查驱动加载情况
[root@rac01 dev]# lsmod | grep oracleasm
检查oracleasmfs文件系统:
[root@rac01 ~]# df -a |head -1;df -a | grep oracleasm
asm disk创建成功后,会在/dev/oracleasm/disks目录下有相应的文件
[root@rac01 ~]# cat /var/log/oracleasm 及时查看日志
创建asm磁盘
[root@rac01 ~]# fdisk -l
[root@rac01 ~]# fdisk /dev/sdf
[root@rac01 ~]# partprobe
[root@rac01 ~]# oracleasm --help
[root@rac01 ~]# oracleasm createdisk ARCHVOL1 /dev/sde1
[root@rac01 ~]# oracleasm createdisk CRSVOL1 /dev/sdc1
[root@rac01 ~]# oracleasm createdisk DATAVOL1 /dev/sdf1
[root@rac01 ~]# oracleasm createdisk FLASHVOL1 /dev/sdd1
[root@rac01 ~]# oracleasm scandisks
[root@rac02 ~]# oracleasm listdisks
ARCHVOL1
CRSVOL1
DATAVOL1
FLASHVOL1
[root@rac02 ~]# oracleasm querydisk -p ARCHVOL1
Disk "ARCHVOL1" is a valid ASM disk
/dev/sde1: LABEL="ARCHVOL1" TYPE="oracleasm"
[root@rac01 ~]# oracleasm querydisk -d ARCHVOL1
Disk "ARCHVOL1" is a valid ASM disk on device /dev/sde1[8,65]
[root@rac01 ~]# oracleasm querydisk -d CRSVOL1
Disk "CRSVOL1" is a valid ASM disk on device /dev/sdc1[8,33]
[root@rac01 ~]# oracleasm querydisk -d DATAVOL1
Disk "DATAVOL1" is a valid ASM disk on device /dev/sdf1[8,81]
[root@rac01 ~]# oracleasm querydisk -d FLASHVOL1
Disk "FLASHVOL1" is a valid ASM disk on device /dev/sdd1[8,49]
SQL> select * from v$asm_client;
SQL> select * from v$asm_diskgroup;    4块盘,4个磁盘组
http://blog.csdn.net/leshami/article/details/6134071         ASM 磁盘、目录的管理
创建asm磁盘组
切换到 grid 用户下,执行 ASMCA 创建 ASM 磁盘组
要在 ASM diskgroup 上创建 Oracle ADVM volume,diskgroup 的 COMPATIBLE.ASM和COMPATIBLE.ADVM兼容性必须 设置为 11.2.0.2。
可以在创建磁盘组时选择“Advanced Options”设置diskgroup的该属性,也可以通过 sql 命令创建磁盘组或者修改磁盘组的该属性, 创建Oracle ADVM volume
ASMCMD [+] > volcreate -G GOLDENGATE -s 1900m GOLDENGATE 创建Oracle ACFS 文件系统
[root@rac1 ~]# /sbin/mkfs -t acfs /dev/asm/goldengate-
在节点1和2上分别创建 ACFS 文件系统的挂载点
在集群 mount registery 中注册刚刚创建的 ACFS 文件系统,也可以不注册,直接手动挂载。注册 ACFS 文件系统的好处是在集群每隔30秒检查 mount registery 时会在每个节点自动挂载该文件系统,同时当集群软件或系统重启后也会自动挂载该文件系统。
[root@rac1 ~]# /sbin/acfsutil registry -a /dev/asm/goldengate- /home/oracle/ggs
acfsutil registry: mount point /home/oracle/ggs successfully added to Oracle Registry
手动挂载命令如下:
[root@rac1 ~]# /bin/mount -t acfs /dev/asm/goldengate- /home/oracle/ggs
执行注册命令后等待30秒,然后在各节点查看ACFS文件系统是否挂载
[root@rac1 ~]# df -h
[root@rac2 ~]# df -h 测试文件系统
[root@rac1 ~]# chown -R oracle:oinstall /home/oracle/ggs
第一节点
[oracle@rac1 ~]$ echo "Oracle ACFS File System" > /home/oracle/ggs/acfs.log
[oracle@rac1 ggs]$ more /home/oracle/ggs/acfs.log
Oracle ACFS File System
第二节点
[oracle@rac2 ~]$ more /home/oracle/ggs/acfs.log
Oracle ACFS File System ####下面是一个已设置好的实例,所以只查看相关信息
[root@rac02 ~]# su - grid
[grid@rac02 ~]$ echo $ORACLE_SID
+ASM2
####如果没有上面的,就会连接到一个空的实例上
[oracle@rac02 ~]$ asmcmd
Connected to an idle instance.
ASMCMD>
[grid@rac02 ~]$ asmcmd -p
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8:zh_CN.gb2312"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8:zh_CN.gb2312"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
ASMCMD [+] > lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N N ARCH/
MOUNTED EXTERN N N CRS/
MOUNTED EXTERN N N DATA/
MOUNTED EXTERN N N FLASH/
ASMCMD [+] > lsdsk
Path
ORCL:ARCHVOL1
ORCL:CRSVOL1
ORCL:DATAVOL1
ORCL:FLASHVOL1
ASMCMD [+] > lsct
DB_Name Status Software_Version Compatible_version Instance_Name Disk_Group
+ASM CONNECTED 11.2.0.1. 11.2.0.1. +ASM2 CRS
asmvol CONNECTED 11.2.0.1. 11.2.0.1. +ASM2 ARCH
bus CONNECTED 11.2.0.1. 11.2.0.0. bus DATA
bus CONNECTED 11.2.0.1. 11.2.0.0. bus FLASH
ASMCMD [+] > help lsof
lsof [-G dgroup] [--dbname dbname] [-C clientinstname] Lists the open files in an ASM instance.
[--dbname <dbname>] list files only from database <dbname>
[-G <dgname>] list files only from from disk group <dgname>
[-C <clientinstname>] list files only from instance <clientinstname>
ASMCMD [+] > lsof --dbname asmvol
DB_Name Instance_Name Path
asmvol +ASM2 +arch/ARCHLV.256.828288767
ASMCMD [+] > lsof --dbname bus
DB_Name Instance_Name Path
bus bus +data/bus/changetracking/ctf.1271.843239387
bus bus +data/bus/controlfile/current.507.843164017
bus bus +data/bus/datafile/example.263.843164031

ASMCMD [+] > volinfo -a
Diskgroup Name: ARCH


Volume Name: ARCHLV
Volume Device: /dev/asm/archlv-215
State: ENABLED
Size (MB): 102144
Resize Unit (MB): 256
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage: ACFS
Mountpath: /archive


ASMCMD [+] > volstat

DISKGROUP NUMBER / NAME:   / ARCH
---------------------------------------
VOLUME_NAME
READS BYTES_READ READ_TIME READ_ERRS
WRITES BYTES_WRITTEN WRITE_TIME WRITE_ERRS
-------------------------------------------------------------
ARCHLV ASMCMD [+] > volinfo -G ARCH ARCHLV
Diskgroup Name: ARCH Volume Name: ARCHLV
Volume Device: /dev/asm/archlv-
State: ENABLED
Size (MB):
Resize Unit (MB):
Redundancy: UNPROT
Stripe Columns:
Stripe Width (K):
Usage: ACFS
Mountpath: /archive
ASMCMD [+] > pwd
+
ASMCMD [+] > ls
ARCH/
CRS/
DATA/
FLASH/
ASMCMD [+] > cd flash
ASMCMD [+flash] > ls
BUS/
FLT/
MAN/
ASMCMD [+crs/rac-cluster] > du ocrfile
Used_MB Mirror_used_MB ASMCMD [+data/bus/tempfile] > ls -l
Type Redund Striped Time Sys Name
TEMPFILE UNPROT COARSE NOV :: Y TEMP.266.843164027
ASMCMD [+data/bus] > iostat
Group_Name Dsk_Name Reads Writes
ARCH ARCHVOL1
CRS CRSVOL1
DATA DATAVOL1
FLASH FLASHVOL1
ASMCMD [+data/bus] > iostat --io
Group_Name Dsk_Name Reads Writes
ARCH ARCHVOL1
CRS CRSVOL1
DATA DATAVOL1
FLASH FLASHVOL1
ASMCMD [+data/bus] > iostat -t
Group_Name Dsk_Name Reads Writes Read_Time Write_Time
ARCH ARCHVOL1 . .
CRS CRSVOL1 3.835 .
DATA DATAVOL1 2107092.656861 160237.009142
FLASH FLASHVOL1 3062.787 715411.780234
ASMCMD [+data/bus] > lsdsk --statistics
Reads Write Read_Errs Write_Errs Read_time Write_Time Bytes_Read Bytes_Written Voting_File Path
. . N ORCL:ARCHVOL1
3.838 . Y ORCL:CRSVOL1
2107092.775861 160237.608142 N ORCL:DATAVOL1
3062.794 715412.346234 N ORCL:FLASHVOL1
ASMCMD [+data/bus] > help lsod
lsod [-H] [-G <group>] [--process <proc>] [disk] Displays the open devices -G <group> Filters devices belonging to diskgroup <group> --process <proc> Filters processes of name <proc>. <disk> Filters disks of name <disk>. -H Suppresses column header from the output. ASMCMD [+data/bus] > lsod
Instance Process OSPID Path
oracle@rac02 (DBW0) ORCL:ARCHVOL1
oracle@rac02 (DBW0) ORCL:CRSVOL1
oracle@rac02 (DBW0) ORCL:DATAVOL1
oracle@rac02 (DBW0) ORCL:FLASHVOL1
oracle@rac02 (GMON) ORCL:ARCHVOL1
oracle@rac02 (GMON) ORCL:CRSVOL1
oracle@rac02 (GMON) ORCL:DATAVOL1
oracle@rac02 (GMON) ORCL:FLASHVOL1
oracle@rac02 (LGWR) ORCL:ARCHVOL1
oracle@rac02 (LGWR) ORCL:CRSVOL1
oracle@rac02 (LGWR) ORCL:DATAVOL1
oracle@rac02 (LGWR) ORCL:FLASHVOL1
oracle@rac02 (RBAL) ORCL:ARCHVOL1
oracle@rac02 (RBAL) ORCL:ARCHVOL1
oracle@rac02 (RBAL) ORCL:CRSVOL1
oracle@rac02 (RBAL) ORCL:CRSVOL1
oracle@rac02 (RBAL) ORCL:DATAVOL1
oracle@rac02 (RBAL) ORCL:DATAVOL1
oracle@rac02 (RBAL) ORCL:FLASHVOL1
oracle@rac02 (RBAL) ORCL:FLASHVOL1
oracle@rac02 (TNS V1-V3) ORCL:CRSVOL1
oracle@rac02 (VBG0) ORCL:ARCHVOL1
ASMCMD [+data/bus] > help lstmpl
lstmpl [-Hl] [-G dgname] [pattern] Lists ASM templates in a disk group.
[-G dgname] shows the templates that belong to a certain disk group.
[-l] shows detailed information about the templates.
[-H] supress headers.
[pattern] filter out template names that match a given pattern. ASMCMD [+data/bus] > lstmpl
Group_Name Group_Num Name
ARCH ARCHIVELOG
ARCH ASMPARAMETERBAKFILE
ARCH ASMPARAMETERFILE
ARCH ASM_STALE
ARCH AUTOBACKUP
ARCH BACKUPSET
ASMCMD [+data/bus] > help lspwusr
lspwusr [-H] List the users from an orapwd file. [-H] suppress headers ASMCMD [+data/bus] > lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE TRUE
ASMSNMP TRUE FALSE FALSE
SYSASM FALSE FALSE TRUE

多实例的启动,先启动asm实例,再启动bus或man实例。

1.13 启动 ASM 数据库的步骤
由于启动 ASM 数据库必须要先启动ASM 实例, 所以基本上启动步骤如下.
1) 先启动ASM实例
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> startup;
SQL> exit;
2) 再启动数据库
$ export ORACLE_SID=EUIS
$ sqlplus / as sysdba
SQL> startup;
SQL> exit; 单instance使用ASM rac环境使用ASM 使用ASM必须先启动CSS服务,只有启动ASM服务,ASM磁盘组才可以被挂载 Cluster Synchronization Services daemon [root@rac02 bin]# ./localconfig add   启动CSS服务 [root@rac02 bin]# find /u01 -name localconfig
/u01/app/11.2.0/grid/crs/utl/localconfig 11g里没有localconfig了。你需要安装grid。用crs_start 命令来启动,要单独用GRID软件 Oracle Grid Infrastructure
http://www.oracle.com/technetwork/cn/articles/index-094679-zhs.html [root@rac02 bin]# su - oracle
[oracle@rac02 ~]$ export ORACLE_SID=+ASM
[oracle@rac02 ~]$ asmcmd
Connected to an idle instance.
ASMCMD> startup
ERROR:
ORA-01031: insufficient privileges
Enter password:
ERROR:
ORA-01005: null password given; logon denied
Connected to an idle instance. 查看自己的环境变量
export ORACLE_BASE=/grid
export ORACLE_HOME=$ORACLE_BASE/product/11.2.3
跟运行的不一样,所以所环境变量改好就行了。 ASMCMD-08102: no connection to ASM; command requires ASM to run 11G R2 有专门的grid用户维护ASM和cluster ware
而且你看看你的ASMinstance到底启动了没?
看看进程也行啊 两种方式  sqlplus / as sysasm和grid用户的asmcmd命令 11g r2 不能用 sqlplus / as sysdba这样启动的 用 sqlplus / as sysasm ps -ef | grep asm* 从上面看,ASM instance好像已经起来了
但是我使用grid 用户,asmcmd 进去之后,任何的命令都无法执行
报错提示全部都是:ASMCMD-08102: no connection to ASM; command requires ASM to run 我用 sysasm 启动也是这样,说已经有实例在运行了,现在关也关不掉,难道让我重启服务器吗? 正如楼上说的,这是环境变量设置错误的结果
我当时做实验的时候没有新建grid用户,所以,我的操作是
export ORACLE_SID=+ASM
export ORACLE_HOME=/u01/app/11.2.0/grid 可以看出diskgroup没有mount,所以先把diskgroup mount
上一篇:安装oracleASM


下一篇:iOS开发-添加圆角效果高效实现