傳輸表空間

 

前言:ORACLE 11G EM控制檯提供的傳輸表空間,是指在到另一個數據庫上拷貝一份源數據庫表空間,而非在同個數據庫中複製表空間。現在大致步驟記錄下並簡單說明:

  準備工作:

                 設置此次會話字符集: export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK .

                 將源數據庫的表空間設置爲只讀模式: alter tablespace sandbox2 read only;

1.exp "'/ as sysdba'" file=/tmp/exp/exp_sandbox.dmp log=/tmp/exp/exp.log owner=sandbox2
2.create tablespace sandbox3  datafile '... / sandbox3_01.dbf'  size 100m;
3.create user   sandbox3    identified by  sandbox3   default tablespace sandbox3  temporary tablespace temp;
4.grant connect,resource to sandbox3;  //resource限額爲unlimited
5.revoke unlimited tablespace from sandbox3;  //回收user sandbox3的unlimited tablespace限額(對所有表空間)
6.alter user sandbox3 quota 0 on sandbox2;   //對sandbox2的限額爲0 (沒有權限)
7.alter user sandbox3 quota unlimited on sandbox3;  //對sandbox3的限額爲無限制

    -------------這幾部操作的關鍵是通過用戶的關係,把用戶的默認表空間設置修改,重新配置。這樣 sandbox3用戶 只有對sandbox3表空間的權限,而對sandbox2爲0.預防了衝突
8.imp "'/ as sysdba'" file=/tmp/exp/exp_sandbox.dmp fromuser=sandbox2 touser=sandbox3

   --------通過fromuser 和touser 將sandbox2用戶下的表空間 賦給sandbox3

發佈了14 篇原創文章 · 獲贊 2 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章