Renaming Datafiles in a Single Tablespace
To rename datafiles from a single tablespace, complete the following steps:
- Take the non-
SYSTEMtablespace that contains the datafiles offline.For example:
ALTER TABLESPACE users OFFLINE NORMAL;
- Rename the datafiles using the operating system.
- Use the
ALTER TABLESPACEstatement with theRENAME DATAFILEclause to change the filenames within the database.For example, the following statement renames the datafiles /u02/oracle/rbdb1/user1.dbf and /u02/oracle/rbdb1/user2.dbf to/u02/oracle/rbdb1/users01.dbf and /u02/oracle/rbdb1/users02.dbf, respectively:
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';The new files must already exist; this statement does not create the files. Also, always provide complete filenames (including their paths) to properly identify the old and new datafiles. In particular, specify the old datafile name exactly as it appears in the
DBA_DATA_FILESview of the data dictionary. - Back up the database. After making any structural changes to a database, always perform an immediate and complete backup.
No comments:
Post a Comment