利用rman生成備用資料庫操作文件
1.準備好相應的目錄結構
D:\oracle\admin\copy\bdump
D:\oracle\admin\copy\udump
D:\oracle\admin\copy\cdump
D:\oracle\oradata\copy
2.建立好引數檔案 initcopy.ora 檔案,參照主庫檔案進行修改.新增和修改以下引數檔案
db_name=copy
instance_name=copy
background_dump_dest=d:\oracle\admin\copy\bdump
core_dump_dest=d:\oracle\admin\copy\cdump
user_dump_dest=d:\oracle\admin\copy\udump
control_files='D:\oracle\oradata\copy\control01.ctl','d:\oracle\oradata\copy\control02.ctl','d:\oracle\oradata\copy\control03.ctl'
DB_FILE_NAME_CONVERT=('d:\oracle\oradata\paul','E:\oracle\oradata\copy')
LOG_FILE_NAME_CONVERT=('d:\oracle\oradata\paul','E:\oracle\oradata\copy')
3.
使用oradim建立新的instance
c:\>oradim -new -sid copy
例程已建立。
4.使用orapwd建立password檔案
C:\Documents and Settings\Paul Yi>orapwd file=d:\oracle\ora92\database\pwdcopy.o
ra password=abcdefg entries=10
5.配置好監聽和tnsnames,然後使用sqlplus測試連線
listener.ora檔案中
增加以下內容
(SID_DESC =
(GLOBAL_DBNAME = copy)
(ORACLE_HOME = D:\oracle\ora92)
(SID_NAME = copy)
)
tnsnames.ora檔案中增加
copy =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.163)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = copy)
)
)
6.重新停止監聽並且重啟
Service "test" has 1 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
7.使用rman備份原庫
C:\Documents and Settings\Paul Yi>rman target / catalog paultest/paultest@dev89.
avocado.local
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: PAUL (DBID=1605165889)
connected to recovery catalog database
RMAN> backup full database tag 'fullbk';
Starting backup at 24-DEC-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=13 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:\ORACLE\ORADATA\PAUL\SYSTEM01.DBF
input datafile fno=00002 name=D:\ORACLE\ORADATA\PAUL\UNDOTBS01.DBF
input datafile fno=00003 name=D:\ORACLE\ORADATA\PAUL\INDX01.DBF
input datafile fno=00005 name=D:\ORACLE\ORADATA\PAUL\USERS01.DBF
input datafile fno=00004 name=D:\ORACLE\ORADATA\PAUL\TOOLS01.DBF
channel ORA_DISK_1: starting piece 1 at 24-DEC-07
channel ORA_DISK_1: finished piece 1 at 24-DEC-07
piece handle=D:\BACKUP\3TJ4DISC_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
Finished backup at 24-DEC-07
Starting Control File and SPFILE Autobackup at 24-DEC-07
piece handle=D:\BACKUP\C-1605165889-20071224-00 comment=NONE
Finished Control File and SPFILE Autobackup at 24-DEC-07
8.啟動備用資料庫到nomount狀態
C:\Documents and Settings\Paul Yi>sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on Mon Dec 24 13:42:40 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn as sysdba
Connected to an idle instance.
SQL>startup pfile='D:\oracle\ora92\database\initcopy.ora';
File created.
SQL> startup nomount;
9.使用rman複製資料庫
C:\Documents and Settings\Paul Yi>rman target / auxiliary
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: PAUL (DBID=1605165889)
connected to auxiliary database: copy (not mounted)
RMAN> duplicate target database to 'copy';
Starting Duplicate Db at 24-DEC-07
using target database controlfile instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=3 devtype=DISK
printing stored script. Memory Script
{
set until scn 979183;
set newname for datafile 1 to
"D:\ORACLE\ORADATA\COPY\SYSTEM01.DBF";
set newname for datafile 2 to
"D:\ORACLE\ORADATA\COPY\UNDOTBS01.DBF";
set newname for datafile 3 to
"D:\ORACLE\ORADATA\COPY\INDX01.DBF";
set newname for datafile 4 to
"D:\ORACLE\ORADATA\COPY\TOOLS01.DBF";
set newname for datafile 5 to
"D:\ORACLE\ORADATA\COPY\USERS01.DBF";
restore
check readonly
clone database
;
}
executing script. 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 24-DEC-07
using channel ORA_AUX_DISK_1
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 D:\ORACLE\ORADATA\COPY\SYSTEM01.DBF
restoring datafile 00002 to D:\ORACLE\ORADATA\COPY\UNDOTBS01.DBF
restoring datafile 00003 to D:\ORACLE\ORADATA\COPY\INDX01.DBF
restoring datafile 00004 to D:\ORACLE\ORADATA\COPY\TOOLS01.DBF
restoring datafile 00005 to D:\ORACLE\ORADATA\COPY\USERS01.DBF
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=D:\BACKUP\3MJ454NL_1_1 tag=TAG20071221T084645 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 24-DEC-07
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "copy" RESETLOGS ARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 ( 'D:\ORACLE\ORADATA\COPY\REDO01.LOG' ) SIZE 104857600 REUSE,
GROUP 2 ( 'D:\ORACLE\ORADATA\COPY\REDO02.LOG' ) SIZE 104857600 REUSE,
GROUP 3 ( 'D:\ORACLE\ORADATA\COPY\REDO03.LOG' ) SIZE 104857600 REUSE
DATAFILE
'D:\ORACLE\ORADATA\COPY\SYSTEM01.DBF'
CHARACTER SET ZHS16GBK
printing stored script. Memory Script
{
switch clone datafile all;
}
executing script. Memory Script
datafile 2 switched to datafile copy
input datafilecopy recid=1 stamp=642179779 filename=D:\ORACLE\ORADATA\COPY\UNDOT
BS01.DBF
datafile 3 switched to datafile copy
input datafilecopy recid=2 stamp=642179779 filename=D:\ORACLE\ORADATA\COPY\INDX0
1.DBF
datafile 4 switched to datafile copy
input datafilecopy recid=3 stamp=642179779 filename=D:\ORACLE\ORADATA\COPY\TOOLS
01.DBF
datafile 5 switched to datafile copy
input datafilecopy recid=4 stamp=642179779 filename=D:\ORACLE\ORADATA\COPY\USERS
01.DBF
printing stored script. Memory Script
{
set until scn 979183;
recover
clone database
delete archivelog
;
}
executing script. Memory Script
executing command: SET until clause
Starting recover at 24-DEC-07
using channel ORA_AUX_DISK_1
starting media recovery
archive log thread 1 sequence 182 is already on disk as file D:\BACKUP\1_182.DBF
archive log thread 1 sequence 183 is already on disk as file D:\ARCHPAUL\1_183.D
BF
archive log thread 1 sequence 184 is already on disk as file D:\ARCHPAUL\1_184.D
BF
archive log thread 1 sequence 185 is already on disk as file D:\ARCHPAUL\1_185.D
BF
archive log thread 1 sequence 186 is already on disk as file D:\ARCHPAUL\1_186.D
BF
archive log filename=D:\BACKUP\1_182.DBF thread=1 sequence=182
archive log filename=D:\ARCHPAUL\1_183.DBF thread=1 sequence=183
archive log filename=D:\ARCHPAUL\1_184.DBF thread=1 sequence=184
archive log filename=D:\ARCHPAUL\1_185.DBF thread=1 sequence=185
archive log filename=D:\ARCHPAUL\1_186.DBF thread=1 sequence=186
media recovery complete
Finished recover at 24-DEC-07
printing stored script. Memory Script
{
shutdown clone;
startup clone nomount ;
}
executing script. Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 101785252 bytes
Fixed Size 454308 bytes
Variable Size 75497472 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "copy" RESETLOGS ARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 ( 'D:\ORACLE\ORADATA\COPY\REDO01.LOG' ) SIZE 104857600 REUSE,
GROUP 2 ( 'D:\ORACLE\ORADATA\COPY\REDO02.LOG' ) SIZE 104857600 REUSE,
GROUP 3 ( 'D:\ORACLE\ORADATA\COPY\REDO03.LOG' ) SIZE 104857600 REUSE
DATAFILE
'D:\ORACLE\ORADATA\COPY\SYSTEM01.DBF'
CHARACTER SET ZHS16GBK
printing stored script. Memory Script
{
catalog clone datafilecopy "D:\ORACLE\ORADATA\COPY\UNDOTBS01.DBF";
catalog clone datafilecopy "D:\ORACLE\ORADATA\COPY\INDX01.DBF";
catalog clone datafilecopy "D:\ORACLE\ORADATA\COPY\TOOLS01.DBF";
catalog clone datafilecopy "D:\ORACLE\ORADATA\COPY\USERS01.DBF";
switch clone datafile all;
}
executing script. Memory Script
cataloged datafile copy
datafile copy filename=D:\ORACLE\ORADATA\COPY\UNDOTBS01.DBF recid=1 stamp=642180
927
cataloged datafile copy
datafile copy filename=D:\ORACLE\ORADATA\COPY\INDX01.DBF recid=2 stamp=642180927
cataloged datafile copy
datafile copy filename=D:\ORACLE\ORADATA\COPY\TOOLS01.DBF recid=3 stamp=64218092
7
cataloged datafile copy
datafile copy filename=D:\ORACLE\ORADATA\COPY\USERS01.DBF recid=4 stamp=64218092
8
datafile 2 switched to datafile copy
input datafilecopy recid=1 stamp=642180927 filename=D:\ORACLE\ORADATA\COPY\UNDOT
BS01.DBF
datafile 3 switched to datafile copy
input datafilecopy recid=2 stamp=642180927 filename=D:\ORACLE\ORADATA\COPY\INDX0
1.DBF
datafile 4 switched to datafile copy
input datafilecopy recid=3 stamp=642180927 filename=D:\ORACLE\ORADATA\COPY\TOOLS
01.DBF
datafile 5 switched to datafile copy
input datafilecopy recid=4 stamp=642180928 filename=D:\ORACLE\ORADATA\COPY\USERS
01.DBF
printing stored script. Memory Script
{
Alter clone database open resetlogs;
}
executing script. Memory Script
database opened
Finished Duplicate Db at 24-DEC-07
RMAN>
10.檢查複製庫的狀態
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------------------
copy OPEN
11.然後去掉initcopy.ora的DB_FILE_NAME_CONVERT和LOG_FILE_NAME_CONVERT引數,再使用該檔案生成spfile
SQL> create spfile from pfile='D:\oracle\ora92\database\initcopy.ora';
檔案已建立。
sql>startup
over
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7199859/viewspace-1261/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 利用RMAN建立備用資料庫資料庫
- 利用RMAN備份重建資料庫資料庫
- 【RMAN】利用備份片還原資料庫資料庫
- oracle rman備用資料庫(一)Oracle資料庫
- 【RMAN】利用備份片還原資料庫(上)資料庫
- 【RMAN】利用備份片還原資料庫(中)資料庫
- 【RMAN】利用備份片還原資料庫(下)資料庫
- 如何利用Rman對Oracle資料庫進行備份Oracle資料庫
- 利用rman全備恢復刪除的資料庫資料庫
- 【RMAN】利用備份片還原資料庫(中)-附加資料庫
- rman全備資料庫資料庫
- 利用RMAN建立STANDBY資料庫資料庫
- 使用RMAN備份資料庫資料庫
- 為RMAN操作配置資料庫資料庫
- 用RMAN執行DUPLICATE資料庫操作——RMAN使用者手冊資料庫
- 利用RMAN恢復整個資料庫資料庫
- rman恢復資料庫--用備份的控制檔案資料庫
- 用rman建立dataguard備用資料庫繼續(無法找到備份檔案)資料庫
- Python操作MongoDB文件資料庫PythonMongoDB資料庫
- 實用!一鍵生成資料庫文件,堪稱資料庫界的Swagger資料庫Swagger
- RMAN備份 建立catalog資料庫資料庫
- 非歸檔資料庫RMAN備份資料庫
- 利用rman恢復來複制資料庫資料庫
- 利用RMAN跨平臺遷移資料庫資料庫
- rman資料庫全庫備份與恢復資料庫
- 使用RMAN建立資料庫備份庫(筆記)資料庫筆記
- 用rman遷移資料庫資料庫
- 備用資料庫資料庫
- 【RMAN】使用增量備份更新資料庫備份映象資料庫
- golang利用模板生成資料庫表對應的模型及操作函式Golang資料庫模型函式
- Rman-ORACLE資料庫RMAN實現自動備份Oracle資料庫
- 資料庫界的Swagger:一鍵生成資料庫文件!資料庫Swagger
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- 透過rman全庫備份遷移資料庫資料庫
- ORACLE利用STANDBY端RMAN備份進行資料恢復Oracle資料恢復
- 利用wordpress的資料庫操作函式資料庫函式
- 【原】Oracle學習系列—資料庫備份—RMAN備份Oracle資料庫
- 利用RMAN建立10GRAC資料庫的DATA GUARD資料庫