ITPub博客

首页 > 数据库 > Oracle > 10G下从ASM复制文件到文件系统

10G下从ASM复制文件到文件系统

原创 Oracle 作者:xingfei80 时间:2012-06-14 13:42:25 0 删除 编辑
转自:http://www.dbaroad.me/archives/2012/03/10g_copy_asm_to_fs.html

版本10.2.0.5
1、使用RMAN:

$ sqlplus "/as sysdba"   
 
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Mar 16 10:02:41 2012
 
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
 
Connected to an idle instance.
 
SQL> startup mount;
ORACLE instance started.
 
Total System Global Area 2147483648 bytes
Fixed Size                  2097696 bytes
Variable Size             503320032 bytes
Database Buffers         1627389952 bytes
Redo Buffers               14675968 bytes
Database mounted.
 
SQL> select file#, name, bytes from v$datafile where file#=5;
 
     FILE# NAME                                                    BYTES
---------- -------------------------------------------------- ----------
         5 +DATA01/dbname/datafile/users.264.730552875           524288000
 
$ rman target / nocatalog
 
Recovery Manager: Release 10.2.0.5.0 - Production on Fri Mar 16 10:06:08 2012
 
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
 
connected to target database: dbname (DBID=2555001420, not open)
using target database control file instead of recovery catalog
 
RMAN> copy datafile 5 to '/arch1/users.264.730552875';
 
Starting backup at 16-MAR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1624 instance=dbname1 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+DATA01/dbname/datafile/users.264.730552875
output filename=/arch1/users.264.730552875 tag=TAG20120316T100622 recid=2 stamp=778068391
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 16-MAR-12
 
RMAN> exit
 
 
Recovery Manager complete.
$ ls -l /arch1/users.264.730552875
-rw-r----- 1 oracle oinstall 524296192 Mar 16 10:06 /arch1/users.264.730552875
[@more@]

2、使用dbms_file_transfer包:

SQL> select open_mode from v$database;
 
OPEN_MODE
----------
READ WRITE
 
SQL> create or replace directory SOURCE_DIR1 as '+DATA01/dbname/onlinelog/';
 
Directory created.
 
SQL> create or replace directory ORACLE_DEST as '/arch1/';
 
Directory created.
 
SQL> 
SQL> BEGIN
  2  dbms_file_transfer.copy_file(
  3  source_directory_object =>'SOURCE_DIR1', 
  4  source_file_name => 'group_1.274.730565825',
  5  destination_directory_object => 'ORACLE_DEST',
  6  destination_file_name => 'group_1.274.730565825'
  7  );
  8  END;
  9  / 
 
PL/SQL procedure successfully completed.
 
SQL> ! ls -l /arch1/group_1.274.730565825
-rw-r----- 1 oracle oinstall 524288512 Mar 14 10:49 /arch1/group_1.274.730565825

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14663377/viewspace-1058518/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-07-14

  • 博文量
    102
  • 访问量
    492752