美文网首页
Oracle迁移表空间

Oracle迁移表空间

作者: 与狼共舞666 | 来源:发表于2022-03-13 14:21 被阅读0次
  1. 迁移非system表空间
sys@ORCL 14:03:13> alter tablespace index_tbs offline;

Tablespace altered.

sys@ORCL 14:04:01> !mv '/oradata/orcl/dfile/index_tbs.dbf' '/oradata/orcl/disk1/index_tbs.dbf'

sys@ORCL 14:07:44> alter tablespace index_tbs rename datafile '/oradata/orcl/dfile/index_tbs.dbf' to '/oradata/orcl/disk1/index_tbs.dbf'
  2  ;

Tablespace altered.

sys@ORCL 14:09:05> alter tablespace index_tbs online;

Tablespace altered.

2.迁移system表空间

sys@ORCL 14:09:44> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@ORCL 14:12:53> startup mount
ORACLE instance started.

Total System Global Area 2505338880 bytes
Fixed Size          2255832 bytes
Variable Size        1493173288 bytes
Database Buffers      989855744 bytes
Redo Buffers           20054016 bytes
Database mounted.
sys@ORCL 13-MAR-22> !mv '/oradata/orcl/system01.dbf' '/oradata/orcl/dfile/system01.dbf'

sys@ORCL 13-MAR-22> alter database rename file '/oradata/orcl/system01.dbf' to '/oradata/orcl/dfile/system01.dbf'
  2  
sys@ORCL 13-MAR-22> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/oradata/orcl/system01.dbf'


sys@ORCL 13-MAR-22> alter database rename file '/oradata/orcl/system01.dbf' to '/oradata/orcl/dfile/system01.dbf';

Database altered.

sys@ORCL 13-MAR-22> alter database open;

Database altered.

可以理解成所有与system表空间有关的操作,都必须在数据库mount但未open的状态下操作。(可以把mount状态理解成安全模式)

相关文章

网友评论

      本文标题:Oracle迁移表空间

      本文链接:https://www.haomeiwen.com/subject/tdwrdrtx.html