rman duplicate clone庫的尷尬
[rman clone 目標庫實驗]
實驗環境:
Linux + 10g環境,目標庫與auxiliary庫在同一臺主機
目標庫sid:wtf
clone(auxiliary庫)sid:clone
omf路徑相同
1、使用rman全備目標資料庫 10.128.7.224
------------------------------------
[oracle@wtf01 admin]$ rman target /
RMAN> backup database;
2、配置auxiliary庫例項環境
-------------------------
2.1、配置auxiliary庫的例項環境、監聽、tns檔案、hosts、密碼檔案配置
使用oracle使用者 在$ORACLE_BASE/admin 下新建clone例項目錄,並建立bdump等目錄
[oracle@wtf01 admin]$ cd $ORACEL_BASE/admin
[oracle@wtf01 admin]$ mkdir adump
[oracle@wtf01 admin]$ mkdir bdump
[oracle@wtf01 admin]$ mkdir cdump
[oracle@wtf01 admin]$ mkdir pfile
[oracle@wtf01 admin]$ mkdir udump
建立$ORACLE_BASE/oradata/clone目錄 (存放資料檔案等)
2.2、連線目標庫,準備clone庫的pfile
[oracle@wtf01 oradata]$ sqlplus '/as sysdba'
SQL> create pfile='/oracle/admin/clone/pfile/initclone.ora' from spfile;
File created.
編輯initclone.ora 講目標庫的sid修改為clone
==vi下 :g/wtf//s/clone/g
==修改pfile中db_name=目標庫sid
==增加instance_name=clone庫sid(*。instnance_name=clone)
==*.lock_name_space=CLONE
==/*注意一點*/ 因為clone選擇了通過tns解析並使用密碼連線 ,
務必將pfile中的*.remote_login_passwordfile='shared'改過來原來是none
補充:是否遠端登入認證資料庫,remote_login_passwordfile
有三個值:all|none|shared,具體代表說明就不說了。呵呵
2.3 配置clone庫 監聽和tns (必要時修改etc/hosts,實驗中用了alias解析的服務,故有以下hosts配置)
hosts 配置了 hosts如下:
#IP address of server host name alias
10.128.7.224 wtf clone
listener配置:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = clone)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(SID_NAME = clone)
)
)
//上處只為clone庫配置一個監聽協議,其他不需要配置
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = wtf01)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC01))
)
)
==在遇到啟動listener
tnsnames.ora配置:
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
//之前有存在其他tns 連線描述,故給clone1526埠,後來已將其他連線描述刪除,乾淨是王道
clone =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = wtf01)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME= clone)
)
)
===配置完後,tnsping去驗證的時候碰到了常見問題:
tns-12154:TNS:could not resolve the connect identifier specified
//該問題依然從hosts入手的,增加別名 10.128.7.224 wtf01 clone//別名
TNS-03505: Failed to resolve name
//該問題是hosts檔案裡面 沒有配置正確導致,我發現 127.0.0.1 wtf wtf備註釋掉了,
==最後我是選擇解析別名來達到tnsping clone。
密碼檔案的配置:
在$ORACLE_HOME/dbs下 生成密碼檔案,具體操作如下:
orapwd file=$ORACLE_HOME/dbs/pwdclone password=clone entries=20 force=y
//注意在window環境下 pwdclone要帶.ora(即pwdclone.ora)
以上驗證tns、listener、
為了方便操作,我開了3個視窗
補充:設定sql提示會話標記:set sqlprompt ‘session1’/‘session2’
session1:主庫,進入主庫sqlplus用
session2:auxiliary庫(clone) //Linux切到clone例項下 export ORACLE_SID=clone 進入sqlplus用
session3:配置clone例項用
進入session 2
SQL> conn sys/oracle@clone as sysdba
Connected.
SQL>startup pfilie='/oracle/admin/clone/pfile/initclone.ora' nomount
[oracle@wtf01 pfile]$ rman target / auxiliary sys/oracle@clone
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Mar 19 10:50:20 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: WTF (DBID=18509537)
connected to auxiliary database: CLONE (not mounted)
到此模擬連線clone庫成功
3、使用rman重新命名資料檔案及控制檔案
**************************************************************
//下面在session(1)跑rman duplicate指令碼
[oracle@wtf01 clone]$ env |grep ORA
ORACLE_SID=wtf
ORACLE_BASE=/oracle
ORACLE_HOME=/oracle/product/10.2.0/db_1
[oracle@wtf01 clone]$ rman target / auxiliary sys/oracle@clone
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Mar 21 16:16:13 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: WTF (DBID=18509537)
connected to auxiliary database: CLONE (not mounted)
RMAN> run{
2> set newname for datafile 1 to '/oracle/oradata/clone/system001.dbf';
3> set newname for datafile 2 to '/oracle/oradata/clone/undotbs001.dbf';
4> set newname for datafile 3 to '/oracle/oradata/clone/sysaux001.dbf';
5> set newname for datafile 4 to '/oracle/oradata/clone/user001.dbf';
6> set newname for datafile 5 to '/oracle/oradata/clone/001.dbf';
7> set newname for datafile 10 to '/oracle/oradata/clone/rman001.dbf';
8> set newname for tempfile 1 to '/oracle/oradata/clone/temp001.dbf';
9> duplicate target database to 'clone'
10> logfile
11> '/oracle/oradata/clone/redo1.log' size 10M,
12> '/oracle/oradata/clone/redo2.log' size 10M,
13> '/oracle/oradata/clone/redo3.log' size 10M;
14> }
executing command: SET NEWNAME
using target database control file instead of recovery catalog
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting Duplicate Db at 21-MAR-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=154 devtype=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: sid=153 devtype=DISK
contents of Memory Script.:
{
set until scn 5438693;
set newname for datafile 1 to
"/oracle/oradata/clone/system001.dbf";
set newname for datafile 2 to
"/oracle/oradata/clone/undotbs001.dbf";
set newname for datafile 3 to
"/oracle/oradata/clone/sysaux001.dbf";
set newname for datafile 4 to
"/oracle/oradata/clone/user001.dbf";
set newname for datafile 5 to
"/oracle/oradata/clone/001.dbf";
set newname for datafile 10 to
"/oracle/oradata/clone/rman001.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 21-MAR-11
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /oracle/oradata/clone/sysaux001.dbf
restoring datafile 00005 to /oracle/oradata/clone/001.dbf
restoring datafile 00010 to /oracle/oradata/clone/rman001.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/rman_backup/0vm7pe3g_1_1
channel ORA_AUX_DISK_2: starting datafile backupset restore
channel ORA_AUX_DISK_2: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/clone/system001.dbf
restoring datafile 00002 to /oracle/oradata/clone/undotbs001.dbf
restoring datafile 00004 to /oracle/oradata/clone/user001.dbf
channel ORA_AUX_DISK_2: reading from backup piece /home/oracle/rman_backup/0um7pe3g_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/home/oracle/rman_backup/0vm7pe3g_1_1 tag=TAG20110321T131944
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:55
channel ORA_AUX_DISK_2: restored backup piece 1
piece handle=/home/oracle/rman_backup/0um7pe3g_1_1 tag=TAG20110321T131944
channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:02:20
Finished restore at 21-MAR-11
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLONE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/oracle/oradata/clone/redo1.log' SIZE 10 M ,
GROUP 2 '/oracle/oradata/clone/redo2.log' SIZE 10 M ,
GROUP 3 '/oracle/oradata/clone/redo3.log' SIZE 10 M
DATAFILE
'/oracle/oradata/clone/system001.dbf'
CHARACTER SET WE8ISO8859P1
contents of Memory Script.:
{
switch clone datafile all;
}
executing Memory Script
released channel: ORA_AUX_DISK_1
released channel: ORA_AUX_DISK_2
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=746381922 filename=/oracle/oradata/clone/undotbs001.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=746381922 filename=/oracle/oradata/clone/sysaux001.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=746381922 filename=/oracle/oradata/clone/user001.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=746381922 filename=/oracle/oradata/clone/001.dbf
datafile 10 switched to datafile copy
input datafile copy recid=5 stamp=746381923 filename=/oracle/oradata/clone/rman001.dbf
contents of Memory Script.:
{
set until scn 5438693;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 21-MAR-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=153 devtype=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: sid=154 devtype=DISK
starting media recovery
archive log thread 1 sequence 156 is already on disk as file /oracle/archivelog/1_156_734599521.dbf
archive log filename=/oracle/archivelog/1_156_734599521.dbf thread=1 sequence=156
media recovery complete, elapsed time: 00:00:06
Finished recover at 21-MAR-11
contents of Memory Script.:
{
shutdown clone;
startup clone nomount ;
}
executing Memory Script
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/21/2011 16:40:49
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-03113: end-of-file on communication channel
//下面是我在session2裡面操作open resetlogs的結果(驗證庫能否開啟)**************************************************************
SQL> select status from v$instance;
STATUS
------------
MOUNTED
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
SQL> select * from dual;
ERROR:
ORA-03114: not connected to ORACLE
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@wtf01 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Mar 21 16:41:21 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn sys/oracle@clone as sysdba
Connected to an idle instance.
SQL> startup
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area 1174405120 bytes
Fixed Size 1219040 bytes
Variable Size 301991456 bytes
Database Buffers 855638016 bytes
Redo Buffers 15556608 bytes
Database mounted.
Database opened.
SQL> select * from dual;
D
-
X
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- -------------db_file_name_convert string
db_name string clone
db_unique_name string clone
global_names boolean FALSE
instance_name string clone
lock_name_space string CLONE
log_file_name_convert string
service_names string clone
SQL>
總結:
雖然最後clone庫開啟了,但實驗我覺得應該算失敗的,因為沒達到我預計的效果 session 1的不響應 等待下次測試,非常尷尬!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22907091/viewspace-691959/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 業務測開的尷尬定位
- 光線傳媒的爆款尷尬
- 軟體測試工程師的尷尬工程師
- RMAN Duplicate RAC to Single Instance
- Xbox的日進之路,微軟的尷尬困局微軟
- rman duplicate操作手冊
- 如何擺脫專案命名困難的尷尬局面
- 記一次尷尬的評論翻車事件事件
- 蒂姆.威爾茨:處境尷尬的 DooM 元老OOM
- 在尷尬中進行的數字化轉型
- Oracle rman duplicate遷移測試Oracle
- 【DG】備庫RMAN還原方式搭建DG(不使用duplicate命令)
- 尷尬的遊戲使用者體驗設計師遊戲
- 尷尬的事情又發生Newtonsoft.Json vs Protobuf.netJSON
- 新手使用python採集資料的尷尬事之代理ipPython
- Edge的尷尬:開發者工具癱瘓多日無人反饋
- Intel 5GHz 28核心震撼!然後卻尷尬了Intel
- 記一次尷尬的Java應用記憶體洩露排查Java記憶體洩露
- Stadia的尷尬:Google不願補貼 開發者選擇觀望Go
- 程式碼簽名證書幫你解除“釋出者未知”的尷尬
- 記錄一件很尷尬的事,中介軟體給我的痛。
- 讓人工智慧學會幽默,人機對話不尷尬人工智慧
- 流利說回購,AI教育面臨市場培育的「慢時間」尷尬?AI
- 處處遭遇尷尬,國行Switch鎖卡將會造成怎樣的影響
- 三星迷之尷尬,升級系統的手機不相容GearVRVR
- duplicate遇到RMAN-05535: warning: All redo log files were not defined
- 程式設計師之間的搞笑對話!測試妹子弄得大家好尷尬!程式設計師
- 不是3A,又不算獨立:簡單說說那些尷尬的二線遊戲遊戲
- 科技愛好者週刊(第 242 期):一次尷尬的伺服器被黑伺服器
- vue實現首屏載入等待動畫 避免首次載入白屏尷尬Vue動畫
- 投融資活躍難掩AI企業尷尬 人才缺口超500萬AI
- 尷尬!EXCEL百萬行資料量就歇菜了,還是這個方法實用Excel
- 下一步應該往哪走?有關《刺客信條》的困惑與尷尬
- 女生在求職面試過程中,如何巧妙回答面試官的尷尬問題求職面試
- 看到2018年蘋果設計獎名單後,我替蘋果感到尷尬蘋果
- 程式設計師最不想讓你知道的尷尬瞬間,看完我眼睛都綠了程式設計師
- 人工智慧的尷尬2019及破局2020,三大技術九大行業解析人工智慧行業
- 全面屏時代的尷尬 魅族PRO7再創地板價 1458元起拋售
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid不同UXDatabaseOracle