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


你可能感兴趣的:(oracle)