oracle如何通過cmd導出某個用戶下的所有表
阿新 • • 發佈:2019-03-27
查詢 row -c 導入 users class p s tps www.
1:如果要導入的用戶下有空表,需要執行下面語句
select ‘alter table ‘||table_name||‘ allocate extent;‘ from user_tables where num_rows=0
查詢出的數據拷出來,再次執行
2:cmd進入命令,導出
- 導出用戶所有的表到D盤:exp aa/1234 file=D:\biao.dmp owner=aa;
- 導出用戶aa中的表dept到D盤:exp aa/1234 file=d:\dept.dmp tables=(dept);
-
導出用戶aa中的表dept,emp到D盤:exp aa/1234 file=d:\dept.dmp tables=(dept,emp);
3:刪除原有用戶
- 在cmd中輸入
- sqlplus / as sysdba
drop user aa cascade
4:創建用戶
- create user aa identified by 1234;(aa:用戶名,1234:密碼)
- grant dba,connect to aa;-----授權
5:導入
- 將D盤的biao.dmp導入到用戶bb中:
-
imp aa/1234 file=d:\biao.dmp full=y
- 將用戶aa中表dept中的數據導入到用戶bb的dept表中:
- imp bb/1234 file=d:\dept.dmp tables=(dept) ignore=y full=y
總結:
- exp smart/smart file=D:\smart.dmp owner=smart;
- drop user smart cascade;
- create user smart identified by smart;
-
grant dba,connect to smart;
-
imp smart/smart file=d:\smart.dmp full=y;
===================================
select * from dba_users; 查看數據庫裏面所有用戶,前提是你是有dba權限的帳號,如sys,system
select * from all_users; 查看你能管理的所有用戶!
select * from user_users; 查看當前用戶信息 !
oracle如何通過cmd導出某個用戶下的所有表