+
号,导致自动创建到dbs目录上可以不停库处理
col file_name for a80 col tablespace_name for a32 select file_name,file_id,ONLINE_STATUS,tablespace_name from dba_data_files;
将本地数据文件OFFLINE,或可以将整个表空间OFFLINE。这里假设本地数据文件号为11
alter database datafile 11 offline;
asmcmd cd +DATA/orcl/datafile cp /oradata/orcl/datafile/test01.dbf .
rman target / copy datafile 11 to '+DATA'
-- sqlplus "/ as sysdba" alter database rename file '/oradata/orcl/datafile/test01.dbf' to '+data/orcl/datafile/test01.dbf'; -- 查看文件状态为RECOVER select file_name,file_id,ONLINE_STATUS,tablespace_name from dba_data_files;
sqlplus "/ as sysdba" alter database recover datafile 11; alter database datafile 11 online; select file_name,file_id,ONLINE_STATUS,tablespace_name from dba_data_files;
非归档模式下单个数据文件在数据库OPEN状态下无法OFFLINE
alter tablespace test offline;
rman target / copy datafile 11 to '+data';
-- sqlplus "/ as sysdba" alter database rename file '/oradata/orcl/datafile/test01.dbf' to '+data/orcl/datafile/test01.dbf'; -- 查看文件状态为RECOVER select file_name,file_id,ONLINE_STATUS,tablespace_name from dba_data_files;
alter tablespace test online;
shutdown immediate;
asmcmd cp
report schema; backup as copy datafile 11 format '+data'; switch datafile 11 to copy;
startup mount;
-- sqlplus "/ as sysdba" alter database rename file '/oradata/orcl/datafile/system02.dbf' to '+data/orcl/datafile/system02.dbf';
alter database open;
可能出现errors ORA-01516 or original error ORA-01157: cannot identify/lock data file错误,需要重启其它DB实例
shutdown immediate; startup;
alter database move datafile 12 to '+data/O12C/datafile/test02.dbf';
不需区分系统表空间还是非系统表空间数据文件
不需要执行rename数据文件
# sqlplus offline数据文件 alter database datafile 8 offline; # rman report schema; backup as copy datafile 8 format '+data'; switch datafile 8 to copy; # sqlplus recover datafile 8; alter database datafile 8 online;