move asm file-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 3977065
  • 博文数量: 536
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4825
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(536)

文章存档

2024年(3)

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(252)

2006年(73)

相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: oracle

2009-09-21 11:27:57

the preferred way of doing the file movement amoung asm diskgroups is using rman. rman is critical to automatic storage management and is responsible for tracking the asm filenames and for deleting obsolete asm files. since asm files cannot be accessed through normal operating system interfaces, rman is the preferred means of copying asm file.

the steps involved in moving a datafile from a diskgroup to another is as given below.

1) identify the data file to be moved.
2) identify the diskgroup on to which the file has to be moved.
3) take the file offline.
4) copy the file to new diskgroup using either rman or dbms_file_transfer.
5) rename the file to point to new location.
6) recover the file.
7) bring the file online.
8) verify the new file locations.
9) delete the file from its original location.

1) identify the data file to be moved.
—————————————-
in database instance

sql:orcl> select file_name from dba_data_files:

asmdsk2/orcl/datafile/users.256.565313879 <======= move this to asdsk1.
asmdsk1/orcl/sysaux01.dbf
asmdsk1/orcl/undotbs01.dbf
asmdsk1/orcl/system01.dbf

2) identify the diskgroup on to which the file has to be moved.
--------------------------------------------------------------
in asm instance

sql:asm> select group_number, name from v$asm_diskgroup;

group_number name
———— ———
1 asmdsk1
2 asmdsk2

3) take the file offline.
————————–

sql:orcl> alter database datafile ‘ asmdsk2/orcl/datafile/users.256.565313879′ offline;

4)now copy the file from source diskgroup asmdsk1 to target diskgroup asmdsk2.
——————————————————————————————–
either
4. a) dbms_file_transfer package or
4. b) rman

can be used for this step.
( the step 5 to step 8 is based on the filenames from method b).

4.a).using dbms_file_transfer package

sql:orcl>create or replace directory orcl1 as ‘ asmdsk1/orcl/datafile’;

sql:asm> alter disgroup asmdsk2 add directory ‘ asmdsk2/test’;

sql:orcl> create or replace directory orcl2 as ‘ asmdsk2/test’;

sql:orcl>
begin
dbms_file_transfer.copy_file(
source_directory_object => ‘orcl1′,
source_file_name => ‘users.259.565359071′,
destination_directory_object => ‘orcl2′,
destination_file_name => ‘users01.dbf’);
end; database altered.

4 b).using rman copy the file to new diskgroup.
$ rman target system@orcl10

target database password:
connected to target database: orcl (dbid=1089529226)

rman>
rman> copy datafile ‘ asmdsk2/orcl/datafile/users.256.565313879′ to ‘ asmdsk1′;

starting backup at 03-aug-05
using target database controlfile instead of recovery catalog
allocated channel: ora_disk_1
channel ora_disk_1: sid=146 devtype=disk
channel ora_disk_1: starting datafile copy
input datafile fno=00004 name= asmdsk2/orcl/datafile/users.256.565313879
output filename= asmdsk1/orcl/datafile/users.259.565359071 tag=tag20050803t12110
9 recid=2 stamp=565359071
channel ora_disk_1: datafile copy complete, elapsed time: 00:00:03
finished backup at 03-aug-05

5) rename the file to point to new location.
——————————————-
if you have used dbms_file_transfer (method 4 a)) use the following command to rename:
sql:orcl> alter database rename file ‘ asmdsk2/orcl/datafile/users.256.565313879′ to
‘ asmdsk1/orcl/datafile/users.259.565359071′

database altered.

if you have used rman (method 4 b) use the following option of rman
rman run {
set newname for datafile ‘ asmdsk2/orcl/datafile/users.256.565313879′
to ‘ asmdsk1/orcl/datafile/users.259.565359071′ ;
switch datafile all;
}

6) recover the file.
——————-
sql:orcl> recover datafile ‘ asmdsk1/orcl/datafile/users.259.565359071′
media recovery complete.

7) bring the file online.
———————–
sql:orcl>alter database datafile ‘ asmdsk1/orcl/datafile/users.259.565359071′ online

database altered.

8) verify the new file location.
———————————
sql:orcl> select file_name from dba_data_files;

file_name
——————————————————————————-
asmdsk1/orcl/datafile/users.259.565359071
asmdsk1/orcl/sysaux01.dbf
asmdsk1/orcl/undotbs01.dbf
asmdsk1/orcl/system01.dbf

9) delete the file from its original location

sql:asm> alter diskgroup asmdsk2 drop file users.256.565313879;

note: 1) the steps provided here assume that the database is open and in archivelog mode.

2) the steps outlined here are not for system or sysaux datafiles. for system and sysaux an approach similar to the one given below can be used.

1) create a copy of datafile in target diskgroup:

rman> backup as copy tablespace system format ‘‘;
rman> backup as copy tablespace sysaux format ‘‘;

2) then shutdown the database and restart to a mounted state

rman> shutdown immediate;
rman> startup mount;

3) switch the datafiles to the copy

rman> switch tablespace system to copy;
rman> switch tablespace sysaux to copy;

4) recover the changes made to these tablespaces;

rman> recover database;

ref:
阅读(2531) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图