数据库
首页 > 数据库> > Oracle表空间数据文件迁移

Oracle表空间数据文件迁移

作者:互联网

/**第一步:登陆数据库**/

C:\>sqlplus /nolog

SQL> conn / as sysdba

/**第二步:停止数据库**/

SQL> shutdown immediate

/**第三步:在open模式下启动数据库**/

SQL> startup open

/**第四步:将表空间(tablespacename )脱机**/

SQL> alter tablespace tablespacename offline;

/**第五步:手工将表空间所使用的数据库文件(D:\tablespace01.ORA),复制到你要转移的目录(E:\tablespace01.ORA)**/

/**手工拷贝数据库文件到你想到达的目录下。**/

/**第六步:将表空间与新目录下的数据库文件关联,操作前后可以用SQL来查询表空间所使用的数据库文件的变化情况:select name from v$datafile;**/

SQL> alter tablespace tablespacename rename datafile 'D:\tablespace01.ORA' to 'E:\tablespace01.ORA';

/**第七步:将表空间联机,提交,OK,完成。**/

SQL> alter tablespace tablespacename online;

SQL>commit;

SQL>exit;

/**注意:表空间数据文件时,确保不要对该表空间执行任何写操作**/

 

标签:tablespace01,tablespacename,数据库,空间数据,将表,SQL,Oracle,迁移,ORA
来源: https://www.cnblogs.com/chengjun1989/p/15562854.html