【原創】ORACLE_資料泵匯出匯入遷移恢複資料

來源:互聯網
上載者:User

來源資料庫伺服器上執行:

以system使用者登入執行sql

C:\Documents and Settings\Administrator>sqlplus system/password

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 3月 28 17:16:47 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

串連到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options

SQL> create directory my_dump as 'e:\dump';

目錄已建立。

SQL> quit
從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options 斷開

在CMD視窗中執行資料泵匯出:

C:\Documents and Settings\Administrator>expdp system/password directory=my_dump dumpfile=mydb.dmp SCHEMAS=(myDBA,XUNJIAN)

Export: Release 10.2.0.1.0 - 64bit Production on 星期四, 28 3月, 2013 17:24:37
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

串連到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options
啟動 "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** directory=my_dump dumpfile=mydb.dmp SCHEMAS=(myDBA,XUNJIAN)

 

完成後,將e:\dump下的mydb.dmp 檔案 複製到 149伺服器上,也放置在E:\dump下,然後進行如下操作

目標伺服器上執行:

以system使用者登入執行sql

C:\Documents and Settings\Administrator>sqlplus system/password

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 3月 28 17:16:47 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

串連到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options

SQL> create directory my_dump as 'e:\dump';
目錄已建立。

SQL> CREATE TABLESPACE BUSINESS LOGGING DATAFILE 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\myDB\BUSINESS' SIZE 10240M AUTOEXTEND ON NEXT 150M MAXSIZE 32767M EXTENT MANAGEMENT LOCAL;

資料表空間已建立。

SQL> quit
從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options 斷開

在CMD視窗中執行資料泵匯入:

C:\Documents and Settings\Administrator>impdp system/password directory=my_dump dumpfile=mydb.dmp SCHEMAS=(myDBA,XUNJIAN)

Export: Release 10.2.0.1.0 - 64bit Production on 星期四, 28 3月, 2013 17:24:37
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
串連到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options
啟動 "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** directory=my_dump dumpfile=mydb.dmp SCHEMAS=(myDBA,XUNJIAN)

另外的物理遷移方法,適用於同構資料庫:
1、停止原始伺服器上的Oracle服務,在服務控制台
2、停止目標伺服器上的Oracle服務,在服務控制台
3、備份目標伺服器的E:\oracle\product\10.2.0\oradata\mydb為mydb_bak

4、飛秋傳輸或者複製原始伺服器的E:\oracle\product\10.2.0\oradata\mydb檔案夾到目標伺服器對應路徑E:\oracle\product\10.2.0\oradata\mydb

5、啟動目標伺服器的Oracle服務,在服務控制台
6、執行案頭的test.bat
7、在提示符後輸入@c:\test.sql
8、位於c:\下test.sql檔案的內容為:select * from all_tables;
9、如果開始查詢資料,則說明遷移成功;
10、如果不成功,則停止目標伺服器的Oracle服務,在服務控制台
11、刪除mydb,將mydb_bak改回為mydb,
12、啟動目標伺服器的Oracle服務,在服務控制台
13、然後按普通的exp方式進行資料移轉。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.