ITPub博客

首页 > 数据库 > Oracle > RAC中ASM磁盘组管理

RAC中ASM磁盘组管理

原创 Oracle 作者:xj951423274 时间:2015-11-20 19:13:00 0 删除 编辑
1,添加磁盘后,fdisk分区/dev/sdd     (linux)
2,创建ASM磁盘
     service oracleasm createdisk VOL1 /dev/sdd1
     service oracleasm enable
3,建立磁盘组:sqlplus '/as sysasm'
    SQL>create diskgroup VOL_DATA1 external redundancy disk 'ORCL:VOL1' name VOL_DATA_VOL1;
4,添加成员:
    SLQ>alter diskgroup VOL_DATA1 add disk 'ORCL:VOL2'  name VOL_DATA_VOL2 rebanlance power 1;
    磁盘组负载平衡 0表示不平衡, 1是缓慢的平衡,最大11平衡速度最快,对磁盘消耗较大。
    手动平衡alter diskgroup VOL_DATA1 rebanlance  power 3;
5,查看磁盘:select group_number,disk_number,name,path,total_mb,free_mb from v$asm_disk;
    查看磁盘组:select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;
6,删除磁盘组
    SLQ>drop diskgroup VOL_DATA1 including contents;     ------磁盘组要无数据
    删除组内成员
   SQL>alter diskgroup VOL_DATA1 drop disk VOL_DATA_VOL2;

7,
ASM磁盘上的文件拷贝OS中
①,用dbms_file_transfer.copy_file(); 
    
点击(此处)折叠或打开
  1. [oracle@racy1 ~]$ mkdir backup
  2. [oracle@racy1 backup]$ pwd
  3. /home/oracle/backup
  4. 创建directory对象
  5. SQL> create directory adir as '+DATA/RACDB/datafile/';
  6. Directory created.

  7. SQL> create directory bdir as '/home/oracle/backup';
  8. Directory created.

  9. SQL> select file#,name from v$datafile;

  10.      FILE# NAME
  11. ---------- --------------------------------------------------
  12.      1 +DATA/racdb/datafile/system.259.895793119
  13.      2 +DATA/racdb/datafile/sysaux.260.895793165
  14.      3 +DATA/racdb/datafile/undotbs1.261.895793205
  15.      4 +DATA/racdb/datafile/undotbs2.263.895793255
  16.      5 +DATA/racdb/datafile/users.264.895793267

  17. SQL> alter database datafile 5 offline;

  18. Database altered.
  19. SQL> begin
  20.   2     dbms_file_transfer.copy_file('adir','users.264.895793267','bdir','users.dbf');
  21.   3 end;
  22.   4 /
  23. PL/SQL procedure successfully completed.

        SQL> alter database datafile 5 online;

  1. [oracle@racy1 ~]$ cd /backup
  2. [oracle@racy1 backup]$ ls
  3. users.dbf    
 dbms_file_transfer.copy_file('bdir','users.dbf','adir','users.dbf'); //将文件copy 到ASM 磁盘组中
②,用RMAN的convert 命令
RMAN> convert tablespace test01 format  '/backup/test01.dbf';
或者
RMAN> convert datafile "+DATA/racdb/datafile/test01.268.897172749" format "/backup/test001.dbf"
还原 
RMAN>convert datafile "/backup/test001.dbf"  format  "+DATA";

--------------------------------------------------------------------------------------------------------------
解决删除磁盘组后无法启动的问题:

点击(此处)折叠或打开

  1. [oracle@racy1 ~]$ srvctl start database -d RACDB
  2. PRCR-1079 : Failed to start resource ora.racdb.db
  3. CRS-2640: Required resource 'ora.VOL_DG1.dg' is missing.
  4. [grid@racy1 ~]$ crsctl status resource ora.racdb.db -p | grep ora.VOL_DG1.dg
  5. START_DEPENDENCIES=hard(ora.DATA.dg,ora.RAC.dg,ora.VOL_DG1.dg) weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,uniform:ora.eons) pullup(ora.DATA.dg,ora.RAC.dg)
  6. STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DATA.dg,shutdown:ora.RAC.dg,shutdown:ora.VOL_DG1.dg)
  7. [grid@racy1 ~]$ srvctl modify database -d RACDB -a 'DATA,RAC'  #引号内为我的磁盘组
  8. [grid@racy1 ~]$ crsctl status resource ora.racdb.db -p | grep ora.VOL_DG1.dg
  9. [grid@racy1 ~]$ srvctl start database -d RACDB





来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28275505/viewspace-1842328/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-07-29

  • 博文量
    22
  • 访问量
    28529