oracle 异构平台迁移之传输表空间一例

简介:   第一章 传输表空间一例(win文件系统 -> linux asm )   blog 结构图:   1  场景描述 源平台为:windows xp 32系统 + oracle 11.

 

第一章 传输表空间一例(win文件系统 -> linux asm )

 

blog 结构图:

image

 

1  场景描述

源平台为:windows xp 32系统 + oracle 11.2.0.1.0  + ORACLE_SID=orcl

目标平台rhel6.5 + oracle 11.2.0.1.0 + asm 64位 + ORACLE_SID=orclasm

目标:要实现将自定义的应用程序表空间app1tbs,app2tbs,idxtbs从源平台传递到目标平台

 

注:

 

① linuxwindows 下参考: http://blog.itpub.net/26736162/viewspace-1375260/

② source和target database的数据库版本最好一致,否则会因为db time zone 一致导致报如下错误,但是source如果大于target的话是可以的,向下兼容的
ORA-39002: invalid operation

ORA-39322: Cannot use transportabletablespace with timestamp with timezone columns and different timezone version.

 

 

 

wps2A1B.tmp 

 

2  环境准备

wps2A1C.tmp 

 

2.1  在源库上创建3个用户应用的表空间

C:\Users\Administrator>sqlplus lhr/lhr@orclxp

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期一 15 17:15:22 2015

 

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

 

 

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

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

 

SQL> select * from v$version;

 

BANNER

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

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

PL/SQL Release 11.2.0.1.0 - Production

CORE    11.2.0.1.0      Production

TNS for 32-bit Windows: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

 

SQL> select name from v$datafile;

 

NAME

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

F:\APP\ORACLE\ORADATA\ORCL\SYSTEM01.DBF

F:\APP\ORACLE\ORADATA\ORCL\SYSAUX01.DBF

F:\APP\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF

F:\APP\ORACLE\ORADATA\ORCL\USERS01.DBF

F:\APP\ORACLE\ORADATA\ORCL\RMAN.DBF

 

SQL> create tablespace app1tbs datafile 'F:\APP\ORACLE\ORADATA\ORCL\APP1TBS.DBF' size 10m;

 

表空间已创建。

 

SQL> create tablespace app2tbs datafile 'F:\APP\ORACLE\ORADATA\ORCL\APP2TBS.DBF' size 10m;

 

表空间已创建。

 

SQL> CREATE TABLESPACE IDXTBS DATAFILE 'F:\APP\ORACLE\ORADATA\ORCL\IDXTBS.DBF' SIZE 10M;

 

表空间已创建。

 

 

SQL> set line 9999 pagesize 9999

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

 

NAME                           NAME

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

SYSTEM                         F:\APP\ORACLE\ORADATA\ORCL\SYSTEM01.DBF

SYSAUX                         F:\APP\ORACLE\ORADATA\ORCL\SYSAUX01.DBF

UNDOTBS1                       F:\APP\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF

USERS                          F:\APP\ORACLE\ORADATA\ORCL\USERS01.DBF

RMAN_TS                        F:\APP\ORACLE\ORADATA\ORCL\RMAN.DBF

APP1TBS                        F:\APP\ORACLE\ORADATA\ORCL\APP1TBS.DBF

APP2TBS                        F:\APP\ORACLE\ORADATA\ORCL\APP2TBS.DBF

IDXTBS                         F:\APP\ORACLE\ORADATA\ORCL\IDXTBS.DBF

 

已选择8行。

 

SQL>

SQL>

 

2.2  在相应的表空间创建表和索引

SQL> create table scott.app1_tab tablespace app1tbs as select * from scott.emp;

 

Table created.

 

SQL> create table scott.app2_tab tablespace app2tbs as select * from scott.dept;

 

Table created.

 

SQL> create index scott.idx_emp_ename on scott.app1_tab(ename) tablespace idxtbs;

 

Index created.

 

SQL> create index scott.idx_dept_dname on scott.app2_tab(dname) tablespace idxtbs;

 

Index created.

 

SQL>

 

 

 

3  判断平台支持并确定字节序

如果传输表空间集到不同的平台,则要确定对于源和目标平台这种跨平台表空间被支持,也要确定每个平台的字节序,如果平台具有相同的字节序,则不需要进行转化,否则必须做一个表空间集转化,在源端或目标端。

3.1  在源平台查询

SQL> col platform_name for a40

