参考文档: https://docs.oracle.com/database/122/ADMIN/managing-data-files-and-temp-files.htm#ADMIN13844
先drop掉原来的表空间,建立表空间
SYS@orcl12c>drop tablespace test including contents and datafiles;
Tablespace dropped.
SYS@orcl12c>create tablespace TEST datafile '/u01/app/oracle12/oradata12/orcl12c/test.dbf' size 10M ;
Tablespace created.
将表空间的文件更改为test01.dbf, 原来的文件保留
SYS@orcl12c>
ALTER DATABASE MOVE DATAFILE '/u01/app/oracle12/oradata12/orcl12c/test.dbf'
2 TO '/u01/app/oracle12/oradata12/orcl12c/test01.dbf' keep;
Database altered.
SYS@orcl12c> select file_name,tablespace_name from dba_data_files where tablespace_name='TEST';
FILE_NAME
--------------------------------------------------------------------------------
TABLESPACE_NAME
------------------------------
/u01/app/oracle12/oradata12/orcl12c/test01.dbf
TEST
SYS@orcl12c>
查看host上的数据文件
[oracle@11gr2 orcl12c]$ ll test*
-rw-r----- 1 oracle oinstall 10493952 Nov 8 20:57 test01.dbf
-rw-r----- 1 oracle oinstall 10493952 Nov 8 20:57 test.dbf
[oracle@11gr2 orcl12c]$ pwd
/u01/app/oracle12/oradata12/orcl12c
[oracle@11gr2 orcl12c]$
reuse 参数,略。具体参考文档
end