ence# from v$log where status='CURRENT';
? ? GROUP#? SEQUENCE#
---------- ----------
? ? ? ? 3? ? ? ? 19
误删除发生
SQL> drop table test.emp;
Table dropped
SQL> drop table test.dept;
Table dropped
--Flashback Drop的机会也没有了。
SQL> purge dba_recyclebin;
Done
3、RMAN进行表空间TSPITR
单表表空间移动,要确保表空间内容“内包”,也就是不会有其他表空间牵扯其中。这个操作我们在可移动表空间的演示中也会进行。
SQL>? exec dbms_tts.transport_set_check('testtbl',true);
PL/SQL procedure successfully completed
SQL> select * from transport_set_violations;
VIOLATIONS
--------------------------------------------------------------------------------
下面进行实际恢复操作,首先需要在目录中创建出一个可访问的空间,进行临时文件容纳。
[root@SimpleLinux ~]# cd /
[root@SimpleLinux /]# mkdir -p /extend/oradata/aux
[root@SimpleLinux /]# chown -R oracle:oinstall /extend/
[root@SimpleLinux /]# ls -l | grep extend
drwxr-xr-x.? 3 oracle oinstall? 4096 Jun 18 10:21 extend
启动RMAN,登录后执行recover tablespace操作,指定出恢复时间。注意:RMAN的recover tablespace命令本质上是执行一系列的指令脚本,将利用RMAN恢复过程自动化,无需人工介入。
[oracle@SimpleLinux ~]$ rman nocatalog
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jun 18 13:48:44 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.? All rights reserved.
RMAN> connect target /
connected to target database: ORA11G (DBID=4239941846)
using target database control file instead of recovery catalog
RMAN>? recover tablespace testtbl until time "to_date('2015-06-18 10:51:19','yyyy-mm-dd hh24:mi:ss')" auxiliary destination '/extend/oradata/aux';
Starting recover at 18-JUN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
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='DDfe' –在目录中创建出一个虚拟的Oracle实例
--启动实例的参数都准备好了。
initialization parameters used for automatic instance:
db_name=ORA11G
db_unique_name=DDfe_tspitr_ORA11G
compatible=11.2.0.4.0
db_block_size=8192
db_files=200
sga_target=1G
processes=80
db_create_file_dest=/extend/oradata/aux
log_archive_dest_1='location=/extend/oradata/aux'
#No auxiliary parameter file used
starting up automatic instance ORA11G
Oracle instance started
Total System Global Area? ? 1071333376 bytes
Fixed Size? ? ? ? ? ? ? ? ? ? 1369420 bytes
Variable Size? ? ? ? ? ? ? ? 281021108 bytes
Database Buffers? ? ? ? ? ? 784334848 bytes
Redo Buffers? ? ? ? ? ? ? ? ? 4608000 bytes
Automatic instance created
--自包检查
Running TRANSPORT_SET_CHECK on recovery set tablespaces
TRANSPORT_SET_CHECK completed successfully
--第一块脚本片段,利用备份集合和归档日志,恢复数据到虚拟实例上。
contents of Memory Script:
{
# set requested point in time
set until? time "to_date('2015-06-18 10:51:19','yyyy-mm-dd hh24:mi:ss')";
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log?
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 18-JUN-15
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/fast_recovery_area/ORA11G/