使用用户自定义的辅助实例执行基于表空间的时间点恢复

   关于表空间的时间点恢复的限制条件可查阅oracle官方文档,这里直接给出“使用用户自定义的辅助实例执行基于表空间的时间点恢复”的步骤。


1 创建表空间及相关用户


[oracle@dest backup]$ sqlplus  / as sysdba


SQL*Plus: Release 11.2.0.2.0 Production on Thu Feb 13 11:55:08 2014


Copyright (c) 1982, 2010, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select tablespace_name from dba_tablespaces;


TABLESPACE_NAME

------------------------------

SYSTEM

SYSAUX

UNDOTBS1

TEMP

USERS

USER01

ERP

TEST


8 rows selected.


SQL> create tablespace crm datafile '/oracle/CRM/crm.dbf' size 10m;


Tablespace created.


SQL> create tablespace jxc datafile '/oracle/CRM/jxc.dbf' size 10m;


Tablespace created.


SQL> create user jiujian identified by dhhzdhhz default tablespace crm;


User created.


SQL> create user zx identified by dhhzdhhz default tablespace jxc;


User created.


SQL> grant resource,connect to jiujian;


Grant succeeded.


SQL> grant resource,connect to zx;


Grant succeeded.


SQL> select tablespace_name,status from dba_tablespaces;


TABLESPACE_NAME                STATUS

------------------------------ ---------

SYSTEM                         ONLINE

SYSAUX                         ONLINE

UNDOTBS1                       ONLINE

TEMP                           ONLINE

USERS                          ONLINE

JXC                            ONLINE

USER01                         ONLINE

ERP                            ONLINE

CRM                            ONLINE

TEST                           ONLINE


10 rows selected.


SQL> select username from dba_users where default_tablespace='CRM';


USERNAME

------------------------------

JIUJIAN


SQL> select username from dba_users where default_tablespace='JXC';


USERNAME

------------------------------

ZX




SQL> select group#,archived,sequence#,status from v$log;


   GROUP# ARC  SEQUENCE# STATUS

---------- --- ---------- ----------------

        1 YES         16 INACTIVE

        2 YES         17 INACTIVE

        3 NO          18 CURRENT


SQL> alter system switch logfile;


System altered.


SQL> /


System altered.


SQL> /


System altered.


SQL> /


System altered.


SQL> /


System altered.


SQL> /


System altered.


SQL> alter system checkpoint;


System altered.


SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


2 备份当前数据库


[oracle@dest backup]$ rman target /


Recovery Manager: Release 11.2.0.2.0 - Production on Thu Feb 13 11:59:08 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: CRM (DBID=3641885733)


RMAN> run{

2> delete noprompt obsolete;

3> crosscheck backup;

4> delete noprompt expired backup;

5> crosscheck archivelog all;

6> delete noprompt expired archivelog all;

7> backup incremental level=0  database format '/backup/crm/full-%T-%U.bak';

8> backup archivelog all  format '/backup/crm/arch-%T-%U.bak';

9> backup current controlfile format '/backup/crm/ctl-%T-%U.bak';

10> backup spfile format '/backup/crm/spf-%T-%U.bak';

11> delete noprompt archivelog all completed before 'SYSDATE - 7';

12> }

...........................备份过程略 ....................................


[oracle@dest backup]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.2.0 Production on Thu Feb 13 12:13:32 2014


Copyright (c) 1982, 2010, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> alter system switch logfile;


System altered.


SQL> /


System altered.


SQL> /


System altered.


SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@dest backup]$

[oracle@dest backup]$

[oracle@dest backup]$


3 在表空间crm和jxc上创建测试用的表数据


[oracle@dest backup]$ sqlplus jiujian/dhhzdhhz


SQL*Plus: Release 11.2.0.2.0 Production on Thu Feb 13 12:14:01 2014


Copyright (c) 1982, 2010, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> show user;

USER is "JIUJIAN"

SQL> create table t_jiujian(i int);


Table created.


SQL> begin

 2  for i in 1..20 loop

 3  insert into t_jiujian values(i);

 4  end loop;

 5  commit;

 6  end;

 7  /


PL/SQL procedure successfully completed.


SQL> select count(*) from t_jiujian;


 COUNT(*)

----------

       20


SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@dest backup]$ sqlplus zx/dhhzdhhz


SQL*Plus: Release 11.2.0.2.0 Production on Thu Feb 13 12:15:41 2014


Copyright (c) 1982, 2010, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> show user;

USER is "ZX"

SQL> create table t_zx(i int);


Table created.


SQL> begin

 2  for i in 1..20 loop

 3  insert into t_zx values(i);

 4  end loop;

 5  commit;

 6  end;

 7  /


PL/SQL procedure successfully completed.


SQL> select count(*) from t_zx;


 COUNT(*)

----------

       20



SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@dest backup]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.2.0 Production on Thu Feb 13 12:18:03 2014


Copyright (c) 1982, 2010, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


4 查询数据库当前的时间点


SQL> select current_scn,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from v$database;


CURRENT_SCN TO_CHAR(SYSDATE,'YY

----------- -------------------

   3966583 2014-02-13 12:18:14


5 删除测试表空间crm上的表t_jiujian


SQL> select count(*) from jiujian.t_jiujian;


 COUNT(*)

----------

       20


SQL> alter system switch logfile;


System altered.


SQL> /


System altered.


SQL> select count(*) from jiujian.t_jiujian;


SQL> drop table jiujian.t_jiujian;


Table dropped.


SQL> commit;


Commit complete.


SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


注意:这里为了验证表空间时间点恢复只会回退要操作的表空间。所以在删除crm 表空间上的表数据后,给jxc表空间再添加一些数据,待回退crm表空间后,恢复该表空间上删除的表数据。如果jxc表空间上的表数据没丢失的话,则验证了表空间时间点恢复只会回退要操作的表空间。


[oracle@dest backup]$ sqlplus zx/dhhzdhhz


SQL*Plus: Release 11.2.0.2.0 Production on Thu Feb 13 12:20:13 2014


Copyright (c) 1982, 2010, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> begin

 2  for i in 21..40 loop

 3  insert into t_zx values(i);

 4  end loop;

 5  commit;

 6  end;

 7  /


PL/SQL procedure successfully completed.


SQL> select count(*) from t_zx;


 COUNT(*)

----------

       40


---------前面折腾这么长篇幅仅仅是为了创建测试数据-------------------------------


6 创建辅助实例的初始化参数文件


[oracle@source /]$ cd $ORACLE_HOME/dbs

[oracle@source dbs]$ cp initCRM.ora initAUX.ora

更改 initAUX.ora内容如下

[oracle@source dbs]$ cat initAUX.ora

*.compatible='11.2.0.0.0'

*.control_files='/backup/control04.ctl'

*.db_block_size=8192

*.db_name=CRM

*.db_unique_name=_CRM

*.db_file_name_convert=('/oracle/CRM/CRM/','/backup/')

*.log_file_name_convert=('/oracle/CRM/CRM/','/backup/')

*.remote_login_passwordfile='EXCLUSIVE'

参数介绍如下:

db_name:属于必须有的参数,该值须和目标数据库配置一样。

db_unique_name:属于必须有的参数,一般该值指定为_dbname即可。

compatible:属于必须有的参数,该值需和目标库一致。

db_block_size:属于必须有的参数,该值需和目标数据库一致。

remote_login_passwordfile:属于必须有的参数,当用一个密码文件连接辅助实例时,该值必须设置成EXCLUSIVE,其它为NONE。

control_files:属于非必须参数,该值指定文件名只要不和目标数据库或者其它任意文件名冲突即可。

db_file_name_convert:属于非必须参数,通过指定该值自动转换路径生成辅助实例所需的数据文件。

log_file_name_convert:属于非必须参数,该值基于目标数据库的日志文件名,转换路径后生成辅助实例的联机日志文件。


7 创建辅助实例的密码文件


[oracle@dest CRM]$ cd /ORACLE_HOME/dbs

[oracle@dest dbs]$ ls

01om0ebc_1_1  hc_CRM.dat    initAUX.ora  lkDCTA_TSPITR_CRM  spfileCRM.ora

06om0ek7_1_1  hc_DBUA0.dat  initCRM.ora  orapwCRM

hc_AUX.dat    hc_DctA.dat   lkCRM        snapcf_CRM.f

[oracle@dest dbs]$ cp orapwCRM orapwAUX


8 创建连接辅助数据库的服务名


[oracle@source admin]$ cat tnsnames.ora

# tnsnames.ora Network Configuration File: /oracle/app/db1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.


AUX =

 (DESCRIPTION =

   (ADDRESS_LIST =

     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.8)(PORT = 1521))

   )

   (CONNECT_DATA =

     (SID = AUX)

   )

 )


