遷移mysql資料到oracle上

來源:互聯網
上載者:User

標籤:

一.   伺服器本地安裝Oracle11G或10G

二.   在運行中輸入sqlplus /nolog,oracle中建立資料表空間。

三.   安裝完成後在運行中輸入 sql developer開啟sql developer (就是本機內建的)

四.   選擇jdk版路徑(jdk版本要和安裝的Oracle版本對應)最好選擇 Oracle安裝路徑夾下內建的jdk檔案下的包

五.   遷移mysql資料到oracle上:

下載mysql-connector-java-5.1.15-bin.jar 包。

1.添加驅動:功能表列-工具-喜好設定-資料庫-第三方JDBC驅動程式,選擇添加條目,匯入jar包。

 

 

2.視圖-串連-建立串連(Oracle資料庫)

要麼在內建的資料庫伺服器orcl下登入管理員帳號sys、或者system帳號建立新的帳號test

或者重新建立一個資料庫伺服器名也行,看自身需求。

 

 

選擇Oracle,角色選擇,連線類型選擇,,輸入串連名(任意輸入),使用者名稱和口令,點擊測試測試連接。如果狀態為成功則串連成功。點擊儲存。

這個 資料庫是我自己建立的新的資料庫伺服器名。

然後在test這個資料庫伺服器上的使用者建立一個新的使用者用來轉資料到此帳號下。

 

在這裡進行對新使用者 建立口令並授權等功能。

-- Create the user 
create user TEST

identified by TEST 
  default tablespace USERS 
  temporary tablespace TEMP 
  profile DEFAULT; 
-- Grant/Revoke role privileges 
grant connect to TEST with admin option; 
grant resource to TEST with admin option; 
-- Grant/Revoke system privileges 
grant alter any role to TEST; 
grant alter any sequence to TEST; 
grant alter any table to TEST; 
grant alter any trigger to TEST; 
grant alter tablespace to TEST; 
grant comment any table to TEST; 
grant create any sequence to TEST; 
grant create any table to TEST; 
grant create any trigger to TEST; 
grant create any view to TEST; 
grant create materialized view to TEST with admin option; 
grant create public synonym to TEST with admin option; 
grant create role to TEST; 
grant create session to TEST with admin option; 
grant create synonym to TEST with admin option; 
grant create tablespace to TEST; 
grant create user to TEST; 
grant create view to TEST with admin option; 
grant drop any role to TEST; 
grant drop any sequence to TEST; 
grant drop any table to TEST; 
grant drop any trigger to TEST; 
grant drop tablespace to TEST; 
grant drop user to TEST; 
grant grant any role to TEST; 
grant insert any table to TEST; 
grant select any table to TEST; 
grant unlimited tablespace to TEST with admin option; 
grant update any table to TEST;

 

選擇MySql,輸入串連名(任意輸入),使用者名稱,口令,單擊選擇資料庫,會把root下的資料庫顯示出來。點擊測試測試連接。如果狀態為成功則串連成功。

 

單擊儲存,儲存到左側的串連樹視圖。

 

3.移植-資料檔案庫管理-建立檔案資料庫,建立一個檔案資料庫。

假如建立的oracle資料庫下的使用者名稱為test 那就右鍵點擊 或者有的版本是關聯資料庫

 

關聯你的資料庫之後就可以了。系統自動產生很多預設的動作表函數預存程序等不用管它。

單擊選擇當前資料檔案庫

 

 

左側菜單樹會出現模型菜單。

 

 

4.按右鍵串連菜單中mysql庫中選擇移植的資料庫

 

單擊捕獲方案,即可把資料庫放入捕獲的模型中。

 

點擊關閉

 

5.點擊右鍵,選擇轉換為oracle模型

 

點擊應用

 

6.mysql的資料庫會進入轉換的模型,

 

 

選中資料庫單擊右鍵,選擇產生

 

會產生oracle格式的sql建表、建索引、建觸發器、建函數、建預存程序等的語句,注意這些語句不能通通複製執行,需要刪除一些不需要的語句在oracle中執行

凡是有

 

字樣的語句通通刪除,因為執行會報錯。

 

這三行語句是為資料表空間建立使用者和許可權,如果有資料表空間的話可以執行這三條語句,會自動連接到資料表空間執行下面的語句,如果沒有資料表空間的話需要先建立資料表空間再執行。如果已經建立了資料表空間和使用者的話可以刪除這三條語句。

可以直接在事先建立好的使用者下執行這些語句。

如果有這種建立觸發器語句的話,不需要觸發器的可以把語句刪除

 

7.單擊轉換的模型,右鍵選擇移動資料,

 

選擇源串連和目標串連,去掉勾選,目標串連就是你建立的資料庫或者是你之前用的內建的資料庫,一定要把前面的勾選項去掉。

 

單擊確定,可以把全部的mysql的對應的表的資料移植到oracle中。

這個要等待一段時間,看資料庫的大小了,中間會出現資訊的注意留意下,可以比對來源資料庫資料和轉以後的資料庫表資料是否一致。

 SQLserver轉移到Oracle比較簡單 一步到位 可以參照網上資料都可以成功的

遷移mysql資料到oracle上

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.