oracle 資料庫遷移

來源:互聯網
上載者:User

標籤:資料庫地址   oracle   replace   使用者名稱   create   

PL/SQL Release 11.2.0.4.0 - Production匯出版本,資料庫地址10.36.40.53


PL/SQL Release 11.2.0.4.0 - Production匯入版本,資料庫地址10.36.40.74



10.36.40.53   需要遷移的資料庫地址


1. [[email protected] ~]# 建立目錄

--建立目錄

create or replace directory dumpdir as ‘/home/oracle/bak20170511‘;


2. 添加許可權

chmod w+or /home/oracle/bak20170511


3. shell oracle許可權,登陸dba

su - oracle

sqlplus / as sysdba


4. 將建立的目錄賦予需要遷移的資料庫使用者讀寫權限

-- 授權

grant read,write on directory dumpdir to mkt_standard;


5. 查詢目前使用者的資料表空間,暫存資料表空間

--    目前使用者名    資料表空間             暫存資料表空間

select t.USERNAME,t.DEFAULT_TABLESPACE,t.TEMPORARY_TABLESPACE from user_users t;

使用者名稱         資料表空間              暫存資料表空間

MKT_STANDARD   MKT_STANDARD_DATA     MKT_STANDARD_DATA_TEMP


6. 查詢當前資料庫版本

select * from v$version;

版本資訊

TNS for Linux: Version 11.2.0.4.0 - Production


7. 退出sql命令列模式,進入oracle許可權

exit();

su - oracle


7. 資料匯出

      使用者名稱       密碼           sid      匯入資料庫版本

expdp mkt_standard/[email protected]/orcl directory=dumpdir dumpfile=mkt_standard.dmp logfile=mkt_standard.log version=11.2.0.4.0;







10.36.40.74   遷入資料庫地址


1. [[email protected] ~]# 建立目錄

--建立目錄

create or replace directory dumpdir as ‘/home/oracle/bak20170511‘;


2. 添加許可權

chmod w+or /home/oracle/bak20170511


3. 將遷移的資料存放到目錄中,如果是同網段可以使用以下指令碼

scp -r [email protected]:/home/oracle/bak20170511/mkt_standard.dmp /home/oracle/bak20170511/


4. 將資料檔案添加許可權

chmod w+or /home/oracle/bak20170511/mkt_standard.dmp


5. 進入sql命令列模式

先進入oracle許可權

su - oracle

sql命令列模式,dba許可權

sqlplus / as sysdba


6. 查詢當前資料庫版本

select * from v$version;

版本資訊

TNS for Linux: Version 11.2.0.4.0 - Production


7. 建立資料表空間,與遷移的資料庫使用者資料表空間名一致

create tablespace MKT_STANDARD_DATA logging datafile ‘MKT_STANDARD_DATA.DBF‘ size 500M autoextend on;


8. 建立暫存資料表空間,與遷移的資料庫使用者暫存資料表空間名一致

create temporary tablespace MKT_STANDARD_DATA_TEMP tempfile ‘MKT_STANDARD_DATA_TEMP.DBF‘ size 500M autoextend on;


9. 建立使用者,並且將資料表空間和暫存資料表空間賦予使用者,該建立的使用者名稱、密碼對於大小寫敏感

         使用者名稱              密碼

create user mkt_standard identified by mkt_standard  

           default tablespace MKT_STANDARD_DATA  temporary tablespace MKT_STANDARD_DATA_TEMP profile default;


10. 賦予使用者權限

連結許可權

grant connect to mkt_standard;

建立表,視圖等許可權

grant resource to mkt_standard;

系統許可權

grant unlimited tablespace to mkt_standard;


11. 退出sql命令列模式,進入oracle許可權

exit();

su - oracle


12. 匯入資料

      使用者名稱       密碼           sid      匯出資料庫版本

impdp mkt_standard/[email protected]/orcl directory=dumpdir dumpfile=mkt_standard.dmp logfile=mkt_standard.log version=11.2.0.4.0;






刪除暫存資料表空間

drop tablespace MKT_STANDARD_DATA_TEMP   including contents and datafiles;

刪除資料表空間

drop tablespace MKT_STANDARD_DATA      including contents and datafiles; 

刪除使用者

drop user MKT_STANDARD cascade;


本文出自 “LoNice” 部落格,請務必保留此出處http://wox666.blog.51cto.com/5141734/1924925

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.