文章目录
1.调用EXP和IMP备份数据库(将hr模式下的employees表导出、导入)。并将所有执行正确的PL/SQL语句记录下来
cmd里输入命令
exp hr/hr tables=employees rows=y file=d:\myTemp\employees.dmp
cmd里输入命令
imp hr/hr tables=employees rows=y file=d:\myTemp\employees.dmp
2.调用EXPDP和IMPDP备份数据库(将hr模式下的表或该用户模式或表空间导出、导入)。并将所有执行正确的PL/SQL语句记录下来
首先得新建directory
SQLplus输入
create or replace directory myTemp as 'd:\myTemp';
将目录的权限给hr
SQLplus输入
grant read,write on directory myTemp to hr;
cmd里输入命令:
expdp hr/hr directory=myTemp dumpfile=tab.dmp tables=employees
导入
cmd里输入命令
impdp hr/hr directory=myTemp dumpfile=tab.dmp tables=employees
3.使用SQL*Loader导入外部数据,数据文件见:某班同学的成绩.xls
首先新建一个控制文件(直接txt改后缀)
控制文件内容:
load data
infile 'd:\myTemp\grade.csv'
into table grades
fields terminated by ','
(id,name,sex,class,grade)
根据Excel文件,另存为CSV格式,建议不要改后缀
根据Excel文件,新建一个表:
create table grades(id varchar2(30),name varchar2(30),sex varchar2(30),class varchar2(30),grade varchar(20));
然后在cmd里面输入命令
:sqlldr scott/scott control=d:\myTemp\grade.ctl
我的文件位置
最后结果:
请把你的点赞留给你最喜欢的博主吧~反正又不是我,是不是?(狗头)