使用DISQL来运行一些外部脚本并保存执行过程
第一步:创建一个脚本,为TEST.SQL
test.sql文件内容如下:
[dmdba@dm8 ~]$ cat test.sql
drop table TEST;
create table TEST (ID int,NAEM varchar(10));
begin
for i in 1..10 loop
insert into TEST values (i,'tom'||i);
end loop;
commit;
end;
/
exit
第二步:在LINUX系统提示符下运行:
[dmdba@dm8 ~]$ disql sysdba/dameng123@127.0.0.1:5236 `test.sql > test.log
**注意:“\”转义符的使用 **
第三步:DISQ连接到数据库,验证表是否创建,数据是否录入到数据库中。
[dmdba@dm8 ~]$ disql sysdba/dameng123@127.0.0.1:5236
服务器[127.0.0.1:5236]:处于普通打开状态
登录使用时间 : 10.718(ms)
disql V8
SQL> select * from TEST;
行号 ID NAEM
1 1 tom1
2 2 tom2
3 3 tom3
4 4 tom4
5 5 tom5
6 6 tom6
7 7 tom7
8 8 tom8
9 9 tom9
10 10 tom10
10 rows got
已用时间: 1.007(毫秒). 执行号:900.
第四步:过程是否被保留下来。
[dmdba@dm8 ~]$ cat test.log
服务器[127.0.0.1:5236]:处于普通打开状态
登录使用时间 : 20.072(ms)
disql V8
SQL> drop table TEST;
操作已执行
已用时间: 30.654(毫秒). 执行号:800.
SQL> create table TEST (ID int,NAEM varchar(10));
操作已执行
已用时间: 3.352(毫秒). 执行号:801.
SQL> begin
for i in 1..10 loop
insert into TEST values (i,'tom'||i);
end loop;
commit;
end;
DMSQL 过程已成功完成
已用时间: 0.773(毫秒). 执行号:802.
SQL> exit
[dmdba@dm8 ~]$
文章
阅读量
获赞