首页 > 代码库 > rman
rman
[oracle@racnode oracle]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 28 17:22:41 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup nomount
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL>
SQL>
SQL>
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2220200 bytes
Variable Size 633343832 bytes
Database Buffers 427819008 bytes
Redo Buffers 5554176 bytes
SQL>
SQL>
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@racnode oracle]$ rman target sys/byRuiy.org89@dg1 auxiliary sys/byRuiy.org89@dg2
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jan 28 17:23:29 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DG (DBID=1783515502)
connected to auxiliary database: DG (not mounted)
RMAN> duplicate target database for standby nofilenamecheck from active database;
Starting Duplicate Db at 28-JAN-15
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=63 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile ‘/ruiy/ocr/DBSoftware/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg‘ auxiliary format
‘/ruiy/ocr/DBSoftware/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg‘ ;
}
executing Memory Script
Starting backup at 28-JAN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
Finished backup at 28-JAN-15
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format ‘/ruiy/ocr/DBData/oradata/dg/control01.ctl‘;
restore clone controlfile to ‘/ruiy/ocr/DBSoftware/app/oracle/flash_recovery_area/dg/control02.ctl‘ from
‘/ruiy/ocr/DBData/oradata/dg/control01.ctl‘;
}
executing Memory Script
Starting backup at 28-JAN-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/ruiy/ocr/DBSoftware/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_dg.f tag=TAG20150128T172347 RECID=4 STAMP=870197027
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 28-JAN-15
Starting restore at 28-JAN-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 28-JAN-15
contents of Memory Script:
{
sql clone ‘alter database mount standby database‘;
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/ruiy/ocr/DBData/oradata/dg/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/ruiy/ocr/DBData/oradata/dg/system01.dbf";
set newname for datafile 2 to
"/ruiy/ocr/DBData/oradata/dg/sysaux01.dbf";
set newname for datafile 3 to
"/ruiy/ocr/DBData/oradata/dg/undotbs01.dbf";
set newname for datafile 4 to
"/ruiy/ocr/DBData/oradata/dg/users01.dbf";
set newname for datafile 5 to
"/ruiy/ocr/DBData/oradata/dg/example01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/ruiy/ocr/DBData/oradata/dg/system01.dbf" datafile
2 auxiliary format
"/ruiy/ocr/DBData/oradata/dg/sysaux01.dbf" datafile
3 auxiliary format
"/ruiy/ocr/DBData/oradata/dg/undotbs01.dbf" datafile
4 auxiliary format
"/ruiy/ocr/DBData/oradata/dg/users01.dbf" datafile
5 auxiliary format
"/ruiy/ocr/DBData/oradata/dg/example01.dbf" ;
sql ‘alter system archive log current‘;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /ruiy/ocr/DBData/oradata/dg/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 28-JAN-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/ruiy/ocr/DBData/oradata/dg/system01.dbf
output file name=/ruiy/ocr/DBData/oradata/dg/system01.dbf tag=TAG20150128T172354
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/ruiy/ocr/DBData/oradata/dg/sysaux01.dbf
output file name=/ruiy/ocr/DBData/oradata/dg/sysaux01.dbf tag=TAG20150128T172354
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=/ruiy/ocr/DBData/oradata/dg/undotbs01.dbf
output file name=/ruiy/ocr/DBData/oradata/dg/undotbs01.dbf tag=TAG20150128T172354
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/ruiy/ocr/DBData/oradata/dg/example01.dbf
output file name=/ruiy/ocr/DBData/oradata/dg/example01.dbf tag=TAG20150128T172354
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=/ruiy/ocr/DBData/oradata/dg/users01.dbf
output file name=/ruiy/ocr/DBData/oradata/dg/users01.dbf tag=TAG20150128T172354
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 28-JAN-15
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=870197100 file name=/ruiy/ocr/DBData/oradata/dg/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=5 STAMP=870197100 file name=/ruiy/ocr/DBData/oradata/dg/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=870197100 file name=/ruiy/ocr/DBData/oradata/dg/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=7 STAMP=870197100 file name=/ruiy/ocr/DBData/oradata/dg/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=8 STAMP=870197100 file name=/ruiy/ocr/DBData/oradata/dg/example01.dbf
Finished Duplicate Db at 28-JAN-15
rman