ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 10g Release 2 Tablespace Point In Time Recovery – recover

10g Release 2 Tablespace Point In Time Recovery – recover

原创 Linux操作系统 作者:ygzhou518 时间:2012-03-15 11:30:03 0 删除 编辑
RMAN> recover tablespace ygzhou until scn 2420448 auxiliary destination '/home/oracle/backup';
 
Starting recover at 15-MAR-12
using channel ORA_DISK_1
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point in time
 
List of tablespaces expected to have UNDO segments
tablespace SYSTEM
tablespace UNDOTBS1
 
Creating automatic instance, with SID='ohdn'
 
initialization parameters used for automatic instance:
db_name=YGZHOU01
compatible=10.2.0.1.0
db_block_size=8192
db_files=200
db_unique_name=tspitr_YGZHOU01_ohdn
large_pool_size=1M
shared_pool_size=110M
#No auxiliary parameter file used
db_create_file_dest=/home/oracle/backup
control_files=/home/oracle/backup/cntrl_tspitr_YGZHOU01_ohdn.f
 
 
starting up automatic instance YGZHOU01
 
Oracle instance started
 
Total System Global Area     205520896 bytes
 
Fixed Size                     1266584 bytes
Variable Size                146803816 bytes
Database Buffers              50331648 bytes
Redo Buffers                   7118848 bytes
Automatic instance created
 
contents of Memory Script.:
{
# set the until clause
set until  scn 2420448;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log for tspitr to a resent until time
sql 'alter system archive log current';
# avoid unnecessary autobackups for structural changes during TSPITR
sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
}
executing Memory Script
 
executing command: SET until clause
 
Starting restore at 15-MAR-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=37 devtype=DISK
 
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/10.2.0/dbhome_1/dbs/c-2252700851-20120315-00
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/product/10.2.0/dbhome_1/dbs/c-2252700851-20120315-00 tag=TAG20120315T084616
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/home/oracle/backup/cntrl_tspitr_YGZHOU01_ohdn.f
Finished restore at 15-MAR-12
 
sql statement: alter database mount clone database
 
sql statement: alter system archive log current
 
sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;
released channel: ORA_DISK_1
released channel: ORA_AUX_DISK_1
 
contents of Memory Script.:
{
# generated tablespace point-in-time recovery script
# set the until clause
set until  scn 2420448;
plsql <<<-- tspitr_2
declare
  sqlstatement       varchar2(512);
  offline_not_needed exception;
  pragma exception_init(offline_not_needed, -01539);
begin
  sqlstatement := 'alter tablespace '||  'YGZHOU' ||' offline for recover';
  krmicd.writeMsg(6162, sqlstatement);
  krmicd.execSql(sqlstatement);
exception
  when offline_not_needed then
    null;
end; >>>;
# set an omf destination filename for restore
set newname for clone datafile  1 to new;
# set an omf destination filename for restore
set newname for clone datafile  2 to new;
# set an omf destination tempfile
set newname for clone tempfile  1 to new;
# set a destination filename for restore
set newname for datafile  5 to
 "/u01/app/oracle/oradata/ygzhou01/ygzhou01.dbf";
# rename all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set plus the auxilliary tablespaces
restore clone datafile  1, 2, 5;
switch clone datafile all;
#online the datafiles restored or flipped
sql clone "alter database datafile  1 online";
#online the datafiles restored or flipped
sql clone "alter database datafile  2 online";
#online the datafiles restored or flipped
sql clone "alter database datafile  5 online";
# make the controlfile point at the restored datafiles, then recover them
recover clone database tablespace  "YGZHOU", "SYSTEM", "UNDOTBS1" delete archivelog;
alter clone database open resetlogs;
# PLUG HERE the creation of a temporary tablespace if export fails due to lack
# of temporary space.
# For example in Unix these two lines would do that:
#sql clone "create tablespace aux_tspitr_tmp
#           datafile ''/tmp/aux_tspitr_tmp.dbf'' size 500K";
}
executing Memory Script
 
executing command: SET until clause
 
sql statement: alter tablespace YGZHOU offline for recover
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
renamed temporary file 1 to /home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_temp_%u_.tmp in control file
 
Starting restore at 15-MAR-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=39 devtype=DISK
 
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 /home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_system_%u_.dbf
restoring datafile 00002 to /home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_undotbs1_%u_.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/ygzhou01/ygzhou01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/10.2.0/dbhome_1/dbs/05n5tv90_1_1
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/product/10.2.0/dbhome_1/dbs/05n5tv90_1_1 tag=TAG20120315T084520
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:46
Finished restore at 15-MAR-12
 
datafile 1 switched to datafile copy
input datafile copy recid=4 stamp=777977727 filename=/home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_system_7p3snl5g_.dbf
datafile 2 switched to datafile copy
input datafile copy recid=5 stamp=777977727 filename=/home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_undotbs1_7p3snl5r_.dbf
 
