Moving a datafile from Filesystem to ASM

[oracle@rh01 ocp]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 26 19:53:49 2014

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> col file_name for a60
SQL> set lin 160
SQL> select tablespace_name,file_name from dba_data_files order by 1,2;

TABLESPACE_NAME                FILE_NAME
------------------------------ ------------------------------------------------------------
EXAMPLE                        +DG01/ocp/datafile/example.260.864395179
SYSAUX                         +DG01/ocp/datafile/sysaux.258.861286599
SYSTEM                         +DG01/ocp/datafile/system.257.861286573
TBS_AUTO                       +DG01/ocp/datafile/tbs_auto.271.861893181
UNDOTBS1                       +DG01/ocp/datafile/undotbs1.259.861286623
USERS                          +DG01/ocp/datafile/users.256.861286537
USERS                          +DG01/ocp/datafile/users.312.864659511

7 rows selected.

SQL> alter tablespace example add datafile '/oradata/ocp/exa01.dbf' size 10m;

Tablespace altered.

SQL> select tablespace_name,file_name from dba_data_files order by 1,2;


TABLESPACE_NAME                FILE_NAME
------------------------------ ------------------------------------------------------------
EXAMPLE                        +DG01/ocp/datafile/example.260.864395179
EXAMPLE                        /oradata/ocp/exa01.dbf
SYSAUX                         +DG01/ocp/datafile/sysaux.258.861286599
SYSTEM                         +DG01/ocp/datafile/system.257.861286573
TBS_AUTO                       +DG01/ocp/datafile/tbs_auto.271.861893181
UNDOTBS1                       +DG01/ocp/datafile/undotbs1.259.861286623
USERS                          +DG01/ocp/datafile/users.256.861286537
USERS                          +DG01/ocp/datafile/users.312.864659511

8 rows selected.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@rh01 ocp]$ pwd
/oradata/ocp
[oracle@rh01 ocp]$ ls
exa01.dbf
[oracle@rh01 ocp]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Nov 26 19:55:20 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OCP (DBID=2757501459)


RMAN> backup as copy datafile '/oradata/ocp/exa01.dbf' format '+dg01';

Starting backup at 26-NOV-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=24 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00008 name=/oradata/ocp/exa01.dbf
output file name=+DG01/ocp/datafile/example.311.864676541 tag=TAG20141126T195541 RECID=18 STAMP=864676542
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 26-NOV-14
RMAN-08591: WARNING: invalid archived log deletion policy

RMAN> exit

Recovery Manager complete.
[oracle@rh01 ocp]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 26 19:55:50 2014

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size                  2214936 bytes
Variable Size             331351016 bytes
Database Buffers          184549376 bytes
Redo Buffers                3821568 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@rh01 ocp]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Nov 26 19:56:24 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OCP (DBID=2757501459, not open)

RMAN> list copy;

using target database control file instead of recovery catalog
List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time       
------- ---- - --------------- ---------- ---------------
18      8    A 26-NOV-14       877204     26-NOV-14      
        Name: +DG01/ocp/datafile/example.311.864676541
        Tag: TAG20141126T195541

List of Control File Copies
===========================

Key     S Completion Time Ckp SCN    Ckp Time       
------- - --------------- ---------- ---------------
15      X 18-NOV-14       569070     18-NOV-14      
        Name: /opt/oracle/product/11.2.0/dbs/snapcf_ocp.f
        Tag: TAG20141118T083915

List of Archived Log Copies for database with db_unique_name OCP
=====================================================================

Key     Thrd Seq     S Low Time 
------- ---- ------- - ---------
173     1    117     A 26-NOV-14
        Name: +DG01/ocp/archivelog/2014_11_26/thread_1_seq_117.261.864675773

174     1    118     A 26-NOV-14
        Name: +DG01/ocp/archivelog/2014_11_26/thread_1_seq_118.290.864675775

RMAN> list copy of database;

List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time       
------- ---- - --------------- ---------- ---------------
18      8    A 26-NOV-14       877204     26-NOV-14      
        Name: +DG01/ocp/datafile/example.311.864676541
        Tag: TAG20141126T195541

RMAN> switch datafile 8 to copy;

datafile 8 switched to datafile copy "+DG01/ocp/datafile/example.311.864676541"
RMAN-08591: WARNING: invalid archived log deletion policy

RMAN> recover database;

Starting recover at 26-NOV-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=25 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=26 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 26-NOV-14

RMAN> alter database open;

database opened


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lordcoohoo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值