實戰10g新特性之rman duplicate複製資料庫
對於dba來說,有時為了測試需要或者搭建dg環境時都需要對現有資料庫環境做克隆,而手工完成這個任務又十分的繁瑣,10g推出的rman duplicate特性很好的解決了這個問題,只要準備工作做得充分,一條命令就可以搞定這個複製的任務。接下來為大家演示最簡單的複製環境(即target database與duplicate database目錄結構完全一致)
1.環境描述
IP地址 資料庫名 例項名 角色
10.1.101.19 wilson wilson target
10.1.101.13 newdb newdb auxiliary
2.建立axuliary例項的密碼檔案
[oracle@targetdb tmp]$ cd $ORACLE_HOME/dbs
[oracle@targetdb dbs]$ orapwd file=orapwnewdb password=oracle entires=5
3.建立到auxiliary例項的Oracle Net連線
3.1配置靜態監聽
[oracle@targetdb dbs]$ cd $ORACLE_HOME/network/admin
[oracle@targetdb admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.101.13)(PORT = 1521))
)
)
1.環境描述
IP地址 資料庫名 例項名 角色
10.1.101.19 wilson wilson target
10.1.101.13 newdb newdb auxiliary
2.建立axuliary例項的密碼檔案
[oracle@targetdb tmp]$ cd $ORACLE_HOME/dbs
[oracle@targetdb dbs]$ orapwd file=orapwnewdb password=oracle entires=5
3.建立到auxiliary例項的Oracle Net連線
3.1配置靜態監聽
[oracle@targetdb dbs]$ cd $ORACLE_HOME/network/admin
[oracle@targetdb admin]$ cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.101.13)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = newdb)
(ORACLE_HOME = /oracle/product/10.2/db_1)
(SID_NAME = newdb)
)
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = newdb)
(ORACLE_HOME = /oracle/product/10.2/db_1)
(SID_NAME = newdb)
)
)
3.2重啟監聽
[oracle@targetdb admin]$ lsnrctl stop
[oracle@targetdb admin]$ lsnrctl stop
[oracle@targetdb admin]$ lsnrctl start
3.3配置到target和auxiliary例項的網路服務名
3.3配置到target和auxiliary例項的網路服務名
[oracle@targetdb admin]$ cat tnsnames.ora
target =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.101.19)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = wilson)
)
)
target =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.101.19)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = wilson)
)
)
aux =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.101.13)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newdb)
)
)
4.建立auxiliary例項的初始化檔案
[oracle@targetdb admin]$ cd $ORACLE_HOME/dbs
[oracle@targetdb admin]$ cat initnewdb.ora
*.control_files='/oradata/wilson/control01.ctl','/oradata/wilson/control02.ctl','/oradata/wilson/control03.ctl'
*.db_block_size=8192
*.DB_NAME='newdb'
compatible='10.2.0.3.0'(該引數與target例項保持一致,在執行duplicate過程中曾報ORA-01130: database file version 10.2.0.3.0 incompatible with ORACLE version 10.2.0.0.0錯誤,新增此引數後錯誤解決)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.101.13)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newdb)
)
)
4.建立auxiliary例項的初始化檔案
[oracle@targetdb admin]$ cd $ORACLE_HOME/dbs
[oracle@targetdb admin]$ cat initnewdb.ora
*.control_files='/oradata/wilson/control01.ctl','/oradata/wilson/control02.ctl','/oradata/wilson/control03.ctl'
*.db_block_size=8192
*.DB_NAME='newdb'
compatible='10.2.0.3.0'(該引數與target例項保持一致,在執行duplicate過程中曾報ORA-01130: database file version 10.2.0.3.0 incompatible with ORACLE version 10.2.0.0.0錯誤,新增此引數後錯誤解決)
5.啟動auxiliary例項
[oracle@targetdb dbs]$ export ORACLE_SID=newdb
[oracle@targetdb dbs]$ sqlplus / as sysdba
SQL> startup nomount
6.掛載或啟動target例項
[oracle@sourcedb dbs]$ sqlplus sys/oracle as sysdba
SQL> startup
7.確認有可用的備份和歸檔日誌
7.1備份target資料庫
[oracle@sourcedb dbs]$ rman target sys/oracle
RMAN> backup database format '/tmp/dbf_%U' plus archivelog format '/tmp/arch_%U';
7.2將備份複製到auxiliary端
[oracle@sourcedb dbs]$ cd /tmp
[oracle@sourcedb tmp]$ scp arc* dbf* 10.1.101.13:/tmp
8.建立duplicate資料庫
[oracle@targetdb tmp]$ rman target auxiliary cmdfile=du.cmd log=du.log
7.確認有可用的備份和歸檔日誌
7.1備份target資料庫
[oracle@sourcedb dbs]$ rman target sys/oracle
RMAN> backup database format '/tmp/dbf_%U' plus archivelog format '/tmp/arch_%U';
7.2將備份複製到auxiliary端
[oracle@sourcedb dbs]$ cd /tmp
[oracle@sourcedb tmp]$ scp arc* dbf* 10.1.101.13:/tmp
8.建立duplicate資料庫
[oracle@targetdb tmp]$ rman target auxiliary cmdfile=du.cmd log=du.log
9.驗證duplicate資料庫
[oracle@targetdb tmp]$ export ORACLE_SID=newdb
[oracle@targetdb tmp]$ sqlplus scott/tiger
SQL> select count(*) from emp;
COUNT(*)
----------
13
OK,duplicate資料庫建立成功!
----------
13
OK,duplicate資料庫建立成功!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20801486/viewspace-754129/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN實戰系列之一:用duplicate複製資料庫資料庫
- RMAN高階應用之Duplicate複製資料庫(4)實戰資料庫
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- RMAN duplicate from active database 複製資料庫Database資料庫
- Rman duplicate資料庫複製(單系統)資料庫
- 使用rman的命令duplicate複製資料庫資料庫
- 實戰10g新特性之RMAN TSPITR特性
- Oracle 之 Duplicate 複製資料庫Oracle資料庫
- RMAN高階應用之Duplicate複製資料庫(3)複製流程資料庫
- 使用RMAN高階應用之Duplicate複製資料庫資料庫
- 11g RMAN新特性 active database duplication 複製資料庫Database資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- Oracle 11gR2 使用RMAN Duplicate複製資料庫Oracle資料庫
- Oracle11gR2使用RMAN duplicate複製資料庫Oracle資料庫
- RMAN高階應用之Duplicate複製資料庫(1)概述資料庫
- DG rman duplicate 複製庫錯誤
- Duplicate 複製資料庫實驗過程資料庫
- 克隆資料庫之RMAN複製(二)資料庫
- 克隆資料庫之RMAN複製(一)資料庫
- RMAN高階應用之Duplicate複製資料庫(5)補充資料庫
- 11g RMAN新特性active database duplicate 資料庫異構Database資料庫
- DUPLICATE遠端複製資料庫資料庫
- duplicate複製資料庫(rac-rac)資料庫
- RMAN複製資料庫(十)資料庫
- RMAN複製資料庫(九)資料庫
- RMAN複製資料庫(八)資料庫
- RMAN複製資料庫(七)資料庫
- RMAN複製資料庫(六)資料庫
- RMAN複製資料庫(五)資料庫
- RMAN複製資料庫(四)資料庫
- RMAN複製資料庫(三)資料庫
- RMAN複製資料庫(二)資料庫
- RMAN複製資料庫(一)資料庫
- 使用RMAN複製資料庫資料庫
- oracle rman複製資料庫Oracle資料庫
- Oracle 11gR2 使用 RMAN duplicate from active database 複製資料庫OracleDatabase資料庫