Using datafile copy to rename a data file, datafilecopy

Source: Internet
Author: User

Using datafile copy to rename a data file, datafilecopy

Ideas:

O use RMAN to copy data files

O offline

O switch file name. This step changes the file name corresponding to the data file in the control file.

O recover data files

O online data files and restore production

Note: You can also use this method for database copy, switch database, and migrate the DATABASE...

 

The experiment process is as follows:

==============================================

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination/home/oracle/arch
Oldest online log sequence 63
Next log sequence to archive 65
Current log sequence 65

RMAN> report schema;

Using target database control file instead of recovery catalog
Report of database schema

List of Permanent Datafiles
======================================
File Size (MB) Tablespace RB segs Datafile Name
---------------------------------------------------------------
1 700 SYSTEM ***/u01/app/oracle/oradata/ora10g/system01.dbf
2 700 UNDOTBS1 ***/u01/app/oracle/oradata/ora10g/undotbs01.dbf
3 260 SYSAUX ***/u01/app/oracle/oradata/ora10g/sysaux01.dbf
4 5 USERS ***/u01/app/oracle/oradata/ora10g/users01.dbf
5 5 USERS ***/u01/app/oracle/oradata/ora10g/users02.dbf <I plan to rename the data file No. 5

List of Temporary Files
======================================
File Size (MB) Tablespace Maxsize (MB) Tempfile Name
---------------------------------------------------------------
1 30 TEMP 32767/u01/app/oracle/oradata/ora10g/temp01.dbf

RMAN> backup as copy datafile 5 format'/u01/app/oracle/oradata/ora10g/users02_new.dbf ';

Starting backup at 05-FEB-15
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 146 devtype = DISK
Channel ORA_DISK_1: starting datafile copy
Input datafile fno = 00005 name =/u01/app/oracle/oradata/ora10g/users02.dbf
Output filename =/u01/app/oracle/oradata/ora10g/users02_new.dbf tag = TAG20150205T225207 recid = 1 stamp = 870907927
Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 05-FEB-15

SQL> alter database datafile 5 offline;

Database altered.
SQL> recover datafile 5;
Media recovery complete.
SQL> alter database datafile 5 online;

Database altered.

RMAN> report schema;

Report of database schema

List of Permanent Datafiles
======================================
File Size (MB) Tablespace RB segs Datafile Name
---------------------------------------------------------------
1 700 SYSTEM ***/u01/app/oracle/oradata/ora10g/system01.dbf
2 700 UNDOTBS1 ***/u01/app/oracle/oradata/ora10g/undotbs01.dbf
3 260 SYSAUX ***/u01/app/oracle/oradata/ora10g/sysaux01.dbf
4 5 USERS ***/u01/app/oracle/oradata/ora10g/users01.dbf
5 5 USERS ***/u01/app/oracle/oradata/ora10g/users02_new.dbf <the file name has been replaced

List of Temporary Files
======================================
File Size (MB) Tablespace Maxsize (MB) Tempfile Name
---------------------------------------------------------------
1 30 TEMP 32767/u01/app/oracle/oradata/ora10g/temp01.dbf

 

Related Article

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.