Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3215395
  • 博文数量: 710
  • 博客积分: 14546
  • 博客等级: 上将
  • 技术积分: 6738
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-30 10:20
文章分类

全部博文(710)

文章存档

2016年(1)

2014年(7)

2013年(22)

2012年(227)

2011年(322)

2009年(119)

2008年(12)

分类: Oracle

2011-07-23 08:26:37

目录

一,认识ASM 2

1ASM 2

2ASM 不是一个通用的文件系统 2

3ASM 作为单独的 Oracle 实例实施 2

4ASM提供了3种冗余方法。 2

5oracle 通过failure group 来提供高可用性。 2

6ASM实例只需要初始参数文件,不需要其它物理文件. 2

7ASM的实例的名称是+ASMINSTANCE_TYPE=ASM 2

二,安装ASM 2

1,确认自己系统版本 2

2,下载对应的软件 3

3,安装,注意安装顺序 3

三,使用 3

1,使用ASM前线关闭selinux 3

2,运行配置脚本,准备ASMLib驱动程序 3

3,启用ASMLib驱动程序 3

4ASM的运行需要CSS服务,下面来安装它 4

5,创建ASM磁盘 4

6,查看已标记为ASMLib的硬盘 4

7,创建diskgroup 4

8,启动/关闭ASM实例 4

四,ASM相关视图及内部命令 5

1,查看asm diskgroup的名字、状态、复制类型、总大小、空闲空间 5

2,查看ASM 磁盘的名字、路径、挂载状态、磁盘号 5

3,数据文件命名含义 dba_data_files 6

4,在ASM实例中查询文件编号和大小 6

查询文件号及其大小 7

5,查询相关的物理文件的大小 7

6ASM的内部命令 asmcmd 7

五,高级操作 8

1,创建或更改表空间 8

a,查询asm_diskgroup信息 8

b. 创建表空间erp 8

c,观察磁盘组空间变化 8

ddba_data_files中关于文件名称和大小的信息 8

eresize 文件大小 8

2,删除disk 8

3,添加新硬盘并重新负载均衡 8

六,FAQ: 9

1diskgroup 的管理 9

2,条带化原理和rebalance 9

3,文件名和Template 9

4ASMCMD命令行 9

5ASM文件转化 9

6Failure Groups in ASM 9

7Oracle10g新增DBMS_FILE_TRANSFER 9

正文:

相关视图及内部命令 ,查看asm diskgroup的名字、状态、复制类型、总大小、空闲空间

SQL> select name, state, type, total_mb, free_mb from v$asm_diskgroup;

NAME STATE TYPE TOTAL_MB FREE_MB

-------------------- ----------------------- ----------------- ------------------- ----------

ASMGRP1 MOUNTED NORMAL 6273 3616

DISKGRP2 MOUNTED EXTERN 1913 1863

,查看ASM 磁盘的名字、路径、挂载状态、磁盘号

SQL> select name, path, mode_status, state, disk_number from v$asm_disk;

NAME PATH MODE_STATUS STATE DISK_NUMBER

---------------------------------------------------------------------------------------------------------------------------------

VOL1 ORCL:VOL1 ONLINE NORMAL 0

VOL2 ORCL:VOL2 ONLINE NORMAL 1

VOL3 ORCL:VOL3 ONLINE NORMAL 2

VOL4 ORCL:VOL4 ONLINE NORMAL 0

,数据文件命名含义 dba_data_files

SQL> select file_name from dba_data_files;

FILE_NAME

--------------------------------------------------------------------------------

+ASMGRP1/boy/datafile/users.259.713439439

+ASMGRP1/boy/datafile/sysaux.257.713439427

+ASMGRP1/boy/datafile/undotbs1.258.713439433

+ASMGRP1/boy/datafile/system.256.713439419

+ASMGRP1/boy/datafile/example.269.713440119

+DISKGRP2/boy/datafile/erp.256.713522125

格式说明:

+ASMGRP1/boy /datafile/tbs_name.asm_filenumber.incarnation_number

+ ASMGRP1: diskgroup

boy: 该数据库名

datafile: 文件类型,表示是数据文件

tbs_name: 表空间名

asm file#: 表示ASM file编号,v$asm_file.file_number

incarnation number: 从时间戳提取,唯一值

,在ASM实例中查询文件编号和大小

[oracle@kk ~]$ export ORACLE_SID=+ASM

[oracle@kk ~]$ sqlplus '/as sysdba'

SQL> select file_number,bytes/1024/1024 from v$asm_file;

FILE_NUMBER BYTES/1024/1024

----------- ---------------

256 480.007813

257 250.007813

258 25.0078125

259 70.0078125

260 6.734375

261 6.734375

262 50.0004883

263 50.0004883

264 50.0004883

265 50.0004883

266 50.0004883

267 50.0004883

268 20.0078125

269 100.007813

270 .002441406

256 800.007813

SQL> select member from v$logfile;

MEMBER

--------------------------------------------------------------------------------

+ASMGRP1/boy/onlinelog/group_3.266.713439655

+ASMGRP1/boy/onlinelog/group_3.267.713439663

+ASMGRP1/boy/onlinelog/group_2.264.713439635

