将某个空间的数据文件rename OR relocate
将某个空间的数据文件rename OR relocate
RNAME:
1.将表空间离线:
ALTER TABLESPACE users OFFLINE NORMAL;
2.使用os 命令 mv 进行重命名,重新调整物理位置:
3.rename 数据文件:
ALTER TABLESPACE users
RENAME DATAFILE '/u02/oracle/rbdb1/user1.dbf',
'/u02/oracle/rbdb1/user2.dbf'
TO '/u02/oracle/rbdb1/users01.dbf',
'/u02/oracle/rbdb1/users02.dbf';
4.建议对数据库进行全新全备份:
RELOCATE:
1.确定表空间的数据文件的位置,及大小:
SQL> SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES
WHERE TABLESPACE_NAME = 'USERS';
2.offline tablespace:
ALTER TABLESPACE users OFFLINE NORMAL;
3.使用os 命令将文件拷贝到新的位置,必须 rname 为需要改的名字:
When you rename and relocate datafiles with these procedures, only the pointers to the datafiles, as recorded in the database control file, are changed. The procedures do not physically rename any operating system files, nor do they copy files at the operating system level.
4.rename datafile :
ALTER TABLESPACE users
RENAME DATAFILE
'/u01/app/oracle/oradata/ORA11G/datafile/o1_mf_users_8mm4pff5_.dbf '
'/u01/app/oracle/oradata/ORA11G/datafile/USERS02.DBF'
TO
'/u01/app/oracle/oradata/ORA11G/datafile/USERS01.DBF '
'/u01/app/oracle/oradata/ORA11G/datafile/USERS02.DBF';
5.online datafile:
alter tablespace users online;
6.建议全新备份数据库