RMAN 異機複製資料庫
實驗平臺: REDHAT linux 4.7 + oracle 10g
目標庫資訊:
ORACLE_BASE: /u01/app/oracle
ORACLE_HOME: /u01/app/oracle/product/10.2.0/db_1
ORACLE_SID:orcl
IP: 192.168.1.20
輔助庫資訊:
ORACLE_BASE: /u01/app/oracle
ORACLE_HOME: /u01/app/oracle/product/10.2.0/db_1
ORACLE_SID:orcl
IP: 192.168.1.21
我們以例項名相同的為例,例項名不同也一樣,在pfile裡修改對應引數就可以了。
步驟如下:
(1)構建輔助資料庫目錄結構
(2)建立pfile,並複製到輔助資料庫,修改相關內容
(3)建立輔助例項口令檔案
(4)RMAN 備份源庫
(5)新增配置監聽
(6)將源庫備份檔案拷貝到輔助庫相同位置
(7)用pfile檔案,將輔助資料庫啟動到nomount 狀態
(8)執行RMAN duplicate命令複製資料庫
(9)建立spfile檔案
(10)在磁帶上恢復備份
(11)使用DBNEWID程式生成新的DBID
一.構建輔助資料庫目錄結構
1.1 Oracle data 目錄
[oracle@localhost oracle]$ mkdir oradata
[oracle@localhost oracle]$ ls
oradata oraInventory product
[oracle@localhost oracle]$ cd oradata/
[oracle@localhost oracle]$ mkdir orcl
1.2 其他目錄
[oracle@localhost oracle]$ pwd
/u01/app/oracle
[oracle@localhost oracle]$ mkdir admin
[oracle@localhost oracle]$ ls
admin oradata oraInventory product
[oracle@localhost oracle]$ cd admin
[oracle@localhost admin]$ ls
[oracle@localhost admin]$ mkdir orcl
[oracle@localhost admin]$ ls
orcl
[oracle@localhost admin]$ cd orcl
[oracle@localhost orcl]$ mkdir adump
[oracle@localhost orcl]$ mkdir bdump
[oracle@localhost orcl]$ mkdir cdump
[oracle@localhost orcl]$ mkdir dpdump
[oracle@localhost orcl]$ mkdir pfile
[oracle@localhost orcl]$ mkdir udump
[oracle@localhost orcl]$ ls
adump bdump cdump dpdump pfile udump
二. 建立pfile,複製到輔助資料庫,並修改相關引數
2.1 在源庫上建立pfile 檔案
SQL> conn sys/admin@orcl as sysdba;
Connected.
SQL> create pfile from spfile;
File created.
2.2 用scp 命令將pfile 檔案傳到輔助庫。要放在$ORACLE_HOME/dbs目錄下,不然ORACLE 不識別。
[oracle@db1 orcl]$ cd /u01/app/oracle/product/10.2.0/db_1/dbs
[oracle@db1 dbs]$ ls
hc_DAVE.dat initdw.ora lkDAVE orapworcl spfileorcl.ora
hc_orcl.dat init.ora lkORCL snapcf_orcl.f
initDAVE.ora initorcl.ora orapwDAVE spfileDAVE.ora
[oracle@db1 dbs]$ scp initorcl.ora 192.168.1.21:/$ORACLE_HOME/dbs
The authenticity of host '192.168.1.21 (192.168.1.21)' can't be established.
RSA key fingerprint is 1a:20:7a:05:bd:e0:ac:04:21:02:b1:72:01:69:40:d6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.21' (RSA) to the list of known hosts.
oracle@192.168.1.21's password:
initorcl.ora 100% 1108 1.1KB/s 00:00
2.3 在輔助庫上確認檔案是否傳送過來
[oracle@localhost orcl]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ls
initdw.ora init.ora initorcl.ora
2.4 在輔助庫上修改pfile引數
[oracle@localhost dbs]$ more initorcl.ora
orcl.__db_cache_size=167772160
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__shared_pool_size=62914560
orcl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
*.compatible='10.2.0.1.0'
*.control_file_record_keep_time=14
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/or
adata/orcl/control02.ctl','/u01/app/oracle/oradata/orcl/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='location=/u01/archivelog'
*.open_cursors=300
*.pga_aggregate_target=81788928
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=246415360
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/orcl/udump'
說明,在這裡我沒有做修改,因為我異機複製例項名相同,儲存位置也相同。 如果說你複製的不同的話,就需要修改相關的例項名。 如果儲存位置不同的話,還需要新增以下引數,對資料檔案位置進行轉換。
db_file_name_convert = ('/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/DAVE')
三.建立輔助例項ORCL 的口令檔案
[oracle@localhost dbs]$ cd $ORACLE_HOME/bin
[oracle@localhost bin]$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=admin
[oracle@localhost bin]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ls
initdw.ora init.ora initorcl.ora orapworcl
windows下oracle預設的位置是$ORACLE_HOME/database目錄,檔名格式是pwdSID.ora。
linux下oracle預設的位置是$ORACLE_HOME/dbs目錄,檔名格式是orapwSID。
建立完後,資料庫需要重啟動,新的口令檔案才能生效。
關於口令檔案建立,詳細內容參考blog:
Oracle OS認證 口令檔案 密碼丟失處理
http://blog.csdn.net/tianlesoftware/archive/2009/10/20/4698293.aspx
四.RMAN 備份源庫(orcl)
[oracle@db1 backup]$ rman target sys/admin@orcl
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Jul 18 18:26:16 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1248423599)
RMAN>RUN {
allocate channel c1 type disk;
allocate channel c2 type disk;
BACKUP FORMAT '/u02/backup/orcl_%U_%T' skip inaccessible filesperset 5 DATABASE TAG orcl_hot_db_bk;
sql 'alter system archive log current';
BACKUP FORMAT '/u02/backup/arch_%U_%T' skip inaccessible filesperset 5 ARCHIVELOG ALL DELETE INPUT;
backup current controlfile tag='bak_ctlfile' format='/u02/backup/ctl_file_%U_%T';
backup spfile tag='spfile' format='/u02/backup/ORCL_spfile_%U_%T';
release channel c2;
release channel c1;
}
備份指令碼,具體參考:
Linux 平臺下 RMAN 全備 和 增量備份 shell 指令碼
http://blog.csdn.net/tianlesoftware/archive/2010/07/16/5740630.aspx
五.新增,配置監聽
5.1 在輔助庫的Listener.ora 檔案中,新增如下內容
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = orcl)
)
)
5.2 修改輔助庫的tnsnames.ora 檔案,新增如下內容
TARGETORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
5.3 修改源庫的tnsnames.ora 檔案,新增如下內容:
AUXORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.21)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
建議使用net manager 工具從介面來修改,這樣不容易出錯
Oracle 資料庫監聽配置
http://blog.csdn.net/tianlesoftware/archive/2009/11/25/4861572.aspx
Oracle Listener 動態註冊 與 靜態註冊
http://blog.csdn.net/tianlesoftware/archive/2010/04/30/5543166.aspx
六. 將源庫的備份拷貝到輔助資料庫的相同位置
這裡有兩種方法,一種直接在輔助庫上建相同的目錄結構,在用SCP 命令把這些備份檔案copy過去,但是這樣會佔用大量的網路資源。 還有一種就是建好目錄結構後用NFS直接Mount上去。 在這裡我們用後面一種方法試一下。
6.1 在輔助庫上建相同的備份目錄結構
因為我們在源庫上備份是備份到/u02/backup目錄中的,所以我們在輔助庫上也建這個目錄
[root@localhost /]# mkdir -p /u02/backup
[root@localhost /]# chown oracle /u02
[root@localhost /]# chmod 777 /u02
6.2 將源庫的備份掛載到輔助庫上
6.2.1 在源庫上將/u02/backup 目錄新增到共享
[root@db1 ~]# more /etc/exports
/u02/backup 192.168.1.21(rw,async,anonuid=65534,anongid=65534)
[root@db1 ~]# service nfs start
6.2.2 在輔助庫上掛載源庫的目錄,注意,mount命令必須以root使用者執行
[root@localhost /]# mount -t nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0
10.85.10.1:/u02/backup /u02/backup
-- 注意: 在掛載NFS的時候,一定要加上-t -o 引數,不然在RMAN 複製的時候會報錯:
--ORA-27054: NFS file system where the file is created or resides is not mounted with correct options
[root@localhost /]# cd /u02/backup/
[root@localhost backup]# ls
arch_3klj4676_1_1_20100718 orcl_3hlj45vf_1_1_20100718
arch_3llj4676_1_1_20100718 orcl_3ilj465c_1_1_20100718
ctl_file_3mlj467h_1_1_20100718 orcl_3jlj4661_1_1_20100718
orcl_3glj45vf_1_1_20100718 ORCL_spfile_3nlj467k_1_1_20100718
七. 啟動輔助庫至nomount 狀態,注意使用pfile引數啟動
[oracle@localhost dbs]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 20 03:53:53 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup nomount pfile=?/dbs/initorcl.ora
ORACLE instance started.
Total System Global Area 247463936 bytes
Fixed Size 1218772 bytes
Variable Size 79693612 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
SQL> exit -- 啟動後就退出session,因為在duplicata的時候不能有session連線
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
八. RMAN 連線到目標例項和輔助例項,執行duplicate 命令複製資料庫
[oracle@db1 ~]$ rman target sys/admin@orcl auxiliary sys/admin@auxorcl;
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Jul 18 20:41:19 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1248423599)
connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database to ORCL nofilenamecheck
2> logfile
3> '/u01/app/oracle/oradata/orcl/redo01.dbf' size 50m,
4> '/u01/app/oracle/oradata/orcl/redo02.dbf' size 50m,
5> '/u01/app/oracle/oradata/orcl/redo03.dbf' size 50m;
注: 這個地方有2個地方需要說明:
(1) Nofilenamecheck 引數:
如果在複製時,位置不同時,我們會用引數db_file_name_convert 對檔案位置進行轉換。 但是在這個複製示例中我們用的是相同的位置。 所以這裡必須加上nofilenamecheck引數。 該引數通知複製操作不必在執行還原操作前確認檔名是不同的。如果沒有指定nofilenamecheck引數,rman會給出如下錯誤:
RMAN-05001: auxiliary filename /u01/app/oracle/oradata/orcl/example01.dbf conflicts with a file used by the target database
RMAN-05001: auxiliary filename /u01/app/oracle/oradata/orcl/users01.dbf conflicts with a file used by the target database
(2) logfile 引數:
在完成複製程式並執行最有一條open resetlogs命令時,RMAN 必須為輔助資料庫構建全新的日誌檔案。 如上面命令所示,我們可以在duplicate 命令中指定logfile引數,並指定使用的日誌檔案的大小,數目和位置。
還可以在pfile裡指定log_file_name_convert 引數來進行轉換。 這種方法相對而言要簡單一點。 但因為我們在RMAN 同機複製資料庫的例子中用的就是這種方法,所以就換種方法來測試。
Starting Duplicate Db at 18-JUL-10
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK
contents of Memory Script:
{
set until scn 733545;
set newname for datafile 1 to "/u01/app/oracle/oradata/orcl/system01.dbf";
set newname for datafile 2 to "/u01/app/oracle/oradata/orcl/undotbs01.dbf";
set newname for datafile 3 to "/u01/app/oracle/oradata/orcl/sysaux01.dbf";
set newname for datafile 4 to "/u01/app/oracle/oradata/orcl/users01.dbf";
set newname for datafile 5 to "/u01/app/oracle/oradata/orcl/example01.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
Starting restore at 18-JUL-10
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore -- 開始restore 資料檔案
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u02/backup/orcl_3plj4ejl_1_1_20100718
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u02/backup/orcl_3plj4ejl_1_1_20100718 tag=ORCL_HOT_DB_BK
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:48
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u02/backup/orcl_3olj4ejk_1_1_20100718
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u02/backup/orcl_3olj4ejk_1_1_20100718 tag=ORCL_HOT_DB_BK
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:14
Finished restore at 18-JUL-10
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
-- 建立源庫的控制檔案,然後根據這個檔案進行相關的恢復
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.dbf' SIZE 50 M ,
GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.dbf' SIZE 50 M ,
GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.dbf' SIZE 50 M
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf'
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=724831148 filename=/u01/app/oracle/oradata/orcl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=724831148 filename=/u01/app/oracle/oradata/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=724831148 filename=/u01/app/oracle/oradata/orcl/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=724831148 filename=/u01/app/oracle/oradata/orcl/example01.dbf
contents of Memory Script:
{
set until scn 733545;
recover
clone database
delete archivelog ;
}
executing Memory Script
executing command: SET until clause
Starting recover at 18-JUL-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK
starting media recovery
channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=46
channel ORA_AUX_DISK_1: reading from backup piece /u02/backup/arch_3tlj4er7_1_1_20100718
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u02/backup/arch_3tlj4er7_1_1_20100718 tag=TAG20100718T205809
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=45
channel ORA_AUX_DISK_1: reading from backup piece /u02/backup/arch_3slj4er7_1_1_20100718
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u02/backup/arch_3slj4er7_1_1_20100718 tag=TAG20100718T205809
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/u01/archivelog/1_45_720642866.dbf thread=1 sequence=45
channel clone_default: deleting archive log(s)
archive log filename=/u01/archivelog/1_45_720642866.dbf recid=2 stamp=724831155
archive log filename=/u01/archivelog/1_46_720642866.dbf thread=1 sequence=46
channel clone_default: deleting archive log(s)
archive log filename=/u01/archivelog/1_46_720642866.dbf recid=1 stamp=724831153
media recovery complete, elapsed time: 00:00:02
Finished recover at 18-JUL-10
contents of Memory Script:
{
shutdown clone;
startup clone nomount ;
-- 如果此時,輔助例項上有session連在上面,將一直等到session退出才能執行,如果等了很長時間還沒有執行,不妨檢查一下,有沒有session連在資料庫上。
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 247463936 bytes
Fixed Size 1218772 bytes
Variable Size 79693612 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
-- 建立新的控制檔案
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.dbf' SIZE 50 M ,
GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.dbf' SIZE 50 M ,
GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.dbf' SIZE 50 M
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf'
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/orcl/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/orcl/undotbs01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/orcl/sysaux01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/orcl/users01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/orcl/example01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /u01/app/oracle/oradata/orcl/temp01.dbf in control file
cataloged datafile copy datafile copy filename=/u01/app/oracle/oradata/orcl/undotbs01.dbf recid=1 stamp=724831185
cataloged datafile copy datafile copy filename=/u01/app/oracle/oradata/orcl/sysaux01.dbf recid=2 stamp=724831186
cataloged datafile copy datafile copy filename=/u01/app/oracle/oradata/orcl/users01.dbf recid=3 stamp=724831186
cataloged datafile copy datafile copy filename=/u01/app/oracle/oradata/orcl/example01.dbf recid=4 stamp=724831186
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=724831185 filename=/u01/app/oracle/oradata/orcl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=724831186 filename=/u01/app/oracle/oradata/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=724831186 filename=/u01/app/oracle/oradata/orcl/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=724831186 filename=/u01/app/oracle/oradata/orcl/example01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
executing Memory Script
database opened
Finished Duplicate Db at 18-JUL-10
九. 建立spfile,並驗證資料庫
通過上面8步的操作,複製操作已經完成。 我們現在建立一個spfile。
SQL> create spfile from pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora';
File created.
SQL> select name from v$database;
NAME
---------
ORCL
SQL> select tablespace_name,file_name from dba_data_files;
TABLESPACE_NAME FILE_NAME
------------------------------ -------------------------------------------------
SYSTEM /u01/app/oracle/oradata/orcl/system01.dbf
UNDOTBS1 /u01/app/oracle/oradata/orcl/undotbs01.dbf
SYSAUX /u01/app/oracle/oradata/orcl/sysaux01.dbf
USERS /u01/app/oracle/oradata/orcl/users01.dbf
EXAMPLE /u01/app/oracle/oradata/orcl/example01.dbf
十. 在遠端伺服器上覆制磁帶備份
如果在遠端伺服器上覆制磁帶備份,必須配置輔助通道,以反映介質管理器的需求。 除了指定介質管理器和用於常規通道的類或池外,還必須指定目標客戶端名稱,如下所示:
RMAN> configure auxiliary channel 1 device type sbt parms="env=(nb_ora_serv=db1,nb_ora_client=db2)";
十一. 使用DBNEWID 適用程式的不完全複製
複製時最令人不滿意的一點是不存在"可重啟的複製",也就是說,如果在執行還原所有檔案的步驟(複製程式中最常出錯)時出錯。比如在恢復操作期間出錯,就必須再次重啟複製程式並重新還原檔案。我們無法修復複製程式(如使丟失的歸檔日誌可用),只能重新開始整個過程。
將resote optimization 選項設定為on, rman 就不會在還原位置中再次還原具有相同資料檔案頭SCN資訊檔案。這也適合用於複製操作。 如果複製操作還原一個檔案,然後重新啟動該複製操作,RMAN 將不會再次還原該檔案。 然後,如果將一個歸檔日誌應用於該檔案,則會再次還原該歸檔日誌。
在Oracle 10g中,使用DBNEWID使用程式可以部分修復恢復程式,這個使用程式以安全和可控的方式為複製的資料庫指定新的DBID。 我們可以手工恢復複製的資料庫,準備所有元素,然後再次執行DBNEWID實用程式完成由複製操作啟動的程式。 這就允許我們至少可以手工完成複製操作。
DBNEWID 使用程式的用法很簡單。 首先,必須確認在使用實用程式前生成了有效的備份,儘管要執行驗證備份的程式,但是在修改DBID期間仍然可能會遇到不可恢復的錯誤。 確認備份有效後,還必須在一致的狀態中關閉資料庫,然後將資料庫切換回載入狀態。
使用示例如下:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 247463936 bytes
Fixed Size 1218772 bytes
Variable Size 79693612 bytes
Database Buffers 163577856 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> !
[oracle@localhost u01]$ nid target=/
DBNEWID: Release 10.2.0.1.0 - Production on Tue Jul 20 07:20:37 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to database ORCL (DBID=1252611919)
Connected to server version 10.2.0
Control Files in database:
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/oradata/orcl/control02.ctl
/u01/app/oracle/oradata/orcl/control03.ctl
Change database ID of database ORCL? (Y/[N]) => y
Proceeding with operation
Changing database ID from 1252611919 to 1252672326
Control File /u01/app/oracle/oradata/orcl/control01.ctl - modified
Control File /u01/app/oracle/oradata/orcl/control02.ctl - modified
Control File /u01/app/oracle/oradata/orcl/control03.ctl - modified
Datafile /u01/app/oracle/oradata/orcl/system01.dbf - dbid changed
Datafile /u01/app/oracle/oradata/orcl/undotbs01.dbf - dbid changed
Datafile /u01/app/oracle/oradata/orcl/sysaux01.dbf - dbid changed
Datafile /u01/app/oracle/oradata/orcl/users01.dbf - dbid changed
Datafile /u01/app/oracle/oradata/orcl/example01.dbf - dbid changed
Datafile /u01/app/oracle/oradata/orcl/temp01.dbf - dbid changed
Control File /u01/app/oracle/oradata/orcl/control01.ctl - dbid changed
Control File /u01/app/oracle/oradata/orcl/control02.ctl - dbid changed
Control File /u01/app/oracle/oradata/orcl/control03.ctl - dbid changed
Instance shut down
Database ID for database ORCL changed to 1252672326.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.
------------------------------------------------------------------------------
本文來自CSDN部落格,轉載請標明出處:http://blog.csdn.net/tianlesoftware/archive/2010/07/20/5749932.aspx
相關文章
- RMAN 同機複製資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- RMAN複製資料庫(十)資料庫
- RMAN複製資料庫(九)資料庫
- RMAN複製資料庫(八)資料庫
- RMAN複製資料庫(七)資料庫
- RMAN複製資料庫(六)資料庫
- RMAN複製資料庫(五)資料庫
- RMAN複製資料庫(四)資料庫
- RMAN複製資料庫(三)資料庫
- RMAN複製資料庫(二)資料庫
- RMAN複製資料庫(一)資料庫
- 使用RMAN複製資料庫資料庫
- oracle rman複製資料庫Oracle資料庫
- RMAN的活動資料庫複製資料庫
- rman管理的複製資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- 使用RMAN複製資料庫 active database資料庫Database
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- 克隆資料庫之RMAN複製(二)資料庫
- 使用RMAN進行資料庫複製資料庫
- 克隆資料庫之RMAN複製(一)資料庫
- RMAN duplicate from active database 複製資料庫Database資料庫
- Rman duplicate資料庫複製(單系統)資料庫
- 使用rman的命令duplicate複製資料庫資料庫
- RMAN高階應用之Duplicate複製資料庫(3)複製流程資料庫
- rman複製資料庫詳細的步驟資料庫
- 使用RMAN遷移資料庫到異機資料庫
- 異構資料庫間批量表快速複製資料庫
- 使用RMAN高階應用之Duplicate複製資料庫資料庫
- TiDB 異構資料庫複製最佳實踐TiDB資料庫
- GoldenGate異種資料庫之間的複製Go資料庫
- Oracle 11gR2 使用RMAN Duplicate複製資料庫Oracle資料庫
- RMAN 複製目標資料庫的理論知識資料庫
- 使用RMAN複製活動資料庫(檔案路徑相同)資料庫
- 使用RMAN複製活動資料庫(檔案路徑不同)資料庫
- Oracle11gR2使用RMAN duplicate複製資料庫Oracle資料庫