Changes to the practice data file: Renaming or changing the path users01.dbf-->users01_bak.dbf

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.