oracle如何经过cmd导出某个用户下的全部表

1:若是要导入的用户下有空表,须要执行下面语句sql

select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0

查询出的数据拷出来,再次执行数据库

2:cmd进入命令,导出ide

  1.  
    导出用户全部的表到D盘: exp aa/1234 file=D:\biao.dmp owner=aa;
  2.  
     
  3.  
    导出用户aa中的表dept到D盘: exp aa/1234 file=d:\dept.dmp tables=(dept);
  4.  
     
  5.  
    导出用户aa中的表dept,emp到D盘: exp aa/1234 file=d:\dept.dmp tables=(dept,emp);

3:删除原有用户ui

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

4:建立用户spa

  1.  
    create user aa identified by 1234;(aa:用户名,1234:密码)
  2.  
     
  3.  
    grant dba,connect to aa;-----受权

5:导入code

  1.  
    将D盘的biao.dmp导入到用户bb中:
  2.  
    imp aa/ 1234 file=d:\biao.dmp full=y
  3.  
     
  4.  
    将用户aa中表dept中的数据导入到用户bb的dept表中:
  5.  
    imp bb/ 1234 file=d:\dept.dmp tables=(dept) ignore=y full=y

总结:get

  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,systemcmd

    select * from all_users;  查看你能管理的全部用户!string

    select * from user_users; 查看当前用户信息 !table

相关文章
相关标签/搜索