sql statement: alter database datafile  1 online
 
sql statement: alter database datafile  2 online
 
sql statement: alter database datafile  5 online
 
Starting recover at 15-MAR-12
using channel ORA_AUX_DISK_1
 
starting media recovery
 
archive log thread 1 sequence 154 is already on disk as file /home/oracle/archivelog/1_154_771675891.dbf
archive log filename=/home/oracle/archivelog/1_154_771675891.dbf thread=1 sequence=154
media recovery complete, elapsed time: 00:00:03
Finished recover at 15-MAR-12
 
database opened
 
contents of Memory Script.:
{
# export the tablespaces in the recovery set
host 'exp userid =\"/@\(DESCRIPTION=\(ADDRESS=\(PROTOCOL=beq\)\(PROGRAM=/u01/app/oracle/product/10.2.0/dbhome_1/bin/oracle\)\(ARGV0=oracleohdn\)\(ARGS=^'\(DESCRIPTION=\(LOCAL=YES\)\(ADDRESS=\(PROTOCOL=beq\)\)\)^'\)\(ENVS=^'ORACLE_SID=ohdn^'\)\)\(CONNECT_DATA=\(SID=ohdn\)\)\) as sysdba\" point_in_time_recover=y tablespaces=
 YGZHOU file=
tspitr_a.dmp';
# shutdown clone before import
shutdown clone immediate
# import the tablespaces in the recovery set
host 'imp userid =\"/@ as sysdba\" point_in_time_recover=y file=
tspitr_a.dmp';
# online/offline the tablespace imported
sql "alter tablespace  YGZHOU online";
sql "alter tablespace  YGZHOU offline";
# enable autobackups in case user does open resetlogs from RMAN after TSPITR
sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;';
}
executing Memory Script
 
 
Export: Release 10.2.0.4.0 - Production on Thu Mar 15 08:55:38 2012
 
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
 
 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHT16BIG5 character set (possible charset conversion)
Note: table data (rows) will not be exported
 
About to export Tablespace Point-in-time Recovery objects...
For tablespace YGZHOU ...
. exporting cluster definitions
. exporting table definitions
. . exporting table                        ARCHIVE
EXP-00091: Exporting questionable statistics.
. . exporting table                         YGZHOU
. exporting referential integrity constraints
. exporting triggers
. end point-in-time recovery
Export terminated successfully with warnings.
host command complete
 
database closed
database dismounted
Oracle instance shut down
 
 
Import: Release 10.2.0.4.0 - Production on Thu Mar 15 08:55:53 2012
 
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
 
 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
Export file created by EXPORT:V10.02.01 via conventional path
About to import Tablespace Point-in-time Recovery objects...
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHT16BIG5 character set (possible charset conversion)
. importing SYS's objects into SYS
. importing YGZHOU's objects into YGZHOU
. . importing table                      "ARCHIVE"
. . importing table                       "YGZHOU"
. importing SYS's objects into SYS
Import terminated successfully without warnings.
host command complete
 
sql statement: alter tablespace  YGZHOU online
 
sql statement: alter tablespace  YGZHOU offline
 
sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end;
 
Removing automatic instance
Automatic instance removed
auxiliary instance file /home/oracle/backup/cntrl_tspitr_YGZHOU01_ohdn.f deleted
auxiliary instance file /home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_system_7p3snl5g_.dbf deleted
auxiliary instance file /home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_undotbs1_7p3snl5r_.dbf deleted
auxiliary instance file /home/oracle/backup/TSPITR_YGZHOU01_OHDN/datafile/o1_mf_temp_7p3sp6nj_.tmp deleted
auxiliary instance file /home/oracle/backup/TSPITR_YGZHOU01_OHDN/onlinelog/o1_mf_1_7p3sp3y3_.log deleted
auxiliary instance file /home/oracle/backup/TSPITR_YGZHOU01_OHDN/onlinelog/o1_mf_2_7p3sp4f8_.log deleted
auxiliary instance file /home/oracle/backup/TSPITR_YGZHOU01_OHDN/onlinelog/o1_mf_3_7p3sp4sw_.log deleted
Finished recover at 15-MAR-12
 
RMAN>
RECOVER TABLESPACE today UNTIL SCN 314692 AUXILIARY DESTINATION '/data1/stream/ygzhouback';
RECOVER TABLESPACE today UNTIL TIME "TO_DATE('2012-03-15 12:00:00','YYYY-MM-DD HH24:MI:SS')" AUXILIARY DESTINATION '/data1/stream/ygzhouback';

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24867586/viewspace-718626/,如需转载,请注明出处,否则将追究法律责任。

下一篇: DB存儲規劃
请登录后发表评论 登录
全部评论

注册时间:2011-02-11

  • 博文量
    167
  • 访问量
    359432