11g從活動資料庫複製資料庫
11g新特性,duplicate database,檔案不落地,直接從庫複製庫
db1:
189.168.0.11
db2
189.168.0.22
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db1)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = zaradb)
(ORACLE_HOME = /opt/oracle/product/11.2.0/db_1)
(SID_NAME = zaradb)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db2)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = zaradb)
(ORACLE_HOME = /opt/oracle/product/11.2.0/db_1)
(SID_NAME = zaradb)
)
)
db1=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=189.168.0.11)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=zaradb)
)
)
db2=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=189.168.0.22)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=zaradb)
)
)
listener動態註冊,口令檔案一致
orapwd file=?/dbs/orapworcl password=oracle
db1歸檔open
db2啟動到nomount
rman target sys/oracle@db1 auxiliary sys/oracle@db2
duplicate target database to ZARADB from active database nofilenamecheck;
注意事項
監聽必須是靜態註冊
---------------------------
oracle@db2 /opt/oracle/oradata$rman target sys/oracle@db1 auxiliary sys/oracle@db2
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Mar 19 14:38:40 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ZARADB (DBID=2839592742)
connected to auxiliary database: ZARADB (not mounted)
RMAN> duplicate target database to ZARADB from active database nofilenamecheck;
Starting Duplicate Db at 19-MAR-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
contents of Memory Script:
{
sql clone "alter system set db_name =
''ZARADB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ZARADB'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
backup as copy current controlfile auxiliary format '/opt/oracle/oradata/zaradb/control01.ctl';
restore clone controlfile to '/opt/oracle/oradata/zaradb/control02.ctl' from
'/opt/oracle/oradata/zaradb/control01.ctl';
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''ZARADB'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''ZARADB'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 523108352 bytes
Fixed Size 1346052 bytes
Variable Size 159385084 bytes
Database Buffers 356515840 bytes
Redo Buffers 5861376 bytes
Starting backup at 19-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=43 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/opt/oracle/product/11.2.0/db_1/dbs/snapcf_zaradb.f tag=TAG20140319T143853 RECID=2 STAMP=842625533
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:04
Finished backup at 19-MAR-14
Starting restore at 19-MAR-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 19-MAR-14
database mounted
contents of Memory Script:
{
set newname for datafile 1 to
"/opt/oracle/oradata/zaradb/system01.dbf";
set newname for datafile 2 to
"/opt/oracle/oradata/zaradb/sysaux01.dbf";
set newname for datafile 3 to
"/opt/oracle/oradata/zaradb/undotbs01.dbf";
set newname for datafile 4 to
"/opt/oracle/oradata/zaradb/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/opt/oracle/oradata/zaradb/system01.dbf" datafile
2 auxiliary format
"/opt/oracle/oradata/zaradb/sysaux01.dbf" datafile
3 auxiliary format
"/opt/oracle/oradata/zaradb/undotbs01.dbf" datafile
4 auxiliary format
"/opt/oracle/oradata/zaradb/users01.dbf" ;
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
Starting backup at 19-MAR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/opt/oracle/oradata/zaradb/system01.dbf
output file name=/opt/oracle/oradata/zaradb/system01.dbf tag=TAG20140319T143904
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:38
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/opt/oracle/oradata/zaradb/sysaux01.dbf
output file name=/opt/oracle/oradata/zaradb/sysaux01.dbf tag=TAG20140319T143904
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/opt/oracle/oradata/zaradb/undotbs01.dbf
output file name=/opt/oracle/oradata/zaradb/undotbs01.dbf tag=TAG20140319T143904
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/opt/oracle/oradata/zaradb/users01.dbf
output file name=/opt/oracle/oradata/zaradb/users01.dbf tag=TAG20140319T143904
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 19-MAR-14
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "/opt/oracle/oradata/arch/1_6_842613930.dbf" auxiliary format
"/opt/oracle/oradata/arch/1_6_842613930.dbf" ;
catalog clone archivelog "/opt/oracle/oradata/arch/1_6_842613930.dbf";
switch clone datafile all;
}
executing Memory Script
Starting backup at 19-MAR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=6 RECID=2 STAMP=842625626
output file name=/opt/oracle/oradata/arch/1_6_842613930.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 19-MAR-14
cataloged archived log
archived log file name=/opt/oracle/oradata/arch/1_6_842613930.dbf RECID=2 STAMP=842625627
datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=842625627 file name=/opt/oracle/oradata/zaradb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=3 STAMP=842625627 file name=/opt/oracle/oradata/zaradb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=842625628 file name=/opt/oracle/oradata/zaradb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=842625628 file name=/opt/oracle/oradata/zaradb/users01.dbf
contents of Memory Script:
{
set until scn 855884;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 19-MAR-14
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 6 is already on disk as file /opt/oracle/oradata/arch/1_6_842613930.dbf
archived log file name=/opt/oracle/oradata/arch/1_6_842613930.dbf thread=1 sequence=6
media recovery complete, elapsed time: 00:00:00
Finished recover at 19-MAR-14
Oracle instance started
Total System Global Area 523108352 bytes
Fixed Size 1346052 bytes
Variable Size 159385084 bytes
Database Buffers 356515840 bytes
Redo Buffers 5861376 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''ZARADB'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''ZARADB'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 523108352 bytes
Fixed Size 1346052 bytes
Variable Size 159385084 bytes
Database Buffers 356515840 bytes
Redo Buffers 5861376 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ZARADB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/opt/oracle/oradata/zaradb/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/opt/oracle/oradata/zaradb/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/opt/oracle/oradata/zaradb/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/opt/oracle/oradata/zaradb/system01.dbf'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
set newname for tempfile 1 to
"/opt/oracle/oradata/zaradb/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/opt/oracle/oradata/zaradb/sysaux01.dbf",
"/opt/oracle/oradata/zaradb/undotbs01.dbf",
"/opt/oracle/oradata/zaradb/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /opt/oracle/oradata/zaradb/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/opt/oracle/oradata/zaradb/sysaux01.dbf RECID=1 STAMP=842625647
cataloged datafile copy
datafile copy file name=/opt/oracle/oradata/zaradb/undotbs01.dbf RECID=2 STAMP=842625647
cataloged datafile copy
datafile copy file name=/opt/oracle/oradata/zaradb/users01.dbf RECID=3 STAMP=842625647
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=842625647 file name=/opt/oracle/oradata/zaradb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=842625647 file name=/opt/oracle/oradata/zaradb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=842625647 file name=/opt/oracle/oradata/zaradb/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 19-MAR-14
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13177610/viewspace-1125138/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 資料庫主從複製資料庫
- Mysql(Mariadb)資料庫主從複製MySql資料庫
- mysql資料庫實現主從複製MySql資料庫
- DM7資料複製之資料庫級複製資料庫
- MySQL-主從複製之搭建從資料庫MySql資料庫
- 資料庫複製(一)–複製介紹資料庫
- 監控資料庫活動資料庫
- MySQL-主從複製之搭建主資料庫MySql資料庫
- MongoDB資料庫之主從複製配置實戰【轉】MongoDB資料庫
- mysql資料庫的主從複製和主主複製實踐MySql資料庫
- linux下mysql主從複製,實現資料庫同步LinuxMySql資料庫
- 使用RMAN複製資料庫 active database資料庫Database
- dimitri/pgcopydb:Postgres資料庫複製工具MITGC資料庫
- 11G oracle資料庫重新啟動crsOracle資料庫
- 資料庫複習資料庫
- Linux實現MySql資料庫的主從複製(一主一從)LinuxMySql資料庫
- 分散式資料庫的複製原理 - Quastor分散式資料庫AST
- 架構設計(二):資料庫複製架構資料庫
- 利用SQL Server Management Studio(SSMS)複製資料庫SQLServerSSM資料庫
- TiDB 異構資料庫複製最佳實踐TiDB資料庫
- 異構資料庫間批量表快速複製資料庫
- GoldenGate異種資料庫之間的複製Go資料庫
- 資料庫複習(一)資料庫
- 複習資料庫原理資料庫
- php資料庫資料如何去除重複資料呢?PHP資料庫
- 資料庫如何應對保障大促活動資料庫
- Centos-Mysql複製備份還原資料庫CentOSMySql資料庫
- oracle sqldeveloper選擇性複製備份資料庫OracleSQLDeveloper資料庫
- 什麼是單主資料庫複製? -Vlad Mihalcea資料庫
- 達夢資料庫遷移資料/複製表/匯入匯出2資料庫
- 達夢資料庫如何將Excel表的資料複製到表中資料庫Excel
- 資料庫學習與複習筆記--資料庫概念和不同類資料庫CRUD操作(1)資料庫筆記
- Moebius資料庫多活叢集資料庫
- 資料庫管理-第126期 如何將資料從11g弄到19c上(202301223)資料庫
- 靜默安裝Oracle資料庫11gOracle資料庫
- Oracle 11g用impdp還原資料庫Oracle資料庫
- MongoDB在不同主機間複製資料庫和集合MongoDB資料庫
- 資料庫容災、複製解決方案全分析(轉)資料庫
- 資料庫檔案複製問題和解決辦法資料庫