使用RMAN增量备份来更新传输表空间(2)

Grant succeeded.
'
SQL> create public database link dblink_jytest
2 connect to jytest identified by "jytest"
3 using '(DESCRIPTION =
4 (ADDRESS = (PROTOCOL = TCP)(HOST = 10.138.130.28)(PORT = 1521))
5 (CONNECT_DATA =
6 (SERVICE_NAME = jytest)
7 )
8 )';

Database link created.
SQL> select count(*) from t1@dblink_jytest;

COUNT(*)
----------
12856
[oracle@weblogic29 jytest]$ impdp jytest/jytest directory=test_dump network_link=dblink_jytest transport_tablespaces=jytest transport_full_check=n transport_datafiles=\'/u01/app/oracle/oradata/jytest/jytest01.dbf\'

Import: Release 10.2.0.5.0 - 64bit Production on Wednesday, 13 April, 2016 14:47:43

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "JYTEST"."SYS_IMPORT_TRANSPORTABLE_01": jytest/******** directory=test_dump network_link=dblink_jytest transport_tablespaces=jytest transport_full_check=n transport_datafiles='/u01/app/oracle/oradata/jytest/jytest01.dbf'
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "JYTEST"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 14:47:48
SQL> show parameter compatible

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
compatible string 10.2.0.3.0
SQL> select count(*) from jytest.t1;

COUNT(*)
----------
12856


6.将表空间jytest从目标数据库中删除,但保留数据文件
SQL> drop tablespace jytest including contents;

Tablespace dropped.


7.将原数据库中的表空间jytest联机,继续向表t1插入记录
SQL> alter tablespace jytest read write;

Tablespace altered.
SQL> insert into t1 select * from t1;
insert into t1 select * from t1
*
ERROR at line 1:
ORA-01653: unable to extend table JYTEST.T1 by 128 in tablespace JYTEST


由于表空间jytest没有空间了,如是向表这僮jytest增加一个数据文件jytest02.dbf来增加表空间
SQL> alter tablespace jytest add datafile '/u01/app/oracle/oradata/jytest/jytest02.dbf' size 5M;

Tablespace altered.

SQL> insert into t1 select * from t1;

12856 rows created.

SQL> commit;

Commit complete.

SQL> select count(*) from t1;

COUNT(*)
----------
25712


8.如果自上次增量备份以后原数据库表空间jytest增加了新的数据文件,因此执行以下命令来为新增加的数据文件创建镜像副本。
SQL> alter tablespace jytest read only;

Tablespace altered.
SQL> select file#,name from v$datafile;

FILE# NAME
---------- -------------------------------------------------------------------------
1 /u01/app/oracle/oradata/jytest/system01.dbf
2 /u01/app/oracle/oradata/jytest/undotbs01.dbf
3 /u01/app/oracle/oradata/jytest/sysaux01.dbf
4 /u01/app/oracle/oradata/jytest/users01.dbf
5 /u01/app/oracle/oradata/jytest/example01.dbf
6 /u01/app/oracle/oradata/jytest/tspitr01.dbf
7 /u01/app/oracle/oradata/jytest/test01.dbf
8 /u01/app/oracle/oradata/jytest/jytest01.dbf
9 /u01/app/oracle/oradata/jytest/jytest02.dbf

9 rows selected.
RMAN> run
2> {
3> allocate channel c1 type disk format '/jytest_data/jytest02.dbf';
4> backup incremental level 1 tag "INCR_JYTEST" for recover of copy with tag "INCR_JYTEST" datafile 9;
5> }

allocated channel: c1
channel c1: sid=141 devtype=DISK

Starting backup at 13-APR-16
WARNING: TAG INCR_JYTEST option is ignored; backups will be tagged with INCR_JYTEST
no parent backup or copy of datafile 9 found
channel c1: starting datafile copy
input datafile fno=00009 name=/u01/app/oracle/oradata/jytest/jytest02.dbf
output filename=/jytest_data/jytest02.dbf tag=INCR_JYTEST recid=4 stamp=909069392
channel c1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 13-APR-16
released channel: c1


9.对原数据库执行RMAN增量备份并使用目标数据库文件目录中的数据文件与其合并,因些创建一组
 新的数据文件
RMAN> run
2> {
3> allocate channel c1 type disk format '/jytest_data/jytest01_%t.dbf';
4> allocate channel c2 type disk format '/jytest_data/jytest02_%t.dbf';
5> backup incremental level 1 tag "INCR_JYTEST" for recover of copy with tag "INCR_JYTEST" tablespace jytest;
6> recover copy of tablespace jytest with tag "INCR_JYTEST";
7> }

allocated channel: c1
channel c1: sid=141 devtype=DISK

allocated channel: c2
channel c2: sid=139 devtype=DISK

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/eff86780a02c35749be7955f97528067.html