1. 程式人生 > >oracle表空間文件系統遷移到ASM

oracle表空間文件系統遷移到ASM

備份 value local lec max num 文件系統 space get

1.配置測試環境
創建數據表空間
create tablespace test logging datafile ‘/home/oracle/test.dbf‘ size 10m autoextend on next 10m maxsize 2048m extent management local;
創建用戶並指定表空間
create user test identified by 123456 default tablespace test;
給用戶授予權限
grant connect,resource,dba to test;
創建表
sqlplus test/123456@orcl
CREATE TABLE test2(userId number(8), username varchar2(40), tep number (20)) PARTITION BY RANGE (userId)(PARTITION p1 VALUES LESS THAN (10000), PARTITION p2 VALUES LESS THAN (20000), PARTITION p3 VALUES LESS THAN (30000) );
查詢當前用戶下的表:
select tname from tab;

2.文件系統表空間遷移到ASM中去
rman target /
report schema; 查看表空間
sql ‘alter tablespace test offline‘;離線表空間
backup as copy datafile 5 format ‘+DATA‘;Copy類型備份表空間
switch datafile 5 to copy;切換表空間文件到copy副本
sql ‘alter tablespace test online‘;上線表空間
report schema;

sqlplus / as sysdba
select ts#,name from v$tablespace where name=‘TEST‘ union all select file#,name from v$datafile where ts#=6;

select * from v$dbfile;

sqlplus test/123456@orcl
select tname from tab;

oracle表空間文件系統遷移到ASM