zoukankan      html  css  js  c++  java
  • ASM 管理命令和操作笔记

    首先创建磁盘(如果是虚拟机,通过添加hard disk 文件加磁盘)
    [需要停虚拟机,将盘添加到第二个节点]
    [root@node1 ~]#fdisk /dev/sdf
    输入以下:n/p/1/enter/enter
    node1上初始化ASM盘
    [root@node1 ~]#/etc/init.d/oracleasm createdisk NOVA3 /dev/sdf1
    node2 上扫描并列盘
    [root@node2 ~]#/etc/init.d/oracleasm scandisks
    [root@node2 ~]# /etc/init.d/oracleasm listdisks
    NOVA1
    NOVA2
    NOVA3
    登录node1添加磁盘
    [root@node1 ~]#su – oracle
    [root@node1 ~]#ORACLE_SID=+ASM1
    [root@node1 ~]#sqlplus / as sysdba
    SQL>alter diskgroup RAC_DISK add disk ‘ORCL:NOVA3′ name test_asmdisk;
    登录node2测试
    SQL> select path from v$asm_disk;
    PATH
    ——————————————————————————–
    ORCL:NOVA3
    /dev/raw/raw2
    /dev/raw/raw1
    ORCL:NOVA1
    ORCL:NOVA2
    /dev/raw/raw3
    /dev/raw/raw4
    SQL> select NAME,ALLOCATION_UNIT_SIZE,TOTAL_MB from v$asm_diskgroup;
    NAME ALLOCATION_UNIT_SIZE TOTAL_MB
    —————————— ——————– ———-
    RAC_DISK 1048576 8180
    在node1上执行,ASM上创建一个表空间
    [oracle@node1 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.1.0 – Production on Fri May 8 17:19:58 2009
    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, Real Application Clusters, OLAP and Data Mining options
    SQL> create tablespace nova_test datafile ‘+RAC_DISK’ size 200M;
    Tablespace created.
    SQL> create user nova identified by nova default tablespace nova_test;
    User created.
    SQL> grant dba to nova;
    Grant succeeded.
    SQL> conn nova/nova;
    Connected.
    SQL> create table t_test as select * from dba_objects;
    Table created.
    SQL> select count(*) from t_test;
    COUNT(*)
    ———-
    50029
    SQL>
    登录node2上执行,做一下测试。
    [oracle@node2 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.1.0 – Production on Fri May 8 17:24:00 2009
    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, Real Application Clusters, OLAP and Data Mining options
    SQL> conn nova/nova
    Connected.
    SQL> select count(*)from t_test;
    COUNT(*)
    ———-
    50029
    SQL>
    其他命令操作
    alter diskgroup dgroup1 add failgroup fgroup1 disk ‘ORCL:NOVA3′ failgroup fgroup2 disk ‘ORCL:VOL6′;
    自动平衡的工作进度
    desc v$asm_operation
    select * from v$asm_operation;
    查询ASM磁盘组对应关系
    select label,failgroup from v$asm_disk;
    查看磁盘组的名称和状态
    SQL> select state,header_status,substr(name,1,12) Name,free_mb,substr(path,1,16) PATH from v$asm_disk;

    STATE HEADER_STATU NAME FREE_MB PATH
    ——– ———— ———— ———- —————-
    NORMAL FOREIGN 0 /dev/raw/raw2
    NORMAL FOREIGN 0 /dev/raw/raw1
    NORMAL UNKNOWN 0 ORCL:NOVA1
    NORMAL UNKNOWN 0 ORCL:NOVA2
    NORMAL MEMBER RAC_DISK_000 2496 /dev/raw/raw3
    NORMAL MEMBER RAC_DISK_000 3334 /dev/raw/raw4
    NORMAL MEMBER TEST_ASMDISK 826 ORCL:NOVA3
    查看ASM磁盘管理均衡情况
    SQL>select operation,state,power,actual,sofar,est_work,est_minutes from v$asm_operation;
    登入到ASM的实例,删除磁盘组中VOL4磁盘
    alter diskgroup RAC_DISK drop disk NOVA3;
    强制让ASM自动平衡
    alter diskgroup RAC_DISK rebalance;
    加入故障盘到磁盘组
    alter diskgroup dgroup1 add failgroup fgroup1 disk ‘ORCL:NOVA3′ failgroup fgroup2 disk ‘ORCL:NOVA4′;

  • 相关阅读:
    USACO 2016 February Contest, Gold解题报告
    USACO 2016 January Contest, Gold解题报告
    NOIP2013 Day2
    [DP题]放苹果
    [DP题]登山
    洛谷八连测R6
    [20171025模拟赛]
    [DP题]吃糖果
    [DP题]采药
    spring-security-oauth2 授权服务集成钉钉扫码登录
  • 原文地址:https://www.cnblogs.com/sopost/p/2190133.html
Copyright © 2011-2022 走看看