In Oracle 10 Gb database, if you need to transfer the data files of one disk group in the ASM instance to another disk group. You can migrate data using a traditional file system or table space-level copy.
For example, if there is a database sdb and the data files in the users tablespace are all on the vg1 disk group, move the vg2 disk group to complete this task.
Backup as copy tablespace users format' + vg2 ';
Switch tablespace users to copy;
These two Commands need to be operated under rman, because only rman can manage files in the ASM disk group.
The test environment is oracle 10.2.0.4 for linux x86. The following is the test process.
Step 1: Check the environment, check the users tablespace, and restart the database to the mounted state.
[Oracle @ db-172-17-2-8 bdump] $ export ORACLE_SID = sdb
[Oracle @ db-172-17-2-8 bdump] $ sqlplus/as sysdba
SQL * Plus: Release 10.2.0.4.0-Production on Tue Feb 19 16:47:13 2013
Copyright (c) 1982,200 7, Oracle. All Rights Reserved.
Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select name from v $ tablespace
2;
NAME
------------------------------
USERS
UNDOTBS1
SYSTEM
SYSAUX
OFCARDQUERY
TEMP
6 rows selected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2084296 bytes
Variable Size 385876536 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14692352 bytes
Database mounted.
Step 2: Use the rman tool to copy the tablespace and then switch. The switch operation completes the modification of the data dictionary.
[Oracle @ db-172-17-2-8 bdump] $ rman target/
Recovery Manager: Release 10.2.0.4.0-Production on Tue Feb 19 16:48:20 2013
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to target database: SDB (DBID = 2245827732, not open)
RMAN> backup as copy tablespace users format '+ vg2 ';
Starting backup at 19-FEB-13
Using target database control file instead of recovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 151 devtype = DISK
Channel ORA_DISK_1: starting datafile copy
Input datafile fno = 00005 name = + VG1/sdb/users02.dbf
Output filename = + VG2/sdb/datafile/users.285.80781420.tag = TAG20130219T164857 recid = 17 stamp = 807814139
Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Channel ORA_DISK_1: starting datafile copy
Input datafile fno = 00004 name = + VG1/sdb/users01.dbf
Output filename = + VG2/sdb/datafile/users.284.807814141 tag = TAG20130219T164857 recid = 18 stamp = 807814141
Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 19-FEB-13
RMAN> switch tablespace users to copy;
Datafile 4 switched to datafile copy "+ VG2/sdb/datafile/users.284.807814141"
Datafile 5 switched to datafile copy "+ VG2/sdb/datafile/users.285.807814137"
RMAN> recover database;
Starting recover at 19-FEB-13
Using channel ORA_DISK_1
Starting media recovery
Media recovery complete, elapsed time: 00:00:00
Finished recover at 19-FEB-13