1) Using ASMCMD Utility ( Latest method )
2) Using RMAN ( alternative method )
3) Using DBMS package ( old method )
첫 번째
> Using ASMCMD Utility
select file_id,file_name,bytes/1024/1024 from dba_data_files;
FILE_ID FILE_NAME BYTES/1024/1024
---------- -------------------------------------------------- ---------------
1 +DATA/ARACDB/DATAFILE/system.265.1136924533 810
3 +DATA/ARACDB/DATAFILE/sysaux.266.1136924577 530
5 +DATA/ARACDB/DATAFILE/undotbs2.273.1136924729 25
7 +DATA/ARACDB/DATAFILE/users.268.1136924605 5
4 +DATA/ARACDB/DATAFILE/undotbs1.267.1136924603 70
[+ASM1:/home/grid]> asmcmd
ls
ASMCMD> CRS/
DATA/
FRA/
MGMT/
ASMCMD> cd data
ASMCMD> ls
aracdb/
ASMCMD> cd a*
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
PASSWORD/
TEMPFILE/
ASMCMD> cd datafile
ASMCMD> ls
SYSAUX.258.1136915229
SYSAUX.266.1136924577
SYSTEM.257.1136915185
SYSTEM.265.1136924533
UNDOTBS1.259.1136915255
UNDOTBS1.267.1136924603
UNDOTBS2.273.1136924729
USERS.260.1136915255
USERS.268.1136924605
-- 복사
ASMCMD> cp SYSAUX.266.1136924577 /home/grid/sysaux01.dbf
copying +data/aracdb/datafile/SYSAUX.266.1136924577 -> /home/grid/sysaux01.dbf
두 번째
> Using RMAN
[aracdb1:/home/oracle]> rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Thu Jan 25 11:12:10 2024
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: ARACDB (DBID=2943394426)
RMAN> copy datafile 1 to '/home/oracle/system01.dbf' ;
Starting backup at 24/01/25
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=277 instance=aracdb1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/ARACDB/DATAFILE/system.265.1136924533
output file name=/home/oracle/system01.dbf tag=TAG20240125T111517 RECID=1 STAMP=1159182926
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16
Finished backup at 24/01/25
Starting Control File and SPFILE Autobackup at 24/01/25
piece handle=+FRA/ARACDB/AUTOBACKUP/2024_01_25/s_1159182933.287.1159182935 comment=NONE
Finished Control File and SPFILE Autobackup at 24/01/25
세 번째
> Using DBMS package
SQL> desc dbms_file_transfer
PROCEDURE COPY_FILE
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
SOURCE_DIRECTORY_OBJECT VARCHAR2 IN
SOURCE_FILE_NAME VARCHAR2 IN
DESTINATION_DIRECTORY_OBJECT VARCHAR2 IN
DESTINATION_FILE_NAME VARCHAR2 IN
PROCEDURE COPY_FILE
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
SOURCE_DIRECTORY_OBJECT VARCHAR2 IN
SOURCE_FILE_NAME VARCHAR2 IN
DESTINATION_DIRECTORY_OBJECT VARCHAR2 IN
DESTINATION_FILE_NAME VARCHAR2 IN
CREATED_FILE_NAME VARCHAR2 OUT
DESTINATION_FILE_TAG VARCHAR2 IN DEFAULT
PROCEDURE GET_FILE
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
SOURCE_DIRECTORY_OBJECT VARCHAR2 IN
SOURCE_FILE_NAME VARCHAR2 IN
SOURCE_DATABASE VARCHAR2 IN
DESTINATION_DIRECTORY_OBJECT VARCHAR2 IN
DESTINATION_FILE_NAME VARCHAR2 IN
PROCEDURE PUT_FILE
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
SOURCE_DIRECTORY_OBJECT VARCHAR2 IN
SOURCE_FILE_NAME VARCHAR2 IN
DESTINATION_DIRECTORY_OBJECT VARCHAR2 IN
DESTINATION_FILE_NAME VARCHAR2 IN
DESTINATION_DATABASE VARCHAR2 IN
SQL> create directory SOURCE_DIR as '+DATA/aracdb/datafile';
Directory created.
SQL> create directory TARGET_DIR as '/oradata/';
Directory created.
SQL> BEGIN
2 dbms_file_transfer.copy_file(source_directory_object =>
3 'SOURCE_DIR', source_file_name => 'SYSAUX.266.1136924577',
4 destination_directory_object => 'TARGET_DIR',
5 destination_file_name => 'sysaux001.dbf');
6 END;
7 /
PL/SQL procedure successfully completed.
[oracle@arac1 ~]$ cd /oradata
[oracle@arac1 oradata]$ ls
sysaux001.dbf
[oracle@arac1 oradata]$ ls -al
합계 542732
drwxr-xr-x. 2 oracle dba 26 1월 25 11:36 .
dr-xr-xr-x. 20 root root 4096 1월 25 11:27 ..
-rw-r-----. 1 oracle asmadmin 555753472 1월 25 11:36 sysaux001.dbf
=============================================================
ASM 에서 filesystem으로 복사 하는 3가지 방법이 있습니다.
위 3가지 방법 중에서는 1,2번(asmcmd cp,rman copy) 방법이 제일 간단히 할 수 있겠습니다.
감사합니다.
'ORACLE > ADMIN' 카테고리의 다른 글
12.2.0.1 기준 rac to single로 변환 (0) | 2024.01.28 |
---|---|
12C RAC GIRU Patch ROLLBACK (0) | 2024.01.26 |
오라클 동적 리스너 설정 (0) | 2024.01.18 |
오라클 datafile filesystem 에서 asm으로 이동 (0) | 2023.12.18 |
oracle 리두로그(redo log) 관리(member,group 추가 삭제 변경) (0) | 2023.09.21 |