First Method (must be done as sysdba):
1. First, shut down the database: “shutdown immediate;”
2. Rename and/or move data files to new destination using OS commands (e.g. mv for linux)
3. Startup DB in mount mode: “startup mount;”
4. Change data files names from the DB: “alter database rename file ‘ old_absolute_path_to_old_file_including_filename’ TO ‘new_absolute_path_to_old_file_including_filename’ ;”
5. Open the DB: “alter database open;”
Second Method (must be done as sysdba as well):
1. Take the tablespace offline: “alter tablespace app_data offline;”
2. Rename and/or move data files to new destination using OS commands (e.g. mv for linux)
3. Use the alter tablespace command to rename the file in the database: “alter tablespace tablespace_name rename datafile ‘ old_absolute_path_to_old_file_including_filename’ TO ‘new_absolute_path_to_old_file_including_filename’ ;”
4. Bring the tablespace back online: “alter tablespace tablespace_name online;”
Advantage of the second over the first is that you don’t need to bring the whole DB down, only the tablespace, however I still prefer the first 🙂
Note: To get the names of the existing Data Files, use the following query: “select name from v$datafile;”
Source: Ahmed Ismail