Migrate common files to ASM

Source: Internet
Author: User

1. ASM access through FTP and HTML using XDB Configuration

2. RMAN

3. dbms_file_transfer

4.11g asmcmd

Migrate the database from the file system to ASM using RMAN
1. Open the ASM instance
[Oracle @ ASM ~] $ Echo $ oracle_sid
+ ASM
[Oracle @ ASM ~] $ Sqlplus/nolog

SQL * Plus: Release 10.2.0.1.0-production on Mon Apr 6 01:01:28 2009

Copyright (c) 1982,200 5, Oracle. All rights reserved.

SQL> Conn/As sysdba
Connected to an idle instance.
SQL> startup
ASM instance started

Total system global area 79691776 bytes
Fixed size 1217812 bytes
Variable Size 53308140 bytes
ASM cache 25165824 bytes
ASM diskgroups mounted
SQL> select name, State from V $ asm_diskgroup;

Name state
-----------------------------------------
Data mounted
Dgroup1 mounted
Ii. Modify the spfile of the target database (toasm)
SQL> alter system set control_files = '+ dgroup1' scope = spfile;

System altered.

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

System altered.
3. Close the target database
SQL> shutdown immediate
Database closed.
Database dismounted.
Oracle instance shut down.
4. connect to the target database through RMAN and start to nomount

[Oracle @ ASM admin] $ RMAN target/

Recovery MANAGER: Release 10.2.0.1.0-production on Mon Apr 6 01:06:39 2009

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Connected to target database (not started)

RMAN> startup nomount

Oracle instance started

Total system global area 230686720 bytes

Fixed size 1218676 bytes
Variable Size 75499404 bytes
Database buffers 150994944 bytes
Redo buffers 2973696 bytes

RMAN>
5. Restore the control file to the ASM disk group and start the database to the Mount status.

RMAN> restore controlfile from '/u01/oradata/toasm/control01.ctl ';

Starting restore at 06-apr-09
Using target database control file instead of recovery catalog
Allocated channel: ora_disk_1
Channel ora_disk_1: SID = 155 devtype = Disk

Channel ora_disk_1: Copied control file copy
Output Filename = + dgroup1/toasm/controlfile/backup.269.683428107
Finished restore at 06-apr-09
RMAN> alter database Mount;

Database mounted
Released channel: ora_disk_1

RMAN>
6. Use RMAN to copy data files to the ASM disk group
RMAN> Backup as copy database format '+ dgroup1 ';
Starting backup at 06-apr-09
Allocated channel: ora_disk_1
Channel ora_disk_1: SID = 155 devtype = Disk
Channel ora_disk_1: Starting datafile copy
Input datafile fno = 00001 name =/u01/oradata/toasm/system01.dbf
Output Filename = + dgroup1/toasm/datafile/system.258.683428337 tag = tag20090406t0000015 recid = 2 Stamp = 683428412
Channel ora_disk_1: datafile copy complete, elapsed time: 00:01:25
Channel ora_disk_1: Starting datafile copy
Input datafile fno = 00003 name =/u01/oradata/toasm/sysaux01.dbf
Output Filename = + dgroup1/toasm/datafile/sysaux.259.683428421 tag = tag20090406t0000015 recid = 3 stamp = 683428457
Channel ora_disk_1: datafile copy complete, elapsed time: 00:00:45
Channel ora_disk_1: Starting datafile copy
Input datafile fno = 00005 name =/u01/oradata/toasm/example01.dbf
Output Filename = + dgroup1/toasm/datafile/example.261.683428467 tag = tag20090406t0000015 recid = 4 stamp = 683428481
Channel ora_disk_1: datafile copy complete, elapsed time: 00:00:15
Channel ora_disk_1: Starting datafile copy
Input datafile fno = 00002 name =/u01/oradata/toasm/undotbs01.dbf
Output Filename = + dgroup1/toasm/datafile/undotbs1.260.683428483 tag = tag20090406t0000015 recid = 5 Stamp = 683428486
Channel ora_disk_1: datafile copy complete, elapsed time: 00:00:07
Channel ora_disk_1: Starting datafile copy
Input datafile fno = 00004 name =/u01/oradata/toasm/users01.dbf
Output Filename = + dgroup1/toasm/datafile/users.262.683428489 tag = tag20090406t0000015 recid = 6 stamp = 683428491
Channel ora_disk_1: datafile copy complete, elapsed time: 00:00:03
Channel ora_disk_1: Starting datafile copy
Copying Current Control File
Output Filename = + dgroup1/toasm/controlfile/backup.278.683428493 tag = tag20090406t0000015 recid = 7 stamp = 683428495
Channel ora_disk_1: datafile copy complete, elapsed time: 00:00:03
Channel ora_disk_1: Starting full datafile backupset
Channel ora_disk_1: specifying datafile (s) in backupset
Including Current spfile in backupset
Channel ora_disk_1: Starting piece 1 at 06-apr-09
Channel ora_disk_1: finished piece 1 at 06-apr-09
Piece handle = + dgroup1/toasm/backupset/2009_04_06/nnsnf0_tag20090406t01_15_0.277.683428497 tag = tag20090406t01_15 comment = none
Channel ora_disk_1: Backup set complete, elapsed time: 00:00:05
Finished backup at 06-apr-09

