Oracle notes: Summary of methods for moving data files

Source: Internet
Author: User

1. Use SQL * plus to move data files

  1. SQL>SelectFILE_NAME, ONLINE_STATUSFromDba_data_filesWhereFILE_NAMELike '% Ttb %';
  2. FILE_NAME ONLINE _
  3. Certificate -----------------------------------------------------------------------------------------------------------
  4. /U01/app/Oracle/oradata/orcl/ttb1.dbf ONLINE
  5. SQL>AlterTablespace ttb1 offline;
  6. The tablespace has been changed.
  7. SQL>! Mv/u01/app/oracle/oradata/orcl/ttb1.dbf/u01/ttb1.dbf
  8. SQL>AlterTablespace ttb1 rename datafile'/U01/app/oracle/oradata/orcl/ttb1.dbf' To '/U01/ttb1.dbf';
  9. The tablespace has been changed.
  10. SQL>AlterTablespace ttb1 online;
  11. The tablespace has been changed.
  12. SQL>SelectFILE_NAME, ONLINE_STATUSFromDba_data_filesWhereFILE_NAMELike '% Ttb %';
  13. FILE_NAME ONLINE _
  14. Certificate -----------------------------------------------------------------------------------------------------------
  15. /U01/ttb1.dbf ONLINE

2. Use SQL * plus to move data files

  1. SQL>SelectFILE_NAME, ONLINE_STATUSFromDba_data_filesWhereFILE_NAMELike '% Ttb %';
  2. FILE_NAME ONLINE _
  3. Certificate -----------------------------------------------------------------------------------------------------------
  4. /U01/ttb1.dbf ONLINE
  5. SQL>AlterTablespace ttb1 offline;
  6. The tablespace has been changed.
  7. SQL>! Mv/u01/ttb1.dbf/u01/app/oracle/oradata/orcl/ttb1.dbf
  8. SQL>Alter DatabaseOrcl rename file'/U01/ttb1.dbf' To '/U01/app/oracle/oradata/orcl/ttb1.dbf';
  9. The database has been changed.
  10. SQL>AlterTablespace ttb1 online;
  11. The tablespace has been changed.
  12. SQL>SelectFILE_NAME, ONLINE_STATUSFromDba_data_filesWhereFILE_NAMELike '% Ttb %';
  13. FILE_NAME ONLINE _
  14. Certificate -----------------------------------------------------------------------------------------------------------
  15. /U01/app/oracle/oradata/orcl/ttb1.dbf ONLINE

3. Use rman to move data files

  1. SQL>SelectFILE_NAME, ONLINE_STATUSFromDba_data_filesWhereFILE_NAMELike '% Ttb %';
  2. FILE_NAME ONLINE _
  3. Certificate -----------------------------------------------------------------------------------------------------------
  4. /U01/app/oracle/oradata/orcl/ttb1.dbf ONLINE
  1. [Oracle @ linux ~] $ Rman target/
  2. Recovery MANAGER: Release 10.2.0.4.0-ProductionOnThursday October 6 17:19:24 2011
  3. Copyright (c) 1982,200 7, Oracle.AllRights reserved.
  4. Connect to the target database: ORCL (DBID = 1289573235)
  5. RMAN> backupAsCopy datafile'/U01/app/oracle/oradata/orcl/ttb1.dbf'Format'/U01/ttb1.dbf';
  6. Start backup from
  7. Use the target database control file to replace the recovery directory
  8. Allocated channel: ORA_DISK_1
  9. Channel ORA_DISK_1: sid = 149 devtype = DISK
  10. Channel ORA_DISK_1: starts data file copies
  11. Input data file: fno = 00014Name=/U01/app/oracle/oradata/orcl/ttb1.dbf
  12. Output file name =/u01/ttb1.dbf mark = TAG20111006T172010 recid = 3 timestamp = 763838410
  13. Channel ORA_DISK_1: Data File copied. elapsed time: 00:00:01
  14. Backup completed in month-11
  15. RMAN> SQL"Alter tablespace ttb1 offline";
  16. SQL statement:AlterTablespace ttb1 offline
  17. RMAN> switch datafile'/U01/app/oracle/oradata/orcl/ttb1.dbf' ToCopy;
  18. Data File 14 has been switched to a data file copy"/U01/ttb1.dbf"
  19. RMAN> SQL"Alter tablespace ttb1 online";
  20. SQL statement:AlterTablespace ttb1 online
  21. MAN-00571: ========================================================== ==============================
  22. RMAN-00569: ==================== error message stack follows ==========================
  23. RMAN-00571: ========================================================== ==============================
  24. RMAN-03009: SQL command (DefaultOn the channel, at 17:21:52 on) failed
  25. RMAN-11003: failed during analysis/execution of SQL statements:AlterTablespace ttb1 online
  26. ORA-01113: file 14 requires media recovery
  27. ORA-01110: Data File 14:'/U01/ttb1.dbf'
  28. RMAN> recover datafile 14;
  29. Start recover from
  30. Use channel ORA_DISK_1
  31. Restoring media...
  32. Media Recovery completed. Time: 00:00:03
  33. The recover is completed from month to month 11.
  34. RMAN> SQL"Alter tablespace ttb1 online";
  35. SQL statement:AlterTablespace ttb1 online
 
  1. SQL>SelectFILE_NAME, ONLINE_STATUSFromDba_data_filesWhereFILE_NAMELike '% Ttb %';
  2. FILE_NAME ONLINE _
  3. Certificate -----------------------------------------------------------------------------------------------------------
  4. /U01/ttb1.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.