首发:http://www.arppinging.com/wordpress/?p=93
连接用户和查看当前用户
SQL> show user;
USER is "SCOTT"
SQL> conn /as sysdba
Connected.
SQL> show user
USER is "SYS"
SQL>
清除屏幕输出
记录输出内容到文本
开启记录
SQL> spool /tmp/sql.txt
SQL> select * from student;
SNO SNAME BIRTHDAY
---------- ------------------------------ -------------------
1 A 0011-01-01 00:00:00
2 B 2011-01-01 00:00:00
3 1981-02-23 00:00:00
4 D
SQL> spool off
#关闭记录
# 查看文本是否有记录内容
[root@localhost tmp]# cat /tmp/sql.txt
SQL> select * from student;
SNO SNAME BIRTHDAY
---------- ------------------------------ -------------------
1 A 0011-01-01 00:00:00
2 B 2011-01-01 00:00:00
3 1981-02-23 00:00:00
4 D
SQL> spool off
[root@localhost tmp]#
将时间信息打印在提示符的左边
#开启时间显示
SQL> set time on
16:02:39 SQL>
16:02:41 SQL> set time off
# 关闭时间显示
SQL>
host可以执行linux或者windows的命令
SQL> host ls -l
total 40
-rw-r--r--. 1 oracle oinstall 20 Oct 3 12:59 afiedt.buf
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Desktop
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Documents
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Downloads
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Music
drwxr-x---. 3 oracle oinstall 4096 Oct 2 11:28 oradiag_oracle
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Pictures
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Public
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Templates
drwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Videos
SQL>
@在oracle中可以用来执行脚本中的内容
# 查看脚本信息
[root@localhost tmp]# cat test.sql
select * from student;
show user;
[root@localhost tmp]#
# 执行脚本
SQL> @/tmp/test.sql
SNO SNAME BIRTHDAY
---------- ------------------------------ -------------------
1 A 0011-01-01 00:00:00
2 B 2011-01-01 00:00:00
3 1981-02-23 00:00:00
4 D
USER is "SCOTT"
SQL>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。