Oracle 傳輸表空間-EXP/IMP
Transport_Tablespace-EXP/IMP
透過傳輸表空間 (EXP/IMP 方式 ) 將 192.168.3.199 資料庫下, chenjc 使用者下的 t1 表,匯入到 192.168.3.198 資料庫下, chenjc 使用者下;
一 檢視作業系統版本,資料庫版本
192.168.3.199
[oracle@ogg1 ~]$ cat /etc/issue
Oracle Linux Server release 6.3
SQL> select * from v$version where rownum<=2;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
192.168.3.198
[oracle@ogg2 orcl]$ cat /etc/issue
Oracle Linux Server release 6.3
SQL> select * from v$version where rownum<=2;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
二 建立測試表空間,測試使用者,測試表
192.168.3.199
SQL> create tablespace chenjc datafile '/u01/app/oracle/oradata/orcl/chenjc01.dbf' size 30m autoextend on;
Tablespace created.
SQL> create user chenjc identified by chenjc default tablespace chenjc;
User created.
SQL> grant connect,resource,dba to chenjc;
Grant succeeded.
SQL> conn chenjc/chenjc
Connected.
SQL> create table t1 as select level id,sysdate as t_date from dual connect by level<=100000;
Table created.
三 檢查準備遷移的表空間是否自包含
SQL> conn /as sysdba
Connected.
SQL> execute dbms_tts.transport_set_check(ts_list=>'CHENJC',incl_constraints=>TRUE);
PL/SQL procedure successfully completed.
SQL> select * from transport_set_violations;
no rows selected
/* 無返回記錄,說明符合傳輸表空間條件*/
四 設定準備傳輸的表空間為只讀
SQL> alter tablespace chenjc read only;
Tablespace altered.
五 透過 exp 工具匯出所要傳輸表空間的原資料
[oracle@ogg1 ~]$ exp "'sys/oracle as sysdba'" file=chenjc.dmp log=chenjc.log transport_tablespace=y tablespaces=chenjc
Export: Release 11.2.0.3.0 - Production on Mon Aug 3 09:40:25 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
Note: table data (rows) will not be exported
About to export transportable tablespace metadata...
For tablespace CHENJC ...
. exporting cluster definitions
. exporting table definitions
. . exporting table T1
. exporting referential integrity constraints
. exporting triggers
. end transportable tablespace metadata export
Export terminated successfully without warnings.
/* 雙引號+ 單引號*/
/*
模擬平臺轉換(同一平臺傳輸不需要這步)
SQL> col platform_name for a35
SQL> select * from v$transportable_platform order by platform_id;
RMAN>convert tablespace "TESTSPACE" to platform 'Microsoft Windows IA (32-bit)' format 'd:\TESTSPACE01.DBF' --這個是轉換的目標地址
*/
六 將資料庫檔案和匯出的表空間原檔案複製到 192.168.3.198 伺服器
[oracle@ogg1 ~]$ scp chenjc.dmp 192.168.3.198:/home/oracle/
[oracle@ogg1 ~]$ scp /u01/app/oracle/oradata/orcl/chenjc01.dbf 192.168.3.198:/home/oracle/
192.168.3.198
[oracle@ogg2 ~]$ mv chenjc* /u01/app/oracle/oradata/orcl/
[oracle@ogg2 ~]$ cd /u01/app/oracle/oradata/orcl/
[oracle@ogg2 orcl]$ ll -rth
......
-rw-r--r-- 1 oracle oinstall 16K Aug 3 09:43 chenjc.dmp
-rw-r----- 1 oracle oinstall 31M Aug 3 09:44 chenjc01.dbf
......
七 目標資料庫建立使用者,指定表空間 ( 目標資料庫不能有和將要傳輸表空間同名的表空間 )
SQL> create user chenjc identified by chenjc default tablespace users;
User created.
SQL> grant connect,resource,dba to chenjc;
Grant succeeded.
八 透過 imp 工具匯入表空間
[oracle@ogg2 orcl]$ imp "'sys/oracle as sysdba'" file=chenjc.dmp log=chenjc.log
tablespaces=chenjc datafiles='/u01/app/oracle/oradata/orcl/chenjc01.dbf' transport_tablespace=y
Import: Release 11.2.0.3.0 - Production on Mon Aug 3 10:14:15 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
About to import transportable tablespace(s) metadata...
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SYS's objects into SYS
. importing SYS's objects into SYS
. importing CHENJC's objects into CHENJC
. . importing table "T1"
. importing SYS's objects into SYS
Import terminated successfully without warnings.
/*datafiles 必須絕對路徑*/
九 修改使用者預設表空間
SQL> alter user chenjc default tablespace chenjc;
User altered.
十 檢視
SQL> select name from v$dbfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system.dbf
/u01/app/oracle/oradata/orcl/sysaux.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/user01.dbf
/u01/app/oracle/oradata/orcl/ggm01.dbf
/u01/app/oracle/oradata/orcl/chenjc01.dbf
6 rows selected.
SQL> conn chenjc/chenjc
SQL> select id,to_char(t_date,'yyyy-mm-dd hh24:mi:ss') from t1 where rownum<=3;
ID TO_CHAR(T_DATE,'YYY
---------- -------------------
1 2015-08-03 09:27:01
2 2015-08-03 09:27:01
3 2015-08-03 09:27:01
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-1760402/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 表空間傳輸Oracle
- oracle表空間傳輸Oracle
- Oracle傳輸表空間Oracle
- imp/EXP 表空間轉換問題
- 傳輸表空間操作-OracleOracle
- Oracle傳輸表空間(TTS)OracleTTS
- Oracle 傳輸表空間-RmanOracle
- Oracle傳輸表空間學習Oracle
- Oracle 傳輸表空間-EXPDP/IMPDPOracle
- Oracle表空間傳輸詳解Oracle
- oracle 傳輸表空間一例Oracle
- Oracle可傳輸表空間測試Oracle
- exp,imp 不同表空間大欄位處理方法
- 通過oracle10g exp/imp在不同表空間間遷移資料Oracle
- MySQL 傳輸表空間MySql
- MySQL表空間傳輸MySql
- 【XTTS】Oracle傳輸表空間xtts增量方式TTSOracle
- oracle可傳輸表空間TTS小結OracleTTS
- oracle表空間傳輸的限制條件Oracle
- mysql之 表空間傳輸MySql
- 總結-表空間傳輸
- 聊聊Oracle可傳輸表空間(Transportable Tablespace)(上)Oracle
- 聊聊Oracle可傳輸表空間(Transportable Tablespace)(中)Oracle
- 聊聊Oracle可傳輸表空間(Transportable Tablespace)(下)Oracle
- Oracle TTS ORA-39322: 表空間傳輸OracleTTS
- 跨平臺表空間遷移(傳輸表空間)
- 使用Oracle可傳輸表空間的特性複製資料(7)實戰RMAN備份傳輸表空間Oracle
- Oracle imp/expOracle
- 【傳輸表空間】使用 EXPDP/IMPDP工具的傳輸表空間完成資料遷移
- 基於可傳輸表空間的表空間遷移
- 關於oracle可傳輸表空間的總結Oracle
- oracle 10g 傳輸表空間的測試Oracle 10g
- Oracle 10g的可傳輸表空間操作Oracle 10g
- 傳輸表空間自包含理解
- 【傳輸表空間】使用 EXPDP/IMPDP工具的傳輸表空間完成資料遷移[轉]
- exp_imp_遷移_同使用者_不同表空間的小記
- oracle不同版本之間exp/imp規則Oracle
- oracle跨版本與平臺執行傳輸表空間Oracle