11g RMAN新特性active database duplicate 資料庫異構
主庫:linux rh4+oracle 11.1.0.6
資料檔案 /oradata/asm11g
複製到:windows 2003 server+oracle 11.1.0.6
資料檔案 f:\asm11g 下
簡稱 主庫和複製庫
主庫只需要複製密碼檔案 $ORACLE_HOME/dbs/orapwasm11g 到 windows $ORACLE_HOME/database/目錄下
並且重新命名為PWDasm11g.ora
現在我們做需要複製到windows 2003庫的準備:
在windows 2003 server F盤上 新建asm11g 目錄
oracle_base d:\app\administrator\admin 目錄下新建asm11g 目錄
d:\app\administrator\admin\asm11g\目錄下 新建adump,dpdump,pfile 三個目錄
在F盤上 新建個 init.ora 檔案 裡面輸入db_name=asm11g
1,複製庫啟動到 nomount 下
C:\Documents and Settings\複製Administrator>set oracle_sid=asm11g
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Aug 1 12:19:01 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile='f:\init.ora';
ORACLE instance started.
Total System Global Area 146472960 bytes
Fixed Size 1331740 bytes
Variable Size 92278244 bytes
Database Buffers 50331648 bytes
Redo Buffers 2531328 bytes
SQL> exit
主庫開始執行以下命令開始複製:
[oracle@asm11g ~]$ rman target / auxiliary
Recovery Manager: Release 11.1.0.6.0 - Production on Sun Jul 27 06:40:22 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ASM11G (DBID=4214158610)
connected to auxiliary database: ASM11G (not mounted)
RMAN> duplicate target database to 'asm11g'
2> from active database
3> spfile set DB_UNIQUE_NAME 'asm11g'
4> set control_files 'f:\asm11g\control01.ctl';
Starting Duplicate Db at 27-JUL-08
using channel ORA_AUX_DISK_1
contents of Memory Script.:
{
backup as copy reuse
file '/u01/app/oracle/product/11.1.6/db_1/dbs/spfileasm11g.ora' auxiliary format
'D:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\SPFILEASM11G.ORA' ;
sql clone "alter system set spfile= ''D:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\SPFILEASM11G.ORA''";
}
executing Memory Script
Starting backup at 27-JUL-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=103 device type=DISK
Finished backup at 27-JUL-08
sql statement: alter system set spfile= ''D:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\SPFILEASM11G.ORA''
contents of Memory Script.:
{
sql clone "alter system set db_name =
''ASM11G'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ASM11G'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''asm11g'' comment=
'''' scope=spfile";
sql clone "alter system set control_files =
''f:\asm11g\control01.ctl'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount ;
}
executing Memory Script
sql statement: alter system set db_name = ''ASM11G'' comment= ''duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''ASM11G'' comment= ''duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''asm11g'' comment= '''' scope=spfile
sql statement: alter system set control_files = ''f:\asm11g\control01.ctl'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/27/2008 06:41:37
RMAN-03015: error occurred in stored script. Memory Script
RMAN-04014: startup failed: ORA-48108: invalid value given for the diagnostic_dest init.ora parameter
ORA-48140: the specified ADR Base directory does not exist [d:\u01\app\oracle]
ORA-48187: specified directory does not exist
OSD-00002: additional error information
O/S-Error: (OS 3) The system cannot find the path specified.
這個錯誤是因為從主庫複製spfileasm11g.ora 到複製庫的 所以兩邊oracle_base 不一致 造成複製庫啟動不了
這個時候只需要修改相關引數為複製庫的oracle_base 和修改檔案轉換路徑引數
複製庫修改引數檔案如下:
C:\Documents and Settings\Administrator>set oracle_sid=asm11g
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Aug 1 12:26:24 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile from spfile;
File created.
首先建立出pfile 檔案 用ue 編輯最後修改的引數檔案如下:
asm11g.__db_cache_size=276824064
asm11g.__java_pool_size=4194304
asm11g.__large_pool_size=4194304
asm11g.__oracle_base='D:\app\Administrator'#ORACLE_BASE set from environment
asm11g.__pga_aggregate_target=138412032
asm11g.__sga_target=411041792
asm11g.__shared_io_pool_size=0
asm11g.__shared_pool_size=121634816
asm11g.__streams_pool_size=0
*.audit_file_dest='D:\app\Administrator\admin\asm11g\adump'
*.audit_trail='db'
*.compatible='11.1.0.0.0'
*.control_files='f:\asm11g\control01.ctl'
*.db_block_size=8192
*.db_create_file_dest='+data'
*.db_domain=''
*.db_file_name_convert='/oradata/asm11g','f:\asm11g' # 資料檔案路徑轉換
*.db_name='ASM11G'#duplicate
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=2147483648
*.db_unique_name='asm11g'
*.diagnostic_dest='D:\app\Administrator' --ORACLE_BASE
*.log_archive_dest_1='location=f:\asm11g DB_UNIQUE_NAME=asm11g'
*.log_archive_dest_2='service=standby SYNC VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=30
*.log_archive_min_succeed_dest=2
*.log_file_name_convert='/oradata/asm11g','f:\asm11g' --日誌檔案路徑轉換
*.open_cursors=300
*.pga_aggregate_target=136314880
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sec_case_sensitive_logon=FALSE
*.sga_target=408944640
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
修改儲存後 生成spfile檔案
SQL> create spfile from pfile;
File created.
複製庫啟動到nomount狀態
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 414306304 bytes
Fixed Size 1333536 bytes
Variable Size 130025184 bytes
Database Buffers 276824064 bytes
Redo Buffers 6123520 bytes
主庫再次執行復制命令:
[oracle@asm11g ~]$ rman target / auxiliary
Recovery Manager: Release 11.1.0.6.0 - Production on Sun Jul 27 06:44:49 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ASM11G (DBID=4214158610)
connected to auxiliary database: ASM11G (not mounted)
RMAN> duplicate target database to 'asm11g'
2> from active database
3> ;
Starting Duplicate Db at 27-JUL-08
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=152 device type=DISK
contents of Memory Script.:
{
set newname for datafile 1 to
"F:\ASM11G\SYSTEM01.DBF";
set newname for datafile 2 to
"F:\ASM11G\SYSAUX01.DBF";
set newname for datafile 3 to
"F:\ASM11G\UNDOTBS101.DBF";
set newname for datafile 4 to
"F:\ASM11G\USERS01.DBF";
set newname for datafile 5 to
"F:\ASM11G\TEST01_NEW.DBF";
backup as copy reuse
datafile 1 auxiliary format
"F:\ASM11G\SYSTEM01.DBF" datafile
2 auxiliary format
"F:\ASM11G\SYSAUX01.DBF" datafile
3 auxiliary format
"F:\ASM11G\UNDOTBS101.DBF" datafile
4 auxiliary format
"F:\ASM11G\USERS01.DBF" datafile
5 auxiliary format
"F:\ASM11G\TEST01_NEW.DBF" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 27-JUL-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=100 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/oradata/asm11g/system01.dbf
output file name=F:\ASM11G\SYSTEM01.DBF tag=TAG20080727T064459 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/oradata/asm11g/undotbs101.dbf
output file name=F:\ASM11G\UNDOTBS101.DBF tag=TAG20080727T064459 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/oradata/asm11g/sysaux01.dbf
output file name=F:\ASM11G\SYSAUX01.DBF tag=TAG20080727T064459 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/oradata/asm11g/test01_new.dbf
output file name=F:\ASM11G\TEST01_NEW.DBF tag=TAG20080727T064459 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/oradata/asm11g/users01.dbf
output file name=F:\ASM11G\USERS01.DBF tag=TAG20080727T064459 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 27-JUL-08
sql statement: alter system archive log current
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ASM11G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 ( 'F:\ASM11G\REDO01.LOG' ) SIZE 50 M REUSE,
GROUP 5 ( 'F:\ASM11G\REDO02.LOG' ) SIZE 50 M REUSE,
GROUP 6 ( 'F:\ASM11G\REDO03.LOG' ) SIZE 50 M REUSE
DATAFILE
'F:\ASM11G\SYSTEM01.DBF'
CHARACTER SET WE8MSWIN1252
contents of Memory Script.:
{
backup as copy reuse
archivelog like "/u01/app/oracle/archivelog/1_163_660159058.arc" auxiliary format
"F:\ASM11G\1_163_660159058.ARC" ;
catalog clone archivelog "F:\ASM11G\1_163_660159058.ARC";
switch clone datafile all;
}
executing Memory Script
Starting backup at 27-JUL-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=163 RECID=220 STAMP=661157178
output file name=F:\ASM11G\1_163_660159058.ARC RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
Finished backup at 27-JUL-08
cataloged archived log
archived log file name=F:\ASM11G\1_163_660159058.ARC RECID=1 STAMP=661609914
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=661609914 file name=F:\ASM11G\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=661609914 file name=F:\ASM11G\UNDOTBS101.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=661609914 file name=F:\ASM11G\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=661609914 file name=F:\ASM11G\TEST01_NEW.DBF
contents of Memory Script.:
{
set until scn 615675;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 27-JUL-08
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 163 is already on disk as file F:\ASM11G\1_163_660159058.ARC
archived log file name=F:\ASM11G\1_163_660159058.ARC thread=1 sequence=163
media recovery complete, elapsed time: 00:00:00
Finished recover at 27-JUL-08
contents of Memory Script.:
{
shutdown clone immediate;
startup clone nomount ;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 414306304 bytes
Fixed Size 1333536 bytes
Variable Size 130025184 bytes
Database Buffers 276824064 bytes
Redo Buffers 6123520 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ASM11G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 ( 'F:\ASM11G\REDO01.LOG' ) SIZE 50 M REUSE,
GROUP 5 ( 'F:\ASM11G\REDO02.LOG' ) SIZE 50 M REUSE,
GROUP 6 ( 'F:\ASM11G\REDO03.LOG' ) SIZE 50 M REUSE
DATAFILE
'F:\ASM11G\SYSTEM01.DBF'
CHARACTER SET WE8MSWIN1252
contents of Memory Script.:
{
set newname for tempfile 2 to
"F:\ASM11G\TEMP01.DBF";
switch clone tempfile all;
catalog clone datafilecopy "F:\ASM11G\SYSAUX01.DBF";
catalog clone datafilecopy "F:\ASM11G\UNDOTBS101.DBF";
catalog clone datafilecopy "F:\ASM11G\USERS01.DBF";
catalog clone datafilecopy "F:\ASM11G\TEST01_NEW.DBF";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 2 to F:\ASM11G\TEMP01.DBF in control file
cataloged datafile copy
datafile copy file name=F:\ASM11G\SYSAUX01.DBF RECID=1 STAMP=661609931
cataloged datafile copy
datafile copy file name=F:\ASM11G\UNDOTBS101.DBF RECID=2 STAMP=661609931
cataloged datafile copy
datafile copy file name=F:\ASM11G\USERS01.DBF RECID=3 STAMP=661609931
cataloged datafile copy
datafile copy file name=F:\ASM11G\TEST01_NEW.DBF RECID=4 STAMP=661609931
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=661609931 file name=F:\ASM11G\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=661609931 file name=F:\ASM11G\UNDOTBS101.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=661609931 file name=F:\ASM11G\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=661609931 file name=F:\ASM11G\TEST01_NEW.DBF
contents of Memory Script.:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 27-JUL-08
RMAN>
這時登入複製庫進行查詢,可以正常使用
C:\Documents and Settings\Administrator>set oracle_sid=asm11g
C:\Documents and Settings\Administrator>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Aug 1 12:53:55 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select status,instance_name from v$instance;
STATUS INSTANCE_NAME
------------ ----------------
OPEN asm11g
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination f:\asm11g
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-417408/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用RMAN複製資料庫 active database資料庫Database
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid不同UXDatabaseOracle
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid相同UXDatabaseOracle
- database資料庫的資料結構Database資料庫資料結構
- RMAN Duplicate RAC to Single Instance
- RMAN資料庫恢復異常報錯ORA-01180資料庫
- rman duplicate操作手冊
- Oracle 11G RAC複製備庫RMAN-03002 RMAN-05501 RMAN-03015 RMAN-03009 RMAN-10038Oracle
- Oracle rman duplicate遷移測試Oracle
- 用rman遷移資料庫資料庫
- 使用RMAN備份資料庫資料庫
- 【DG】備庫RMAN還原方式搭建DG(不使用duplicate命令)
- 1 Oracle Database 19c 新特性OracleDatabase
- 配置ORACLE資料庫到達夢資料庫的異構DBLINKOracle資料庫
- 12c RMAN新特性之Recover Table
- 3.1.1.2 使用RMAN啟動資料庫資料庫
- 利用RMAN備份重建資料庫資料庫
- Oracle 如何快速的 duplicate 一個資料庫Oracle資料庫
- 3. 資料庫 database & Eloquent ORM資料庫DatabaseORM
- 資料庫分片(Database Sharding)詳解資料庫Database
- Oracle 11g DG新特性--Automatic block repairOracleBloCAI
- Oracle 12C新特性-RMAN恢復表Oracle
- ORACLE資料庫檢視ACQ(ACTIVE CHECKPOINT QUEUE)資訊Oracle資料庫
- 【12c】12c RMAN新特性之通過網路遠端恢復資料庫(RESTORE/Recover from Service)資料庫REST
- 資料庫週刊18│4月資料庫排行;PG是最好的資料庫;TiDB 4.0新特性資料庫TiDB
- 摩杜雲資料庫MySQL,破解異構資料庫遷移難題資料庫MySql
- 異構資料庫間批量表快速複製資料庫
- TiDB 異構資料庫複製最佳實踐TiDB資料庫
- Android資料庫檢視庫---Android-Debug-DatabaseAndroid資料庫Database
- 國產資料庫OushuDB(Database)簡介資料庫Database
- 2.4.1 使用 CREATE DATABASE 子句建立資料庫Database資料庫
- mysql database manual(mysql資料庫手冊)MySqlDatabase資料庫
- 【11g 庫異地恢復】實驗
- [20190718]12c rman新特性 表恢復.txt
- Oracle 12.2新特性: PDB級閃回資料庫(Flashback PDB)Oracle資料庫
- Oracle RMAN 連線資料庫認證方法Oracle資料庫
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- 異構資料庫遷移 sql等價改寫資料庫SQL
- 多個異構資料庫如何關聯查詢資料庫