首页 > Linux操作系统 > Linux操作系统 > 巧用rman修改数据文件名
在添加一个数据文件时,由于终端的原因,导致数据文件名中包含了隐含字符,在操作系统和数据库里均无法以数据文件名定位数据文件,用rman对该数据文件进行重命名:
1.获得该文件的file_id
select file_id from dba_data_files where tablespace_name='BCREG_TS04';
2.运行rman,执行如下脚本:
run{
sql "alter database backup controlfile to ''/rmandata/backup/3/controlfile_old2''";
copy datafile 172 to ‘/oradata/bcreg_data3/BCREG_TS04_06.dbf’;
set newname for datafile 172 to ‘/oradata/bcreg_data3/BCREG_TS04_06.dbf’;
switch datafile 172;
sql "alter database backup controlfile to ''/rmandata/backup/3/controlfile_new''";
}
上述脚本先将该数据文件copy,再执行set newname对该文件重命名,最后执行switch,切换到新的数据文件名。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10972173/viewspace-255334/ ,如需转载,请注明出处,否则将追究法律责任。