RAC TO SINGLE 복제 목적지 에서 실행
[oracle@aracdb aracdb]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.219.201 ora12c
### Public
192.168.219.111 arac1
192.168.219.113 arac2
### Private
192.168.0.111 arac1-priv
192.168.0.112 arac2-priv
### Virtual
192.168.219.112 arac1-vip
192.168.219.114 arac2-vip
### DNS
192.168.219.115 arac-scan
source 서버에서 pwd파일 목적지 서버로 카피
scp $ORACLE_HOME/dbs/orapwaracdb1 ora12c:$ORACLE_HOME/dbs/orapwaracdb
-- 패스워드 파일이 없을 시에 실행 후 목적지 서버로 옮긴다
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=oracle force=y format=12
파라미터 설정
*.audit_file_dest='/u01/app/oracle/admin/aracdb/adump'
*.audit_trail='db'
#*.cluster_database=true
*.compatible='12.2.0'
*.control_files='/oradata/aracdb/controlfile/control01.ctl','/oradata/aracdb/controlfile/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='/oradata/aracdb'
*.db_name='aracdb'
*.db_recovery_file_dest='/oradata/aracdb'
*.db_recovery_file_dest_size=10g
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=aracdbXDB)'
#family:dw_helper.instance_mode='read-only'
*.log_archive_format='%t_%s_%r.dbf'
*.nls_language='KOREAN'
*.nls_territory='KOREA'
*.open_cursors=300
*.pga_aggregate_target=1000m
*.processes=320
*.remote_login_passwordfile='exclusive'
*.sga_target=2998m
*.log_file_name_convert='+DATA','/oradata','+FRA','/oradata'
*.db_file_name_convert='+DATA','/oradata','+FRA','/oradata'
오라클 유저로 디렉토리 생성
/oradata/aracdb
/oradata/aracdb/onlinelog <<== 리두 로그 경로 안만들었더니 에러 발생
/u01/app/oracle/admin/aracdb/adump
/u01/app/oracle/diag/rdbms/aracdb/aracdb/trace
/u01/app/oracle/diag/rdbms/aracdb/aracdb/cdump
-- 목적지 복제용 리스너 구성
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ora12c)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = aracdb)
(ORACLE_HOME = /u01/app/oracle/product/12C/db_1)
)
)
목적지 NO MOUNT 모드 기동
SQL*Plus: Release 12.2.0.1.0 Production on Tue May 23 17:18:57 2023
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 3154116608 bytes
Fixed Size 8625656 bytes
Variable Size 788529672 bytes
Database Buffers 2348810240 bytes
Redo Buffers 8151040 bytes
SQL>
목적지
## tnsnames.ora
ARACDB1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.219.112)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = aracdb)
)
)
aracdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ora12c)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = aracdb)
)
)
-- 리스너 기동
[oracle@aracdb admin]$ lsnrctl start
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 25-JAN-2024 16:31:24
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12C/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12C/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 25-JAN-2024 16:31:24
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12C/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/ora12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora12c)(PORT=1521)))
Services Summary...
Service "aracdb" has 1 instance(s).
Instance "aracdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
-- 목적지에서 rman 접속 후 복제 명령어 실행
[oracle@aracdb admin]$ rman target sys/oracle@aracdb1 auxiliary sys/oracle@aracdb
Recovery Manager: Release 12.2.0.1.0 - Production on Thu Jan 25 16:31:34 2024
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: ARACDB (DBID=2943394426)
connected to auxiliary database: ARACDB (not mounted)
RMAN> DUPLICATE DATABASE TO aracdb
2> FROM ACTIVE DATABASE
3> NOFILENAMECHECK;
Starting Duplicate Db at 24/01/25
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=261 device type=DISK
current log archived
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 3154116608 bytes
Fixed Size 8625656 bytes
Variable Size 788529672 bytes
Database Buffers 2348810240 bytes
Redo Buffers 8151040 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''ARACDB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''aracdb'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone from service 'aracdb1' primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''ARACDB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''aracdb'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 3154116608 bytes
Fixed Size 8625656 bytes
Variable Size 788529672 bytes
Database Buffers 2348810240 bytes
Redo Buffers 8151040 bytes
Starting restore at 24/01/25
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=135 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/oradata/aracdb/controlfile/control01.ctl
output file name=/oradata/aracdb/controlfile/control02.ctl
Finished restore at 24/01/25
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/oradata/aracdb/datafile/system.265.1136924533";
set newname for datafile 3 to
"/oradata/aracdb/datafile/sysaux.266.1136924577";
set newname for datafile 4 to
"/oradata/aracdb/datafile/undotbs1.267.1136924603";
set newname for datafile 5 to
"/oradata/aracdb/datafile/undotbs2.273.1136924729";
set newname for datafile 7 to
"/oradata/aracdb/datafile/users.268.1136924605";
restore
from nonsparse from service
'aracdb1' clone database
;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 24/01/25
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /oradata/aracdb/datafile/system.265.1136924533
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata/aracdb/datafile/sysaux.266.1136924577
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata/aracdb/datafile/undotbs1.267.1136924603
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata/aracdb/datafile/undotbs2.273.1136924729
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /oradata/aracdb/datafile/users.268.1136924605
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 24/01/25
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service 'aracdb1'
archivelog from scn 1728198;
switch clone datafile all;
}
executing Memory Script
Starting restore at 24/01/25
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=23
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service aracdb1
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=24
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 24/01/25
datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=1159202130 file name=/oradata/aracdb/datafile/system.265.1136924533
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=1159202130 file name=/oradata/aracdb/datafile/sysaux.266.1136924577
datafile 4 switched to datafile copy
input datafile copy RECID=12 STAMP=1159202130 file name=/oradata/aracdb/datafile/undotbs1.267.1136924603
datafile 5 switched to datafile copy
input datafile copy RECID=13 STAMP=1159202130 file name=/oradata/aracdb/datafile/undotbs2.273.1136924729
datafile 7 switched to datafile copy
input datafile copy RECID=14 STAMP=1159202130 file name=/oradata/aracdb/datafile/users.268.1136924605
contents of Memory Script:
{
set until scn 1728333;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 24/01/25
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 23 is already on disk as file /oradata/aracdb/ARACDB/archivelog/2024_01_25/o1_mf_1_23_lv43szth_.arc
archived log for thread 1 with sequence 24 is already on disk as file /oradata/aracdb/ARACDB/archivelog/2024_01_25/o1_mf_1_24_lv43t18x_.arc
archived log file name=/oradata/aracdb/ARACDB/archivelog/2024_01_25/o1_mf_1_23_lv43szth_.arc thread=1 sequence=23
archived log file name=/oradata/aracdb/ARACDB/archivelog/2024_01_25/o1_mf_1_24_lv43t18x_.arc thread=1 sequence=24
media recovery complete, elapsed time: 00:00:01
Finished recover at 24/01/25
Oracle instance started
Total System Global Area 3154116608 bytes
Fixed Size 8625656 bytes
Variable Size 788529672 bytes
Database Buffers 2348810240 bytes
Redo Buffers 8151040 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''ARACDB'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
}
executing Memory Script
sql statement: alter system set db_name = ''ARACDB'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance started
Total System Global Area 3154116608 bytes
Fixed Size 8625656 bytes
Variable Size 788529672 bytes
Database Buffers 2348810240 bytes
Redo Buffers 8151040 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ARACDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/oradata/aracdb/onlinelog/group_1.260.1136924673', '/oradata/aracdb/onlinelog/group_1.270.1136924671' ) SIZE 200 M REUSE,
GROUP 2 ( '/oradata/aracdb/onlinelog/group_2.261.1136924673', '/oradata/aracdb/onlinelog/group_2.271.1136924671' ) SIZE 200 M REUSE
DATAFILE
'/oradata/aracdb/datafile/system.265.1136924533'
CHARACTER SET AL32UTF8
sql statement: ALTER DATABASE ADD LOGFILE
INSTANCE 'i2'
GROUP 3 ( '/oradata/aracdb/onlinelog/group_3.274.1136924835', '/oradata/aracdb/onlinelog/group_3.262.1136924835' ) SIZE 200 M REUSE,
GROUP 4 ( '/oradata/aracdb/onlinelog/group_4.275.1136924837', '/oradata/aracdb/onlinelog/group_4.263.1136924837' ) SIZE 200 M REUSE
contents of Memory Script:
{
set newname for tempfile 1 to
"/oradata/aracdb/tempfile/temp.272.1136924683";
switch clone tempfile all;
catalog clone datafilecopy "/oradata/aracdb/datafile/sysaux.266.1136924577",
"/oradata/aracdb/datafile/undotbs1.267.1136924603",
"/oradata/aracdb/datafile/undotbs2.273.1136924729",
"/oradata/aracdb/datafile/users.268.1136924605";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /oradata/aracdb/tempfile/temp.272.1136924683 in control file
cataloged datafile copy
datafile copy file name=/oradata/aracdb/datafile/sysaux.266.1136924577 RECID=1 STAMP=1159202165
cataloged datafile copy
datafile copy file name=/oradata/aracdb/datafile/undotbs1.267.1136924603 RECID=2 STAMP=1159202165
cataloged datafile copy
datafile copy file name=/oradata/aracdb/datafile/undotbs2.273.1136924729 RECID=3 STAMP=1159202165
cataloged datafile copy
datafile copy file name=/oradata/aracdb/datafile/users.268.1136924605 RECID=4 STAMP=1159202165
datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=1159202165 file name=/oradata/aracdb/datafile/sysaux.266.1136924577
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=1159202165 file name=/oradata/aracdb/datafile/undotbs1.267.1136924603
datafile 5 switched to datafile copy
input datafile copy RECID=3 STAMP=1159202165 file name=/oradata/aracdb/datafile/undotbs2.273.1136924729
datafile 7 switched to datafile copy
input datafile copy RECID=4 STAMP=1159202165 file name=/oradata/aracdb/datafile/users.268.1136924605
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Cannot remove created server parameter file
Finished Duplicate Db at 24/01/25
RMAN>
접속 후 상태 확인
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 25 16:37:44 2024
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
aracdb OPEN
##################################################################################
채널 여러개 할당
복제 시에 채널 개수 만큼 패러럴 하게 복제
ex) 채널 2개 할당
rman target sys/oracle@aracdb1 auxiliary sys/oracle@aracdb
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate auxiliary channel stby1 type disk;
allocate auxiliary channel stby2 type disk;
duplicate database to aracdb from active database nofilenamecheck;
}
'ORACLE > Backup & Recovery' 카테고리의 다른 글
백업 되지 않는 datafile 삭제 (0) | 2024.02.14 |
---|---|
오라클 duplicate (복제) 시에 에러 (0) | 2023.05.23 |
RAC to clonedb(single) 복구 (2) | 2014.08.15 |
clone DB를 이용한 incomplete recovery (0) | 2012.08.08 |
복구에 필요한 정보 보기 (0) | 2011.11.23 |