SQL> select d.platform_name,tp.endian_format from v$transportable_platform tp,v$database d

  2  where tp.platform_name=d.platform_name;

 

PLATFORM_NAME                            ENDIAN_FORMAT

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

Microsoft Windows IA (32-bit)            Little

 

 

结论:当前的系统平台支持跨平台表空间传输(因为上面的查询有记录返回)

 

3.2  在目标平台查询

 

SQL> col platform_name for a40

SQL> select d.platform_name,tp.endian_format from v$transportable_platform tp,v$database d

  2  where tp.platform_name=d.platform_name;

 

PLATFORM_NAME ENDIAN_FORMAT

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

Linux x86 64-bit Little

 

SQL>

 

 

 

结论: 当前的平台支持跨平台的表空间传输源平台和目标平台的Endian_format 相同(均为Little),不需要进行表空间集转换

 

4  选择自包含的表空间集(目前要传输app1tbsidxtbs2个表空间)

4.1  进行检查

Indicates whether a full or partial dependency check is required. If TRUE, treats all IN and OUT pointers(dependencies) and captures them as violations if they are not self-contained in the transportable set.

SQL> execute sys.dbms_tts.transport_set_check('app1tbs,idxtbs',true);

 

PL/SQL procedure successfully completed.

 

 

4.2  查看检查结果

SQL> col violations for a70

SQL> select * from sys.transport_set_violations;

 

VIOLATIONS

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

ORA-39907: 索引 SCOTT.IDX_DEPT_DNAME (在表空间 IDXTBS ) 指向表 SCOTT.APP2_TAB

(在表空间 APP2TBS )

 

 

SQL>

 

结论: 在idxtbs表空间中IDX_DEPT_DNAME索引指向了表空间集外的SYS.APP2_TAB表,所以这里选择app1tabs,app2tabs,idxtbs作为新的表空间集再次进行检查

 

SQL> execute sys.dbms_tts.transport_set_check('app1tbs,app2tbs,idxtbs',true);

 

PL/SQL procedure successfully completed.

 

SQL> select * from transport_set_violations;

 

no rows selected

 

SQL>

 

结论: 此时这个表空间集已经不在违背自包含的条件,可以确定为一个可传输表空间集

 

 

5  产生可传输表空间集

5.1  使自包含的表空间集中的所有表空间变为只读状态

SQL> alter tablespace app1tbs read only;

 

Tablespace altered.

 

SQL> alter tablespace app2tbs read only;

 

Tablespace altered.

 

SQL> alter tablespace idxtbs read only;

 

Tablespace altered.

 

 

5.2  使用数据泵导出工具,导出要传输的各个表空间的元数据

5.2.1  确定导出目录

SQL> set line 9999

SQL> col directory_name for a25

SQL> col directory_path for a100

SQL> select directory_name,directory_path from dba_directories;

 

 

DIRECTORY_NAME            DIRECTORY_PATH

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

XMLDIR                    c:\ade\aime_dadvfm0254\oracle\rdbms\xml

ASMSRC                    F:\app\oracle\oradata\orcl

DATA_PUMP_DIR             F:\app\oracle\admin\orcl\dpdump\

ORACLE_OCM_CONFIG_DIR     F:\app\oracle\product\ccr\state

 

SQL>

 

 

 

SQL>

 

5.2.2  开始导出

C:\Users\Administrator>expdp system/lhr@orclxp dumpfile=expdat.dmp directory=DATA_PUMP_DIR transport_tablespaces=app1tbs,app2tbs,idxtbs logfile=tts_export.log

 

Export: Release 11.2.0.1.0 - Production on 星期一 15 19:29:29 2015

 

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

 

连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

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

启动 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01":  system/********@orclxp dumpfile=expdat.dmp directory=DATA_PUMP_DIR transport_tablespaces=app1tbs,app2tbs,idxtbs logfile=tts_export.log

处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK

处理对象类型 TRANSPORTABLE_EXPORT/TABLE

处理对象类型 TRANSPORTABLE_EXPORT/INDEX

处理对象类型 TRANSPORTABLE_EXPORT/INDEX_STATISTICS

处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

已成功加载/卸载了主表 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01"

******************************************************************************

SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 的转储文件集为:

  F:\APP\ORACLE\ADMIN\ORCL\DPDUMP\EXPDAT.DMP

******************************************************************************

可传输表空间 APP1TBS 所需的数据文件:

  F:\APP\ORACLE\ORADATA\ORCL\APP1TBS.DBF