9 创建并启动辅助实例的监听服务


[oracle@source admin]$ cat listener.ora

# listener.ora Network Configuration File: /oracle/app/db1/network/admin/listener.ora

# Generated by Oracle configuration tools.


SID_LIST_AUX =

 (SID_LIST =

   (SID_DESC =

     (GLOBAL_DBNAME = AUX)

     (ORACLE_HOME = /oracle/app/db1)

     (SID_NAME = AUX)

   )

 )


ADR_BASE_AUX = /oracle/app


AUX =

 (DESCRIPTION =

   (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.10)(PORT = 1521))

 )



oracle@dest admin]$ lsnrctl


LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 13-FEB-2014 12:55:21


Copyright (c) 1991, 2010, Oracle.  All rights reserved.


Welcome to LSNRCTL, type "help" for information.


LSNRCTL> start aux

Starting /oracle/app/db1/bin/tnslsnr: please wait...


TNSLSNR for Linux: Version 11.2.0.2.0 - Production

System parameter file is /oracle/app/db1/network/admin/listener.ora

Log messages written to /oracle/app/diag/tnslsnr/dest/aux/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.5.10)(PORT=1521)))


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.5.10)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     aux

Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production

Start Date                13-FEB-2014 12:55:25

Uptime                    0 days 0 hr. 0 min. 1 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oracle/app/db1/network/admin/listener.ora

Listener Log File         /oracle/app/diag/tnslsnr/dest/aux/alert/log.xml

Listening Endpoints Summary...

 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.5.10)(PORT=1521)))

Services Summary...

Service "AUX" has 1 instance(s).

 Instance "AUX", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

LSNRCTL> exit



10 启动辅助数据库到nomount 状态


[oracle@source admin]$ export ORACLE_SID=AUX

[oracle@source admin]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.2.0 Production on Fri Nov 8 23:19:07 2013


Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup nomount;

ORACLE instance started.


Total System Global Area  217157632 bytes

Fixed Size                  2225064 bytes

Variable Size             159386712 bytes

Database Buffers           50331648 bytes

Redo Buffers                5214208 bytes

SQL> show parameter control_files;


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

control_files                        string      /backup/control03.ctl

SQL> show parameter instance_name;


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

instance_name                        string      AUX


11 连接目标数据库和辅助数据库


[oracle@source admin]$ export ORACLE_SID=CRM

[oracle@source admin]$ rman target / auxiliary sys/dhhzdhhz@aux


Recovery Manager: Release 11.2.0.2.0 - Production on Thu Nov 28 06:46:58 2013


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: CRM (DBID=3599153036)

connected to auxiliary database: CRM (not mounted)


12 开始表空间的时间点恢复


Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@dest dbs]$ rman target /  auxiliary sys/dhhzdhhz@aux


Recovery Manager: Release 11.2.0.2.0 - Production on Thu Feb 13 13:39:51 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: CRM (DBID=3641885733)

connected to auxiliary database: CRM (not mounted)


RMAN> run{

2> set newname for tablespace crm to '/oracle/CRM/CRM/%b';

3> allocate auxiliary channel c1 device type disk;

4> recover tablespace crm until time "to_date('2014-02-13 12:18:14','yyyy-mm-dd hh24:mi:ss')" ;

5> }

注意 1 通过用户定义的辅助实例在执行时需要至少分配一个 auxiliary 通道

    2 %b 表示从表空间数据文件全路径中截取表空间的数据文件名

executing command: SET NEWNAME


using target database control file instead of recovery catalog

allocated channel: c1

channel c1: SID=135 device type=DISK


