oracle如何移动datafile的位置?
[root@sc ~]# su - oracle
[oracle@sc ~]$ sqlplus / as sysdba
sql> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /recovery/arch
Oldest online log sequence 85
Next log sequence to archive 87
Current log sequence 87
sql> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ocp/system01.dbf
/u01/app/oracle/oradata/ocp/undotbs01.dbf
/u01/app/oracle/oradata/ocp/sysaux01.dbf
/u01/app/oracle/oradata/ocp/users01.dbf
/u01/app/oracle/oradata/ocp/example01.dbf
/u01/app/oracle/oradata/ocp/perstat.dbf
sql> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
UNDOTBS1 ONLINE
SYSAUX ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
PERSTAT ONLINE
第一步,将表空间offline
Tablespace altered.
[oracle@sc ~]$ cp /u01/app/oracle/oradata/ocp/perstat.dbf /u01/app/oracle/oradata/perstat.dbf
sql> alter tablespace perstat rename datafile '/u01/app/oracle/oradata/ocp/perstat.dbf' to '/u01/app/oracle/oradata/perstat.dbf';
Tablespace altered.
将表空间online
sql> alter tablespace perstat online;
Tablespace altered.
sql> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ocp/system01.dbf
/u01/app/oracle/oradata/ocp/undotbs01.dbf
/u01/app/oracle/oradata/ocp/sysaux01.dbf
/u01/app/oracle/oradata/ocp/users01.dbf
/u01/app/oracle/oradata/ocp/example01.dbf
/u01/app/oracle/oradata/perstat.dbf