1. 测试环境准备
create tablespace test datafile '+DATA/JOYCE/test01.dbf' size 1G,'+DATA/JOYCE/test02.dbf' size 1G;
create user test identified by test default tablespace test;
grant dba to test;
conn test/test
create table test.test_partition(id number)
partition by range(id)
(
partition P1 values less than (10000),
partition P2 values less than (20000),
partition P3 values less than (30000),
partition P4 values less than (MAXVALUE)
) tablespace TEST;
create index test.IDX_test_partition on test.test_partition(id) nologging local;
create table test1 (id number primary key(id));
create table test (id number,name clob);
CREATE PROCEDURE test()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i < 400000 DO
insert into test_partition values(i);
SET i = i + 1;
END WHILE;
END
create trigger test
after insert on test1
for each row
begin
insert into test(id) values(100);
end;
CREATE OR REPLACE FORCE EDITIONABLE VIEW "TEST"."VW_TEST" ("ID", "NAME") AS
select a.id,b.name from test1 a,test b where a.id=b.id
insert 测试数据到表中
select object_name,object_type,status from user_objects;
2. move数据文件
alter database move datafile '+DATA/JOYCE/test01.dbf' to '+DATA/_mgmtdb/DATAFILE/test01.dbf';
alter database move datafile '+DATA/JOYCE/test02.dbf' to '+DATA/_mgmtdb/DATAFILE/test02.dbf';
同时进行一些DML操作,发现DML操作正常
3. 检查object status
select object_name,object_type,status from user_objects;
4.Move数据文件时的注意点
(1)temp文件和redo log无法move,需要重建;undo可以move也可以重建
(2)对于asm存储,可以将asm中的数据文件move到文件系统;反之也可以
(3)move过程中可以重命名数据文件
(4)move过程中原数据文件仍占用空间,等到move完成后,原数据文件被删,释放空间,所以同目录move要保证空间充足
(5)若想move时保留原数据文件,可以加keep关键字
alter database move datafile '+DATA/JOYCE/test01.dbf' to '+DATA/_mgmtdb/DATAFILE/test01.dbf' keep;
完后可以手动删除原文件
参考oracle官方文档
https://docs.oracle.com/database/121/ADMIN/dfiles.htm#ADMIN13837
附上旭宏在兰卡的步骤