Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10327596
  • 博文数量: 1669
  • 博客积分: 16831
  • 博客等级: 上将
  • 技术积分: 12594
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-25 07:23
个人简介

柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!

文章分类

全部博文(1669)

文章存档

2023年(4)

2022年(1)

2021年(10)

2020年(24)

2019年(4)

2018年(19)

2017年(66)

2016年(60)

2015年(49)

2014年(201)

2013年(221)

2012年(638)

2011年(372)

分类: Oracle

2012-01-10 09:19:31

移动数据文件!
分类: 文特日志 11人阅读 评论(0) 举报

由于空间问题,一个数据文件要移动一下。

步骤很简单!

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------

D:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF
D:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF
D:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF
D:\ORACLE\ORADATA\ORCL\USERS01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\DATASML01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\DATAUSR01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\INDEXLRG01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\INDEXSML01.DBF

9 rows selected.

SQL> alter database rename file 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG01.DBF' t
o 'F:\oradata\DATALRG01.DBF';
alter database rename file 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG01.DBF' to 'F:
\oradata\DATALRG01.DBF'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01121: cannot rename database file 5 - file is in use or recovery
ORA-01110: data file 5: 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG01.DBF'


SQL> alter database datafile 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG01.DBF' offl
ine;
alter database datafile 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG01.DBF' offline
*
ERROR at line 1:
ORA-01145: offline immediate disallowed unless media recovery enabled


SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     151
Current log sequence           153
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.

Total System Global Area  644468736 bytes
Fixed Size                  1376520 bytes
Variable Size             398462712 bytes
Database Buffers          239075328 bytes
Redo Buffers                5554176 bytes

SQL> alter database mount;

Database altered.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.


SQL> alter database datafile 5 offline;

Database altered.

 

Cut/paste the file to dest location.

Wait until it is done or will raise the error like this.

SQL> alter tablespace datalrg rename datafile 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DA
TALRG01.DBF' to 'F:\oradata\DATALRG01.DBF';
alter tablespace datalrg rename datafile 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG
01.DBF' to 'F:\oradata\DATALRG01.DBF'
*
ERROR at line 1:
ORA-01525: error in renaming data files
ORA-01141: error renaming data file 5 - new file 'F:\oradata\DATALRG01.DBF' not
found
ORA-01110: data file 5: 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DATALRG01.DBF'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 32) The process cannot access the file because it is being used
by another process.

When it is done then run the command.
SQL> alter tablespace datalrg rename datafile 'D:\ORACLE\PRODUCT\ORADATA\ORCL\DA
TALRG01.DBF' to 'F:\oradata\DATALRG01.DBF';

Tablespace altered.

SQL> show user
USER is "SYS"
SQL> alter database datafile 5 online;
alter database datafile 5 online
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: 'F:\ORADATA\DATALRG01.DBF'


SQL> recover datafile 5;
Media recovery complete.
SQL> alter database datafile 5 online;

Database altered.

SQL>  select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------

D:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF
D:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF
D:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF
D:\ORACLE\ORADATA\ORCL\USERS01.DBF
F:\ORADATA\DATALRG01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\DATASML01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\DATAUSR01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\INDEXLRG01.DBF
D:\ORACLE\PRODUCT\ORADATA\ORCL\INDEXSML01.DBF

9 rows selected.

SQL>

 

 

阅读(876) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

sijialgc2012-09-19 15:09:18

私家侦探 上海私家侦探 私人侦探 上海私人侦探 http://www.sh-007.com.cn