RMAN使用备份按时间点传输表空间(12)

archive log thread 1 sequence 80 is already on disk as file /u02/1_80_870806981.dbf
archive log thread 1 sequence 81 is already on disk as file /u02/1_81_870806981.dbf
archive log thread 1 sequence 82 is already on disk as file /u02/1_82_870806981.dbf
archive log thread 1 sequence 83 is already on disk as file /u02/1_83_870806981.dbf
archive log filename=/u02/1_80_870806981.dbf thread=1 sequence=80
archive log filename=/u02/1_81_870806981.dbf thread=1 sequence=81
archive log filename=/u02/1_82_870806981.dbf thread=1 sequence=82
archive log filename=/u02/1_83_870806981.dbf thread=1 sequence=83
media recovery complete, elapsed time: 00:00:07
Finished recover at 27-MAR-15

database opened

contents of Memory Script:
{
#mark read only the tablespace that will be exported
sql clone "alter tablespace TSPITR read only";
#mark read only the tablespace that will be exported
sql clone "alter tablespace TEST read only";
# create directory for datapump export
sql clone "create or replace directory STREAMS_DIROBJ_DPDIR as ''
/u02/transport''";
# export the tablespaces in the recovery set
host 'expdp userid=\"/@\(DESCRIPTION=\(ADDRESS=\(PROTOCOL=beq\)\(PROGRAM=/u01/app/oracle/10.2.0/db/bin/oracle\)\(ARGV0=oraclewkgj\)\(ARGS=^'\(DESCRIPTION=\(LOCAL=YES\)\(ADDRESS=\(PROTOCOL=beq\)\)\)^'\)\(ENVS=^'ORACLE_SID=wkgj^'\)\)\(CONNECT_DATA=\(SID=wkgj\)\)\) as sysdba\" transport_tablespaces=
 TSPITR,
 TEST dumpfile=
dmpfile.dmp directory=
STREAMS_DIROBJ_DPDIR logfile=
explog.log';
}
executing Memory Script

sql statement: alter tablespace TSPITR read only

sql statement: alter tablespace TEST read only

sql statement: create or replace directory STREAMS_DIROBJ_DPDIR as ''/u02/transport''


Export: Release 10.2.0.5.0 - Production on Friday, 27 March, 2015 20:22:11

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

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TRANSPORTABLE_01":  userid="/********@(DESCRIPTION=(ADDRESS=(PROTOCOL=beq)(PROGRAM=/u01/app/oracle/10.2.0/db/bin/oracle)(ARGV0=oraclewkgj)(ARGS=\(DESCRIPTION=\(LOCAL=YES\)\(ADDRESS=\(PROTOCOL=beq\)\)\))(ENVS=ORACLE_SID=wkgj))(CONNECT_DATA=(SID=wkgj))) AS SYSDBA" transport_tablespaces= TSPITR, TEST dumpfile=dmpfile.dmp directory=STREAMS_DIROBJ_DPDIR logfile=explog.log
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is:
  /u02/transport/dmpfile.dmp
Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 20:23:07

host command complete
/*
  The following command may be used to import the tablespaces.
  Substitute values for  and .
  impdp  directory= dumpfile= 'dmpfile.dmp' transport_datafiles= /u02/transport/tspitr01.dbf, /u02/transport/test01.dbf
*/
--------------------------------------------------------------
-- Start of sample PL/SQL script for importing the tablespaces
--------------------------------------------------------------
-- creating directory objects
CREATE DIRECTORY STREAMS$DIROBJ$1 AS  '/u02/transport/';
CREATE DIRECTORY STREAMS$DIROBJ$DPDIR AS  '/u02/transport';
/* PL/SQL Script to import the exported tablespaces */
DECLARE
  -- the datafiles
  tbs_files    dbms_streams_tablespace_adm.file_set;
  cvt_files    dbms_streams_tablespace_adm.file_set;
  -- the dumpfile to import
  dump_file    dbms_streams_tablespace_adm.file;
  dp_job_name  VARCHAR2(30) := NULL;
  -- names of tablespaces that were imported
  ts_names      dbms_streams_tablespace_adm.tablespace_set;
BEGIN
  -- dump file name and location
  dump_file.file_name :=  'dmpfile.dmp';
  dump_file.directory_object := 'STREAMS$DIROBJ$DPDIR';
  -- forming list of datafiles for import
  tbs_files( 1).file_name :=  'tspitr01.dbf';
  tbs_files( 1).directory_object :=  'STREAMS$DIROBJ$1';
  tbs_files( 2).file_name :=  'test01.dbf';
  tbs_files( 2).directory_object :=  'STREAMS$DIROBJ$1';
  -- import tablespaces
  dbms_streams_tablespace_adm.attach_tablespaces(
    datapump_job_name      => dp_job_name,
    dump_file              => dump_file,
    tablespace_files      => tbs_files,
    converted_files        => cvt_files,
    tablespace_names      => ts_names);
  -- output names of imported tablespaces
  IF ts_names IS NOT NULL AND ts_names.first IS NOT NULL THEN
    FOR i IN ts_names.first .. ts_names.last LOOP
      dbms_output.put_line('imported tablespace '|| ts_names(i));
    END LOOP;
  END IF;
END;
/
-- dropping directory objects
DROP DIRECTORY STREAMS$DIROBJ$1;
DROP DIRECTORY STREAMS$DIROBJ$DPDIR;
--------------------------------------------------------------
-- End of sample PL/SQL script
--------------------------------------------------------------

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

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