Starting recover at 2014-02-13 13:42:23

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

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('2014-02-13 12:18:14','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 2014-02-13 13:42:32


channel c1: starting datafile backup set restore

channel c1: restoring control file

channel c1: reading from backup piece /backup/crm/ctl-20140213-2cp0h1fh_1_1.bak

channel c1: piece handle=/backup/crm/ctl-20140213-2cp0h1fh_1_1.bak tag=TAG20140213T120257

channel c1: restored backup piece 1

channel c1: restore complete, elapsed time: 00:00:01

output file name=/backup/control04.ctl

Finished restore at 2014-02-13 13:42:34


sql statement: alter database mount clone database


sql statement: alter system archive log current


sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;


contents of Memory Script:

{

# set requested point in time

set until  time "to_date('2014-02-13 12:18:14','yyyy-mm-dd hh24:mi:ss')";

plsql <<<-- tspitr_2

declare

 sqlstatement       varchar2(512);

 offline_not_needed exception;

 pragma exception_init(offline_not_needed, -01539);

begin

 sqlstatement := 'alter tablespace '||  'CRM' ||' offline immediate';

 krmicd.writeMsg(6162, sqlstatement);

 krmicd.execSql(sqlstatement);

exception

 when offline_not_needed then

   null;

end; >>>;

# set destinations for recovery set and auxiliary set datafiles

set newname for datafile  1 to

"/backup/system01.dbf";

set newname for datafile  3 to

"/backup/undotbs01.dbf";

set newname for datafile  2 to

"/backup/sysaux01.dbf";

set newname for tempfile  1 to

"/backup/temp01.dbf";

set newname for datafile  5 to

"/oracle/CRM/CRM/crm.dbf";

# switch all tempfiles

switch clone tempfile all;

# restore the tablespaces in the recovery set and the auxiliary set

restore clone datafile  1, 3, 2, 5;

switch clone datafile all;

}

executing Memory Script


executing command: SET until clause


sql statement: alter tablespace CRM offline immediate


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME



Starting restore at 2014-02-13 13:42:41


channel c1: starting datafile backup set restore

channel c1: specifying datafile(s) to restore from backup set

channel c1: restoring datafile 00001 to /backup/system01.dbf

channel c1: restoring datafile 00003 to /backup/undotbs01.dbf

channel c1: restoring datafile 00002 to /backup/sysaux01.dbf

channel c1: restoring datafile 00005 to /oracle/CRM/CRM/crm.dbf

channel c1: reading from backup piece /backup/crm/full-20140213-20p0h19e_1_1.bak

channel c1: piece handle=/backup/crm/full-20140213-20p0h19e_1_1.bak tag=TAG20140213T115941

channel c1: restored backup piece 1

channel c1: restore complete, elapsed time: 00:01:15

Finished restore at 2014-02-13 13:43:58


datafile 5 switched to datafile copy

input datafile copy RECID=2 STAMP=839425439 file name=/oracle/CRM/CRM/crm.dbf


contents of Memory Script:

{

# set requested point in time

set until  time "to_date('2014-02-13 12:18:14','yyyy-mm-dd hh24:mi:ss')";

# online the datafiles restored or switched

sql clone "alter database datafile  1 online";

sql clone "alter database datafile  3 online";

sql clone "alter database datafile  2 online";

sql clone "alter database datafile  5 online";

# recover and open resetlogs

recover clone database tablespace  "CRM", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;

alter clone database open resetlogs;

}

executing Memory Script


executing command: SET until clause


sql statement: alter database datafile  1 online


sql statement: alter database datafile  3 online


sql statement: alter database datafile  2 online


sql statement: alter database datafile  5 online


Starting recover at 2014-02-13 13:44:00


starting media recovery


archived log for thread 1 with sequence 24 is already on disk as file /oracle/archivelog/arch_1_24_839098938.arch

archived log for thread 1 with sequence 25 is already on disk as file /oracle/archivelog/arch_1_25_839098938.arch

archived log for thread 1 with sequence 26 is already on disk as file /oracle/archivelog/arch_1_26_839098938.arch

archived log for thread 1 with sequence 27 is already on disk as file /oracle/archivelog/arch_1_27_839098938.arch

archived log for thread 1 with sequence 28 is already on disk as file /oracle/archivelog/arch_1_28_839098938.arch

archived log file name=/oracle/archivelog/arch_1_24_839098938.arch thread=1 sequence=24

archived log file name=/oracle/archivelog/arch_1_25_839098938.arch thread=1 sequence=25

archived log file name=/oracle/archivelog/arch_1_26_839098938.arch thread=1 sequence=26

archived log file name=/oracle/archivelog/arch_1_27_839098938.arch thread=1 sequence=27

archived log file name=/oracle/archivelog/arch_1_28_839098938.arch thread=1 sequence=28

media recovery complete, elapsed time: 00:00:03

Finished recover at 2014-02-13 13:44:09


database opened


contents of Memory Script:

{

# make read only the tablespace that will be exported

sql clone 'alter tablespace  CRM read only';

# create directory for datapump import

sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''

/oracle/app/db1/dbs''";

# create directory for datapump export

sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''

/oracle/app/db1/dbs''";

}

executing Memory Script


sql statement: alter tablespace  CRM read only


sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/oracle/app/db1/dbs''


sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/oracle/app/db1/dbs''


Performing export of metadata...

  EXPDP> Starting "SYS"."TSPITR_EXP_Asqx":  

  EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK

  EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE

  EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

  EXPDP> Master table "SYS"."TSPITR_EXP_Asqx" successfully loaded/unloaded

  EXPDP> ******************************************************************************

  EXPDP> Dump file set for SYS.TSPITR_EXP_Asqx is:

  EXPDP>   /oracle/app/db1/dbs/tspitr_Asqx_78684.dmp

  EXPDP> ******************************************************************************

  EXPDP> Datafiles required for transportable tablespace CRM:

  EXPDP>   /oracle/CRM/CRM/crm.dbf

  EXPDP> Job "SYS"."TSPITR_EXP_Asqx" successfully completed at 13:46:25

Export completed



contents of Memory Script:

{

# shutdown clone before import

shutdown clone immediate

# drop target tablespaces before importing them back

sql 'drop tablespace  CRM including contents keep datafiles';

}

executing Memory Script


database closed

database dismounted

Oracle instance shut down


sql statement: drop tablespace  CRM including contents keep datafiles


Performing import of metadata...

  IMPDP> Master table "SYS"."TSPITR_IMP_Asqx" successfully loaded/unloaded

  IMPDP> Starting "SYS"."TSPITR_IMP_Asqx":  

  IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK

  IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE

  IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

  IMPDP> Job "SYS"."TSPITR_IMP_Asqx" successfully completed at 13:47:38

Import completed



contents of Memory Script:

{

# make read write and offline the imported tablespaces

sql 'alter tablespace  CRM read write';

sql 'alter tablespace  CRM offline';

# enable autobackups after TSPITR is finished

sql 'begin dbms_backup_restore.AutoBackupFlag(TRUE); end;';

}

executing Memory Script


sql statement: alter tablespace  CRM read write


sql statement: alter tablespace  CRM offline


sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end;

auxiliary instance file /backup/temp01.dbf deleted

auxiliary instance file /backup/redo03.log deleted

auxiliary instance file /backup/redo02.log deleted

auxiliary instance file /backup/redo01.log deleted

auxiliary instance file /backup/sysaux01.dbf deleted

auxiliary instance file /backup/undotbs01.dbf deleted

auxiliary instance file /backup/system01.dbf deleted

auxiliary instance file /backup/control04.ctl deleted

Finished recover at 2014-02-13 13:47:56


RMAN> exit


这里需要注意如果基于表空间的时间点恢复执行成功则

a 由SET NEWNAME 指定恢复文件新路径在目标数据库控制文件中重新注册

b 辅助集控制文件,日志文件,数据文件被删除

c 辅助集实例shutdown  


13 验证数据



SQL> select tablespace_name,status from dba_tablespaces;


TABLESPACE_NAME                STATUS

------------------------------ ---------

SYSTEM                         ONLINE

SYSAUX                         ONLINE

TEMP                           ONLINE

USERS                          ONLINE

JXC                            ONLINE

POS                            ONLINE

USER01                         ONLINE

ERP                            ONLINE

UNDOTBS3                       ONLINE

ZX                             ONLINE

CRM                            OFFLINE


11 rows selected.


SQL> alter tablespace crm online;


Tablespace altered.



SQL> select count(*) from jiujian.t_jiujian;


 COUNT(*)

----------

       20


SQL> select count(*) from zx.t_zx;


 COUNT(*)

----------

       40


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值