数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

Oracle数据文件位置迁移


发布日期:2020年02月24日
 
Oracle数据文件位置迁移

操作系统Windows Server

Oracle Version:

下为非归档模式的迁移过程

D:>sqlplus /as sysdba

SQL*Plus: Release Production on 星期日 ::

Copyright (c) Oracle Corporation All rights reserved

已连接到空闲例程

SQL> select * from v$datafile;

select * from v$datafile

*

ERROR位于第行:

ORA: ORACLE not available

SQL> startup;

ORACLE 例程已经启动

Total System Global Area bytes

Fixed Size bytes

Variable Size bytes

Database Buffers bytes

Redo Buffers bytes

数据库装载完毕

数据库已经打开

SQL> select name from v$datafile;

NAME

E:ORACLESONBWEBSYSTEMDBF E:ORACLESONBWEBUNDOTBSDBF E:ORACLESONBWEBCWMLITEDBF E:ORACLESONBWEBDRSYSDBF E:ORACLESONBWEBEXAMPLEDBF E:ORACLESONBWEBINDXDBF E:ORACLESONBWEBODMDBF E:ORACLESONBWEBTOOLSDBF E:ORACLESONBWEBUSERSDBF E:ORACLESONBWEBXDBDBF E:ORACLESONBWEBHOUSEWEBORA

NAME

E:ORACLESONBWEBSDEDBF E:ORACLESONBWEBREALSTARORA

已选择

SQL> select name from v$controlfile;

NAME

E:ORACLESONBWEBCONTROLCTL E:ORACLESONBWEBCONTROLCTL E:ORACLESONBWEBCONTROLCTL

SQL> select * from v$logfile;

GROUP# STATUS TYPE

MEMBER

STALE ONLINE

E:ORACLESONBWEBREDOLOG

ONLINE

E:ORACLESONBWEBREDOLOG

STALE ONLINE

E:ORACLESONBWEBREDOLOG

SQL> shutdown immediate;

数据库已经关闭

已经卸载数据库

ORACLE 例程已经关闭

SQL> host copy E:ORACLESONBWEB*dbf D:oracleoradataSONBWEB;

E:ORACLESONBWEBCWMLITEDBF E:ORACLESONBWEBDRSYSDBF E:ORACLESONBWEBEXAMPLEDBF E:ORACLESONBWEBINDXDBF E:ORACLESONBWEBODMDBF E:ORACLESONBWEBSDEDBF E:ORACLESONBWEBSYSTEMDBF E:ORACLESONBWEBTEMPDBF E:ORACLESONBWEBTOOLSDBF E:ORACLESONBWEBUNDOTBSDBF E:ORACLESONBWEBUSERSDBF E:ORACLESONBWEBXDBDBF已复制 个文件

SQL> host copy E:ORACLESONBWEB*ora D:oracleoradataSONBWEB;

E:ORACLESONBWEBHOUSEWEBORA E:ORACLESONBWEBREALSTARORA已复制 个文件

SQL> host copy E:ORACLESONBWEB*ctl D:oracleoradataSONBWEB;

E:ORACLESONBWEBCONTROLCTL E:ORACLESONBWEBCONTROLCTL E:ORACLESONBWEBCONTROLCTL已复制 个文件

SQL> host copy E:ORACLESONBWEB*log D:oracleoradataSONBWEB;

E:ORACLESONBWEBREDOLOG E:ORACLESONBWEBREDOLOG E:ORACLESONBWEBREDOLOG已复制 个文件

SQL> create pfile from spfile;

文件已创建

编辑生成的pfile即INIT<SID>ORA默认在$Oracle_HOME\database下此例中为INITsonbwebORA将文件中控制文件的路径改成迁移后的路径

SQL> create spfile from pfile;

文件已创建

SQL> startup mount;

ORACLE 例程已经启动

Total System Global Area bytes

Fixed Size bytes

Variable Size bytes

Database Buffers bytes

Redo Buffers bytes

数据库装载完毕

SQL> alter database rename file E:ORACLESONBWEBSYSTEMDBF to D:oracleoradataSONBWEBsystemdbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBCWMLITEDBF to D:oracleoradataSONBWEBcwmlitedbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBDRSYSDBF to D:oracleoradataSONBWEBdrsysdbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBEXAMPLEDBF to D:oracleoradataSONBWEBexampledbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBINDXDBF to D:oracleoradataSONBWEBindxdbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBODMDBF to D:oracleoradataSONBWEBodmdbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBTOOLSDBF to D:oracleoradataSONBWEB oolsdbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBUSERSDBF to D:oracleoradataSONBWEBusersdbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBXDBDBF to D:oracleoradataSONBWEBsdbdbf;

alter database rename file E:ORACLESONBWEBXDBDBF

*

ERROR位于第行:

ORA:重命名日志/数据文件时出错

ORA:重命名数据文件时出错未找到新文件

D:oracleoradataSONBWEBsdbdbf ORA: 数据文件 : E:ORACLESONBWEBXDBDBF

ORA:无法打开文件

OSD:无法打开文件

O/SError: (OS ) 系统找不到指定的文件

SQL> alter database rename file E:ORACLESONBWEBXDBDBF to D:oracleoradataSONBWEBxdbdbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBHOUSEWEBORA to D:oracleoradataSONBWEBhousewebora;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBsdedbf to D:oracleoradataSONBWEBsdedbf;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBREALSTARORA to D:oracleoradataSONBWEBREALSTARORA;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBREDOLOG to D:oracleoradataSONBWEBREDOLOG;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBREDOLOG to D:oracleoradataSONBWEBREDOLOG;

数据库已更改

SQL> alter database rename file E:ORACLESONBWEBREDOLOG to D:oracleoradataSONBWEBREDOLOG;

数据库已更改

临时文件更改无效必须删除原先的临时文件重新生成

SQL> startup;

ORA:无法启动已在运行的ORACLE 请首先关闭

SQL> shutdown immediate;

ORA:数据库未打开

已经卸载数据库

ORACLE 例程已经关闭

SQL> startup;

ORACLE 例程已经启动

Total System Global Area bytes

Fixed Size bytes

Variable Size bytes

Database Buffers bytes

Redo Buffers bytes

数据库装载完毕

数据库已经打开

SQL> select * from v$tempfile;

FILE# CREATION_CHANGE# CREATION_T TS# RFILE# STATUS ENABLED

BYTES BLOCKS CREATE_BYTES BLOCK_SIZE

NAME

ONLINE READ WRITE

E:ORACLESONBWEBTEMPDBF

SQL> alter database tempfile E:ORACLESONBWEBTEMPDBF drop;

数据库已更改

SQL> alter tablespace temp add tempfile D:oracleoradataSONBWEBTEMPora s

ize M reuse;

表空间已更改

SQL> select * from v$tempfile;

FILE# CREATION_CHANGE# CREATION_T TS# RFILE# STATUS ENABLED

BYTES BLOCKS CREATE_BYTES BLOCK_SIZE

NAME

ONLINE READ WRITE

D:ORACLEORADATASONBWEBTEMPORA

本文来自CSDN博客

SQL>

迁移完成.

上一篇:Oracle性能优化:收缩临时表空间

下一篇:首个针对Oracle数据库蠕虫于万圣节现身