码迷,mamicode.com
首页 > 数据库 > 详细

Oracle控制文件日志文件数据文件迁移

时间:2017-10-14 19:49:16      阅读:331      评论:0      收藏:0      [点我收藏+]

标签:数据库   logfile   控制   ctr   复制   min   log   art   force   

1.查看表空间对应关系
d:
cd D:\app\administrator\product\11.2.0\dbhome_1\BIN
sqlplus sys/infinitt@spectra as sysdba
select * from v$tablespace;
 
2.关闭数据库
shutdown immediate;
 
3.复制数据文件到新的位置
 
4.启动数据库到mount状态
startup mount;
5.重命名数据文件
alter database rename file ‘H:\oradata\spectra\RISDAT01.DBF‘ to ‘L:\oradata\spectra\RISDAT01.DBF‘;
alter database rename file ‘H:\oradata\spectra\RISDAT02.DBF‘ to ‘L:\oradata\spectra\RISDAT02.DBF‘;
alter database rename file ‘H:\oradata\spectra\SPDAT01.DBF‘ to ‘L:\oradata\spectra\SPDAT01.DBF‘;
alter database rename file ‘H:\oradata\spectra\SPDAT02.DBF‘ to ‘L:\oradata\spectra\SPDAT02.DBF‘;
alter database rename file ‘H:\oradata\spectra\SPIDX01.DBF‘ to ‘L:\oradata\spectra\SPIDX01.DBF‘;
alter database rename file ‘H:\oradata\spectra\SPIDX02.DBF‘ to ‘L:\oradata\spectra\SPIDX02.DBF‘;
alter database rename file ‘H:\oradata\spectra\SYSAUX01.DBF‘ to ‘L:\oradata\spectra\SYSAUX01.DBF‘;
alter database rename file ‘H:\oradata\spectra\SYSTEM01.DBF‘ to ‘L:\oradata\spectra\SYSTEM01.DBF‘;
alter database rename file ‘H:\oradata\spectra\TEMP01.DBF‘ to ‘L:\oradata\spectra\TEMP01.DBF‘;
alter database rename file ‘H:\oradata\spectra\UNDOTBS01.DBF‘ to ‘L:\oradata\spectra\UNDOTBS01.DBF‘;
alter database rename file ‘H:\oradata\spectra\USERS01.DBF‘ to ‘L:\oradata\spectra\USERS01.DBF‘;
 
 
5.重命名日志文件
alter database rename file ‘H:\oradata\spectra\REDO01.LOG‘ to ‘L:\oradata\spectra\REDO01.LOG‘;
alter database rename file ‘H:\oradata\spectra\REDO02.LOG‘ to ‘L:\oradata\spectra\REDO02.LOG‘;
alter database rename file ‘H:\oradata\spectra\REDO03.LOG‘ to ‘L:\oradata\spectra\REDO03.LOG‘;
6.打开数据库并查看状态
alter database open;
shutdown immediate;
startup;
select * from v$logfile;
select a.group#, a.status, b.member,a.bytes/1024/1024 sizeM from v$log a ,v$logfile b where a.group#=b.group#;
alter system switch logfile;//切换日志
 
===========================================================
7.查看控制文件
select name from v$controlfile;
 
8.恢复控制文件
shutdown immediate;
startup nomount;
quit
rmant target /
restore controlfile to ‘L:\oradata\spectra\CONTROL01.CTL‘ from ‘H:\oradata\spectra\CONTROL01.CTL‘ ;
restore controlfile to ‘L:\oradata\spectra\CONTROL02.CTL‘ from ‘H:\oradata\spectra\CONTROL02.CTL‘ ;
restore controlfile to ‘L:\oradata\spectra\CONTROL03.CTL‘ from ‘H:\oradata\spectra\CONTROL03.CTL‘ ;
 
quit //退出rman
 
9..修改控制文件位置
sqlplus / as sysdba
alter system set control_files=‘L:\oradata\spectra\CONTROL01.CTL‘,‘L:\oradata\spectra\CONTROL02.CTL‘,‘L:\oradata\spectra\CONTROL03.CTL‘  scope=spfile;
 
10.启动数据库
startup mount force;
select * from v$controlfile;
alter database open;
select * from spectra.version;
 
 
11.查看数据库以上更改的信息 select name from v$controlfile;
select * from v$logfile;
select * from v$tablespace;
 

Oracle控制文件日志文件数据文件迁移

标签:数据库   logfile   控制   ctr   复制   min   log   art   force   

原文地址:http://www.cnblogs.com/miaozhigg/p/7668089.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!