ASM和OS文件系统之间交互

主要有3种方法:

dbms_file_transfer包、rman的convert命令,或FTP的形式,这里只介绍前两种方法

一、使用dbms_file_transfer包


将+DATA/RAC/spfilerac.ora拷贝到文件系统

ASMCMD [+DATA/RAC] > ls
ARCHIVELOG/
CHANGETRACKING/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilerac.ora


SQL>create directory sd as '+DATA/RAC/';

Directory created.

SQL> create directory dd as '/opt/oracle/';

Directory created.


SQL> begin dbms_file_transfer.copy_file('sd','spfilerac.ora','dd','spfilerac1.ora');
  2  end;
  3  /

PL/SQL procedure successfully completed.

SQL> !ls --l
1208.ora  Desktop  Documents  app  cat  extapi  spfilerac1.ora

SQL> !cat spfilerac1.ora
Q1rac1.__db_cache_size=150994944
rac2.__db_cache_size=155189248
rac1.__java_pool_size=4194304
rac2.__java_pool_size=4194304
rac1.__large_pool_size=4194304
rac2.__large_pool_size=4194304
rac1.__shared_pool_size=96468992
rac2.__shared_pool_size=92274688
rac1.__streams_pool_size=0
rac2.__streams_pool_size=0
*.audit_file_dest='/opt/oracle/app/oracle/admin/rac/adump'
*.background_dump_dest='/opt/oracle/app/oracle/admin/rac/bdump'
*.cluster_database_instances=2
*.cluster_database=TRUE
*.compatible='10.2.0.5.0'
*.control_files='+DATA/rac/controlfile/current.268.833042213'
*.core_dump_dest='/opt/oracle/app/oracle/admin/rac/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='rac'
rac2.instance_number=2
rac1.instance_number=1
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=+DATA/'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=87031808
*.processes=150
*.remote_listener='LISTENERS_RAC'
*.remote_login_passwordfile='exclusive'
*.sga_target=261095424
rac2.thread=2
rac1.thread=1
*.undo_management='AUTO'
rac2.undo_tablespace='UNDOTBS2'
rac1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/opt/oracle/app/oracle/admin/rac/udump'

从文件系统拷到ASM也类似,这里不再重复.

二、RMAN的CONVERT方法
convert命令是用于对数据文件进行字节格式转换,主要用于跨平台传输表空间,也可完成ASM和本地文件系统间拷贝文件
(1)从ASM拷贝到文件系统:
RMAN>convert datafile '+DATA/RAC/DATAFILE/JFDATA.292.833627517' format   

 '/opt/oracle/jfdata01.dbf';  

Starting backup at 09-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=+DATA/rac/datafile/jfdata.292.833627517
converted datafile=/opt/oracle/jfdata01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished backup at 09-DEC-13

(2)从文件系统拷贝到ASM

RMAN>convert datafile '/opt/oracle/jfdata01.dbf' format   

 '+DATA/RAC/DATAFILE/JFDATA02.dbf';  

Starting backup at 09-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input filename=/opt/oracle/jfdata01.dbf
converted datafile=+DATA/rac/datafile/jfdata02.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished backup at 09-DEC-13


ASMCMD [+DATA/RAc/DATAFILE] > ls -l
Type      Redund  Striped  Time             Sys  Name
DATAFILE  UNPROT  COARSE   DEC 09 22:00:00  Y    JFDATA.292.833627517
DATAFILE  UNPROT  COARSE   DEC 09 22:00:00  Y    JFDATA.297.833754101
DATAFILE  UNPROT  COARSE   DEC 01 16:00:00  Y    SYSAUX.264.833041299
DATAFILE  UNPROT  COARSE   DEC 09 21:00:00  Y    SYSAUX.273.833042249
DATAFILE  UNPROT  COARSE   DEC 01 16:00:00  Y    SYSTEM.262.833041271
DATAFILE  UNPROT  COARSE   DEC 09 21:00:00  Y    SYSTEM.271.833042227
DATAFILE  UNPROT  COARSE   DEC 01 16:00:00  Y    UNDOTBS1.263.833041293
DATAFILE  UNPROT  COARSE   DEC 09 21:00:00  Y    UNDOTBS1.272.833042245
DATAFILE  UNPROT  COARSE   DEC 01 16:00:00  Y    UNDOTBS2.266.833041319
DATAFILE  UNPROT  COARSE   DEC 09 21:00:00  Y    UNDOTBS2.275.833042263
DATAFILE  UNPROT  COARSE   DEC 01 16:00:00  Y    USERS.267.833041329
DATAFILE  UNPROT  COARSE   DEC 09 21:00:00  Y    USERS.276.833042271
                                            N    jfdata01.dbf => +DATA/RAC/DATAFILE/JFDATA.292.833627517
                                            N    jfdata02.dbf => +DATA/RAC/DATAFILE/JFDATA.297.833754101
ASMCMD [+DATA/RAc/DATAFILE] >


你可能感兴趣的:(RMAN的CONVERT方法)