Oracle 不同平臺間表空間遷移

wuweilong發表於2011-11-16
       平臺環境:
  1、源庫:
        Windows Service 2003 SP2 x86
        Oracle Service 10.2.0.4 x86
 
   2、目標庫
         Redhat Linux   5.5  X64
         Oracle Service 10.2.0.5 
 
   3、檢查目標資料庫的系統環境

3、檢查目標系統環境
記憶體大小:
[root@lgxt ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3937       2625       1311          0        184       1544
-/+ buffers/cache:        896       3040
Swap:         5951          0       5951
磁碟空間,規劃表空間存放路徑
[root@lgxt ~]# df -h
檔案系統              容量        已用 可用 已用% 掛載點
/dev/mapper/VolGroup00-LogVol00   33G   12G   20G  39% /
/dev/sda1                         99M   13M   82M  14% /boot
tmpfs                             2.0G     0  2.0G   0% /dev/shm
/dev/mapper/data1-data1           195G  6.5G  179G   4% /data1
/dev/mapper/data2-data2           196G  1.4G  184G   1% /data2
/dev/mapper/data3-data3           214G  188M  203G   1% /data3                   
啟動資料庫                     
[root@lgxt ~]# su - oracle
[oracle@lgxt ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Nov 11 13:16:42 2011
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size                  2097696 bytes
Variable Size             637537760 bytes
Database Buffers         1493172224 bytes
Redo Buffers               14675968 bytes
Database mounted.
Database opened.
檢查現有的表空間及狀態
SQL> set line 100
SQL> select * from v$tablespace;
       TS# NAME                           INC BIG FLA ENC
---------- ------------------------------ --- --- --- ---
         0 SYSTEM                         YES NO  YES
         1 UNDOTBS1                       YES NO  YES
         2 SYSAUX                         YES NO  YES
         4 USERS                          YES NO  YES
         3 TEMP                           NO  NO  YES

表空間的資料檔案路徑
SQL> select TABLESPACE_NAME,FILE_NAME,STATUS from dba_data_files
TABLESPACE FILE_NAME                                STATUS
---------- ---------------------------------------- ---------
USERS      /data2/oradata/lgxt/users01.dbf          AVAILABLE
SYSAUX     /data2/oradata/lgxt/sysaux01.dbf         AVAILABLE
UNDOTBS1   /data2/oradata/lgxt/undotbs01.dbf        AVAILABLE
SYSTEM     /data2/oradata/lgxt/system01.dbf         AVAILABLE    
檢查字符集
SQL> col property_value format a50
SQL> col description format a50
SQL> set line 300
SQL> select * from database_properties
PROPERTY_NAME                  PROPERTY_VALUE                                     DESCRIPTION
------------------------------ -------------------------------------------------- --------------------------------------------------
DICT.BASE                      2                                                  dictionary base tables version #
DEFAULT_TEMP_TABLESPACE        TEMP                                               Name of default temporary tablespace
DEFAULT_PERMANENT_TABLESPACE   USERS                                              Name of default permanent tablespace
NLS_LANGUAGE                   AMERICAN                                           Language
DEFAULT_TBS_TYPE               SMALLFILE                                          Default tablespace type
NO_USERID_VERIFIER_SALT        7A5EEDE64CF9425191B719548533F708
NLS_NCHAR_CHARACTERSET         AL16UTF16                                          NCHAR Character set
GLOBAL_DB_NAME                 LGXT.REGRESS.RDBMS.DEV.US.ORACLE.COM               Global database name
EXPORT_VIEWS_VERSION           8                                                  Export views revision #
DBTIMEZONE                     00:00                                              DB time zone
NLS_TERRITORY                  AMERICA                                            Territory
PROPERTY_NAME                  PROPERTY_VALUE                                     DESCRIPTION
------------------------------ -------------------------------------------------- --------------------------------------------------
NLS_CURRENCY                   $                                                  Local currency
NLS_ISO_CURRENCY               AMERICA                                            ISO currency
NLS_NUMERIC_CHARACTERS         .,                                                 Numeric characters
NLS_CHARACTERSET               ZHS16GBK                                           Character set
NLS_CALENDAR                   GREGORIAN                                          Calendar system
NLS_DATE_FORMAT                DD-MON-RR                                          Date format
NLS_DATE_LANGUAGE              AMERICAN                                           Date language
NLS_SORT                       BINARY                                             Linguistic definition
NLS_TIME_FORMAT                HH.MI.SSXFF AM                                     Time format
NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM                           Time stamp format
NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR                                 Time with timezone format
PROPERTY_NAME                  PROPERTY_VALUE                                     DESCRIPTION
------------------------------ -------------------------------------------------- --------------------------------------------------
NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR                       Timestamp with timezone format
NLS_DUAL_CURRENCY              $                                                  Dual currency symbol
NLS_COMP                       BINARY                                             NLS comparison
NLS_LENGTH_SEMANTICS           BYTE                                               NLS length semantics
NLS_NCHAR_CONV_EXCP            FALSE                                              NLS conversion exception
NLS_RDBMS_VERSION              10.2.0.5.0                                         RDBMS version for NLS parameters
WORKLOAD_CAPTURE_MODE                                                             CAPTURE implies workload capture is in progress
29 rows selected.
SQL>
 
檢查是否可以做表空間傳輸遷移,我們是Redhat Linux 5.5 X64 和 Windows Service 2003 SP2 x86 平臺,
正好這兩個平臺都是Little模式是可以無縫的進行表空間傳輸遷移,當然在10個裡面模式不一樣也可以遷移,在後期的實驗裡面會提到。
SQL> select * from v$transportable_platform
PLATFORM_ID PLATFORM_NAME                            ENDIAN_FORMAT
----------- ---------------------------------------- --------------
          1 Solaris[tm] OE (32-bit)                  Big
          2 Solaris[tm] OE (64-bit)                  Big
          7 Microsoft Windows IA (32-bit)            Little
         10 Linux IA (32-bit)                        Little
          6 AIX-Based Systems (64-bit)               Big
          3 HP-UX (64-bit)                           Big
          5 HP Tru64 UNIX                            Little
          4 HP-UX IA (64-bit)                        Big
         11 Linux IA (64-bit)                        Little
         15 HP Open VMS                              Little
          8 Microsoft Windows IA (64-bit)            Little
PLATFORM_ID PLATFORM_NAME                            ENDIAN_FORMAT
----------- ---------------------------------------- --------------
          9 IBM zSeries Based Linux                  Big
         13 Linux x86 64-bit                         Little
         16 Apple Mac OS                             Big
         12 Microsoft Windows x86 64-bit             Little
         17 Solaris Operating System (x86)           Little
         18 IBM Power Based Linux                    Big
         20 Solaris Operating System (x86-64)        Little
         19 HP IA Open VMS                           Little
19 rows selected.
四、檢查源庫環境:
1、檢視源庫的表空間及使用者名稱相關狀態
SQL> col username format a12
SQL> select username,default_tablespace,temporary_tablespace,created,account_status from dba_users;
USERNAME     DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED    ACCOUNT_STATUS
------------ ------------------------------ ------------------------------ ---------- --------------------------------
SYS          SYSTEM                         TEMP                           12-5月 -02 OPEN
SYSTEM       SYSTEM                         TEMP                           12-5月 -02 OPEN
DBSNMP       SYSTEM                         TEMP                           12-5月 -02 OPEN
JXTELE_HOMS  HOMS                           TEMP                           23-8月 -10 OPEN
SCOTT        SYSTEM                         TEMP                           12-5月 -02 OPEN
REPADMIN     USERS                          TEMP                           25-4月 -11 OPEN
ORACLEDBA    SYSTEM                         TEMP                           09-8月 -11 OPEN
ORADATA      SYSTEM                         TEMP                           09-8月 -11 OPEN
OUTLN        SYSTEM                         TEMP                           12-5月 -02 EXPIRED & LOCKED
WMSYS        SYSTEM                         TEMP                           12-5月 -02 EXPIRED & LOCKED
ORDSYS       SYSTEM                         TEMP                           12-5月 -02 EXPIRED & LOCKED
USERNAME     DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED    ACCOUNT_STATUS
------------ ------------------------------ ------------------------------ ---------- --------------------------------
ORDPLUGINS   SYSTEM                         TEMP                           12-5月 -02 EXPIRED & LOCKED
MDSYS        SYSTEM                         TEMP                           12-5月 -02 EXPIRED & LOCKED
CTXSYS       DRSYS                          TEMP                           12-5月 -02 EXPIRED & LOCKED
QS_ES        EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
QS_WS        EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
QS           EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
QS_ADM       EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
SH           EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
PM           EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
OE           EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
HR           EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
USERNAME     DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED    ACCOUNT_STATUS
------------ ------------------------------ ------------------------------ ---------- --------------------------------
RMAN         TOOLS                          TEMP                           12-5月 -02 EXPIRED & LOCKED
QS_CS        EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
QS_CB        EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
QS_CBADM     EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
QS_OS        EXAMPLE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
XDB          XDB                            TEMP                           12-5月 -02 EXPIRED & LOCKED
ANONYMOUS    XDB                            TEMP                           12-5月 -02 EXPIRED & LOCKED
WKSYS        DRSYS                          TEMP                           12-5月 -02 EXPIRED & LOCKED
WKPROXY      DRSYS                          TEMP                           12-5月 -02 EXPIRED & LOCKED
ODM          ODM                            TEMP                           12-5月 -02 EXPIRED & LOCKED
ODM_MTR      ODM                            TEMP                           12-5月 -02 EXPIRED & LOCKED
USERNAME     DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED    ACCOUNT_STATUS
------------ ------------------------------ ------------------------------ ---------- --------------------------------
OLAPSYS      CWMLITE                        TEMP                           12-5月 -02 EXPIRED & LOCKED
已選擇34行。
2、檢查表空間大小
SQL>
SQL> select file_id,file_name,tablespace_name ,bytes/1024/1024 "Size M" from dba_data_files;
   FILE_ID FILE_NAME                                TABLESPACE_NAME          Size M
---------- ---------------------------------------- -------------------- ----------
         1 E:\ORACLE\ORADATA\HOMS\SYSTEM01.DBF      SYSTEM                     4960
         2 E:\ORACLE\ORADATA\HOMS\UNDOTBS01.DBF     UNDOTBS1                    435
         3 E:\ORACLE\ORADATA\HOMS\CWMLITE01.DBF     CWMLITE                      20
         4 E:\ORACLE\ORADATA\HOMS\DRSYS01.DBF       DRSYS                        20
         5 E:\ORACLE\ORADATA\HOMS\EXAMPLE01.DBF     EXAMPLE                 149.375
         6 E:\ORACLE\ORADATA\HOMS\INDX01.DBF        INDX                         25
         7 E:\ORACLE\ORADATA\HOMS\ODM01.DBF         ODM                          20
         8 E:\ORACLE\ORADATA\HOMS\TOOLS01.DBF       TOOLS                        10
         9 E:\ORACLE\ORADATA\HOMS\USERS01.DBF       USERS                        25
        10 E:\ORACLE\ORADATA\HOMS\XDB01.DBF         XDB                      38.125
        11 E:\ORACLE\ORADATA\HOMS\HOMS.ORA          HOMS                       3000
   FILE_ID FILE_NAME                                TABLESPACE_NAME          Size M
---------- ---------------------------------------- -------------------- ----------
        12 E:\ORACLE\ORADATA\HOMS\XDB02.DBF         XDB                        2048
        13 E:\ORACLE\ORADATA\HOMS\HOMS01.ORA        HOMS                       3000
        14 E:\ORACLE\ORADATA\HOMS\HOMS02.ORA        HOMS                       3000
已選擇14行。
 
3、檢查表空間狀態
SQL> desc v$tablespace;
 名稱                            是否為空? 型別
 --------------------------------------- -------- ------
 TS#                                      NUMBER
 NAME                                     VARCHAR2(30)
 INCLUDED_IN_DATABASE_BACKUP              VARCHAR2(3)
SQL> select * from v$tablespace;
       TS# NAME                           INC
---------- ------------------------------ ---
         3 CWMLITE                        YES
         4 DRSYS                          YES
         5 EXAMPLE                        YES
         6 INDX                           YES
         7 ODM                            YES
         0 SYSTEM                         YES
         8 TOOLS                          YES
         1 UNDOTBS1                       YES
         9 USERS                          YES
        10 XDB                            YES
         2 TEMP                           YES
       TS# NAME                           INC
---------- ------------------------------ ---
        12 HOMS                           YES
已選擇12行。
4、檢查字符集,源庫和目標庫是一樣的,可以做資料庫遷移
SQL> set line 200
SQL> col property_value format a50
SQL> col description format a50
SQL> l
  1* select * from database_properties
SQL> r
  1* select * from database_properties
PROPERTY_NAME                  PROPERTY_VALUE                                     DESCRIPTION
------------------------------ -------------------------------------------------- --------------------------------------------------
DICT.BASE                      2                                                  dictionary base tables version #
DEFAULT_TEMP_TABLESPACE        TEMP                                               Name of default temporary tablespace
DBTIMEZONE                     -07:00                                             DB time zone
NLS_LANGUAGE                   AMERICAN                                           Language
NLS_TERRITORY                  AMERICA                                            Territory
NLS_CURRENCY                   $                                                  Local currency
NLS_ISO_CURRENCY               AMERICA                                            ISO currency
NLS_NUMERIC_CHARACTERS         .,                                                 Numeric characters
NLS_CHARACTERSET               ZHS16GBK                                           Character set
NLS_CALENDAR                   GREGORIAN                                          Calendar system
NLS_DATE_FORMAT                DD-MON-RR                                          Date format
PROPERTY_NAME                  PROPERTY_VALUE                                     DESCRIPTION
------------------------------ -------------------------------------------------- --------------------------------------------------
NLS_DATE_LANGUAGE              AMERICAN                                           Date language
NLS_SORT                       BINARY                                             Linguistic definition
NLS_TIME_FORMAT                HH.MI.SSXFF AM                                     Time format
NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM                           Time stamp format
NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR                                 Time with timezone format
NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR                       Timestamp with timezone format
NLS_DUAL_CURRENCY              $                                                  Dual currency symbol
NLS_COMP                       BINARY                                             NLS comparison
NLS_LENGTH_SEMANTICS           BYTE                                               NLS length semantics
NLS_NCHAR_CONV_EXCP            FALSE                                              NLS conversion exception
NLS_NCHAR_CHARACTERSET         AL16UTF16                                          NCHAR Character set
PROPERTY_NAME                  PROPERTY_VALUE                                     DESCRIPTION
------------------------------ -------------------------------------------------- --------------------------------------------------
NLS_RDBMS_VERSION              9.2.0.1.0                                          RDBMS version for NLS parameters
GLOBAL_DB_NAME                 HOMS.JXTELE.COM.CN                                 Global database name
EXPORT_VIEWS_VERSION           8                                                  Export views revision #
已選擇25行。
SQL>

只需要遷移一個使用者下的所有資料 JXTELE_HOMES
SQL> select username,default_tablespace,temporary_tablespace,created,account_status from dba_users where USERNAME= 'JXTELE_HOMS';
USERNAME     DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED    ACCOUNT_STATUS
------------ ------------------------------ ------------------------------ ---------- --------------------------------
JXTELE_HOMS  HOMS                           TEMP                           23-8月 -10 OPEN
SQL>

SQL> alter tablespace HOMS read only;
表空間已更改。
SQL>
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME      STATUS
-------------------- ---------
SYSTEM               ONLINE
UNDOTBS1             ONLINE
TEMP                 ONLINE
CWMLITE              ONLINE
DRSYS                ONLINE
EXAMPLE              ONLINE
INDX                 ONLINE
ODM                  ONLINE
TOOLS                ONLINE
USERS                ONLINE
XDB                  ONLINE
TABLESPACE_NAME      STATUS
-------------------- ---------
HOMS                 READ ONLY
已選擇12行。
SQL>
SQL> exec dbms_tts.transport_set_check ('HOMS',true);
PL/SQL 過程已成功完成。
SQL> select * from transport_set_violations;
no rows selected
SQL>

C:\>exp "'"/ as sysdba"'" wner=JXTELE_HOMS file=exp_HOMS.dmp log=exp_HOMS.LOG;
Export: Release 9.2.0.1.0 - Production on 星期五 11月 11 15:24:04 2011
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

連線到: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
已匯出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集
即將匯出指定的使用者...
. 正在匯出 pre-schema 過程物件和操作
. 正在匯出使用者 JXTELE_HOMS 的外部函式庫名稱
. 匯出 PUBLIC 型別同義詞
. 匯出私有型別同義詞
. 正在匯出使用者 JXTELE_HOMS 的物件型別定義
即將匯出 JXTELE_HOMS 的物件 ...
. 正在匯出資料庫連結
. 正在匯出序號
. 正在匯出群集定義
. 即將匯出 JXTELE_HOMS 的表透過常規路徑 ...
. . 正在匯出表                           ADMIN       1734 行被匯出
. . 正在匯出表                        BULLETIN        183 行被匯出
. . 正在匯出表                  CHECKCONDITION          0 行被匯出
. . 正在匯出表                     COUNTRYINFO        235 行被匯出
. . 正在匯出表              DICTIONARY_APANAGE          6 行被匯出
. . 正在匯出表           DICTIONARY_CHINA_CARD          7 行被匯出
. . 正在匯出表              DICTIONARY_COUNTRY       3527 行被匯出
. . 正在匯出表           DICTIONARY_HOTELGRADE          6 行被匯出
. . 正在匯出表   DICTIONARY_INTERNATIONAL_CARD         51 行被匯出
. . 正在匯出表               DICTIONARY_NATION         58 行被匯出
. . 正在匯出表            DICTIONARY_ORDERCASE          4 行被匯出
. . 正在匯出表            DICTIONARY_PENALCASE          5 行被匯出
. . 正在匯出表        DICTIONARY_POSITIONGRADE          5 行被匯出
. . 正在匯出表               DICTIONARY_PUNISH          5 行被匯出
. . 正在匯出表                 DICTIONARY_STAR          6 行被匯出
. . 正在匯出表               DICTIONARY_STATUS          5 行被匯出
. . 正在匯出表            DICTIONARY_USERSNAME       1736 行被匯出
. . 正在匯出表       DICTIONARY_USERSNAME_BACK       1328 行被匯出
. . 正在匯出表            DICTIONARY_VISA_UNIT        255 行被匯出
. . 正在匯出表                          ESCAPE        772 行被匯出
. . 正在匯出表                FALSECARDPROCESS          1 行被匯出
. . 正在匯出表              FUNCTIONDEPARTMENT          0 行被匯出
. . 正在匯出表                           HOTEL       1502 行被匯出
. . 正在匯出表                     HOTELCAMERA          0 行被匯出
. . 正在匯出表                   HOTELEMPLOYEE        154 行被匯出
. . 正在匯出表                 HOTELSAFERECORD          3 行被匯出
. . 正在匯出表              HOTEL_IN_PASSENGER     331667 行被匯出
. . 正在匯出表     HOTEL_IN_PASSENGER_20090610     304723 行被匯出
. . 正在匯出表               HOTEL_RECORD_CASE         32 行被匯出
. . 正在匯出表           HOTEL_RECORD_CASE_xzh          0 行被匯出
. . 正在匯出表             HOTEL_RECORD_PUNISH         13 行被匯出
. . 正在匯出表                    IN_PASSENGER     839010 行被匯出
. . 正在匯出表           IN_PASSENGER_20100401    3383175 行被匯出
. . 正在匯出表           IN_PASSENGER_20110801     545764 行被匯出
. . 正在匯出表            IN_PASSENGER_ALLBACK    1062117 行被匯出
. . 正在匯出表       IN_PASSENGER_ALLBACK_2009     866094 行被匯出
. . 正在匯出表               IN_PASSENGER_BACK    2767597 行被匯出
. . 正在匯出表           IN_PASSENGER_BACK2008     237476 行被匯出
. . 正在匯出表             IN_PASSENGER_ESCAPE          3 行被匯出
. . 正在匯出表                           LOGIN      11815 行被匯出
. . 正在匯出表                         MESSAGE       2440 行被匯出
. . 正在匯出表                 MESSAGETYPEINFO          3 行被匯出
. . 正在匯出表                     MESSAGE_xzh        342 行被匯出
. . 正在匯出表                    OLDPASSENGER     293184 行被匯出
. . 正在匯出表                   OUT_PASSENGER      12220 行被匯出
. . 正在匯出表                      PLAN_TABLE          0 行被匯出
. . 正在匯出表                   POLICESTATION         39 行被匯出
. . 正在匯出表                         POPEDOM         18 行被匯出
. . 正在匯出表                        PORTINFO          3 行被匯出
. . 正在匯出表                     PUBLISHINFO          0 行被匯出
. . 正在匯出表                     RESULTCHECK       1806 行被匯出
. . 正在匯出表                        ROLEINFO          4 行被匯出
. . 正在匯出表                        VISAINFO         16 行被匯出
. . 正在匯出表                           WXJCS        237 行被匯出
. 正在匯出同義詞
. 正在匯出檢視
. 正在匯出儲存的過程
. 正在匯出運算子
. 正在匯出引用完整性約束條件
. 正在匯出觸發器
. 正在匯出索引型別
. 正在匯出點陣圖, 功能性索引和可擴充套件索引
. 正在匯出後期表活動
. 正在匯出實體化檢視
. 正在匯出快照日誌
. 正在匯出作業佇列
. 正在匯出重新整理組和子組
. 正在匯出維
. 正在匯出 post-schema 過程物件和操作
. 正在匯出統計
在沒有警告的情況下成功終止匯出。
C:\>
SQL> alter tablespace HOMS read write;
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME      STATUS
-------------------- ---------
SYSTEM               ONLINE
UNDOTBS1             ONLINE
TEMP                 ONLINE
CWMLITE              ONLINE
DRSYS                ONLINE
EXAMPLE              ONLINE
INDX                 ONLINE
ODM                  ONLINE
TOOLS                ONLINE
USERS                ONLINE
XDB                  ONLINE
HOMS                 ONLINE

五、把匯出來的dmp檔案複製到目標庫上,進行匯入操作:
在目標庫上執行如下命令
1、檢查現有表空間
SQL> select * from v$tablespace order by TS#;
       TS# NAME                           INC BIG FLA ENC
---------- ------------------------------ --- --- --- ---
         0 SYSTEM                         YES NO  YES
         1 UNDOTBS1                       YES NO  YES
         2 SYSAUX                         YES NO  YES
         3 TEMP                           NO  NO  YES
         4 USERS                          YES NO  YES
2、建立一個8G的表空間
SQL> create tablespace HOMS datafile '/data2/oradata/lgxt/HOMS001.dbf' size 8192m;
表空間已建立。

SQL> select * from v$tablespace order by TS#;
       TS# NAME                           INC BIG FLA ENC
---------- ------------------------------ --- --- --- ---
         0 SYSTEM                         YES NO  YES
         1 UNDOTBS1                       YES NO  YES
         2 SYSAUX                         YES NO  YES
         3 TEMP                           NO  NO  YES
         4 USERS                          YES NO  YES
         6 HOMS                           YES NO  YES
已選擇6行。
3、建立業務使用者
SQL> create user JXTELE_HOMS identified by "123456" default tablespace HOMS;
使用者已建立。
4、授權
SQL> grant connect,resource to JXTELE_HOMS;
授權成功。
SQL> exit
C:\>imp "'"/ as sysdba"'" file=exp_HOMS.dmp log=imp_HOMS.log buffer=65500 full=y;
Import: Release 10.2.0.4.0 - Production on 星期日 11月 13 17:37:33 2011
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

連線到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
經由常規路徑由 EXPORT:V10.02.01 建立的匯出檔案
已經完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的匯入
. 正在將 SYS 的物件匯入到 SYS
. 正在將 JXTELE_HOMS 的物件匯入到 JXTELE_HOMS
. . 正在匯入表                         "ADMIN"匯入了        1734 行
. . 正在匯入表                      "BULLETIN"匯入了         184 行
. . 正在匯入表                "CHECKCONDITION"匯入了           0 行
. . 正在匯入表                   "COUNTRYINFO"匯入了         235 行
. . 正在匯入表            "DICTIONARY_APANAGE"匯入了           6 行
. . 正在匯入表         "DICTIONARY_CHINA_CARD"匯入了           7 行
. . 正在匯入表            "DICTIONARY_COUNTRY"匯入了        3527 行
. . 正在匯入表         "DICTIONARY_HOTELGRADE"匯入了           6 行
. . 正在匯入表  "DICTIONARY_INTERNATIONAL_CARD"匯入了          51 行
. . 正在匯入表             "DICTIONARY_NATION"匯入了          58 行
. . 正在匯入表          "DICTIONARY_ORDERCASE"匯入了           4 行
. . 正在匯入表          "DICTIONARY_PENALCASE"匯入了           5 行
. . 正在匯入表      "DICTIONARY_POSITIONGRADE"匯入了           5 行
. . 正在匯入表             "DICTIONARY_PUNISH"匯入了           5 行
. . 正在匯入表               "DICTIONARY_STAR"匯入了           6 行
. . 正在匯入表             "DICTIONARY_STATUS"匯入了           5 行
. . 正在匯入表          "DICTIONARY_USERSNAME"匯入了        1736 行
. . 正在匯入表     "DICTIONARY_USERSNAME_BACK"匯入了        1328 行
. . 正在匯入表          "DICTIONARY_VISA_UNIT"匯入了         255 行
. . 正在匯入表                        "ESCAPE"匯入了         772 行
. . 正在匯入表              "FALSECARDPROCESS"匯入了           1 行
. . 正在匯入表            "FUNCTIONDEPARTMENT"匯入了           0 行
. . 正在匯入表                         "HOTEL"匯入了        1502 行
. . 正在匯入表                   "HOTELCAMERA"匯入了           0 行
. . 正在匯入表                 "HOTELEMPLOYEE"匯入了         154 行
. . 正在匯入表               "HOTELSAFERECORD"匯入了           3 行
. . 正在匯入表            "HOTEL_IN_PASSENGER"匯入了      331667 行
. . 正在匯入表   "HOTEL_IN_PASSENGER_20090610"匯入了      304723 行
. . 正在匯入表             "HOTEL_RECORD_CASE"匯入了          32 行
. . 正在匯入表         "HOTEL_RECORD_CASE_xzh"匯入了           0 行
. . 正在匯入表           "HOTEL_RECORD_PUNISH"匯入了          13 行
. . 正在匯入表                  "IN_PASSENGER"匯入了      853613 行
. . 正在匯入表         "IN_PASSENGER_20100401"匯入了     3383175 行
. . 正在匯入表         "IN_PASSENGER_20110801"匯入了      545764 行
. . 正在匯入表          "IN_PASSENGER_ALLBACK"匯入了     1062117 行
. . 正在匯入表     "IN_PASSENGER_ALLBACK_2009"匯入了      866094 行
. . 正在匯入表             "IN_PASSENGER_BACK"匯入了     2767597 行
. . 正在匯入表         "IN_PASSENGER_BACK2008"匯入了      237476 行
. . 正在匯入表           "IN_PASSENGER_ESCAPE"匯入了           3 行
. . 正在匯入表                         "LOGIN"匯入了       11816 行
. . 正在匯入表                       "MESSAGE"匯入了        2440 行
. . 正在匯入表               "MESSAGETYPEINFO"匯入了           3 行
. . 正在匯入表                   "MESSAGE_xzh"匯入了         342 行
. . 正在匯入表                  "OLDPASSENGER"匯入了      293186 行
. . 正在匯入表                 "OUT_PASSENGER"匯入了       12233 行
. . 正在匯入表                    "PLAN_TABLE"匯入了           0 行
. . 正在匯入表                 "POLICESTATION"匯入了          39 行
. . 正在匯入表                       "POPEDOM"匯入了          18 行
. . 正在匯入表                      "PORTINFO"匯入了           3 行
. . 正在匯入表                   "PUBLISHINFO"匯入了           0 行
. . 正在匯入表                   "RESULTCHECK"匯入了        1806 行
. . 正在匯入表                      "ROLEINFO"匯入了           4 行
. . 正在匯入表                      "VISAINFO"匯入了          16 行
. . 正在匯入表                         "WXJCS"匯入了         237 行
IMP-00041: 警告: 建立的物件帶有編譯警告
 "CREATE FORCE VIEW "JXTELE_HOMS"."INPASS_ENCAPE_BYNAMEBIRTHDAY"             "
 "        ("IN_PASSENGERCODE","HOTELCODE","CHINESENAME","SEX","BIRTHDAY","CHI"
 "NA_CARDCODE","CARDCODE","AREACODE","ADDRESS_DETAIL","IN_DATETIME","ROOMCODE"
 "","OUT_DATETIME","REGISTER_DATETIME","CREDITCARDTYPE","CREDITCARDCODE","PHO"
 "TO","EVERFLAG","CNAMEJP","CNAMEQP","CODE","IFPASS","CHECKCODESIGN","CHECKSI"
 "GN","GOCOUNT","ESCAPECODE","ESCAPE_NAME","ESCAPE_SEX","ESCAPE_BIRTHDAY","ES"
 "CAPE_IDCARD","ESCAPE_AREA","ESCAPE_ADDRESS","REASON","WATCHTIME","WATCHUNIT"
 "","SIGN","AGE","CALLPHONE","CALLTELEPHONE","WATCHUNITCODE","HOTELNAME") AS "
 "select p."IN_PASSENGERCODE",p."HOTELCODE",p."CHINESENAME",p."SEX",p."BIRTHD"
 "AY",p."CHINA_CARDCODE",p."CARDCODE",p."AREACODE",p."ADDRESS_DETAIL",p."IN_D"
 "ATETIME",p."ROOMCODE",p."OUT_DATETIME",p."REGISTER_DATETIME",p."CREDITCARDT"
 "YPE",p."CREDITCARDCODE",p."PHOTO",p."EVERFLAG",p."CNAMEJP",p."CNAMEQP",p."C"
 "ODE",p."IFPASS",p."CHECKCODESIGN",p."CHECKSIGN",p."GOCOUNT",p."SENDSIGN",e."
 ""ESCAPECODE",e."ESCAPE_NAME",e."ESCAPE_SEX",e."ESCAPE_BIRTHDAY",e."ESCAPE_I"
 "DCARD",e."ESCAPE_AREA",e."ESCAPE_ADDRESS",e."REASON",e."WATCHTIME",e."WATCH"
 "UNIT",e."SIGN",e."AGE",e."CALLPHONE",e."CALLTELEPHONE",e."WATCHUNITCODE",e."
 ""SENDSIGN",h.hotelname"
 "    from in_passenger p,escape e,hotel h"
 "   where p.chinesename=e.escape_name and p.birthday=e.escape_birthday and p"
 ".hotelcode=h.hotelcode"
成功終止匯入, 但出現警告。

連線到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
C:\>sqlplus jxtele_homs/123456
SQL*Plus: Release 10.2.0.4.0 - Production on 星期三 11月 16 15:59:48 2011
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

連線到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from tab;
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
IN_PASSENGER_20100401          TABLE
IN_PASSENGER_20110801          TABLE
IN_PASSENGER_ALLBACK           TABLE
IN_PASSENGER_ALLBACK_2009      TABLE
IN_PASSENGER_BACK              TABLE
IN_PASSENGER_BACK2008          TABLE
IN_PASSENGER_ESCAPE            TABLE
LOGIN                          TABLE
MESSAGE                        TABLE
MESSAGETYPEINFO                TABLE
MESSAGE_xzh                    TABLE
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
OLDPASSENGER                   TABLE
OUT_PASSENGER                  TABLE
PLAN_TABLE                     TABLE
POLICESTATION                  TABLE
POPEDOM                        TABLE
PORTINFO                       TABLE
PUBLISHINFO                    TABLE
RESULTCHECK                    TABLE
ROLEINFO                       TABLE
VISAINFO                       TABLE
WXJCS                          TABLE
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
INPASS_ENCAPE_BYID             VIEW
INPASS_ENCAPE_BYIDNAME         VIEW
INPASS_ENCAPE_BYNAMEBIRTHDAY   VIEW
IN_OUT_PASSSTATIC              VIEW
IN_PASSSTATIC                  VIEW
OUT_PASSSTATIC                 VIEW
ADMIN                          TABLE
BULLETIN                       TABLE
CHECKCONDITION                 TABLE
COUNTRYINFO                    TABLE
DICTIONARY_APANAGE             TABLE
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
DICTIONARY_CHINA_CARD          TABLE
DICTIONARY_COUNTRY             TABLE
DICTIONARY_HOTELGRADE          TABLE
DICTIONARY_INTERNATIONAL_CARD  TABLE
DICTIONARY_NATION              TABLE
DICTIONARY_ORDERCASE           TABLE
DICTIONARY_PENALCASE           TABLE
DICTIONARY_POSITIONGRADE       TABLE
DICTIONARY_PUNISH              TABLE
DICTIONARY_STAR                TABLE
DICTIONARY_STATUS              TABLE
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
DICTIONARY_USERSNAME           TABLE
DICTIONARY_USERSNAME_BACK      TABLE
DICTIONARY_VISA_UNIT           TABLE
ESCAPE                         TABLE
FALSECARDPROCESS               TABLE
FUNCTIONDEPARTMENT             TABLE
HOTEL                          TABLE
HOTELCAMERA                    TABLE
HOTELEMPLOYEE                  TABLE
HOTELSAFERECORD                TABLE
HOTEL_IN_PASSENGER             TABLE
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
HOTEL_IN_PASSENGER_20090610    TABLE
HOTEL_RECORD_CASE              TABLE
HOTEL_RECORD_CASE_xzh          TABLE
HOTEL_RECORD_PUNISH            TABLE
IN_PASSENGER                   TABLE
已選擇60行。
SQL>

經過檢查,資料被匯入,但是有一個IMP-00041的編譯錯誤,資料庫遷移算是成功。後期的文件中將會介紹如何處理IMP-00041這個錯誤。
 
 

 
 

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

相關文章