可传输表空间 APP2TBS 所需的数据文件:

  F:\APP\ORACLE\ORADATA\ORCL\APP2TBS.DBF

可传输表空间 IDXTBS 所需的数据文件:

  F:\APP\ORACLE\ORADATA\ORCL\IDXTBS.DBF

作业 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" 已于 19:30:07 成功完成

 

 

C:\Users\Administrator>

 

查看文件:

wps2A2D.tmp 

 

5.3  将数据文件拷贝到dpdump目录下

wps2A3D.tmp 

 

 

6  还原源库中的表空间为读/写模式

SQL> alter tablespace app1tbs read write;

 

Tablespace altered.

 

SQL> alter tablespace app2tbs read write;

 

Tablespace altered.

 

SQL> alter tablespace idxtbs read write;

 

Tablespace altered.

 

SQL>

 

至此,已和源库没有任何关系。

 

7  传输文件

这里需要传输转储元文件和数据文件到目标库

 

7.1  利用ftp工具传输转储元文件到目标库

 

[root@rhel6_lhr share-2]# cd dpdump/

[root@rhel6_lhr dpdump]# ll

total 30850

-rwxrwxrwx 1 root root 10493952 Jan  5 19:27 APP1TBS.DBF

-rwxrwxrwx 1 root root 10493952 Jan  5 19:27 APP2TBS.DBF

-rwxrwxrwx 1 root root   106496 Jan  5 19:30 EXPDAT.DMP

-rwxrwxrwx 1 root root 10493952 Jan  5 19:27 IDXTBS.DBF

-rwxrwxrwx 1 root root     1373 Jan  5 19:30 tts_export.log

[root@rhel6_lhr dpdump]#

 

7.2  查看目标库数据文件位置和导入目录

[oracle@rhel6 ~]$ env | grep ORACLE

ORACLE_UNQNAME=orcl

ORACLE_SID=orcl

ORACLE_BASE=/u01/app/oracle

ORACLE_HOSTNAME=192.168.59.129

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

[oracle@rhel6 ~]$ export ORACLE_SID=orclasm

