oracle rename datafile

 

方法1:文件系统

sql>alter tablespace users offline;
sql>host cp /u01/app/oracle/oradata/orcl/users01.dbf /u01/app/oracle/oradata/orcl/users_01.dbf 
sql>alter database rename file '/u01/app/oracle/oradata/orcl/users01.dbf' to  '/u01/app/oracle/oradata/orcl/users_01.dbf';
sql>alter tablespace users rename datafile '/u01/app/oracle/oradata/orcl/users01.dbf' to  '/u01/app/oracle/oradata/orcl/users_01.dbf';
sql>alter tablespace users online;
 

方法2:(asm环境只能用此法)

rman>
report schema;
copy datafile '+DATA/orcl/datafile/user01.dbf' to '+DATA/orcl/datafile/user_01.dbf'
run{
sql 'alter tablespace users offline';
set newname for datafile 4 to '+DATA/orcl/datafile/user_01.dbf' ;
restore datafile 4;
switch datafile 4;
recover datafile 4;
sql 'alter tablespace users online';
}
report schema;
posted @ 2023-03-28 18:13  雪竹子  阅读(341)  评论(0编辑  收藏  举报