表空间迁移(三)

 开始导入

8.1  生成parfile文件

文件内容如下:

 

[root@rhel6_lhr dpdump]# vi par.f

[root@rhel6_lhr dpdump]# more par.f

DUMPFILE=EXPDAT.DMP

DIRECTORY=DATA_PUMP_DIR

TRANSPORT_DATAFILES=

/u01/app/oracle/admin/orclasm/dpdump/APP1TBS.DBF,

/u01/app/oracle/admin/orclasm/dpdump/APP2TBS.DBF,

/u01/app/oracle/admin/orclasm/dpdump/IDXTBS.DBF

LOGFILE=tts_import.log

[root@rhel6_lhr dpdump]#

 

 

8.2  开始导入

[oracle@rhel6 ~]$ impdp system/lhr parfile='/u01/app/oracle/admin/orclasm/dpdump/par.f'

 

Import: Release 11.2.0.1.0 - Production on Tue Jan 6 00:52:36 2015

 

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

 

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded

Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":  system/******** parfile=/u01/app/oracle/admin/orclasm/dpdump/par.f

Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK

Processing object type TRANSPORTABLE_EXPORT/TABLE

Processing object type TRANSPORTABLE_EXPORT/INDEX

Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS

Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 00:52:57

 

[oracle@rhel6 ~]$

 

8.3  查看目标平台信息

 