RMAN>
7. Use the RMAN switch command to modify the pointer to the data file in the control file and point it to a new location.

RMAN> switch database to copy;

Datafile 1 switched to datafile copy "+ dgroup1/toasm/datafile/system.258.683428337"
Datafile 2 switched to datafile copy "+ dgroup1/toasm/datafile/undotbs1.260.683428483"
Datafile 3 switched to datafile copy "+ dgroup1/toasm/datafile/sysaux.259.683428421"
Datafile 4 switched to datafile copy "+ dgroup1/toasm/datafile/users.262.683428489"
Datafile 5 switched to datafile copy "+ dgroup1/toasm/datafile/example.261.683428467"

RMAN> recover database;

Starting recover at 06-apr-09
Using channel ora_disk_1

Starting media recovery
Media recovery complete, elapsed time: 00:00:00

Finished recover at 06-apr-09

RMAN>
8. Open a database
RMAN> alter database open;

Database opened
RMAN>
IX. Migration of temporary files
Since temporary files will not be migrated, we only need to delete the new ones.

SQL> select name from V $ tempfile;

Name
--------------------------------------------------
/U01/oradata/toasm/temp01.dbf

SQL> alter tablespace temp add tempfile '+ dgroup1 ';

Tablespace altered.

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

Tablespace altered.

SQL> select name from V $ tempfile;

Name
--------------------------------------------------
+ Dgroup1/toasm/tempfile/temp.263.683428909

SQL>
10. Add new online redologs to ASM
SQL> select * from V $ log;

Group # thread # sequence # bytes members arc status first_change # first_tim
-------------------------------------------------------------------------------------------
1 1 5 10485760 1 Yes inactive 473286 06-apr-09
2 1 6 10485760 1 no current 474627 06-apr-09
3 1 4 10485760 1 Yes inactive 472097 06-apr-09

SQL> alter database add logfile '+ dgroup1 'size 10 m;

Database altered.

SQL> alter database add logfile '+ dgroup1 'size 10 m;

Database altered.

SQL> alter database add logfile '+ dgroup1 'size 10 m;

Database altered.

SQL> alter database drop logfile group 1;

Database altered.
SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> alter database drop logfile group 2;
Alter database drop logfile Group 2
*
Error at line 1:
ORA-01624: log 2 needed for crash recovery of instance toasm (thread 1)
ORA-00312: Online log 2 thread 1: '/u01/oradata/toasm/redo02.log'

SQL> alter system checkpoint;

System altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.
SQL> select Member from V $ logfile;

Member
--------------------------------------------------
+ Dgroup1/toasm/onlinelog/group_4.275.683429043
+ Dgroup1/toasm/onlinelog/group_5.276.683429047
+ Dgroup1/toasm/onlinelog/group_6.264.683429049

SQL>
11. Delete the original database file

[Oracle @ ASM ~] $ LS-LH/u01/oradata/toasm/
Total 892 m
-RW-r ----- 1 Oracle oinstall 6.8 m APR 6 0:05 control01.ctl
-RW-r ----- 1 Oracle oinstall 6.8 m APR 6 0:05 control02.ctl
-RW-r ----- 1 Oracle oinstall 6.8 m APR 6 0:05 control03.ctl
-RW-r ----- 1 Oracle oinstall 101 m APR 6 0:05 example01.dbf
-RW-r ----- 1 Oracle oinstall 11 m APR 6 0:17 redo01.log
-RW-r ----- 1 Oracle oinstall 11 m APR 6 0:24 redo02.log
-RW-r ----- 1 Oracle oinstall 11 m APR 6 0:17 redo03.log
-RW-r ----- 1 Oracle oinstall 231 m apr 6 0:05 sysaux01.dbf
-RW-r ----- 1 Oracle oinstall 481 m apr 6 system01.dbf
-RW-r ----- 1 Oracle oinstall 26 m APR 6 0:05 undotbs01.dbf
-RW-r ----- 1 Oracle oinstall 5.1 m APR 6 0:05 users01.dbf
[Oracle @ ASM ~] $ Rm-RF/u01/oradata/toasm /*
[Oracle @ ASM ~] $ LS-LH/u01/oradata/toasm/
Total 0
[Oracle @ ASM ~] $
Migration completed!

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.