Migrate the ORACLE database file system to the ASM Disk

Source: Internet
Author: User
1. log on to the ASM instance and check whether the ASM disk is correct [oracle @ rhel5 ~] $ ExportORACLE_SID + ASM [oracle @ rhel5 ~] $ SqlplusassysdbaSQLselectname, statefromv $ asm_diskgroup; & nbsp ..

1. log on to the ASM instance and check whether the ASM disk is correct [oracle @ rhel5 ~] $ ExportORACLE_SID = + ASM [oracle @ rhel5 ~] $ Sqlplus/assysdbaSQLselectname, statefromv $ asm_diskgroup ;..


1. log on to the ASM instance and check whether the ASM disk is correct.

[Oracle @ rhel5 ~] $ Export ORACLE_SID = + ASM
[Oracle @ rhel5 ~] $ Sqlplus/as sysdba

SQL> select name, state from v $ asm_diskgroup;


NAME STATE
--------------------------
DG1 MOUNTED

2. log on to the database prod
[Oracle @ rhel5 ~] $ Export ORACLE_SID = prod
[Oracle @ rhel5 ~] $ Sqlplus/as sysdba

A. view the control file
SQL> show parameter control_files;

NAME TYPE
---------------------------------------------------------------------
VALUE
------------------------------
Control_files string
/U01/app/oracle/oradata/prod/c
Ontrol01.ctl,/u01/app/oracle/
Oradata/prod/control02.ctl,/u
01/app/oracle/oradata/prod/con
Trol03.ctl
SQL> select name from v $ controlfile;

NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/prod/control01.ctl
/U01/app/oracle/oradata/prod/control02.ctl
/U01/app/oracle/oradata/prod/control03.ctl


B. view the db_create_file_dest parameters.
SQL> show parameter db_create_file_dest;

NAME TYPE
---------------------------------------------------------------------
VALUE
------------------------------
Db_create_file_dest string


C. Modify the Control File Location

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

System altered.

SQL> alter system set db_create_file_dest = '+ DG1' scope = spfile;

System altered.


D. Shut down the database.

SQL> shutdown immediate;

3. log on to rman

[Oracle @ rhel5 ~] $ Export ORACLE_SID = prod
[Oracle @ rhel5 ~] $ Rman target/

A. Use rman to migrate the control files and data files of the target database

RMAN> startup nomount;

B. Use rman to recreate the control file on the file system to DG1 on the ASM disk.
RMAN> restore controlfile from '/u01/app/oracle/oradata/prod/control01.ctl ';

C. Use rman to copy database files to the ASM disk group DG1
RMAN> alter database mount;
RMAN> run {
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Allocate channel c4 type disk;
Backup as copy database format' + DG1 ';
}

D. Use the rman switch command to modify the pointer to the data file in the control file so that it points to the new location.
RMAN> switch database to copy;
RMAN> recover database;
RMAN> alter database open;


4. log on to the database prod
[Oracle @ rhel5 ~] $ Export ORACLE_SID = prod
[Oracle @ rhel5 ~] $ Sqlplus/as sysdba

SQL> select name from v $ controlfile;

NAME
--------------------------------------------------------------------------------
+ DG1/prod/controlfile/backup.271.842150617

SQL> select name from v $ datafile;

NAME
--------------------------------------------------------------------------------
+ DG1/prod/datafile/system.272.842151185
+ DG1/prod/datafile/undotbs1.275.842151191
+ DG1/prod/datafile/sysaux.273.842151185
+ DG1/prod/datafile/users.276.842151211
+ DG1/prod/datafile/example.274.842151187

A. migrate temp files
SQL> select name, status, enabled from v $ tempfile;

NAME
--------------------------------------------------------------------------------
STATUS ENABLED
---------------------------------------------------
/U01/app/oracle/oradata/prod/temp01.dbf
ONLINE READ WRITE

Since the temp file does not have available data but only caches data, temp can directly add a new temp file and then delete the old temp file.
SQL> alter tablespace temp add tempfile '+ DG1 ';

Tablespace altered.

SQL> alter tablespace temp drop tempfile '/u01/app/oracle/oradata/prod/temp01.dbf ';

Tablespace altered.


SQL> select name from v $ tempfile;

NAME
--------------------------------------------------------------------------------
+ DG1/prod/tempfile/temp.279.842151759

B. migrate the log file, create a new log file in DG1, and delete the old file.

SQL> select group #, member from v $ logfile;

GROUP #
----------
MEMBER
--------------------------------------------------------------------------------
3
/U01/app/oracle/oradata/prod/redo03.log

2
/U01/app/oracle/oradata/prod/redo02.log

1
/U01/app/oracle/oradata/prod/redo01.log



SQL> alter database add logfile '+ DG1 'size 51 m;

Database altered.

SQL> alter database add logfile '+ DG1 'size 51 m;

Database altered.

SQL> alter database add logfile '+ DG1 'size 51 m;

Database altered.


When deleting a log file group, the status of the log file group must be inactive, but it cannot be deleted. This indicates that the log file group is not inactive.

SQL> select group #, status from v $ log;

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.