【TTS】傳輸表空間AIX->linux基於rman

lhrbest發表於2016-02-12

TTS】傳輸表空間AIX asm -> linux asm基於rman

一.1  BLOG文件結構圖

 

wpsCB5.tmp 

 

一.2  前言部分

 

一.2.1  導讀和注意事項

各位技術愛好者,看完本文後,你可以掌握如下的技能,也可以學到一些其它你所不知道的知識,~O(∩_∩)O~:

異構平臺下傳輸表空間的實施

傳輸表空間基於表空間的read only和rman2種方式

平臺位元組序、自包含概念

expdp/impdp的應用

 

  Tips:

       ① 若文章程式碼格式有錯亂,推薦使用搜狗360瀏覽器,也可以下載pdf格式的文件來檢視,pdf文件下載地址:http://yunpan.cn/cdEQedhCs2kFz (提取碼:ed9b 

       ② 本篇BLOG中命令的輸出部分需要特別關注的地方我都用灰色背景和粉紅色字型來表示,比如下邊的例子中,thread 1的最大歸檔日誌號為33thread 2的最大歸檔日誌號為43是需要特別關注的地方;而命令一般使用黃色背景和紅色字型注;對程式碼或程式碼輸出部分的注釋一般採用藍色字型表示

 

  List of Archived Logs in backup set 11

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

  1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

  2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

  2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

 

 

 

 

[ZFXDESKDB1:root]:/>lsvg -o

T_XDESK_APP1_vg

rootvg

[ZFXDESKDB1:root]:/>

00:27:22 SQL> alter tablespace idxtbs read write;

 

 

====》2097152*512/1024/1024/1024=1G 

 

 

 

 

 

 

 

本文如有錯誤或不完善的地方請大家多多指正,ITPUB留言或QQ皆可,您的批評指正是我寫作的最大動力。

 

 

一.2.2  相關參考文章連結

其他異構平臺遷移的一些文章參考:

【推薦】 oracle 異構平臺遷移之傳輸表空間一例 http://blog.itpub.net/26736162/viewspace-1391913/

【推薦】 oracle 傳輸表空間一例 http://blog.itpub.net/26736162/viewspace-1375260/

【推薦】 利用rman來實現linux平臺資料庫複製到windows平臺資料庫 http://blog.itpub.net/26736162/viewspace-1352436/

【推薦】 直接複製資料檔案實現linux平臺資料庫複製到windows平臺資料庫 http://blog.itpub.net/26736162/viewspace-1352243/

TTS】傳輸表空間Linux asm -> AIX asm  http://blog.itpub.net/26736162/viewspace-1987949/

TTS】傳輸表空間Linux asm -> AIX asm 基於rman  http://blog.itpub.net/26736162/viewspace-1987953/

TTS傳輸表空間AIX asm -> linux http://blog.itpub.net/26736162/viewspace-1987957/

 

 

 

一.3  相關知識點掃盲

 

可傳輸表空間的特性主要用於進行庫對庫的表空間複製,要進行傳輸的表空間必須置於read-only模式。如果生產庫不允許表空間置為只讀模式,沒關係,方法還是有的,通過RMAN備份也可以建立可傳輸表空間集。要使用可傳輸表空間的特性,oracle至少是8i企業版或更高版本。如果是相同作業系統平臺相互匯入,則8i及以上版本均可支援,但如果是不同作業系統平臺,資料庫版本至少10g。被傳輸的表空間即可以是字典管理,也可以是本地管理。並且自oracle9i開始,被傳輸表空間的block size可以與目標資料庫的block size不同。

 

可傳輸表空間(還有個集)最大的優勢是其速度比export/import或unload/load要快的多。因為可傳輸表空間主要是複製資料檔案到目標路徑,然後再使用export/import或Data Pump export/import等應用僅匯出/匯入表空間物件的後設資料到新資料庫。

關於可傳輸表空間,還有個集(Transportable Tablespace Sets)的建立,其中都提到了很重要一點,就是被傳輸的表空間在傳輸過程中必須置為 read-only。而在實際操作過程中,對於某些生產資料庫,將表空間置為 read-only 是件非常複雜的事情甚至完全不允許,有了 RMAN Transportable Tablespace,這一切都得以避免。RMAN 通過備份建立可傳輸表空間集,它並不需要存取活動的資料檔案,相應也就不需要將表空間置為 read-only。因此,資料庫可用性得到提升,尤其對於超大的表空間,因為被傳輸的表空間在此期間仍可進行讀寫操作,而且把表空間置為 read-only 模式可能會花費較長時間,

使用 RMAN 建立可傳輸表空間集,允許你在傳輸過程中指定目標恢復時間點或 SCN,這樣傳輸的資料可以更靈活,不必完全複製現有表空間,只要備份中存在,你就可以選擇性的恢復資料。例如,你的備份策略為保留一週,你希望建立的可傳輸表空間中資料是截止本月底最後一天的資料,那麼你在下個月第一週內任何時候都可以進行傳輸操作而不需要考慮這期間生產庫是否會有寫入操作。

 

