• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to move a Datafile to a different Location on a Physical Standby Database

by admin

Sometimes it is necessary to move a Datafile to another Location (eg. Mountpoint, ASM Diskgroup) due to Space issues, Hardware Replacement, or Performance Reasons. There are several Possibilities to perform this Task explained below:

Physical Standby Database is mounted

We can copy and rename the Datafile while Managed Recovery is stopped. If the Physical Standby Database is opened READ ONLY you have to shutdown/startup mount first (and open again after renaming). You can use either using OS-Tools and SQL*PLUS, for example:

$ cp [Source] [Destination]
SQL> alter database rename file '[Path of Source datafilename or File#]' to ‘[Destination path and name]’;

If Active Data Guard is used:

SQL> alter database database open;

or using RMAN:

RMAN> connect target /

RMAN> run
      {
      backup as copy datafile  format '';
      switch datafile  to datafilecopy '';
      }

or

RMAN> run { backup as copy datafile [file#] format '[destination Path and name]'; }
RMAN> Switch datafile [file#] to copy;

Physical Standby Database is in Active Data Guard Mode (opened READ ONLY and Managed Recovery is running)

In Oracle 12c, it is now possible to online move a Datafile while Managed Recovery is running, i.e. the Physical Standby Database is in Active Data Guard Mode. You can use this command to move the Datafile:

SQL> alter database move datafile [File# or path and filename] to '[Destination path and name] [keep];

The ‘keep‘ option will also keep the original Datafile, without this Option the File gets automatically deleted once the move completed.

The Destination can also be an ASM Diskgroup, of course, if you want to move a Datafile to ASM or from one Diskgroup to another.

Filed Under: Data Guard, oracle, oracle 12c

Some more articles you might also be interested in …

  1. New Connections to the Database lead to ORA-12518 or TNS-12518
  2. ASMLib-Managed Disks on Multipathed iSCSI Targets are not Discovered after Server Reboot in CentOS/RHEL 7
  3. Oracle Database 12c New Feature: Transaction Guard and Application Continuity
  4. How to Optimize a Data Guard Configuration
  5. Oracle RMAN 11g New Feature – MultiSection Backups
  6. Oracle RMAN – Restore and Recovery of a Noarchivelog Database
  7. How to Use Startup, Shutdown, and Alter Database commands in Oracle 12c
  8. Beginners Guide to Monitoring Oracle Database Restore/Recovery Progress
  9. How to Backup and Restore Java Classes and Privileges only in Oracle Database
  10. What are Oracle Data Guard Protection Modes (redo transport rules) and how to configure them

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright