Port the tablespace so that it can be stored using ASM. 1. Use SQL * Plus to connect to the database instance as SYSDBA, and create a new tablespace named TBSASMMIG. This tablespace should only contain a file of 10 MB in the file system (without ASM ). Make sure that you are connected to the test0924 instance instead of the ASM instance. 2. Create a table named T2 stored in the new tablespace TBSASMMIG. Insert a row in T2. Submit your operations.3. Port TBSASMMIG to the ASM storage. After the operation, check whether the transplantation is successful and whether the tables in the tablespace are unchanged.
Sys @ TEST0924> select FILE_NAME, TABLESPACE_NAME from dba_data_files;
FILE_NAME TABLESPACE_NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/test0924/users01.dbf USERS
/U01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
/U01/app/oracle/oradata/test0924/system01.dbf SYSTEM
/U01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
/U01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1
Sys @ TEST0924> create tablespace TBSASMMIG datafile '/u01/app/oracle/oradata/test0924/tbsasmmi1_1.dbf' size 10 m;
Tablespace created.
Sys @ TEST0924> create table t2 (id number, name varchar2 (20) tablespace TBSASMMIG;
Table created.
Sys @ TEST0924> insert into t2 values (1, 'a1 ');
1 row created.
Sys @ TEST0924> commit;
Commit complete.
Sys @ TEST0924> select file_id, file_name, tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
------------------------------------------------------------------------------------------
4/u01/app/oracle/oradata/test0924/users01.dbf USERS
3/u01/app/oracle/oradata/test0924/tbsasmmi1_1.dbf TBSASMMIG
2/u01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
1/u01/app/oracle/oradata/test0924/system01.dbf SYSTEM
5/u01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
9/u01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1
6 rows selected.
[Oracle @ rtest ~] $ Rman target/
Recovery Manager: Release 11.2.0.3.0-Production on Sun Nov 3 17:02:51 2013
Copyright (c) 1982,201 1, Oracle and/or its affiliates. All rights reserved.
Connected to target database: TEST0924 (DBID = 2720875862)
RMAN> SQL 'alter database datafile 3 offline ';
SQL statement: alter database datafile 3 offline
RMAN> backup as copy datafile 3 format '+ data ';
Starting backup at 03-NOV-13
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 127 device type = DISK
Allocated channel: ORA_DISK_2
Channel ORA_DISK_2: SID = 191 device type = DISK
Allocated channel: ORA_DISK_3
Channel ORA_DISK_3: SID = 157 device type = DISK
Channel ORA_DISK_1: starting datafile copy
Input datafile file number = 00003 name =/u01/app/oracle/oradata/test0924/tbsasmmi1_1.dbf
Output file name = + DATA/test0924/datafile/tbsasmmig.264.830538365 tag = TAG20131103T170603 RECID = 13 STAMP = 830538366
Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 03-NOV-13
Starting Control File and SPFILE Autobackup at 03-NOV-13
Piece handle =/u01/app/oracle/fast_recovery_area/TEST0924/autobackup/2013_11_03/o1_mf_s_830538370_97fl6mr9 _. bkp comment = NONE
Finished Control File and SPFILE Autobackup at 03-NOV-13
RMAN> switch datafile 3 to copy;
Datafile 3 switched to datafile copy "+ DATA/test0924/datafile/tbsasmmig.264.830538365"
RMAN> recover datafile 3;
Starting recover at 03-NOV-13
Using channel ORA_DISK_1
Using channel ORA_DISK_2
Using channel ORA_DISK_3
Starting media recovery
Media recovery complete, elapsed time: 00:00:00
Finished recover at 03-NOV-13
RMAN> SQL 'alter database datafile 3 online ';
SQL statement: alter database datafile 3 online
Sys @ TEST0924> select file_id, file_name, tablespace_name from dba_data_files;
FILE_ID FILE_NAME TABLESPACE_NAME
------------------------------------------------------------------------------------------
4/u01/app/oracle/oradata/test0924/users01.dbf USERS
3 + DATA/test0924/datafile/tbsasmmig.264.830538365 TBSASMMIG
2/u01/app/oracle/oradata/test0924/sysaux01.dbf SYSAUX
1/u01/app/oracle/oradata/test0924/system01.dbf SYSTEM
5/u01/app/oracle/oradata/test0924/example01.dbf EXAMPLE
9/u01/app/oracle/oradata/test0924/undotbs01.dbf UNDOTBS1
6 rows selected.
Sys @ TEST0924> select * from t2
2;
ID NAME
------------------------------
1 a1
For more details, please continue to read the highlights on the next page:
Recommended reading:
Basic Oracle tutorial-copying a database through RMAN
Reference for RMAN backup policy formulation
RMAN backup learning notes
Oracle Database Backup encryption RMAN Encryption