一.3.1  注意事項

 

 

 

?  注意:

 

 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.

 

source和target端的字符集必須一致,例如如下情況報錯:

source為 ZHS16GBK,target為AL32UTF8

ORA-39123: Data Pump transportable tablespace job aborted

ORA-29345: cannot plug a tablespace into a database using an incompatible character set

 

Tartget db char set AL32UTF8 is not a superset of ZHS16GBK.

Failed to plug in a tablespace due to incompatible

  database character set"AL32UTF8" and

  transportable set database character set "ZHS16GBK"

 

  source和target database的compatible 引數最好一致,但source如果小於等於target端的話是可以的,例如source為11.2.0.4.0,target為11.2.0.0.0就不行,impdp的時候報錯:

ORA-39123: Data Pump transportable tablespace job aborted

ORA-00721: changes by release 11.2.0.4.0 cannot be used by release 11.2.0.0.0

 

 

 

 

一.4  實驗部分

 

一.4.1  實驗環境介紹

 

專案

source db

target  db

db 型別

單例項

單例項

db version

11.2.0.3

11.2.0.3

db 儲存

ASM

ASM

ORACLE_SID

ora11g

orclasm

db_name

ora11g

orclasm

主機IP地址:

22.188.139.33

192.168.59.30

OS版本及kernel版本

AIX 645.3.0.0

RHEL6.5 64位,2.6.32-504.16.2.el6.x86_64

OS hostname

ZFXDESKDB2

rhel6_lhr

platform_name

AIX-Based Systems (64-bit)

Linux x86 64-bit

db time zone

14

14

字符集

ZHS16GBK

ZHS16GBK

compatible

11.2.0.0.0

11.2.0.0.0

歸檔模式

Archive Mode

Archive Mode

 

 

一.4.2  實驗目標

 

要實現將自定義的應用程式表空間app1tbs,app2tbs,idxtbs從源平臺傳遞到目標平臺,而在實際的工作過程中,需要將AIX上的資料庫遷移到Linux,或者將Linux上的資料庫遷移到AIX上,除了exp/impexpdp/impdp外,最常用的就是傳輸表空間了,若是整個庫遷移的話,我們需要做的就是把業務使用者和業務表空間的資料遷移過來就行,Undotempsystem等等的就不用遷移了,整個處理過程和本文件的處理過程大同小異,需要關注的是業務物件的個數、大小、狀態等。

wpsCC6.tmp 

一.4.3  實驗過程

 

 

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

 

 

一.5  環境準備

wpsCC7.tmp 

 

一.5.1  在源庫上建立3個使用者應用的表空間,並在相應的表空間建立表和索引

 

 

oracle@ZDMTRAIN2:/oracle$ echo $ORACLE_SID

ora11g

oracle@ZDMTRAIN2:/oracle$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Sat Feb 18 10:51:00 2017

 

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

 

 

Connected to:

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

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

and Real Application Testing options

 

SYS@ora11g> select name from v$datafile;

 

NAME

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

+DATA1/ora11g/datafile/system.379.936264859

+DATA1/ora11g/datafile/sysaux.378.936264861

+DATA1/ora11g/datafile/undotbs1.380.936264861

+DATA1/ora11g/datafile/users.382.936264861

+DATA1/ora11g/datafile/example.391.936264979

 

SYS@ora11g> create tablespace app1tbs DATAFILE '+DATA1' size 10m;

 

Tablespace created.

 

SYS@ora11g> create tablespace app2tbs DATAFILE '+DATA1' size 10m;

 

Tablespace created.

 

SYS@ora11g> CREATE TABLESPACE IDXTBS DATAFILE '+DATA1' SIZE 10M;

 

Tablespace created.

 

SYS@ora11g> create user user_app1 identified by user_app1 default tablespace app1tbs;

 

User created.

 

SYS@ora11g> create user user_app2 identified by user_app2 default tablespace app2tbs;

 

User created.

 

SYS@ora11g> grant connect , resource to user_app1;

 

Grant succeeded.

 

SYS@ora11g> grant connect , resource to user_app2;

 

Grant succeeded.

 

SYS@ora11g> create table user_app1.app1_tab tablespace app1tbs as select * from scott.emp;

 

Table created.

 

SYS@ora11g> create table user_app2.app2_tab tablespace app2tbs as select * from scott.dept;

 

Table created.

 

SYS@ora11g> create index user_app1.idx_emp_ename on user_app1.app1_tab(ename) tablespace idxtbs;

 

Index created.

 

SYS@ora11g> create index user_app2.idx_dept_dname on user_app2.app2_tab(dname) tablespace idxtbs;

 

Index created.

 

SYS@ora11g> set line 9999 pagesize 9999

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

 

NAME            NAME

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

SYSTEM          +DATA1/ora11g/datafile/system.379.936264859

SYSAUX          +DATA1/ora11g/datafile/sysaux.378.936264861

UNDOTBS1        +DATA1/ora11g/datafile/undotbs1.380.936264861

USERS           +DATA1/ora11g/datafile/users.382.936264861

EXAMPLE         +DATA1/ora11g/datafile/example.391.936264979

APP1TBS         +DATA1/ora11g/datafile/app1tbs.393.936269553

APP2TBS         +DATA1/ora11g/datafile/app2tbs.394.936269559

IDXTBS          +DATA1/ora11g/datafile/idxtbs.395.936269565

 

8 rows selected.

 

SYS@ora11g>

 

 

一.6  判斷平臺支援並確定位元組序

如果傳輸表空間集到不同的平臺,則要確定對於源和目標平臺這種跨平臺表空間被支援,也要確定每個平臺的位元組序,如果平臺具有相同的位元組序,則不需要進行轉化,否則必須做一個表空間集轉化,在源端或目標端都可以,在源端用convert  tablespace,在目標端用convert datafile

 

 

SYS@ora11g> col platform_name for a40

SYS@ora11g> select tp.platform_name, tp.endian_format

  2   from v$transportable_platform tp

  3   where tp.platform_name in ('Linux x86 64-bit', 'AIX-Based Systems (64-bit)');

 

PLATFORM_NAME                            ENDIAN_FORMAT

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

AIX-Based Systems (64-bit)               Big

Linux x86 64-bit                         Little

 

SQL>

 

源平臺和目標平臺的Endian_format 不同,source端為Bigtarget端為Little,所以需要進行表空間集轉換,前邊說過在源端或目標端都可以進行轉換,這裡我們選擇在目標端來進行轉換

 

一.7  選擇自包含的表空間集

一.7.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.

 

先試試要傳輸app1tbsidxtbs2個表空間

SYS@ora11g> execute sys.dbms_tts.transport_set_check('app1tbs,idxtbs',true);

 

PL/SQL procedure successfully completed.

 

SQL> col violations for a70

SYS@ora11g> select * from sys.transport_set_violations;

 

VIOLATIONS

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

ORA-39907: Index USER_APP2.IDX_DEPT_DNAME in tablespace IDXTBS points

to table USER_APP2.APP2_TAB in tablespace APP2TBS.

 

 

SQL>

結論: 在idxtbs表空間中IDX_DEPT_DNAME索引指向了表空間集外的user_app2.APP2_TAB表,所以這裡選擇app1tabs,app2tabs,idxtbs作為新的表空間集再次進行檢查

 

 

SYS@ora11g> execute sys.dbms_tts.transport_set_check('app1tbs,app2tbs,idxtbs',true);

 

PL/SQL procedure successfully completed.

 

 

SYS@ora11g>  select * from sys.transport_set_violations;

 

no rows selected

 

SYS@ora11g>

 

結論: 此時這個表空間集已經不違背自包含的條件,可以確定為一個可傳輸表空間集。在實際生產環境中也是如此檢查的,若是全庫遷移,得把需要遷移的表空間修改為自包含的。

 

一.8  產生可傳輸表空間集

一.8.1  rman備份source

當然,如果已經有全庫備份了就可以省略這個步驟。

 

oracle@ZDMTRAIN2:/oracle$ mkdir -p /lxm/oracle_bk/ora11g

oracle@ZDMTRAIN2:/oracle$ rman target /

 

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Feb 18 11:27:16 2017

 

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

 

connected to target database: ORA11G (DBID=37497795)

 

 

RMAN> list backupset;

 

using target database control file instead of recovery catalog

specification does not match any backup in the repository

 

RMAN> backup  as compressed backupset  format  '/lxm/oracle_bk/ora11g/full_%n_%T_%t_%s.bak' database include current controlfile plus archivelog delete input ;

 

 

Starting backup at 2017-02-18 11:27:32

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=196 device type=DISK

channel ORA_DISK_1: starting compressed archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=6 RECID=1 STAMP=936271653

channel ORA_DISK_1: starting piece 1 at 2017-02-18 11:27:34

channel ORA_DISK_1: finished piece 1 at 2017-02-18 11:27:37

piece handle=/lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271654_3.bak tag=TAG20170218T112734 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03

channel ORA_DISK_1: deleting archived log(s)

archived log file name=+DATA1/ora11g/archivelog/2017_02_18/thread_1_seq_6.396.936271653 RECID=1 STAMP=936271653

Finished backup at 2017-02-18 11:27:38

 

Starting backup at 2017-02-18 11:27:38

using channel ORA_DISK_1

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=+DATA1/ora11g/datafile/system.379.936264859

input datafile file number=00002 name=+DATA1/ora11g/datafile/sysaux.378.936264861

input datafile file number=00005 name=+DATA1/ora11g/datafile/example.391.936264979

input datafile file number=00003 name=+DATA1/ora11g/datafile/undotbs1.380.936264861

input datafile file number=00006 name=+DATA1/ora11g/datafile/app1tbs.393.936269553

input datafile file number=00007 name=+DATA1/ora11g/datafile/app2tbs.394.936269559

input datafile file number=00008 name=+DATA1/ora11g/datafile/idxtbs.395.936269565

input datafile file number=00004 name=+DATA1/ora11g/datafile/users.382.936264861

channel ORA_DISK_1: starting piece 1 at 2017-02-18 11:27:38

channel ORA_DISK_1: finished piece 1 at 2017-02-18 11:28:53

piece handle=/lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271658_4.bak tag=TAG20170218T112738 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15

channel ORA_DISK_1: starting compressed full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 2017-02-18 11:28:55

channel ORA_DISK_1: finished piece 1 at 2017-02-18 11:28:56

piece handle=/lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271734_5.bak tag=TAG20170218T112738 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 2017-02-18 11:28:56

 

Starting backup at 2017-02-18 11:28:56

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting compressed archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=7 RECID=2 STAMP=936271736

channel ORA_DISK_1: starting piece 1 at 2017-02-18 11:28:57

channel ORA_DISK_1: finished piece 1 at 2017-02-18 11:28:58

piece handle=/lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271737_6.bak tag=TAG20170218T112856 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_1: deleting archived log(s)

archived log file name=+DATA1/ora11g/archivelog/2017_02_18/thread_1_seq_7.396.936271737 RECID=2 STAMP=936271736

Finished backup at 2017-02-18 11:28:58

 

RMAN> list backupset;

 

 

List of Backup Sets

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

 

 

BS Key  Size       Device Type Elapsed Time Completion Time   

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

2       8.32M      DISK        00:00:03     2017-02-18 11:27:37

        BP Key: 2   Status: AVAILABLE  Compressed: YES  Tag: TAG20170218T112734

        Piece Name: /lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271654_3.bak

 

  List of Archived Logs in backup set 2

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    6       1116417    2017-02-18 09:43:58 1131262    2017-02-18 11:27:32

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   

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

3       Full    284.70M    DISK        00:01:15     2017-02-18 11:28:53

        BP Key: 3   Status: AVAILABLE  Compressed: YES  Tag: TAG20170218T112738

        Piece Name: /lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271658_4.bak

  List of Datafiles in backup set 3

  File LV Type Ckp SCN    Ckp Time            Name

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

  1       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/system.379.936264859

  2       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/sysaux.378.936264861

  3       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/undotbs1.380.936264861

  4       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/users.382.936264861

  5       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/example.391.936264979

  6       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/app1tbs.393.936269553

  7       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/app2tbs.394.936269559

  8       Full 1131273    2017-02-18 11:27:38 +DATA1/ora11g/datafile/idxtbs.395.936269565

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   

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

4       Full    1.03M      DISK        00:00:01     2017-02-18 11:28:55

        BP Key: 4   Status: AVAILABLE  Compressed: YES  Tag: TAG20170218T112738

        Piece Name: /lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271734_5.bak

  SPFILE Included: Modification time: 2017-02-18 11:25:43

  SPFILE db_unique_name: ORA11G

  Control File Included: Ckp SCN: 1131300      Ckp time: 2017-02-18 11:28:53

 

BS Key  Size       Device Type Elapsed Time Completion Time   

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

5       4.00K      DISK        00:00:00     2017-02-18 11:28:57

        BP Key: 5   Status: AVAILABLE  Compressed: YES  Tag: TAG20170218T112856

        Piece Name: /lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271737_6.bak

 

  List of Archived Logs in backup set 5

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

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

  1    7       1131262    2017-02-18 11:27:32 1131306    2017-02-18 11:28:56

 

RMAN>

RMAN>

一.8.2  transport tablespace 生成檔案

該步驟需要注意的是磁碟剩餘空間:如下的目錄/lxm/ora11g/transportdest剩餘空間必須大於source庫整個表空間的大小+需要傳輸的表空間的大小,否則會因為磁碟空間不夠而報錯。

 

oracle@ZDMTRAIN2:/oracle$ mkdir -p /lxm/ora11g/transportdest

oracle@ZDMTRAIN2:/oracle$ rman target /

 

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Feb 18 11:30:34 2017

 

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

 

connected to target database: ORA11G (DBID=37497795)

 

RMAN> transport tablespace APP1TBS,APP2TBS,IDXTBS tablespace destination '/lxm/ora11g/transportdest' auxiliary destination '/lxm/ora11g/transportdest';

 

using target database control file instead of recovery catalog

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

 

Creating automatic instance, with SID='wBBm'

 

initialization parameters used for automatic instance:

db_name=ORA11G

db_unique_name=wBBm_tspitr_ORA11G

compatible=11.2.0.0.0

db_block_size=8192

db_files=200

sga_target=280M

processes=50

db_create_file_dest=/lxm/ora11g/transportdest

log_archive_dest_1='location=/lxm/ora11g/transportdest'

#No auxiliary parameter file used

 

 

starting up automatic instance ORA11G

 

Oracle instance started

 

Total System Global Area     292278272 bytes

 

Fixed Size                     2220880 bytes

Variable Size                100666544 bytes

Database Buffers             184549376 bytes

Redo Buffers                   4841472 bytes

Automatic instance created

Running TRANSPORT_SET_CHECK on recovery set tablespaces

TRANSPORT_SET_CHECK completed successfully

 

contents of Memory Script:

{

# set requested point in time

set until  scn 1131306;

# 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';

}

executing Memory Script

 

executing command: SET until clause

 

Starting restore at 2017-02-18 11:31:02

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=80 device type=DISK

 

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: restoring control file

channel ORA_AUX_DISK_1: reading from backup piece /lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271734_5.bak

channel ORA_AUX_DISK_1: piece handle=/lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271734_5.bak tag=TAG20170218T112738

channel ORA_AUX_DISK_1: restored backup piece 1

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

output file name=/lxm/ora11g/transportdest/ORA11G/controlfile/o1_mf_dbhhzqsd_.ctl

Finished restore at 2017-02-18 11:31:04

 

sql statement: alter database mount clone database

 

sql statement: alter system archive log current

 

contents of Memory Script:

{

# set requested point in time

set until  scn 1131306;

# set destinations for recovery set and auxiliary set datafiles

set newname for clone datafile  1 to new;

set newname for clone datafile  3 to new;

set newname for clone datafile  2 to new;

set newname for clone tempfile  1 to new;

set newname for datafile  6 to

"/lxm/ora11g/transportdest/o1_mf_app1tbs_%u_.dbf";

set newname for datafile  7 to

"/lxm/ora11g/transportdest/o1_mf_app2tbs_%u_.dbf";

set newname for datafile  8 to

"/lxm/ora11g/transportdest/o1_mf_idxtbs_%u_.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, 6, 7, 8;

switch clone datafile all;

}

executing Memory Script

 

executing command: SET until clause

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

renamed tempfile 1 to /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_temp_%u_.tmp in control file

 

Starting restore at 2017-02-18 11:31:10

using channel ORA_AUX_DISK_1

 

channel ORA_AUX_DISK_1: starting datafile backup set restore

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

channel ORA_AUX_DISK_1: restoring datafile 00001 to /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_system_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00003 to /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_undotbs1_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00002 to /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_sysaux_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00006 to /lxm/ora11g/transportdest/o1_mf_app1tbs_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00007 to /lxm/ora11g/transportdest/o1_mf_app2tbs_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00008 to /lxm/ora11g/transportdest/o1_mf_idxtbs_%u_.dbf

channel ORA_AUX_DISK_1: reading from backup piece /lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271658_4.bak

channel ORA_AUX_DISK_1: piece handle=/lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271658_4.bak tag=TAG20170218T112738

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:25

Finished restore at 2017-02-18 11:32:42

 

datafile 1 switched to datafile copy

input datafile copy RECID=8 STAMP=936271962 file name=/lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_system_dbhj055o_.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=9 STAMP=936271962 file name=/lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_undotbs1_dbhj058d_.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=10 STAMP=936271962 file name=/lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_sysaux_dbhj055q_.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=11 STAMP=936271962 file name=/lxm/ora11g/transportdest/o1_mf_app1tbs_dbhj05ll_.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=12 STAMP=936271962 file name=/lxm/ora11g/transportdest/o1_mf_app2tbs_dbhj05nz_.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=13 STAMP=936271962 file name=/lxm/ora11g/transportdest/o1_mf_idxtbs_dbhj05o8_.dbf

 

contents of Memory Script:

