ONLINE RENAME AND
RELOCATION OF AN ACTIVE DATA FILE
Unlike in the previous releases, a data file migration or
renaming in Oracle database 12c R1 no longer requires a number of steps i.e.
putting the tablespace in READ ONLY mode, followed by data file offline action.
In 12c R1, a data file can be renamed or moved online simply using the ALTER
DATABASE MOVE DATAFILE SQL statement. While the data file is being transferred,
the end user can perform queries, DML and DDL tasks. Additionally, data files
can be migrated between storages e.g. from non-ASM to ASM and vice versa.
Rename a data file:
SQL> ALTER DATABASE MOVE DATAFILE '/u00/data/users01.dbf'
TO '/u00/data/users_01.dbf';
Migrate a data file from non-ASM to ASM:
SQL> ALTER DATABASE MOVE DATAFILE
'/u00/data/users_01.dbf' TO '+DG_DATA';
Migrate a data file from one ASM disk group to another:
SQL> ALTER DATABASE MOVE DATAFILE '+DG_DATA/DBNAME/DATAFILE/users_01.dbf
' TO '+DG_DATA_02';
Overwrite the data file with the same name, if it exists at
the new location:
SQL> ALTER DATABASE MOVE DATAFILE
'/u00/data/users_01.dbf' TO '/u00/data_new/users_01.dbf' REUSE;
Copy the file to a new location whilst retaining the old
copy in the old location:
SQL> ALTER DATABASE MOVE DATAFILE
'/u00/data/users_01.dbf' TO '/u00/data_new/users_01.dbf' KEEP;
You can monitor the progress while a data file being moved
by querying the v$session_longops dynamic view. Additionally, you can also
refer the alert.log of the database where Oracle writes the details about
action being taken place.
No comments:
Post a Comment