Home Database Mysql Tutorial Oracle 移动数据文件的操作方法

Oracle 移动数据文件的操作方法

Jun 07, 2016 pm 03:07 PM
oracle operate data document method move space

将表空间和数据文件从一个位置移动到另一个位置的操作方法 一. OFFLINE OFFLINE分为 ALTERDATABASE 与 ALTERTABLESPACEOFFLINE , 他们的区别参看 blog : http://blog.csdn.net/tianlesoftware/archive/2009/11/29/4898800.aspx 按数据文件来: 1. 先将 相

将表空间和数据文件从一个位置移动到另一个位置的操作方法

一. OFFLINE

OFFLINE 分为ALTER DATABASE 与 ALTER TABLESPACE OFFLINE

他们的区别参看bloghttp://blog.csdn.net/tianlesoftware/archive/2009/11/29/4898800.aspx

按数据文件来:

1.先将相应的数据文件 offline  

ALTER DATABASE DATAFILE 'D:/ORACLE/ORADATA/DBA/TEST01.DBF' OFFLINE;
2.把数据文件 copy 到新位置
3. alter database rename file 'D:/ORACLE/ORADATA/DBA/TEST01.DBF' to 'D:/TEST01.DBF';

4. 介质恢复(offline 数据文件必须要介质恢复)

recover datafile 'D:/TEST01.DBF'
5. 将相应的数据文件 online 

SQL>ALTER DATABASE DATAFILE 'D:/TEST01.DBF' ONLINE;

按表空间来:

1.先将相应的表空间 offline  

SQL>alter tablespace test offline;  

2.把数据文件 copy 到新位置
3. alter tablespace TEST  rename datafile 'D:/TEST01.DBF' to 'D:/ORACLE/ORADATA/DBA/TEST01.DBF'

4. 将表空间 online 

SQL>alter tablespace test online;   

 

二. Shutdown 数据库

1. 关闭数据库 

C:>set ORACLE_SID=DBA

C:>sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 11月 29 11:14:02 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn sys/admin as sysdba

已连接。

SQL> shutdown immediate

数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

SQL>


2. 把数据文件 copy 到新位置

3. rename datafile

SQL> startup mount

ORACLE 例程已经启动。

Total System Global Area  289406976 bytes

Fixed Size                  1248576 bytes

Variable Size              71303872 bytes

Database Buffers          209715200 bytes

Redo Buffers                7139328 bytes

数据库装载完毕。

SQL> alter database rename file 'D:/ORACLE/ORADATA/DBA/TEST01.DBF' to 'D:/TEST01

.DBF';

数据库已更改。

SQL> alter database open;

数据库已更改。

SQL> select file#,name,status from v$datafile;

 FILE# NAME                                STATUS

-------- -------------------------------------------------------  ---------------

   1  D:/ORACLE/ORADATA/DBA/SYSTEM01  SYSTEM

   2  D:/ORACLE/ORADATA/DBA/UNDOTBS0  ONLINE

   3  D:/ORACLE/ORADATA/DBA/SYSAUX01  ONLINE

   4  D:/ORACLE/ORADATA/DBA/USERS01.   ONLINE

   5  D:/TEST01.DBF                              ONLINE

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How long will Oracle database logs be kept? How long will Oracle database logs be kept? May 10, 2024 am 03:27 AM

How long will Oracle database logs be kept?

The order of the oracle database startup steps is The order of the oracle database startup steps is May 10, 2024 am 01:48 AM

The order of the oracle database startup steps is

6000 mAh silicon negative battery! Xiaomi 15Pro upgrade leaked again 6000 mAh silicon negative battery! Xiaomi 15Pro upgrade leaked again Jul 24, 2024 pm 12:45 PM

6000 mAh silicon negative battery! Xiaomi 15Pro upgrade leaked again

Oracle database server hardware configuration requirements Oracle database server hardware configuration requirements May 10, 2024 am 04:00 AM

Oracle database server hardware configuration requirements

How to see the number of occurrences of a certain character in Oracle How to see the number of occurrences of a certain character in Oracle May 09, 2024 pm 09:33 PM

How to see the number of occurrences of a certain character in Oracle

How much memory does oracle require? How much memory does oracle require? May 10, 2024 am 04:12 AM

How much memory does oracle require?

How much memory is needed to use oracle database How much memory is needed to use oracle database May 10, 2024 am 03:42 AM

How much memory is needed to use oracle database

Oracle scheduled tasks execute the creation step once a day Oracle scheduled tasks execute the creation step once a day May 10, 2024 am 03:03 AM

Oracle scheduled tasks execute the creation step once a day

See all articles