克隆資料庫之RMAN複製(二)
顯示所有檔案(含屬性與隱藏檔案)
[oracle@oracle oracle]$ ls -al ~
[oracle@oracle ~]$ orapwd file=acct2.pwd password=secret entries=30
[oracle@oracle ~]$ find -name acct.pwd
./acct.pwd
SQL> conn sys/secret as sysdba
Connected.
[oracle@oracle 10g]$ echo $ORACLE_HOME
/oracle/10g
SQL> create pfile='$oracle_home/initnewdb.ora' from spfile;
*.instance_name=newdb
*.DB_FILE_NAME_CONVERT=(/oracle/oradata/orcl/,/newdb/oradata/orcl/)
*.LOG_FILE_NAME_CONVERT=(/oracle/oradata/orcl/,/newdb/oradata/orcl/)
SQL> create spfile='$ORACLE_HOME/dbs/spfilenewdb.ora' from pfile='$ORACLE_HOME/initnewdb.ora';
[oracle@oracle oracle]$ set oracle_sid=newdb----------------------丟人了這裡。。。。。。。。。
[oracle@oracle oracle]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 25 11:36:38 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn sys/secret as sysdba----其實這裡連線的資料庫例項都不對
Connected.
SQL> startup force nomount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
[oracle@oracle oracle]$ set oracle_sid=newdb
[oracle@oracle oracle]$ rman target sys/zja@orcl auxiliary sys/secret
run {
set newname for datafile 1 to '/newdb/oradata/orcl/system01.dbf';
set newname for datafile 2 to '/newdb/oradata/orcl/undotbs01.dbf';
set newname for datafile 3 to '/newdb/oradata/orcl/sysaux01.dbf';
set newname for datafile 4 to '/newdb/oradata/orcl/users01.dbf';
set newname for datafile 5 to '/newdb/oradata/orcl/example01.dbf';
set newname for datafile 6 to '/newdb/oradata/orcl/user02.dbf';
duplicate target database to newdb logfile
'/newdb/oradata/orcl/redo01.log' size 10m,
'/newdb/oradata/orcl/redo02.log' size 10m,
'/newdb/oradata/orcl/redo03.log' size 10m;
}
RMAN> run {
2> set newname for datafile 1 to '/newdb/oradata/orcl/system01.dbf';
3> set newname for datafile 2 to '/newdb/oradata/orcl/undotbs01.dbf';
4> set newname for datafile 3 to '/newdb/oradata/orcl/sysaux01.dbf';
5> set newname for datafile 4 to '/newdb/oradata/orcl/users01.dbf';
6> set newname for datafile 5 to '/newdb/oradata/orcl/example01.dbf';
7> set newname for datafile 6 to '/newdb/oradata/orcl/user02.dbf';
8> duplicate target database to newdb logfile
9> '/newdb/oradata/orcl/redo01.log' size 10m,
10> '/newdb/oradata/orcl/redo02.log' size 10m,
11> '/newdb/oradata/orcl/redo03.log' size 10m;
12> }
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 25-MAY-11
using channel ORA_AUX_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/25/2011 14:57:34
RMAN-05520: database name mismatch, auxiliary instance has ORCL, command specified NEWDB
[oracle@oracle ~]$ export ORACLE_SID=newdb
[oracle@oracle ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 25 15:51:27 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn sys/secret as sysdba
Connected to an idle instance.
SQL> startup force nomount
ORA-09925: Unable to create audit trail file
Linux Error: 2: No such file or directory
Additional information: 9925
/
chown -R oracle:oinstall /newdb
[oracle@oracle ~]$ oerr ora 09925
09925, 00000, "Unable to create audit trail file"
// *Cause: ORACLE was not able to create the file being used to hold
// audit trail records.
// *Action: Check the UNIX error number for a possible operating system error.
// If there is no error, contact ORACLE customer support.
原來*.audit_file_dest 所賦的目錄未建立,還得手工建立這些目錄,包括其他的引數檔案中所用到的目錄
*.audit_file_dest='/newdb/admin/orcl/adump'
SQL> startup force nomount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
chown -R oracle:oinstall /newdb/oradata/orcl/
[oracle@oracle ~]$ export ORACLE_SID=newdb
[oracle@oracle ~]$ sqlplus sys/secret as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 27 11:11:41 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup force nomount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers
--這下終於對了
[oracle@oracle ~]$ export ORACLE_SID=newdb
[oracle@oracle ~]$ rman target sys/zja@orcl auxiliary sys/secret
Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 25 16:54:09 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1278821908)
connected to auxiliary database: NEWDB (not mounted)
run {
set newname for datafile 1 to '/newdb/oradata/orcl/system01.dbf';
set newname for datafile 2 to '/newdb/oradata/orcl/undotbs01.dbf';
set newname for datafile 3 to '/newdb/oradata/orcl/sysaux01.dbf';
set newname for datafile 4 to '/newdb/oradata/orcl/users01.dbf';
set newname for datafile 5 to '/newdb/oradata/orcl/example01.dbf';
set newname for datafile 6 to '/newdb/oradata/orcl/user02.dbf';
duplicate target database to newdb logfile
'/newdb/oradata/orcl/redo01.log' size 10m,
'/newdb/oradata/orcl/redo02.log' size 10m,
'/newdb/oradata/orcl/redo03.log' size 10m;
}
RMAN> run {
2> set newname for datafile 1 to '/newdb/oradata/orcl/system01.dbf';
set newname for datafile 2 to '/newdb/oradata/orcl/undotbs01.dbf';
3> 4> set newname for datafile 3 to '/newdb/oradata/orcl/sysaux01.dbf';
5> set newname for datafile 4 to '/newdb/oradata/orcl/users01.dbf';
6> set newname for datafile 5 to '/newdb/oradata/orcl/example01.dbf';
7> set newname for datafile 6 to '/newdb/oradata/orcl/user02.dbf';
8> duplicate target database to newdb logfile
9> '/newdb/oradata/orcl/redo01.log' size 10m,
10> '/newdb/oradata/orcl/redo02.log' size 10m,
11> '/newdb/oradata/orcl/redo03.log' size 10m;
12> }
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
Starting Duplicate Db at 25-MAY-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=152 devtype=DISK
contents of Memory Script.:
{
set until scn 671526;
set newname for datafile 1 to
"/newdb/oradata/orcl/system01.dbf";
set newname for datafile 2 to
"/newdb/oradata/orcl/undotbs01.dbf";
set newname for datafile 3 to
"/newdb/oradata/orcl/sysaux01.dbf";
set newname for datafile 4 to
"/newdb/oradata/orcl/users01.dbf";
set newname for datafile 5 to
"/newdb/oradata/orcl/example01.dbf";
set newname for datafile 6 to
"/newdb/oradata/orcl/user02.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 25-MAY-11
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 /newdb/oradata/orcl/system01.dbf
restoring datafile 00002 to /newdb/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /newdb/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /newdb/oradata/orcl/users01.dbf
restoring datafile 00005 to /newdb/oradata/orcl/example01.dbf
restoring datafile 00006 to /newdb/oradata/orcl/user02.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/backup/ORCL_15.bak
ORA-19870: error reading backup piece /oracle/backup/ORCL_15.bak
ORA-19504: failed to create file "/newdb/oradata/orcl/system01.dbf"
ORA-27040: file create error, unable to create file
Linux Error: 13: Permission denied
failover to previous backup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/25/2011 20:52:40
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
---chown -R oracle:oinstall /newdb/oradata/orcl/ 這裡更改了許可權,子目錄的許可權也要賦?linux還是不很懂啊
[oracle@oracle ~]$ rman target sys/zja@orcl auxiliary sys/secret
Recovery Manager: Release 10.2.0.1.0 - Production on Fri May 27 11:15:44 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1278821908)
connected to auxiliary database: NEWDB (not mounted)
RMAN> run {
2> set newname for datafile 1 to '/newdb/oradata/orcl/system01.dbf';
3> set newname for datafile 2 to '/newdb/oradata/orcl/undotbs01.dbf';
4> set newname for datafile 3 to '/newdb/oradata/orcl/sysaux01.dbf';
5> set newname for datafile 4 to '/newdb/oradata/orcl/users01.dbf';
6> set newname for datafile 5 to '/newdb/oradata/orcl/example01.dbf';
7> set newname for datafile 6 to '/newdb/oradata/orcl/user02.dbf';
8> duplicate target database to newdb logfile
9> '/newdb/oradata/orcl/redo01.log' size 10m,
10> '/newdb/oradata/orcl/redo02.log' size 10m,
11> '/newdb/oradata/orcl/redo03.log' size 10m;
12> }
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
Starting Duplicate Db at 27-MAY-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK
contents of Memory Script.:
{
set until scn 717794;
set newname for datafile 1 to
"/newdb/oradata/orcl/system01.dbf";
set newname for datafile 2 to
"/newdb/oradata/orcl/undotbs01.dbf";
set newname for datafile 3 to
"/newdb/oradata/orcl/sysaux01.dbf";
set newname for datafile 4 to
"/newdb/oradata/orcl/users01.dbf";
set newname for datafile 5 to
"/newdb/oradata/orcl/example01.dbf";
set newname for datafile 6 to
"/newdb/oradata/orcl/user02.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 27-MAY-11
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 /newdb/oradata/orcl/system01.dbf
restoring datafile 00002 to /newdb/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /newdb/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /newdb/oradata/orcl/users01.dbf
restoring datafile 00005 to /newdb/oradata/orcl/example01.dbf
restoring datafile 00006 to /newdb/oradata/orcl/user02.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/backup/ORCL_15.bak
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/oracle/backup/ORCL_15.bak tag=TAG20110525T174029
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:12
Finished restore at 27-MAY-11
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "NEWDB" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/newdb/oradata/orcl/redo01.log' SIZE 10 M ,
GROUP 2 '/newdb/oradata/orcl/redo02.log' SIZE 10 M ,
GROUP 3 '/newdb/oradata/orcl/redo03.log' SIZE 10 M
DATAFILE
'/newdb/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=752239096 filename=/newdb/oradata/orcl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=752239096 filename=/newdb/oradata/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=752239096 filename=/newdb/oradata/orcl/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=752239096 filename=/newdb/oradata/orcl/example01.dbf
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=752239096 filename=/newdb/oradata/orcl/user02.dbf
contents of Memory Script.:
{
set until scn 717794;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 27-MAY-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK
starting media recovery
archive log thread 1 sequence 18 is already on disk as file /oracle/flash_recovery_area/ORCL/archivelog/2011_05_25/o1_mf_1_18_6xsmsv8t_.arc
archive log thread 1 sequence 19 is already on disk as file /oracle/flash_recovery_area/ORCL/archivelog/2011_05_27/o1_mf_1_19_6xy50q6z_.arc
archive log thread 1 sequence 20 is already on disk as file /oracle/flash_recovery_area/ORCL/archivelog/2011_05_27/o1_mf_1_20_6xy5tq7d_.arc
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2011_05_25/o1_mf_1_18_6xsmsv8t_.arc thread=1 sequence=18
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2011_05_27/o1_mf_1_19_6xy50q6z_.arc thread=1 sequence=19
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2011_05_27/o1_mf_1_20_6xy5tq7d_.arc thread=1 sequence=20
media recovery complete, elapsed time: 00:00:10
Finished recover at 27-MAY-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 05/27/2011 12:54:43
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-01013: user requested cancel of current operation
/
SQL> alter database open resetlogs;
Database altered.
----------------------------==============================================
[oracle@oracle ~]$ rman nocatalog
Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 25 17:03:46 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target sys/zja@orcl
connected to target database: ORCL (DBID=1278821908)
using target database control file instead of recovery catalog
RMAN> report schema;
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 480 SYSTEM *** /oracle/oradata/orcl/system01.dbf
2 30 UNDOTBS1 *** /oracle/oradata/orcl/undotbs01.dbf
3 260 SYSAUX *** /oracle/oradata/orcl/sysaux01.dbf
4 5 USERS *** /oracle/oradata/orcl/users01.dbf
5 100 EXAMPLE *** /oracle/oradata/orcl/example01.dbf
6 20 USER02 *** /oracle/oradata/orcl/user02.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 20 TEMP 32767 /oracle/oradata/orcl/temp01.dbf
--刪除舊的備份
RMAN> delete obsolete;
--列出資料檔案備份
RMAN> list backup of tablespace user02;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25323853/viewspace-696492/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 克隆資料庫之RMAN複製(一)資料庫
- RMAN複製資料庫(二)資料庫
- 克隆資料庫之使用者管理複製(二)資料庫
- 克隆資料庫之使用者管理複製(三)資料庫
- 克隆資料庫之使用者管理複製(一)資料庫
- RMAN複製資料庫(十)資料庫
- RMAN複製資料庫(九)資料庫
- RMAN複製資料庫(八)資料庫
- RMAN複製資料庫(七)資料庫
- RMAN複製資料庫(六)資料庫
- RMAN複製資料庫(五)資料庫
- RMAN複製資料庫(四)資料庫
- RMAN複製資料庫(三)資料庫
- RMAN複製資料庫(一)資料庫
- 使用RMAN複製資料庫資料庫
- oracle rman複製資料庫Oracle資料庫
- 第6章:複製資料庫之克隆開啟的risenet資料庫資料庫SENet
- RMAN 同機複製資料庫資料庫
- RMAN的活動資料庫複製資料庫
- RMAN 異機複製資料庫資料庫
- rman管理的複製資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- 使用RMAN複製資料庫 active database資料庫Database
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- 使用RMAN進行資料庫複製資料庫
- RMAN duplicate from active database 複製資料庫Database資料庫
- Rman duplicate資料庫複製(單系統)資料庫
- 使用rman的命令duplicate複製資料庫資料庫
- RMAN高階應用之Duplicate複製資料庫(3)複製流程資料庫
- DM7資料複製之資料庫級複製資料庫
- 實戰10g新特性之rman duplicate複製資料庫資料庫
- rman複製資料庫詳細的步驟資料庫
- Oracle 之 Duplicate 複製資料庫Oracle資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- 使用RMAN高階應用之Duplicate複製資料庫資料庫
- 架構設計(二):資料庫複製架構資料庫
- Oracle 11gR2 使用RMAN Duplicate複製資料庫Oracle資料庫