{

# set requested point in time

set until  scn 1131306;

# 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  6 online";

sql clone "alter database datafile  7 online";

sql clone "alter database datafile  8 online";

# recover and open resetlogs

recover clone database tablespace  "APP1TBS", "APP2TBS", "IDXTBS", "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  6 online

 

sql statement: alter database datafile  7 online

 

sql statement: alter database datafile  8 online

 

Starting recover at 2017-02-18 11:32:43

using channel ORA_AUX_DISK_1

 

starting media recovery

 

channel ORA_AUX_DISK_1: starting archived log restore to default destination

channel ORA_AUX_DISK_1: restoring archived log

archived log thread=1 sequence=7

channel ORA_AUX_DISK_1: reading from backup piece /lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271737_6.bak

channel ORA_AUX_DISK_1: piece handle=/lxm/oracle_bk/ora11g/full_ORA11Gxx_20170218_936271737_6.bak tag=TAG20170218T112856

channel ORA_AUX_DISK_1: restored backup piece 1

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

archived log file name=/lxm/ora11g/transportdest/1_7_936264966.dbf thread=1 sequence=7

channel clone_default: deleting archived log(s)

archived log file name=/lxm/ora11g/transportdest/1_7_936264966.dbf RECID=2 STAMP=936271966

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

Finished recover at 2017-02-18 11:32:48

 

database opened

 

contents of Memory Script:

{

# make read only the tablespace that will be exported

sql clone 'alter tablespace  APP1TBS read only';

sql clone 'alter tablespace  APP2TBS read only';

sql clone 'alter tablespace  IDXTBS read only';

# create directory for datapump export

sql clone "create or replace directory STREAMS_DIROBJ_DPDIR as ''

/lxm/ora11g/transportdest''";

}

executing Memory Script

 

sql statement: alter tablespace  APP1TBS read only

 

sql statement: alter tablespace  APP2TBS read only

 

sql statement: alter tablespace  IDXTBS read only

 

sql statement: create or replace directory STREAMS_DIROBJ_DPDIR as ''/lxm/ora11g/transportdest''

 

Performing export of metadata...

   EXPDP> Starting "SYS"."TSPITR_EXP_wBBm": 

   EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK

   EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE

   EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX

   EXPDP> Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS

   EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

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

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

   EXPDP> Dump file set for SYS.TSPITR_EXP_wBBm is:

   EXPDP>   /lxm/ora11g/transportdest/dmpfile.dmp

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

   EXPDP> Datafiles required for transportable tablespace APP1TBS:

   EXPDP>   /lxm/ora11g/transportdest/o1_mf_app1tbs_dbhj05ll_.dbf

   EXPDP> Datafiles required for transportable tablespace APP2TBS:

   EXPDP>   /lxm/ora11g/transportdest/o1_mf_app2tbs_dbhj05nz_.dbf

   EXPDP> Datafiles required for transportable tablespace IDXTBS:

   EXPDP>   /lxm/ora11g/transportdest/o1_mf_idxtbs_dbhj05o8_.dbf

   EXPDP> Job "SYS"."TSPITR_EXP_wBBm" successfully completed at 11:34:58

Export completed

 

/*

   The following command may be used to import the tablespaces.

   Substitute values for <logon> and <directory>.

   impdp <logon> directory=<directory> dumpfile= 'dmpfile.dmp' transport_datafiles= /lxm/ora11g/transportdest/o1_mf_app1tbs_dbhj05ll_.dbf, /lxm/ora11g/transportdest/o1_mf_app2tbs_dbhj05nz_.dbf, /lxm/ora11g/transportdest/o1_mf_idxtbs_dbhj05o8_.dbf

*/

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

-- Start of sample PL/SQL script for importing the tablespaces

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

-- creating directory objects

CREATE DIRECTORY STREAMS$DIROBJ$1 AS  '/lxm/ora11g/transportdest/';

CREATE DIRECTORY STREAMS$DIROBJ$DPDIR AS  '/lxm/ora11g/transportdest';

/* 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 :=  'o1_mf_app1tbs_dbhj05ll_.dbf';

  tbs_files( 1).directory_object :=  'STREAMS$DIROBJ$1';

  tbs_files( 2).file_name :=  'o1_mf_app2tbs_dbhj05nz_.dbf';

  tbs_files( 2).directory_object :=  'STREAMS$DIROBJ$1';

  tbs_files( 3).file_name :=  'o1_mf_idxtbs_dbhj05o8_.dbf';

  tbs_files( 3).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

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

 

Removing automatic instance

shutting down automatic instance

database closed

database dismounted

Oracle instance shut down

Automatic instance removed

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_temp_dbhj31y7_.tmp deleted

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/onlinelog/o1_mf_3_dbhj30z7_.log deleted

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/onlinelog/o1_mf_2_dbhj30m3_.log deleted

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/onlinelog/o1_mf_1_dbhj3090_.log deleted

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_sysaux_dbhj055q_.dbf deleted

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_undotbs1_dbhj058d_.dbf deleted

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/datafile/o1_mf_system_dbhj055o_.dbf deleted

auxiliary instance file /lxm/ora11g/transportdest/ORA11G/controlfile/o1_mf_dbhhzqsd_.ctl deleted

 

RMAN>

 

 

 

 

至此,已和源庫沒有任何關係。

一.9  傳輸檔案target

這裡需要傳輸轉儲元檔案和資料檔案到目標庫

 

一.9.1  檢視目標庫資料檔案位置和匯入目錄

[oracle@rhel6 ~]$ export ORACLE_SID=orclasm

 

[oracle@rhel6_lhr dpdump]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on 星期三 2月 3 20:17:58 2016

 

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

 

 

連線到:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.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> set line 9999

SQL> col directory_name for a28

SQL> col directory_path for a100

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>

 

 

 

 

一.9.2  拷貝檔案到目標庫相應位置並修改檔案許可權

wpsCD7.tmp 

 

[root@rhel6_lhr dpdump]# ll

total 30856

-rw-r--r-- 1 root root   110592 Feb 18  2017 dmpfile.dmp

-rw-r--r-- 1 root root     2458 Feb 18  2017 impscrpt.sql

-rw-r--r-- 1 root root 10493952 Feb 18  2017 o1_mf_app1tbs_dbhj05ll_.dbf

-rw-r--r-- 1 root root 10493952 Feb 18  2017 o1_mf_app2tbs_dbhj05nz_.dbf

-rw-r--r-- 1 root root 10493952 Feb 18  2017 o1_mf_idxtbs_dbhj05o8_.dbf

[root@rhel6_lhr dpdump]# chown oracle:dba *

[root@rhel6_lhr dpdump]# ll

total 30856

-rw-r--r-- 1 oracle dba   110592 Feb 18  2017 dmpfile.dmp

-rw-r--r-- 1 oracle dba     2458 Feb 18  2017 impscrpt.sql

-rw-r--r-- 1 oracle dba 10493952 Feb 18  2017 o1_mf_app1tbs_dbhj05ll_.dbf

-rw-r--r-- 1 oracle dba 10493952 Feb 18  2017 o1_mf_app2tbs_dbhj05nz_.dbf

-rw-r--r-- 1 oracle dba 10493952 Feb 18  2017 o1_mf_idxtbs_dbhj05o8_.dbf

[root@rhel6_lhr dpdump]#

 

 

 

 

一.10  target端轉換位元組序

 

 

 

 

[oracle@rhel6_lhr dpdump]$ rman target /

 

恢復管理器: Release 11.2.0.3.0 - Production on 星期三 2月 3 20:39:19 2016

 

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

 

已連線到目標資料庫: ORCLASM (DBID=3424884828)

 

RMAN> CONVERT DATAFILE

2> "/u01/app/oracle/admin/orclasm/dpdump/o1_mf_app1tbs_dbhj05ll_.dbf",

3> "/u01/app/oracle/admin/orclasm/dpdump/o1_mf_app2tbs_dbhj05nz_.dbf",

4> "/u01/app/oracle/admin/orclasm/dpdump/o1_mf_idxtbs_dbhj05o8_.dbf"

5> TO PLATFORM="Linux x86 64-bit"

6> FROM PLATFORM="AIX-Based Systems (64-bit)"

7> FORMAT '+DATA';

 

啟動 conversion at target 於 2016-02-03 20:39:22

使用目標資料庫控制檔案替代恢復目錄

分配的通道: ORA_DISK_1

通道 ORA_DISK_1: SID=30 裝置型別=DISK

分配的通道: ORA_DISK_2

通道 ORA_DISK_2: SID=415 裝置型別=DISK

通道 ORA_DISK_1: 啟動資料檔案轉換

輸入檔名=/u01/app/oracle/admin/orclasm/dpdump/o1_mf_app1tbs_dbhj05ll_.dbf

通道 ORA_DISK_2: 啟動資料檔案轉換

輸入檔名=/u01/app/oracle/admin/orclasm/dpdump/o1_mf_app2tbs_dbhj05nz_.dbf

已轉換的資料檔案 = +DATA/orclasm/datafile/app1tbs.301.902867963

通道 ORA_DISK_1: 資料檔案轉換完畢, 經過時間: 00:00:03

通道 ORA_DISK_1: 啟動資料檔案轉換

輸入檔名=/u01/app/oracle/admin/orclasm/dpdump/o1_mf_idxtbs_dbhj05o8_.dbf

已轉換的資料檔案 = +DATA/orclasm/datafile/app2tbs.300.902867963

通道 ORA_DISK_2: 資料檔案轉換完畢, 經過時間: 00:00:03

已轉換的資料檔案 = +DATA/orclasm/datafile/idxtbs.299.902867967

通道 ORA_DISK_1: 資料檔案轉換完畢, 經過時間: 00:00:01

完成 conversion at target 於 2016-02-03 20:39:27

 

RMAN>

一.11  開始匯入

 

一.11.1  建立source庫的2個使用者並賦許可權

如果不建立使用者會報如下的錯誤:

ORA-39123: Data Pump transportable tablespace job aborted

ORA-29342: user USER_APP1 does not exist in the database

 

create user user_app1 identified by user_app1;

 

 

SYS@orclasm> create user user_app1 identified by user_app1;

 

User created.

 

SYS@orclasm> create user user_app2 identified by user_app2;

 

User created.

 

SYS@orclasm>  grant connect , resource to user_app1;

 

Grant succeeded.

 

SYS@orclasm>  grant connect , resource to user_app2;

 

Grant succeeded.

 

SYS@orclasm>  exit

 

 

一.11.2  開始匯入

檔案內容如下:

 

[oracle@rhel6_lhr dpdump]$ impdp \'/ as sysdba \' DUMPFILE=dmpfile.dmp DIRECTORY=DATA_PUMP_DIR TRANSPORT_DATAFILES='+DATA/orclasm/datafile/app1tbs.301.902867963','+DATA/orclasm/datafile/app2tbs.300.902867963','+DATA/orclasm/datafile/idxtbs.299.902867967' LOGFILE=impdp_tts_rman_20160203.log

 

Import: Release 11.2.0.3.0 - Production on 星期三 2月 3 20:41:47 2016

 

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

 

連線到: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

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

and Real Application Testing options

已成功載入/解除安裝了主表 "SYS"."SYS_IMPORT_TRANSPORTABLE_01"

啟動 "SYS"."SYS_IMPORT_TRANSPORTABLE_01":  "/******** AS SYSDBA" DUMPFILE=dmpfile.dmp DIRECTORY=DATA_PUMP_DIR TRANSPORT_DATAFILES=+DATA/orclasm/datafile/app1tbs.301.902867963,+DATA/orclasm/datafile/app2tbs.300.902867963,+DATA/orclasm/datafile/idxtbs.299.902867967 LOGFILE=impdp_tts_rman_20160203.log

處理物件型別 TRANSPORTABLE_EXPORT/PLUGTS_BLK

處理物件型別 TRANSPORTABLE_EXPORT/TABLE

處理物件型別 TRANSPORTABLE_EXPORT/INDEX/INDEX

處理物件型別 TRANSPORTABLE_EXPORT/INDEX_STATISTICS

處理物件型別 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

作業 "SYS"."SYS_IMPORT_TRANSPORTABLE_01" 已於 20:41:59 成功完成

 

[oracle@rhel6_lhr dpdump]$

 

一.11.3  檢視目標平臺資訊

 

 

[oracle@rhel6_lhr dpdump]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on 星期三 2月 3 20:27:41 2016

 

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

 

 

連線到:

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

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

and Real Application Testing options

 

SYS@orclasm >  select tablespace_name,status from dba_tablespaces;

 

TABLESPACE_NAME                STATUS

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

SYSTEM                         ONLINE

SYSAUX                         ONLINE

UNDOTBS1                       ONLINE

TEMP                           ONLINE

USERS                          ONLINE

EXAMPLE                        ONLINE

TS_LHR                         ONLINE

ENCRYPTED_TS                   ONLINE

GOLDENGATE                     ONLINE

APP1TBS                        READ ONLY

APP2TBS                        READ ONLY

IDXTBS                         READ ONLY

 

已選擇12行。

 

SYS@orclasm >

 

SYS@orclasm > alter tablespace APP1TBS read write;

 

表空間已更改。

 

SYS@orclasm > alter tablespace APP2TBS read write;

 

表空間已更改。

 

SYS@orclasm > alter tablespace IDXTBS read write;

 

表空間已更改。

 

SYS@orclasm > select tablespace_name,status from dba_tablespaces;

 

TABLESPACE_NAME                STATUS

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

SYSTEM                         ONLINE

SYSAUX                         ONLINE

UNDOTBS1                       ONLINE

TEMP                           ONLINE

USERS                          ONLINE

EXAMPLE                        ONLINE

TS_LHR                         ONLINE

ENCRYPTED_TS                   ONLINE

GOLDENGATE                     ONLINE

APP1TBS                        ONLINE

APP2TBS                        ONLINE

IDXTBS                         ONLINE

 

已選擇12行。

 

SYS@orclasm >

 

SYS@orclasm> set line 9999 pagesize 9999

SYS@orclasm> 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行。

 

SYS@orclasm> select * from scott.app2_tab;

 

    DEPTNO DNAME          LOC

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

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 SALES          CHICAGO

        40 OPERATIONS     BOSTON

 

SYS@orclasm > 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

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

USER_APP1                      IDX_EMP_ENAME                  APP1_TAB                       IDXTBS

USER_APP2                      IDX_DEPT_DNAME                 APP2_TAB                       IDXTBS

 

SYS@orclasm >

SYS@orclasm > set line 9999

SYS@orclasm > 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.850260145

SYSAUX                         +DATA/orclasm/datafile/sysaux.257.850260145

UNDOTBS1                       +DATA/orclasm/datafile/undotbs1.258.851526539

USERS                          +DATA/orclasm/datafile/users.259.850260147

EXAMPLE                        +DATA/orclasm/datafile/example.265.850260295

APP1TBS                        +DATA/orclasm/datafile/app1tbs.301.902867963

APP2TBS                        +DATA/orclasm/datafile/app2tbs.300.902867963

TS_LHR                         +DATA/orclasm/datafile/ts_lhr.269.852632495

ENCRYPTED_TS                   +DATA/orclasm/datafile/encrypted_ts.272.854650889

GOLDENGATE                     +DATA/orclasm/datafile/goldengate.273.862829891

IDXTBS                         +DATA/orclasm/datafile/idxtbs.299.902867967

TS_LHR                         +DATA/orclasm/datafile/ts_lhr.284.869738273

USERS                          +FRA/orclasm/datafile/users.449.880121199

SYSTEM                         +FRA/orclasm/datafile/system.349.880121287

 

已選擇14行。

 

SYS@orclasm >

 

 

至此說明3個表空間已經完全由AIX平臺遷移到Linux平臺上。

 

 

 

 

 

 

 

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

 

 

一.12  總結

 

到此所有的處理算是基本完畢,過程很簡單,但是不同的場景處理方式有很多種,我們應該學會靈活變通。

 

 

 

一.13  About Me

 

...........................................................................................................................................................................................

本文作者:小麥苗,只專注於資料庫的技術,更注重技術的運用

ITPUB BLOG:http://blog.itpub.net/26736162

本文地址:http://blog.itpub.net/26736162/viewspace-1987961/

本文pdf版:http://yunpan.cn/cdEQedhCs2kFz (提取碼:ed9b)

QQ:642808185 若加QQ請註明所正在讀的文章標題

2016-01-26 10:00~ 2016-02-06 19:00 在中行完成

<版權所有,文章允許轉載,但須以連結方式註明源地址,否則追究法律責任!>

...........................................................................................................................................................................................

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26736162/viewspace-1987961/,如需轉載,請註明出處,否則將追究法律責任。

相關文章