Data file renames can be used in two ways: ALTER DATABASE and ALTER TABLESPACE
The difference between the two methods is that the ALTER TABLESPACE can only be used in the following data files: not the SYSTEM tablespace, does not include the activated rollback segment, there is a temporal session, but use ALTER TABLESPACE to execute when the instance is started The ALTER DATABASE is adapted to any data file, but the database is to be in the MOUNT state.
ALTER DATABASE steps: 1. Close instance 2. Rename or move the data file 3.mount database with the operating system command, then use the ALTER DATABASE to rename the file, to write the full path name 4. Starting instance
SVRMGR> Connect Sys / Oracle As Sysdba; SVRMGR> Startup Mount U1; SVRMGR> ALTER DATABASE RENAME File '/u01/oracle/u1/data01.dbf' to '/u02/oracle/u1/data04.dbf'; SVRMGR> ALTER Database open;
ALTER TABLESPACE Steps: 1.Offline The corresponding tablespace 2. Rename or move the data file with the operating system command 3. Use the alter tableSpace command to rename the file in the database 4.online table space
SVRMGR> connect sys / oracle as sysdba SVRMGR> alter tablespace app_data offline; SVRMGR> alter tablespace app_date rename datafile '/u01/oracle/U1/data01.dbf' TO '/u02/oracle/U1/data04.dbf'; SVRMGR> Alter TableSpace App_Data Online;