1. 程式人生 > >oracle如何通過cmd導出某個用戶下的所有表

oracle如何通過cmd導出某個用戶下的所有表

查詢 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進入命令,導出

  1. 導出用戶所有的表到D盤:exp aa/1234 file=D:\biao.dmp owner=aa;
  2. 導出用戶aa中的表dept到D盤:exp aa/1234 file=d:\dept.dmp tables=(dept);
  3. 導出用戶aa中的表dept,emp到D盤:exp aa/1234 file=d:\dept.dmp tables=(dept,emp);

3:刪除原有用戶

  1. 在cmd中輸入
  2. sqlplus / as sysdba
 drop user aa cascade

4:創建用戶

  1. create user aa identified by 1234;(aa:用戶名,1234:密碼)
  2. grant dba,connect to aa;-----授權

5:導入

  1. 將D盤的biao.dmp導入到用戶bb中:
  2. imp aa/1234 file=d:\biao.dmp full=y
  3. 將用戶aa中表dept中的數據導入到用戶bb的dept表中:
  4. imp bb/1234 file=d:\dept.dmp tables=(dept) ignore=y full=y

總結:

  1. exp smart/smart file=D:\smart.dmp owner=smart;
  2. drop user smart cascade;
  3. create user smart identified by smart;
  4. grant dba,connect to smart;
  5. 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導出某個用戶下的所有表