How to move a datafile from a file system to ASM
Moving a datafile from the file system can be achived in two ways.

i. While the database is shutdown (in mount stage).
ii. While the database is running (with the selected tablespace offline).
(数据文件实现文件系统到ASM的转换迁移,一是在数据库mount状态,二是在open状态,但数据文件所属表空间需要offline状态)
-----------------------------------------------------------------------------------------------

i. While the database is shutdown (in mount stage).
(1、mount状态)
Moving oracle datafile while the database is in mount stage is performed in the following way:

1. Shutdown and mount the database.

[oracle@linux] sqlplus '/as sysdba'
SQL> shutdown immediate;
SQL> startup mount;

2. Ensure you have enough space in the ASM diskgroup to copy the datafile.
First identify the size of the datafile you wish to move.

在ASM上要有足够的空间

SQL> select file#, name, (bytes/1048576) File_Size_MB from v$datafile;
FILE# NAME FILE_SIZE_MB
----- ---------------------------- --------------
...
4 /oradata/PROD/users01.dbf 2500
...
* In this example we will be moving users01.dbf

[oracle@linux] export ORACLE_SID=+ASM

SQL> select NAME, STATE, TOTAL_MB, FREE_MB from v$asm_diskgroup;

NAME STATE TOTAL_MB FREE_MB
------------------------------ ----------- ---------- ----------
DGROUP1 MOUNTED 100 3
DGROUP2 MOUNTED 4882 4830

3. Connect to RMAN and copy the datafile from the filesystem to the select ASM diskgroup.

用RMAN copy 数据文件

[oracle@linux] rman target=/
RMAN> copy datafile 4 to '+DGROUP2'
Starting backup at 2006/09/05 12:14:23
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=31 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/oradata/PROD/users01.dbf
output filename=+DGROUP2/PROD/datafile/users01.258.600351265 tag=TAG20060905T121424 recid=10 stamp=600351264
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:05:01
Finished backup at 2006/09/05 12:19:24

4. Update the controlfile with the new location of the datafile.

更新控制文件中的数据文件新的文件位置

[oracle@linux] rman target /
RMAN> switch datafile 4 to copy;
datafile 4 switched to datafile copy "+DGROUP2/PROD/datafile/users01.258.600351265".

5. The file is now if the new location.

在数据库中查看,文件位置已经更新

SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
..
+DGROUP2/PROD/datafile/users01.258.600351265
..

6. The database may now be opened.
open 数据库。

While the database is running (with the select tablespace offline).

在open状态下转换
In order to move a datafile on a running active database the tablespace where the datafile resides must be placed offline.

1. Identify the tablespace which contains the datafile and offline the tablespace.

确保表空间offline

SQL> select tablespace_name, file_name from dba_data_files where file_id=4;

TABLESPACE_NAME FILE_NAME
------------------ ------------------------------
USERS /oradata/RMAN/users01.dbf

SQL> alter tablespace USERS offline;

* * * * * Continue with Steps 2 - 5 above. * * * * *

以上步骤2-5相同

6. After you have successfully completed the above steps (2 -5) place the

tablespace online;

SQL> alter tablespace USERS online;

