测试脱机,看看状态
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 就好了
阅读(497) | 评论(0) | 转发(0) |