Database Reference
In-Depth Information
The following example demonstrates how to move the data files associated with a single tablespace. First, take
the data files offline with the ALTER TABLESPACE statement:
SQL> alter tablespace users offline;
Now, from the OS prompt, move the data files to a new location, using the Linux/Unix mv command:
$ mv /u01/dbfile/O12C/users01.dbf /u02/dbfile/O12C/users01.dbf
Update the control file with the ALTER TABLESPACE statement:
alter tablespace users
rename datafile
'/u01/dbfile/O12C/users01.dbf'
to
'/u02/dbfile/O12C/users01.dbf';
Finally, bring the data files within the tablespace back online:
SQL> alter tablespace users online;
If you want to rename data files from multiple tablespaces in one operation, you can use the ALTER DATABASE
RENAME FILE statement (instead of the ALTER TABLESPACE...RENAME DATAFILE statement). The following example
renames several data files in the database. Because the SYSTEM and UNDO tablespaces' data files are being moved, you
must shut down the database first and then place it in mount mode:
SQL> conn / as sysdba
SQL> shutdown immediate;
SQL> startup mount;
Because the database is in mount mode, the data files aren't open for use, and thus there is no need to take the
data files offline. Next, physically move the files via the Linux/Unix mv command:
$ mv /u01/dbfile/O12C/system01.dbf /u02/dbfile/O12C/system01.dbf
$ mv /u01/dbfile/O12C/sysaux01.dbf /u02/dbfile/O12C/sysaux01.dbf
$ mv /u01/dbfile/O12C/undotbs01.dbf /u02/dbfile/O12C/undotbs01.dbf
you must move the files before you update the control file. the ALTER DATABASE RENAME FILE command
expects the file to be in the renamed location. if the file isn't there, an error is thrown: ORA-27037: unable to obtain file
status.
Note
 
Search WWH ::




Custom Search