[oracle@rhel6 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 6 00:53:46 2015

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SQL> select tablespace_name,status from dba_tablespaces;

 

TABLESPACE_NAME        STATUS

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

SYSTEM        ONLINE

SYSAUX        ONLINE

UNDOTBS1        ONLINE

TEMP        ONLINE

USERS        ONLINE

APP1TBS 

APP2TBS 

IDXTBS

 

8 rows selected.

 

SQL>

已选择-80            800                    20

      7499 ALLEN      SALESMAN        7698 20-2月 -81           1250        500         30

      7566 JONES      MANAGER         7839 02-4月 -81           1250       1400         30

      7698 BLAKE      MANAGER         7839 01-5月 -81           2450                    10

      7788 SCOTT      ANALYST         7566 19-4月 -81           5000                    10

      7844 TURNER     SALESMAN        7698 08-9月 -87           1100                    20

      7900 JAMES      CLERK           7698 03-12月-81           3000                    20

      7934 MILLER     CLERK           7782 23-1月 16行。

 

SQL> select * from scott.app2_tab;

 

    DEPTNO DNAME          LOC

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

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 SALES          CHICAGO

        40 OPERATIONS     BOSTON

 

SQL> select D.owner,D.index_name,D.table_name,D.tablespace_name from dba_indexes d WHERE d.table_name in ('APP1_TAB','APP2_TAB');

 

OWNER                          INDEX_NAME                     TABLE_NAME                     TABLESPACE_NAME

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

SCOTT                            IDX_EMP_ENAME                  APP1_TAB                       IDXTBS

SCOTT                           IDX_DEPT_DNAME                 APP2_TAB                       IDXTBS

 

SQL> SELECT   a.NAME,  b.NAME FROM v$tablespace a , v$datafile b WHERE a.TS#=b.TS#  ;

 

NAME        NAME

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

SYSTEM        +DATA/orclasm/datafile/system.256.868235071

SYSAUX        +DATA/orclasm/datafile/sysaux.257.868235073

UNDOTBS1        +DATA/orclasm/datafile/undotbs1.258.868235073

USERS        +DATA/orclasm/datafile/users.259.868235073

APP1TBS 

APP2TBS 

IDXTBS

 

7 rows selected.

 

SQL>

 

 

 修改表空间对应的文件名

 

执行如下脚本:

SQL> archive log list;

Database log mode        No Archive Mode

Automatic archival        Disabled

Archive destination        /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch

Oldest online log sequence     3

Current log sequence        5

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area  626327552 bytes

Fixed Size     2215944 bytes

Variable Size   398462968 bytes

Database Buffers   218103808 bytes

Redo Buffers     7544832 bytes

Database mounted.

 

rman convert修改:

 

[oracle@rhel6 ~]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jan 6 01:02:30 2015

 

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

 

connected to target database: ORCLASM (DBID=3442859793, not open)

 

RMAN> report schema;

 

using target database control file instead of recovery catalog

Report of database schema for database with db_unique_name ORCLASM

 

List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

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

1    680      SYSTEM               ***     +DATA/orclasm/datafile/system.256.868235071

2    480      SYSAUX               ***     +DATA/orclasm/datafile/sysaux.257.868235073

3    75       UNDOTBS1             ***     +DATA/orclasm/datafile/undotbs1.258.868235073

4    5        USERS                ***     +DATA/orclasm/datafile/users.259.868235073

5    10       APP1TBS              ***     /u01/app/oracle/admin/orclasm/dpdump/APP1TBS.DBF

6    10       APP2TBS              ***     /u01/app/oracle/admin/orclasm/dpdump/APP2TBS.DBF

7    10       IDXTBS               ***     /u01/app/oracle/admin/orclasm/dpdump/IDXTBS.DBF

 

List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

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

1    29       TEMP                 32767       +DATA/orclasm/tempfile/temp.264.868235253

 

RMAN>  backup as copy datafile 5 format '+DATA';

 

Starting backup at 06-JAN-15

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=247 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00005 name=/u01/app/oracle/admin/orclasm/dpdump/APP1TBS.DBF

output file name=+DATA/orclasm/datafile/app1tbs.266.868237521 tag=TAG20150106T010520 RECID=1 STAMP=868237522

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

Finished backup at 06-JAN-15

 

RMAN>  backup as copy datafile 6 format '+DATA';

 

Starting backup at 06-JAN-15

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00006 name=/u01/app/oracle/admin/orclasm/dpdump/APP2TBS.DBF

output file name=+DATA/orclasm/datafile/app2tbs.267.868237551 tag=TAG20150106T010550 RECID=2 STAMP=868237551

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 06-JAN-15

 

RMAN>  backup as copy datafile 7 format '+DATA';

 

Starting backup at 06-JAN-15

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00007 name=/u01/app/oracle/admin/orclasm/dpdump/IDXTBS.DBF

output file name=+DATA/orclasm/datafile/idxtbs.268.868237557 tag=TAG20150106T010556 RECID=3 STAMP=868237557

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 06-JAN-15

 

RMAN> SWITCH TABLESPACE APP1TBS TO COPY;

 

datafile 5 switched to datafile copy "+DATA/orclasm/datafile/app1tbs.266.868237521"

 

RMAN> SWITCH TABLESPACE APP2TBS TO COPY;

 

datafile 6 switched to datafile copy "+DATA/orclasm/datafile/app2tbs.267.868237551"

 

RMAN> SWITCH TABLESPACE IDXTBS TO COPY;

 

datafile 7 switched to datafile copy "+DATA/orclasm/datafile/idxtbs.268.868237557"

 

RMAN> ALTER DATABASE OPEN;

 

database opened

 

RMAN>

 

查看结果:

RMAN> report schema;

 

Report of database schema for database with db_unique_name ORCLASM

 

List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

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

1    680      SYSTEM               ***     +DATA/orclasm/datafile/system.256.868235071

2    480      SYSAUX               ***     +DATA/orclasm/datafile/sysaux.257.868235073

3    75       UNDOTBS1             ***     +DATA/orclasm/datafile/undotbs1.258.868235073

4    5        USERS                ***     +DATA/orclasm/datafile/users.259.868235073

5    10       APP1TBS              ***     +DATA/orclasm/datafile/app1tbs.266.868237521

6    10       APP2TBS              ***     +DATA/orclasm/datafile/app2tbs.267.868237551

7    10       IDXTBS               ***     +DATA/orclasm/datafile/idxtbs.268.868237557

 

List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

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

1    29       TEMP                 32767       +DATA/orclasm/tempfile/temp.264.868235253

 

RMAN>

 

 

 

SQL> SELECT  a.NAME,  b.NAME FROM v$tablespace a , v$datafile b WHERE a.TS#=b.TS#;

 

NAME        NAME

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

SYSTEM        +DATA/orclasm/datafile/system.256.868235071

SYSAUX        +DATA/orclasm/datafile/sysaux.257.868235073

UNDOTBS1        +DATA/orclasm/datafile/undotbs1.258.868235073

USERS        +DATA/orclasm/datafile/users.259.868235073

APP1TBS 

APP2TBS 

IDXTBS

 

7 rows selected.

 

SQL>

已选择9行。

 

SQL>  set line 9999 pagesize 9999

SQL> select * from scott.app1_tab;

 

     EMPNO ENAME      JOB              MGR HIREDATE              SAL       COMM     DEPTNO

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

      9000 lastwiner

      9001 lastwiner

      7369 SMITH      CLERK           7902 17-12月-81           1600        300         30

      7521 WARD       SALESMAN        7698 22-2月 -81           2975                    20

      7654 MARTIN     SALESMAN        7698 28-9月 -81           2850                    30

      7782 CLARK      MANAGER         7839 09-6月 -87           3000                    20

      7839 KING       PRESIDENT            17-11月-81           1500          0         30

      7876 ADAMS      CLERK           7788 23-5月 -81            950                    30

      7902 FORD       ANALYST         7566 03-12月-82           1300                    10

 

已选择<font lucida"="" console?="" style="word-wrap: break-word;">16行。

 

SQL>


你可能感兴趣的:(表空间,迁移)