测试脱机,看看状态
alter tablespace ts1 offline;
1是offline?
开始测试移动文件
-
sql> select tablespace_name,file_name from dba_data_files;
-
-
lineid tablespace_name file_name
-
---------- --------------- -------------------------------------
-
1 system /home/dmdba/dmdbms/data/dmserver/system.dbf
-
2 t2 /home/dmdba/t2.dbf
-
3 ts1 /home/dmdba/b.dbf <-----这几个文件位置不规范
-
4 ts1 /home/dmdba/a.dbf
-
5 main /home/dmdba/dmdbms/data/dmserver/main.dbf
-
6 temp /home/dmdba/dmdbms/data/dmserver/temp.dbf
-
7 roll /home/dmdba/dmdbms/data/dmserver/roll.dbf
-
-
7 rows got
-
-
sql> alter tablespace ts1 offline; <-----------这里可以放心移动文件了
-
executed successfully
-
-
sql> host mv /home/dmdba/a.dbf /home/dmdba/dmdbms/data/dmserver/ts01.dbf <----oracle的思路
-
-
sql>host mv /home/dmdba/b.dbf /home/dmdba/dmdbms/data/dmserver/ts02.dbf
-
-
sql> alter tablespace ts1 online;
-
alter tablespace ts1 online;
-
[-2405]:file or directory [/home/dmdba/a.dbf] does not exist. <---- 草率了
-
-
sql> alter tablespace ts1 rename datafile '/home/dmdba/a.dbf' to '/home/dmdba/dmdbms/data/dmserver/ts01.dbf';
-
alter tablespace ts1 rename datafile '/home/dmdba/a.dbf' to '/home/dmdba/dmdbms/data/dmserver/ts01.dbf';
-
[-2191]:error in line: 1
-
invalid file path[/home/dmdba/a.dbf]. <------错上加错,思考了一下。。。
-
-
sql> host mv /home/dmdba/dmdbms/data/dmserver/ts01.dbf /home/dmdba/a.dbf <------先恢复原样
-
-
sql> alter tablespace ts1 rename datafile '/home/dmdba/a.dbf' to '/home/dmdba/dmdbms/data/dmserver/ts01.dbf';
-
executed successfully <---- 原来达梦是一步到位,不需要os层面mv
-
sql> host mv /home/dmdba/dmdbms/data/dmserver/ts02.dbf /home/dmdba/b.dbf
-
-
sql> alter tablespace ts1 rename datafile '/home/dmdba/b.dbf' to '/home/dmdba/dmdbms/data/dmserver/ts02.dbf';
-
executed successfully
-
-
sql> alter tablespace ts1 online;
-
executed successfully
-
再看表空间状态
0k 就好了
阅读(406) | 评论(0) | 转发(0) |