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建立DataGuard物理備庫
- 使用RMAN建立Duplicate資料庫資料庫
- 【轉】RMAN建立duplicate資料庫資料庫
- Xbox的日進之路,微軟的尷尬困局微軟
- 蒂姆.威爾茨:處境尷尬的 DooM 元老OOM
- 拿什麼拯救你,“尷尬”的UI介面?(一)UI
- SOAP協議棧是令人尷尬的失敗?協議
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- DG rman duplicate 複製庫錯誤
- RMAN duplicate 建立standby RAC資料庫資料庫
- 使用rman的命令duplicate複製資料庫資料庫
- 奧巴馬陷入尷尬:蘋果接受中國反恐法草案蘋果
- 如何擺脫專案命名困難的尷尬局面
- 記一次尷尬的評論翻車事件事件
- 尷尬的遊戲使用者體驗設計師遊戲
- RMAN duplicate databaseDatabase
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- Edge的尷尬:開發者工具癱瘓多日無人反饋
- 網路安全保障為何仍處尷尬期?
- 寒冬籠罩 COACH線上策略遇銷量尷尬
- Rman 實現oracle11g資料庫cloneOracle資料庫
- RMAN duplicate from active database 複製資料庫Database資料庫
- Rman duplicate資料庫複製(單系統)資料庫
- 通過RMAN Duplicate建立Oracle物理standby備庫Oracle
- 中國手機遊戲開發者正處於“尷尬時期”?遊戲開發
- 使用RMAN duplicate對源庫的某個incarnation進行duplicate操作時遇到的問題
- 用RMAN執行DUPLICATE資料庫操作——RMAN使用者手冊資料庫
- 通過rman duplicate database!Database
- RMAN duplicate On Windows7Windows
- Stadia的尷尬:Google不願補貼 開發者選擇觀望Go
- 新手使用python採集資料的尷尬事之代理ipPython