[oracle@rhel6 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 6 09:50:44 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 name from v$datafile;

 

NAME

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

+DATA/orclasm/datafile/system.256.868235071

+DATA/orclasm/datafile/sysaux.257.868235073

+DATA/orclasm/datafile/undotbs1.258.868235073

+DATA/orclasm/datafile/users.259.868235073

13 rows selected.

SQL> select directory_name,directory_path from dba_directories;

 

DIRECTORY_NAME   DIRECTORY_PATH

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

XMLDIR        /ade/b/2125410156/oracle/rdbms/xml

DATA_PUMP_DIR        /u01/app/oracle/admin/orclasm/dpdump/

ORACLE_OCM_CONFIG_DIR        /u01/app/oracle/product/11.2.0/dbhome_1/ccr/state

3 rows selected.

 

SQL>

 

7.3  拷贝文件到目标库相应位置并修改文件权限

 

[root@rhel6_lhr dpdump]# rm -rf /u01/app/oracle/admin/orclasm/dpdump/*

[root@rhel6_lhr dpdump]#

[root@rhel6_lhr dpdump]#

[root@rhel6_lhr dpdump]#

[root@rhel6_lhr dpdump]# mv * /u01/app/oracle/admin/orclasm/dpdump/

[root@rhel6_lhr dpdump]# ll /u01/app/oracle/admin/orclasm/dpdump/

total 30852

-rwxrwxrwx 1 root root 10493952 Jan  5 19:27 APP1TBS.DBF

-rwxrwxrwx 1 root root 10493952 Jan  5 19:27 APP2TBS.DBF

-rwxrwxrwx 1 root root   106496 Jan  5 19:30 EXPDAT.DMP

-rwxrwxrwx 1 root root 10493952 Jan  5 19:27 IDXTBS.DBF

-rwxrwxrwx 1 root root     1373 Jan  5 19:30 tts_export.log

[root@rhel6 dpdump]# chown oracle:oinstall APP1TBS.DBF

[root@rhel6 dpdump]# chown oracle:oinstall APP2TBS.DBF

[root@rhel6 dpdump]# chown oracle:oinstall IDXTBS.DBF

[root@rhel6 dpdump]# ll

total 30860

-rwxr-xr-x. 1 oracle oinstall 10493952 Jan  6 00:46 APP1TBS.DBF

-rwxr-xr-x. 1 oracle oinstall 10493952 Jan  6 00:46 APP2TBS.DBF

-rwxr-xr-x. 1 root   root       106496 Jan  6 00:46 EXPDAT.DMP

-rwxr-xr-x. 1 oracle oinstall 10493952 Jan  6 00:46 IDXTBS.DBF

-rw-r--r--. 1 oracle oinstall      236 Jan  6 00:52 par.f

-rwxr-xr-x. 1 root   root         1373 Jan  6 00:46 tts_export.log

-rw-r--r--. 1 oracle asmadmin      917 Jan  6 00:52 tts_import.log

[root@rhel6 dpdump]#

 

 

8  开始导入

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        READ ONLY

APP2TBS        READ ONLY

IDXTBS        READ ONLY

 

8 rows selected.

 

SQL>

已选择9行。

 

SQL> alter tablespace app1tbs read write;

 

表空间已更改。

 

SQL> alter tablespace app2tbs read write;

 

表空间已更改。

 

SQL> alter tablespace idxtbs read write;

 

表空间已更改。

 

SQL>

 

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月-80            800                    20

      7499 ALLEN      SALESMAN        7698 20-2月 -81           1600        300         30

      7521 WARD       SALESMAN        7698 22-2月 -81           1250        500         30

      7566 JONES      MANAGER         7839 02-4月 -81           2975                    20

      7654 MARTIN     SALESMAN        7698 28-9月 -81           1250       1400         30

      7698 BLAKE      MANAGER         7839 01-5月 -81           2850                    30

      7782 CLARK      MANAGER         7839 09-6月 -81           2450                    10

      7788 SCOTT      ANALYST         7566 19-4月 -87           3000                    20

      7839 KING       PRESIDENT            17-11月-81           5000                    10

      7844 TURNER     SALESMAN        7698 08-9月 -81           1500          0         30

      7876 ADAMS      CLERK           7788 23-5月 -87           1100                    20

      7900 JAMES      CLERK           7698 03-12月-81            950                    30

      7902 FORD       ANALYST         7566 03-12月-81           3000                    20

      7934 MILLER     CLERK           7782 23-1月 -82           1300                    10

 

已选择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        /u01/app/oracle/admin/orclasm/dpdump/APP1TBS.DBF

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

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

 

7 rows selected.

 

SQL>

 

 

9  修改表空间对应的文件名

 

执行如下脚本:

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        +DATA/orclasm/datafile/app1tbs.266.868237521

APP2TBS        +DATA/orclasm/datafile/app2tbs.267.868237551

IDXTBS        +DATA/orclasm/datafile/idxtbs.268.868237557

 

7 rows selected.

 

SQL>

已选择8行。

 

 

查询数据:

SQL> select tablespace_name,status from dba_tablespaces;

 

TABLESPACE_NAME                STATUS

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

SYSTEM                         ONLINE

SYSAUX                         ONLINE

UNDOTBS1                       ONLINE

TEMP                           ONLINE

USERS                          ONLINE

RMAN_TS                        ONLINE

APP1TBS                        ONLINE

APP2TBS                        ONLINE

IDXTBS                         ONLINE

 

已选择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月-80            800                    20

      7499 ALLEN      SALESMAN        7698 20-2月 -81           1600        300         30

      7521 WARD       SALESMAN        7698 22-2月 -81           1250        500         30

      7566 JONES      MANAGER         7839 02-4月 -81           2975                    20

      7654 MARTIN     SALESMAN        7698 28-9月 -81           1250       1400         30

      7698 BLAKE      MANAGER         7839 01-5月 -81           2850                    30

      7782 CLARK      MANAGER         7839 09-6月 -81           2450                    10

      7788 SCOTT      ANALYST         7566 19-4月 -87           3000                    20

      7839 KING       PRESIDENT            17-11月-81           5000                    10

      7844 TURNER     SALESMAN        7698 08-9月 -81           1500          0         30

      7876 ADAMS      CLERK           7788 23-5月 -87           1100                    20

      7900 JAMES      CLERK           7698 03-12月-81            950                    30

      7902 FORD       ANALYST         7566 03-12月-81           3000                    20

      7934 MILLER     CLERK           7782 23-1月 -82           1300                    10

 

已选择16行。

 

SQL>

 

 

 

 

相关实践学习
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
目录
相关文章
|
SQL 运维 Oracle
【迁移秘籍揭晓】ADB如何助你一臂之力,轻松玩转Oracle至ADB的数据大转移?
【8月更文挑战第27天】ADB(Autonomous Database)是由甲骨文公司推出的自动化的数据库服务,它极大简化了数据库的运维工作。在从传统Oracle数据库升级至ADB的过程中,数据迁移至关重要。
448 0
|
Oracle 关系型数据库
【YashanDB知识库】YMP从oracle到yashan迁移评估报OCI相关错误
本文来自YashanDB官网,主要解决在使用YMP(yashan-migrate-platform)进行迁移评估时出现的OCI版本检查错误问题。错误原因为操作系统重装后,OCI所需依赖缺失(如`libnsl.so.1`、`libnnz19.so`等)。文章提供了排查步骤和解决方法:一是检查并配置环境变量`LD_LIBRARY_PATH`,二是若依赖仍缺失,则需手动下载并安装对应依赖文件。适用于使用YMP迁移平台的用户遇到OCI相关问题时参考。
|
Oracle 关系型数据库 网络安全
崖山异构数据库迁移利器YMP初体验-Oracle迁移YashanDB
文章是作者小草对崖山异构数据库迁移利器 YMP 的初体验分享,包括背景、YMP 简介、体验环境说明、YMP 部署(含安装前准备、安装、卸载、启动与停止)、数据迁移及遇到的问题与解决过程。重点介绍了 YMP 功能、部署的诸多细节和数据迁移流程,还提到了安装和迁移中遇到的问题及解决办法。
|
SQL Oracle 关系型数据库
Oracle向YashanDB迁移的丝滑体验
这篇文章主要介绍了从 Oracle 向 YashanDB 迁移的过程,包括 YashanDB 迁移平台 YMP 的介绍、下载安装准备、安装步骤、运行状态及访问方式,迁移中的添加数据源、创建任务、迁移配置、离线迁移、一致性校验等环节,还分享了迁移后的体验,认为 YMP 不错但希望增加在线迁移等功能。
|
SQL Oracle 关系型数据库
【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
【YashanDB知识库】YMP迁移oracle不兼容给用户授权高级包
|
SQL Oracle 关系型数据库
基于YMP工具实现Oracle迁移YashanDB
这篇文章主要介绍了基于 YMP 工具实现 Oracle 迁移 YashanDB 的相关内容,包括 YMP 工具的简介、架构、规格,迁移前的环境准备和工具部署,迁移过程中的创建任务、评估、配置、离线迁移、校验等步骤,以及迁移体验,指出其部署简单、数据类型兼容但存在部分功能不支持等情况。
|
Oracle 关系型数据库 MySQL
使用崖山YMP 迁移 Oracle/MySQL 至YashanDB 23.2 验证测试
这篇文章是作者尚雷关于使用崖山YMP迁移Oracle/MySQL至YashanDB 23.2的验证测试分享。介绍了YMP的产品信息,包括架构、版本支持等,还详细阐述了外置库部署、YMP部署、访问YMP、数据源管理、任务管理(创建任务、迁移配置、离线迁移、校验初始化、一致性校验)及MySQL迁移的全过程。
|
监控 Oracle 关系型数据库
Linux平台Oracle开机自启动设置
【11月更文挑战第8天】在 Linux 平台设置 Oracle 开机自启动有多种方法,本文以 CentOS 为例,介绍了两种常见方法:使用 `rc.local` 文件(较简单但不推荐用于生产环境)和使用 `systemd` 服务(推荐)。具体步骤包括编写启动脚本、赋予执行权限、配置 `rc.local` 或创建 `systemd` 服务单元文件,并设置开机自启动。通过 `systemd` 方式可以更好地与系统启动过程集成,更规范和可靠。
1401 2
|
Oracle Ubuntu 关系型数据库
Linux平台Oracle开机自启动设置
【11月更文挑战第7天】本文介绍了 Linux 系统中服务管理机制,并详细说明了如何在使用 systemd 和 System V 的系统上设置 Oracle 数据库的开机自启动。包括创建服务单元文件、编辑启动脚本、设置开机自启动和启动服务的具体步骤。最后建议重启系统验证设置是否成功。
708 1
|
存储 Oracle NoSQL
Oracle 表空间、数据文件、schema的关系
Oracle 表空间、数据文件、schema的关系
579 2

推荐镜像

更多