首发:
http://www.arppinging.com/wordpress/?p=93
连接用户和查看当前用户
SQL> show user;USER is "SCOTT"SQL> conn /as sysdbaConnected.SQL> show userUSER is "SYS"SQL>
清除屏幕输出
记录输出内容到文本
开启记录SQL> spool /tmp/sql.txtSQL> 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 DSQL> 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 on16:02:39 SQL> 16:02:41 SQL> set time off# 关闭时间显示SQL>
host可以执行linux或者windows的命令
SQL> host ls -ltotal 40-rw-r--r--. 1 oracle oinstall 20 Oct 3 12:59 afiedt.bufdrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Desktopdrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Documentsdrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Downloadsdrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Musicdrwxr-x---. 3 oracle oinstall 4096 Oct 2 11:28 oradiag_oracledrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Picturesdrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Publicdrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 Templatesdrwxr-xr-x. 2 oracle oinstall 4096 Oct 2 10:54 VideosSQL>
@在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 DUSER is "SCOTT"SQL>