标签:
数据库开启归档模式,非系统表空间数据文件迁移可以不用停数据库。<span><span>移动的时候,注意asm磁盘空间。</span></span> 1.模拟创建 一节点: SQL> create tablespace tdb datafile '/u02/app/oracle/datafile/tdb.dbf' size 10m autoextend off; Tablespace created. 2.查看数据文件 一节点: FILE# NAME ---------- ---------------------------------------------------------------------------------------------------- 4 +DATA/orcl/datafile/users.257.901333687 3 +DATA/orcl/datafile/undotbs1.264.901333687 2 +DATA/orcl/datafile/sysaux.256.901333685 1 +DATA/orcl/datafile/system.265.901333685 5 +DATA/orcl/datafile/undotbs2.266.901333943 6 /u02/app/oracle/datafile/tdb.dbf 二节点: SQL> select file_name,file_id,ONLINE_STATUS,tablespace_name from dba_data_files; ERROR: ORA-01157: cannot identify/lock data file 6 - see DBWR trace file ORA-01110: data file 6: '/u02/app/oracle/datafile/tdb.dbf' 3.将数据文件offline SQL> alter database datafile 6 offline; Database altered. 4.在asmcmd下移动数据文件 到了+DATA/orcl/datafile/ ASMCMD [+data/orcl/datafile] > cp /u02/app/oracle/datafile/tdb.dbf . copying /u02/app/oracle/datafile/tdb.dbf -> +data/orcl/datafile/tdb.dbf 5.重命名文件 SQL> alter database rename file '/u02/app/oracle/datafile/tdb.dbf' to '+data/orcl/datafile/tdb.dbf'; Database altered. 6.查看数据文件状态 FILE_NAME FILE_ID ONLINE_ TABLESPACE_NAME ------------------------------------------------------------ ---------- ------- ---------------------------------------- +DATA/orcl/datafile/users.257.901333687 4 ONLINE USERS +DATA/orcl/datafile/undotbs1.264.901333687 3 ONLINE UNDOTBS1 +DATA/orcl/datafile/sysaux.256.901333685 2 ONLINE SYSAUX +DATA/orcl/datafile/system.265.901333685 1 SYSTEM SYSTEM +DATA/orcl/datafile/undotbs2.266.901333943 5 ONLINE UNDOTBS2 +DATA/orcl/datafile/tdb.dbf 6 RECOVER TDB 7.对数据文件recover一下 SQL> recover datafile 6; Media recovery complete. FILE_NAME FILE_ID ONLINE_ TABLESPACE_NAME ------------------------------------------------------------ ---------- ------- ---------------------------------------- +DATA/orcl/datafile/users.257.901333687 4 ONLINE USERS +DATA/orcl/datafile/undotbs1.264.901333687 3 ONLINE UNDOTBS1 +DATA/orcl/datafile/sysaux.256.901333685 2 ONLINE SYSAUX +DATA/orcl/datafile/system.265.901333685 1 SYSTEM SYSTEM +DATA/orcl/datafile/undotbs2.266.901333943 5 ONLINE UNDOTBS2 +DATA/orcl/datafile/tdb.dbf 6 OFFLINE TDB 8.将数据文件online SQL> alter database datafile 6 online; Database altered. 9.检查数据文件 FILE_NAME FILE_ID ONLINE_ TABLESPACE_NAME ------------------------------------------------------------ ---------- ------- ---------------------------------------- +DATA/orcl/datafile/users.257.901333687 4 ONLINE USERS +DATA/orcl/datafile/undotbs1.264.901333687 3 ONLINE UNDOTBS1 +DATA/orcl/datafile/sysaux.256.901333685 2 ONLINE SYSAUX +DATA/orcl/datafile/system.265.901333685 1 SYSTEM SYSTEM +DATA/orcl/datafile/undotbs2.266.901333943 5 ONLINE UNDOTBS2 +DATA/orcl/datafile/tdb.dbf 6 ONLINE TDB
标签:
原文地址:http://blog.csdn.net/ghostliming/article/details/50561386