Oracle 如何快速的 duplicate 一個資料庫
首先
1.duplicate daabase幹什麼的
快速複製一個資料庫。通常用在系統遷移、測試系統搭建。
使用active方式複製,可以不需要有備份檔案的情況下,直接複製資料庫到新的地方。
如果有備份系統,我是不建議從生產直接duplicate資料庫的。因為直接操作生產系統還是有些風險的,比如你搞錯源和目標了,刪庫跑路了。
那麼開搞吧
1.新的資料庫一定要使用使用新的dbname有別於生產
因為如果使用了相同的名字,你將在最後的時候發現新的資料庫無法OPEN。
*.audit_file_dest='/data/app/oracle/admin/gtmstt/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/data/app/oracle/oradata/gtmstt/control01.ctl','/data/app/oracle/fast_recovery_area/gtmstt/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='gtmstt'
*.db_recovery_file_dest='/data/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/data/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=gtmsttXDB)'
*.open_cursors=300
*.pga_aggregate_target=2434793472
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=4293918720
*.undo_tablespace='UNDOTBS1'
*.log_file_name_convert='/data/app/oracle/oradata/gtmsdb','/data/app/oracle/oradata/gtmstt'
*.db_file_name_convert='/data/app/oracle/oradata/gtmsdb','/data/app/oracle/oradata/gtmstt','/data/app/oracle/oradata','/data/app/oracle/oradata/gtmstt'
2.建立新的路徑
mkdir -p /data/app/oracle/admin/gtmstt/adump
mkdir -p /data/app/oracle/oradata/gtmstt
mkdir -p /data/app/oracle/fast_recovery_area/gtmstt
3.新庫要在listener中靜態註冊
listenser.ora 和 tnsnames.ora檔案中的 行縮排是不能省略的。否則你會遇到奇奇怪怪的問題。
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.3)(PORT = 1521))
)
)SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = gtmstt)
(ORACLE_HOME = /data/app/oracle/product/11.2.0/dbhome_1)
)
)ADR_BASE_LISTENER = /data/app/oracle
[oracle@gtmstestdb ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-NOV-2020 17:13:54
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-NOV-2020 16:57:03
Uptime 0 days 0 hr. 16 min. 50 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /data/app/oracle/diag/tnslsnr/gtmstestdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.1.3)(PORT=1521)))
Services Summary...
Service "gtmstt" has 2 instance(s).
Instance "gtmstt", status UNKNOWN, has 1 handler(s) for this service... 這個UNKNOWN 就是靜態註冊上的意思。
The command completed successfully
4.一定要檢查防火牆是否關閉
[root@gtmstestdb ~]$ /bin/systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Nov 05 17:22:39 gtmstestdb systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 05 17:22:39 gtmstestdb systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 06 16:11:54 gtmstestdb systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 06 16:11:54 gtmstestdb systemd[1]: Stopped firewalld - dynamic firewall daemon.
5.配置源庫tnsnames.ora 或者配置 測試庫tnsnames.ora均可,取決於你想在哪一邊進行操作
gtmsdb_du =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.3)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME= gtmsdb)
)
)gtmsdb=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.1.2)(PORT=1521))
(CONNECT_DATA=
(SERVER=dedicated)
(SERVICE_NAME=gtmsdb)
)
)
5.開始duplicate在哪一端操作均可以,命令是一樣的
target 後面加源庫
auxiliary 後面加新庫
rman target sys/oracle@gtmsdb auxiliary sys/oracle@gtmsdb_du
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate AUXILIARY channel c5 type disk;
allocate AUXILIARY channel c6 type disk;
allocate AUXILIARY channel c7 type disk;
allocate AUXILIARY channel c8 type disk;
duplicate target database to gtmstt from active database nofilenamecheck ;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
release channel c8;}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26474945/viewspace-2889762/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE DUPLICATE建立物理standby資料庫Oracle資料庫
- Oracle 之 Duplicate 複製資料庫Oracle資料庫
- oracle 11g duplicate from active database 複製資料庫(一)OracleDatabase資料庫
- 恢復之RAC資料庫DUPLICATE(一)資料庫
- 如何快速找到 oracle 資料庫的所需要的psuOracle資料庫
- 10g duplicate .快速的恢復與建立備份資料庫資料庫
- 使用duplicate克隆資料庫資料庫
- duplicate資料庫的操作步驟資料庫
- oracle 11g duplicate database基於備份複製資料庫(一)OracleDatabase資料庫
- 教你快速掌握Oracle資料庫結構的16個要點Oracle資料庫
- 使用RMAN建立Duplicate資料庫資料庫
- 【轉】RMAN建立duplicate資料庫資料庫
- Oracle 11gR2 使用RMAN Duplicate複製資料庫Oracle資料庫
- Oracle11gR2使用RMAN duplicate複製資料庫Oracle資料庫
- oracle快速定位資料庫瓶頸Oracle資料庫
- Oracle資料庫快速Drop 大表Oracle資料庫
- 一個Oracle soft 啟用2個Clone 的資料庫Oracle資料庫
- 一次使用duplicate建立測試資料庫的過程資料庫
- 如何快速的成為一個合格的Oracle DBA?Oracle
- 使用rman的命令duplicate複製資料庫資料庫
- DUPLICATE遠端複製資料庫資料庫
- RMAN duplicate 建立standby RAC資料庫資料庫
- 100萬資料,如何快速的匯入資料庫?資料庫
- 如何快速的瞭解某種資料庫資料庫
- oracle 11g duplicate from active database 複製資料庫(四)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(三)OracleDatabase資料庫
- oracle 11g duplicate from active database 複製資料庫(二)OracleDatabase資料庫
- RMAN實戰系列之一:用duplicate複製資料庫資料庫
- 【DBA】如何快速的成為一個合格的Oracle DBA?Oracle
- oracle資料庫巡檢優化-快速定位資料庫瓶頸Oracle資料庫優化
- duplicate複製資料庫(rac-rac)資料庫
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- 如何匯出11.2.0.4的某個資料庫使用者許可權及角色並快速複製到另一個同版本的資料庫資料庫
- 關於Oracle中重啟資料庫的一個bugOracle資料庫
- 快速掌握重啟Oracle資料庫的操作步驟Oracle資料庫
- oracle資料庫巡檢優化-快速定位資料庫瓶頸(轉)Oracle資料庫優化
- oracle資料庫巡檢最佳化-快速定位資料庫瓶頸Oracle資料庫