oracle將資料匯入指定表空間

2022-07-30 09:15:09 字數 1049 閱讀 8140

在使用oracle的 exp 和imp 匯出匯入的時候。有時遇到,需要匯入的資料不是同乙個使用者的,也不一定是同乙個表空間。

例如,源資料庫,上使用者為aaa,表空間aa 目標資料庫 ,使用者為bbb 表空間bb 當用imp匯入以後檢視發現,bbb沒有aa這個表空間,但是還是匯入進去了,不過全部都跑到了users裡面。這種情況時常有發生,特別是遷移資料庫的時候。那麼為了更好的管理表空間和資料表,可以採用下面的方式。

連線目標資料庫

oracle@ucitdb:~> sqlplus /nolog sql

sql> conn /as sysdba connected.

sql> revoke unlimited tablespace from ucitdba;

revoke succeeded. 刪除該使用者的表空間使用限制

sql> alter user ucitdba quota 0 on users;

user altered. 修改表空間使用引數

sql> alter user ucitdba quota unlimited on ucit;

user altered. 將目標表空間的無限制使用許可權賦給使用者

sql> quit

disconnected from oracle database 10g enterprise edition release 10.2.0.1.0 - 64bit production with the partitioning, olap and data mining options

imp ucitdba/111111 fromuser=ucitdba touser=ucitdba file=/opt/oracle/oradata/backup/ucit_20101015.dmp tablespaces=ucit grants=y

具體位址根據自己的設定修改,之後回車搞定

如果出現了tablespaces的錯誤。那麼是因為dmp檔案中還有大量的建立表的命令中含有表空間users 可以使用 ultraedit 將 tablespaces "users" 替換成 你的表空間,儲存後,重新匯入。

Oracle匯入資料指定表空間

假設資料使用者user1使用預設表空間ts1,使用者user2使用預設表空間ts2,現在將user1的資料匯入到user2,要求使用表空間ts2。通過imp命令引數tablespaces指定表空間是不行的,其他複雜方法要修改配額什麼的,麻煩。其實有乙個簡單的方法 直接使用ultraedit打方dmp...

Oracle imp命令匯入資料到指定表空間

找了乙個幾百萬行資料的庫,準備匯入的本地oracle中 imp sam lee file d agent.dmp fromuser system touser sam sam使用者的預設表空間是sam,但是資料卻匯入到了system表空間。google了一下,應該這樣做 1.收回unlimited ...

Oracle匯出匯入指定表

從源資料庫匯出 exp user1 pwd server1 file c temp exp.dmp tables table1,table2 匯入到目標資料庫 exp user2 pwd server2 file c temp exp.dmp tables table1,table2 oracle就...