+ASMGRP1/boy/onlinelog/group_2.265.713439643

+ASMGRP1/boy/onlinelog/group_1.262.713439615

+ASMGRP1/boy/onlinelog/group_1.263.713439627

16 rows selected.

所查询到的值,与dba_data_files相匹配。

+ASM (ASM instance)

SQL> select file_number , sum(bytes)/(1024*1024) MB from v$asm_file group by file_number;

FILE_NUMBER SUM(BYTES)/(1024*1024)

----------- ----------------------

256 360.007813

257 35.0078125

BOY (database instance)

SQL> select name from v$datafile

NAME

----------------------------------------

+DATA/orcl/datafile/sysaux.256.3

+DATA/orcl/datafile/system.258.3

+DATA/orcl/datafile/undotbs1.257.3

+DATA/orcl/datafile/users.265.3

+DATA/orcl/datafile/nitin.263.3

,查询相关的物理文件的大小

select sum(bytes)/(1024*1024*1024) from v$datafile;

select sum(bytes)/(1024*1024*1024) from v$logfile a, v$log b where a.group#=b.group#;

select sum(bytes)/(1024*1024*1024) from v$tempfile where status='ONLINE';

ASM的内部命令 asmcmd

[oracle@kk ~]$ export ORACLE_SID=+ASM

[oracle@kk ~]$ asmcmd

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LANG = "AMRICAN"

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 = "AMRICAN"

are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

ASMCMD> ls -l

State Type Rebal Unbal Name

MOUNTED NORMAL N N ASMGRP1/

MOUNTED EXTERN N N DISKGRP2/

ASMCMD [+ASMGRP1] > help

commands:

--------

cd

du

find

help

ls

lsct

lsdg

mkalias

mkdir

pwd

rm

rmalias

,创建或更改表空间 查询asm_diskgroup信息

SQL> select group_number,name, total_mb,free_mb from v$asm_diskgroup

GROUP_NUMBER NAME TOTAL_MB FREE_MB

------------ ------------------------------------------------------------ ---------- ----------

1 ASMGRP1 6273 3616

2 DISKGRP2 1913 1863

创建表空间erp

SQL> create tablespace erp datafile '+DISKGRP2' size 800m;

Tablespace created.

观察磁盘组空间变化

SQL> select group_number,name, total_mb,free_mb from v$asm_diskgroup;

GROUP_NUMBER NAME TOTAL_MB FREE_MB

------------ ------------------------------------------------------------ ---------- ----------

1 ASMGRP1 6273 3616

2 DISKGRP2 1913 1060

dba_data_files中关于文件名称和大小的信息

SQL> select file_name,tablespace_name,bytes/1024/1024 MB,autoextensible from dba_data_files

FILE_NAME TABLESPACE_NAME MB AUTOEX

------------------------------------------------------------- ------------------------------------------------------------ ---------- ------

+ASMGRP1/boy/datafile/users.259.713439439 USERS 5 YES

+ASMGRP1/boy/datafile/sysaux.257.713439427 SYSAUX 240 YES

+ASMGRP1/boy/datafile/undotbs1.258.713439433 UNDOTBS1 25 YES

+ASMGRP1/boy/datafile/system.256.713439419 SYSTEM 480 YES

+ASMGRP1/boy/datafile/example.269.713440119 EXAMPLE 100 YES

+DISKGRP2/boy/datafile/erp.256.713522125 ERP 800 NO

resize 文件大小

SQL> alter database datafile '+ASMGRP1/boy/datafile/users.259.713439439' resize 70M;

Database altered.

SQL> select file_name,tablespace_name,bytes/1024/1024 MB,autoextensible from dba_data_files;

FILE_NAME TABLESPACE_NAME MB AUTOEX

----------------------------------------------------------------- ------------------------------------------------------------ ---------- ------

+ASMGRP1/boy/datafile/users.259.713439439 USERS 70 YES

,删除disk

SQL> select group_number, name from v$asm_diskgroup;

SQL> select path, name from v$asm_disk where group_number=1;

SQL> alter diskgroup DISKGRP2 drop disk VOL4;

Diskgroup altered.

,添加新硬盘并重新负载均衡

SQL> alter diskgroup DATA add disk '/dev/rdsk/c3t19d39s4' rebalance power 11 <==power:允许使用系统资源的一个参数

SQL> select * from v$asm_operation

diskgroup 的管理

http://space.itpub.net/?uid-354732-action-viewspace-itemid-627665

,条带化原理和rebalance

http://space.itpub.net/?uid-354732-action-viewspace-itemid-628992

,文件名和Template

http://space.itpub.net/?uid-354732-action-viewspace-itemid-629497

ASMCMD命令行

http://space.itpub.net/?uid-354732-action-viewspace-itemid-629586

ASM文件转化

http://space.itpub.net/?uid-354732-action-viewspace-itemid-629618

Failure Groups in ASM

http://blog.chinaunix.net/u/19769/showart_244125.html

Oracle10g新增DBMS_FILE_TRANSFER

http://yangtingkun.itpub.net/post/468/484002

8, oracle wiki

9, oracle asm download


阅读(1583) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~