DUPLICATE遠端複製資料庫
環境描述(兩臺機器中oracle版本均為10.0.2.1):
目標端(待複製資料庫ORCL)
IP:10.37.100.100
DB_NAME:ORCL
SID:ORCL
輔助端:
IP:10.37.100.101
DB_NAME:ORCL_DUP
SID:ORCL_DUP
建立秘鑰檔案
[oracle@localhost ~]$ orapwd file=/u01/app/oracle/10.2.0/db_1/dbs/ora
pworcl password=oracle entries=30 force=y
建立PFILE
SQL> create pfile='/u01/pfile.ora' from spfile;
File created.
[oracle@localhost ~]$ scp 10.37.100.100:/u01/pfile.ora /u01/
oracle@10.37.100.100's password:
pfile.ora 100% 1058 1.0KB/s 00:00
[oracle@localhost ~]$ scp 10.37.100.100:/u01/app/oracle/10.2.0/db_1/dbs/orapworcl /u01/app/oracle/10.2.0/d
b_1/dbs/orapworcl_dup
oracle@10.37.100.100's password:
orapworcl 100% 5120 5.0KB/s 00:00
配置輔助端監聽
[oracle@localhost ~]$ echo O$ORACLE_SID
orcl_dup
[oracle@localhost ~]$ cd $ORACLE_HOME/network/admin
[oracle@localhost admin]$ vi listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl_dup)
(ORACLE_HOME = /u01/app/oracle/10.2.0/db_1)
(GLOBAL_NAME = orcl_dup)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.37.100.101)(PORT = 1521))
)
)
重啟監聽:
[oracle@localhost ~]$ lsnrctl stop
[oracle@localhost ~]$ lsnrctl start
配置目標端tns
[oracle@localhost ~]$ cd $ORACLE_HOME/network/admin
[oracle@localhost admin]$ vi tnsnames.ora
新增如下內容:
RMAN_DUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.37.100.101)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl_dup)
)
)
測試TNS:
[oracle@localhost admin]$ tnsping rman_dup
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 11-APR-2014 09:00:40
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/10.2.0/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.37.100.101)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl_dup)))
OK (10 msec)
建立輔助端相關目錄
[oracle@localhost admin]$ vi tnsnames.ora
[oracle@localhost ~]$ mkdir -p /u01/FRA/orcl_dup
[oracle@localhost ~]$ mkdir -p /u01/orcl_dup_arch
[oracle@localhost ~]$ mkdir -p /u01/app/oracle/admin/orcl_dup/{a,b,c,u}dump
[oracle@localhost ~]$ mkdir -p /u01/app/oracle/oradata/orcl_dup
修改輔助端引數檔案
[oracle@localhost ~]$ vi /u01/pfile.ora
orcl.__db_cache_size=88080384
orcl.__java_pool_size=4194304
orcl.__large_pool_size=8388608
orcl.__shared_pool_size=58720256
orcl.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/orcl_dup/adump'
*.background_dump_dest='/u01/app/oracle/admin/orcl_dup/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/orcl_dup/control01.ctl','/u01/app/oracle/oradata/orcl_dup/control02.ctl','/u01/app/oracle/oradata/orcl_dup/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/orcl_dup/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl_dup'
*.db_recovery_file_dest='/u01/FRA/orcl_dup'
*.db_recovery_file_dest_size=5368709120
*.dbwr_io_slaves=2
*.disk_asynch_io=FALSE
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='location=/u01/orcl_dup_arch'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS'
*.user_dump_dest='/u01/app/oracle/admin/orcl_dup/udump'
啟動輔助例項
SQL> create spfile from pfile='/u01/pfile.ora';
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
目標端啟動資料庫到mount或open,登入rman檢視有無資料庫備份,沒有備份需做一次整庫備份:
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 1.07G DISK 00:03:38 08-APR-14
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20140408T090232
Piece Name: /u01/FRA/ORCL/backupset/2014_04_08/o1_mf_nnndf_TAG20140408T090232_9n6looxp_.bkp
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1678073 08-APR-14 /u01/app/oracle/oradata/orcl/system01.dbf
2 Full 1678073 08-APR-14
3 Full 1678073 08-APR-14 /u01/app/oracle/oradata/orcl/sysaux01.dbf
4 Full 1678073 08-APR-14 /u01/app/oracle/oradata/orcl/users01.dbf
5 Full 1678073 08-APR-14 /u01/app/oracle/oradata/orcl/example01.dbf
6 Full 1678073 08-APR-14 /u01/app/oracle/oradata/orcl/tts01.dbf
7 Full 1678073 08-APR-14 /u01/app/oracle/oradata/orcl/tts02.dbf
rman連線資料庫和輔助例項
[oracle@localhost admin]$ rman target sys/oracle auxiliary sys/oracle@rman_dup
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Apr 11 09:08:48 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1370299695)
connected to auxiliary database: ORCL_DUP (not mounted)
RMAN> list backup;
檢視備份集,將備份集copy至目標端的相應路徑下
[oracle@localhost backupset]$ scp 10.37.100.100:/u01/FRA/ORCL/backupset/2014_04_11/* /u01/FRA/ORCL/backupset/2014_04_11/
oracle@10.37.100.100's password:
o1_mf_annnn_TAG20140411T092418_9ngk2cpl_.bkp 100% 2416MB 10.1MB/s 03:59
o1_mf_annnn_TAG20140411T093218_9ngkk4fo_.bkp 100% 142KB 142.0KB/s 00:01
o1_mf_ncsnf_TAG20140411T092904_9ngkjv89_.bkp 100% 7008KB 6.8MB/s 00:01
o1_mf_nnndf_TAG20140411T092904_9ngkc1fm_.bkp 100% 857MB 13.0MB/s 01:06
開始複製
RMAN> run{
2> allocate auxiliary channel c1 device type disk;
3> allocate auxiliary channel c2 device type disk;
4> duplicate target database to orcl_dup
5> db_file_name_convert='/u01/app/oracle/oradata/orcl', '/u01/app/oracle/oradata/orcl_dup'
6> logfile
7> '/u01/app/oracle/oradata/orcl_dup/redo01.log' size 20m,
8> '/u01/app/oracle/oradata/orcl_dup/redo03.log' size 20m,
9> '/u01/app/oracle/oradata/orcl_dup/redo02.log' size 20m;
10> }
.
.
.
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 11-APR-14
複製完成,驗證結果
輔助端登入資料庫:
[oracle@localhost backupset]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 11 09:58:53 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> conn scott/oracle
Connected.
SQL> select tname from tab;
TNAME
------------------------------
DEPT
EMP
BONUS
SALGRADE
TEST
DUPLICATE複製資料庫成功。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29254281/viewspace-1296703/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 之 Duplicate 複製資料庫Oracle資料庫
- duplicate複製資料庫(rac-rac)資料庫
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- RMAN duplicate from active database 複製資料庫Database資料庫
- Duplicate 複製資料庫實驗過程資料庫
- Rman duplicate資料庫複製(單系統)資料庫
- 使用rman的命令duplicate複製資料庫資料庫
- RMAN高階應用之Duplicate複製資料庫(3)複製流程資料庫
- duplicate複製資料庫(rac-單例項)資料庫單例
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- DB2資料庫與Oracle資料庫之間遠端複製(轉)DB2資料庫Oracle
- 使用RMAN高階應用之Duplicate複製資料庫資料庫
- Oracle 11gR2 使用RMAN Duplicate複製資料庫Oracle資料庫
- Oracle11gR2使用RMAN duplicate複製資料庫Oracle資料庫
- RMAN實戰系列之一:用duplicate複製資料庫資料庫
- RMAN高階應用之Duplicate複製資料庫(1)概述資料庫
- oracle 11g duplicate from active database 複製資料庫(四)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(三)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(二)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(一)OracleDatabase資料庫
- RMAN高階應用之Duplicate複製資料庫(4)實戰資料庫
- RMAN高階應用之Duplicate複製資料庫(5)補充資料庫
- DG rman duplicate 複製庫錯誤
- 採用DUPLICATE 把asm資料庫複製到檔案系統ASM資料庫
- 實戰10g新特性之rman duplicate複製資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- 基於快照實現遠端資料只讀複製
- 資料庫複製資料庫
- 複製資料庫資料庫
- Oracle 11gR2 使用 RMAN duplicate from active database 複製資料庫OracleDatabase資料庫
- Oracle備份與恢復系列(四)續 RMAN Duplicate複製資料庫Oracle資料庫
- oracle 11g duplicate database基於備份複製資料庫(六)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(五)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(四)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(三)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(二)OracleDatabase資料庫
- oracle 11g duplicate database基於備份複製資料庫(一)OracleDatabase資料庫