Oracle ASM file migration (using RMAN)

Source: Internet
Author: User

1. Migration of ASM files

ASM file migration refers to migrating database files located on the file system to the ASM disk group, or migrating database files located on the ASM disk group to the file system. As shown in:


Ii. migrate from the file system to the ASM disk group

Step 1: Modify the spfile

SQL> alter system set control_files = '+ dgdata1', '+ dgdata1' scope = spfile;


Step 2: Back up the control file

$ Rman target/

Rman> backup current controlfile format '/home/oracle/controlfile. ctl ';


Step 3: Start the database to NOMOUNT

Rman> shutdown immediate

Rman> startup nomount

Note: because the position of the control file in spfile is modified, the control file cannot be found when the database is started.

System File, so the database is started to the NOMOUNT state, and then restore the control file.


Step 4: Restore Control Files

Rman> resotore controlfile from '/home/oracle/controlfile. ctl ';

Note: RMAN restores the control file to the specified path based on the value of control_files in the spfile file.


Step 5: Start the database to MOUNT

Rman> alter database mount;

Note: because the control file has been restored, the system can smoothly read the control file, so the database is started to MOUNT

To migrate database files.


Step 6: copy the database file to the ASM disk group

Rman> backup as copy database format '+ dgdata1 ';

Note: The backup as copy command backs up the database in a COPY mode. Its function and the copy function of the Operating System

Commands are the same, but their executors are different. For database file copying

You do not need to specify it. It is automatically generated by ASM. In addition, the backup as copy command only backs up data files.

Log files, and do not back up temporary files.


Step 7: Modify the internal data file pointer of the Control File

Rman> switch database to copy;

Note: The control file still points to the directory path of the file system. Our purpose

Is to point to the ASM file modified to the ASM disk group. The function of this command is exactly like this.


Note: you cannot use the alter database rename file command to modify the internal data file of the control file.

Pointer. Because the alter database rename file command cannot be used across the system. Institute

You cannot change the data file path of the file system to the ASM file path of the ASM system.


Step 8: Restore database files

Rman> recover database;

Note: Apply logs to the recovered data file for restoration.


Step 9: Use RESETLOGS to open a database

Rman> alter database open resetlogs;


Step 10: Modify the online Log File Group

SQL> alter database add logfile group 3' + dgdata1 ',' + dgdata1 ') size 10 m;

SQL> alter database add logfile group 4' + dgdata1 ',' + dgdata1 ') size 10 m;

SQL> alter system switch logfile;

SQL> alter system switch logfile;

SQL> alter system checkpoint;

SQL> alter database drop logfile group 1;

SQL> alter database drop logfile group 2;


Note: Because the backup as copy database command only copies data files and does not copy online log files

To manually add online log files, delete the log files in the file system. During the deletion process,

The log file may be in the active or active state, so use the following command to solve the problem:

Alter system switch logfile; log switch)

Alter system checkpoint; write dirty data into the data file to make the log file state inactive)


Step 2: Add a temporary tablespace File

SQL> alter tablespace temp add tempfile '+ dgdata1' size 50 m;

SQL> alter tablespace temp drop tempfile '/u01/oradata/info/temp01.dbf ';

Note: Because the backup as copy database command only copies data files and does not copy temporary files

To manually add temporary files.


3. migrate data from the ASM disk to the file system

Step 1: Modify the spfile

SQL> alter system set control_files = '/u01/info/control_01.ctl' scope = spfile;


Step 2: Back up the control file

$ Rman target/

Rman> backup current controlfile format '/home/oracle/controlfile. ctl ';


Step 3: Start the database to NOMOUNT

Rman> shutdown immediate

Rman> startup nomount

Note: because the position of the control file in spfile is modified, the control file cannot be found when the database is started.

System File, so the database is started to the NOMOUNT state, and then restore the control file.


Step 4: Restore Control Files

Rman> resotore controlfile from '/home/oracle/controlfile. ctl ';

Note: RMAN restores the control file to the specified path based on the value of control_files in the spfile file.


Step 5: Start the database to MOUNT

Rman> alter database mount;

Note: because the control file has been restored, the system can smoothly read the control file, so the database is started to MOUNT

To migrate database files.


Step 6: copy the data file of the ASM disk to the file system

Rman> backup as copy datafile '+ dgdata1/info/datafile/system.256.344545 'format'/u01/info/system_01.dbf ';

Rman> backup as copy datafile '+ dgdata1/info/datafile/sysaux.257.344545 'fromat'/u01/info/sysaux_01.dbf ';

... ...

Note: The backup as copy command backs up the database in a COPY mode. Its function and the copy function of the Operating System

Commands are the same, but their executors are different. The names and

The name of the copy. In addition, the backup as copy command only backs up data files, does not back up log files, or

Back up temporary files.


Step 7: Modify the internal data file pointer of the Control File

Rman> switch database to copy;

Note: The control file still points to the directory path of the ASM file. Our purpose

Is to make it point to the database file modified to the file system. The function of this command is exactly like this.


Note: you cannot use the alter database rename file command to modify the internal data file of the control file.

Pointer. Because the alter database rename file command cannot be used across the system. Institute

You cannot change the ASM file path of the ASM system to the data file path of the file system.


Step 8: Restore database files

Rman> recover database;

Note: Apply logs to the recovered data file for restoration.


Step 9: Use RESETLOGS to open a database

Rman> alter database open resetlogs;


Step 10: Modify the online Log File Group

SQL> alter database add logfile group 3'/u01/info/redo_03_01.log') size 10 m;

SQL> alter database add logfile group 4'/u01/info/redo_04_01.log ') size 10 m;

SQL> alter system switch logfile;

SQL> alter system switch logfile;

SQL> alter system checkpoint;

SQL> alter database drop logfile group 1;

SQL> alter database drop logfile group 2;

Note: Because the backup as copy database command only copies data files and does not copy online log files

To manually add online log files, delete the log files in the ASM disk group. During the deletion process,

The log file may be in the active or active state, so use the following command to solve the problem:

Alter system switch logfile; log switch)

Alter system checkpoint; write dirty data into the data file to make the log file state inactive)


Step 2: Add a temporary tablespace File

SQL> alter tablespace temp add tempfile '/u01/oradata/info/temp01.dbf' size 10 m;

SQL> alter tablespace temp drop tempfile '+ dgdata1/info/tempfile/temp.259.34344 ';

Note: Because the backup as copy database command only copies data files and does not copy temporary files

To manually add temporary files.

Oracle video tutorial follow: http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html


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.