asm和file system之间数据文件的转换的更多相关文章

  1. rac下asm管理的表空间-数据文件的重命名

    asm下表空间的重命名与普通文件系统下的表空间重命名原理是一样的,只不过asm管理的数据文件有一些需要注意的地方,另外在asm下操作数据文件需要格外小心,稍有不慎将会造成数据文件丢失,如可以做备份最好 ...

  2. ASM集群文件系统ACFS(ASM Cluster File System)

    在11g R2中ASM文件支持包括数据文件,控制文件,归档日志文件,spfile,RMAN备份文件,Change Tracking文件,数据泵Dump文件盒OCR文件等.而推出的ACFS和Oracle ...

  3. ASM时的OFM特性对影的建数据文件名称的影响及为SYSTEM表空间的数据文件使用别名

    客户遇到个DG的问题,存储使用的ASM管理,有多个磁盘盘. 在主库创建数据文件,备库自己主动创建的数据文件都在同一磁盘组,而且在主库创建数据文件是指定的是类似**.DBF的名字,到备库也变成了使用AS ...

  4. 磁盘、分区及Linux文件系统 [Disk, Partition, Linux File System]

    1.磁盘基础知识 1.1 物理结构 硬盘的物理结构一般由磁头与碟片.电动机.主控芯片与排线等部件组成:当主电动机带动碟片旋转时,副电动机带动一组(磁头)到相对应的碟片上并确定读取正面还是反面的碟面,磁 ...

  5. 12C新功能:在线移动数据文件 (Doc ID 1566797.1)

    12C New Feature : Move a Datafile Online (Doc ID 1566797.1) APPLIES TO: Oracle Database - Enterprise ...

  6. 【转】Oracle 表空间与数据文件

    --============================== --Oracle 表空间与数据文件 --============================== /* 一.概念 表空间:是一个或 ...

  7. 表空间与数据文件Offline,online的区别

    首先明确,表空间与数据文件的关系:Oracle数据库表空间有两种,一种smallfile小文件表空间(默认),另一种bigfile大文件表空间: 默认表空间与数据文件的关系:允许一对多的处理方式,一个 ...

  8. Oracle 表空间与数据文件

    -============================== --Oracle 表空间与数据文件 --============================== /* 一.概念 表空间:是一个或多 ...

  9. Git报错:error: cannot open .git/FETCH_HEAD: Read-only file system

    Git:git pull时报错 error: cannot open .git/FETCH_HEAD: Read-only file system 查看该文件: 未在网上找到解决办法,重启服务器就好了 ...

随机推荐

  1. PAT1089. Insert or Merge

    PAT1089. Insert or Merge 题目大意 给定一个初始序列src, 一个排序当中的序列tar, 问排序方式是 Insert Sort, 或者 Merge Sort. 并输出下一次迭代 ...

  2. bootstrap-table表格导出

    在bootstrap-table官网->拓展模块中有导出模块的详细介绍.网址:http://bootstrap-table.wenzhixin.net.cn/zh-cn/extensions/ ...

  3. java的引用总结

    四种引用:强弱软虚 强引用:使用强引用,在内存不足的时候垃圾处理器也不会回收他,哪怕导致程序崩溃 例如: A a=new A() 软引用:内存不足的时候会被回收(软引用可以和一个引用队列(Refere ...

  4. 纯JS拖动案例

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  5. Python 学习笔记(四)数字(二)

    Python Python2 中除法的问题 >>> 3 / 6 0 >>> 3.0 / 6 0.5 >>> 3.0 / 6.0 0.5 >& ...

  6. SQL0668N 不允许对表XX执行操作,原因码为 "3"

    DB2 Load导入数据失败之后,表被锁,提示,SQL0668N 不允许对表XX执行操作,原因码为 "3". 之前也遇到过,当时都是现查现用的,现在在博客记一下,以备后查. 解决方 ...

  7. 给xcode项目重命名

    在xcode项目开发中,经常会遇到需要修改项目名字的问题, 但是xcode本身修改项目名字比较麻烦,有时候修改的不完全,有时候修改了项目无法打开,无奈只能建一个新项目.这里提供一种修改xcode项目名 ...

  8. ETO的公开赛T4《对抗水滴》 题解(BY 萌萌哒123456 )

    题意: 给你一个\(n*n\)的矩阵A,其中有\(T\)个元素不为零.定义矩阵内元素\((x,y)\)的能量值 \(E[x][y]=\sum_{i=1}^{x}\sum_{j=1}^{y}[A[i][ ...

  9. YII2.0学习一 Advanced 模板安装

    下载github上的完事安装包(本机环境使用Composer安装非常慢) https://github.com/yiisoft/yii2-app-advanced 解压到文件目录 wwwroot/sh ...

  10. NOIP模拟 candy

    题目描述 一天,小 DD 决定买一些糖果.他决定在两家不同的商店中买糖果,来体验更多的口味. 在每家商店中都有 nn 颗糖果,每颗糖果都有一个权值:愉悦度,代表小 DD 觉得这种糖果有多好吃.其中,第 ...