Method One:
1. Offline The status of the data file
Sql> Select file_name, Tablespace_name fromDba_data_fileswhere file_name like '%user%';file_name--------------------------------------------------------------------------------Tablespace_name------------------------------/U01/App/Oracle/Oradata/Ora11gr2/Users01.dbfuserssql> Altertablespace users offline; Tablespace altered. SQL> SelectName,status fromV$datafile;name--------------------------------------------------------------------------------STATUS--------------------------------------------------/U01/App/Oracle/Oradata/Ora11gr2/System01.dbfsystem/U01/App/Oracle/Oradata/Ora11gr2/Sysaux01.dbfonline/U01/App/Oracle/Oradata/Ora11gr2/Undotbs01.dbfonlinename--------------------------------------------------------------------------------STATUS--------------------------------------------------/U01/App/Oracle/Oradata/Ora11gr2/Users01.dbfoffline/U01/App/Oracle/Oradata/Ora11gr2/Example01.dbfonline
2. Operating system level to complete the true MV renaming operation
SQL>/u01/apps/Oracle/oradata/ora11gr2// u01/app/Oracle/oradata/ora11gr2/users01_bak.dbf
3. Database level modify data file name---> Tell database
sql> alter database rename file 2 " /u01/app/oracle/oradata/ora11gr2/users01.dbf " to 3 " /u01/app/oracle/oradata/ora11gr2/users01_bak.dbf " database altered.
4. Post the changed documents to online service
Table Space->online
Sql> Altertablespace users online; Tablespace altered. SQL> SelectName,status fromv$datafile;name STATUS------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------- -------------------- ------------------------------/U01/App/Oracle/Oradata/Ora11gr2/system01.dbf SYSTEM/U01/App/Oracle/Oradata/Ora11gr2/sysaux01.dbf ONLINE/U01/App/Oracle/Oradata/Ora11gr2/undotbs01.dbf ONLINE/U01/App/Oracle/Oradata/Ora11gr2/users01_bak.dbf ONLINE/U01/App/Oracle/Oradata/Ora11gr2/EXAMPLE01.DBF ONLINE
Method Two: (Applicable to all data files, but system files can only be used in this way)
1, Shutdown Guanqu
SQL>shutdown immediateDatabase closed. Database dismounted. ORACLE instance shut down.
2. The operating system level really performs the MV
SQL>/u01/apps/Oracle/oradata/ora11gr2// u01/app/Oracle/oradata/ora11gr2/users01.dbf
3. Boot to mount
sql> startup Mountoracle instance started. Total System Global area 830930944 bytesfixed Size 2257800 bytesvariable Size 536874104 bytes database Buffers 289406976 Bytesredo B Uffers 2392064 b Ytes database mounted.
4. Notify the database first to change the structure of the database-->rename
Sql> Alter DatabaseRenamefile 2 '/u01/app/oracle/oradata/ora11gr2/users01_bak.dbf' to 3 '/u01/app/oracle/oradata/ora11gr2/users01.dbf';Databasealtered. SQL> Alter Database Open;DatabaseAltered.
Changes to the practice data file: Renaming or changing the path users01.dbf-->users01_bak.dbf