【EXP】根据字段导出数据query
exp有些时候需要根据字段来进行导出操作
例如:想要导出hr用户中的employees中salary要大于4000的数据
这样的话需要添加where语句,需要用到的参数是query
查看下大于4000的有多少数据
SQL> select count(*) from employees where salary>=4000;
COUNT(*)
----------
65
这样写:
exp hr/hr file=salary.dmp query=\" where salary \>=\'4000\' \" tables=employees
导出后,将数据导入到其他用户验证下
imp scott/tiger file=salary.dmp fromuser=hr touser=scott
sqlplus scott/tiger
SQL> select count(*) from employees;
COUNT(*)
----------
65
SQL> set pages 1000;
SQL> select salary from employees order by salary;
SALARY
----------
4000
4100
4200
4200
4400
4800
4800
5800
6000
6000
6100
6200
6200
6400
6500
6500
6800
6900
7000
7000
7000
7200
7300
7400
7500
7500
7700
7800
7900
8000
8000
8000
8200
8200
8300
8400
8600
8800
9000
9000
9000
9000
9500
9500
9500
9600
10000
10000
10000
10000
10500
10500
11000
11000
11000
11500
12000
12000
12000
13000
13500
14000
17000
17000
24000
65 rows selected.
果然全部都是正确的,操作完成