oracle sqlplus常用命令

登录到sqlplus

sqlplus user/pwd@dbname

不登录使用

sqlplus /nolog

查看当前登录用户

show user;

更改用户密码

ALTER USER USER IDENTIFIED BY password;

查看当前数据库

SELECT name FROM v$database;
SELECT * FROM global_name;

查看数据库版本

SELECT * FROM v$version;

列出所有参数

SHOW PARAMETERS parameter_name;
SELECT name, VALUE FROM v$parameter WHERE name LIKE '%xyz%'

重新运行SQL在缓冲区中的语句。

SQL > /

指定脚本文件装入SQL缓冲区并运行

@@D:\sql\data.sql 

or

Start D:\sql\data.sql 

显示一个表的结构

SQL> desc table_name

将显示的内容输出到指定文件

SQL> SPOOL file_name 

在屏幕上的所有内容都包含在该文件中,包括你输入的sql语句。

关闭spool输出

SQL> SPOOL OFF 

查看所有68个系统变量

SQL> show all;
appinfo 为 OFF 并且已设置为 "SQL*Plus"
arraysize 15
autocommit OFF
autoprint OFF
autorecovery OFF
autotrace OFF
blockterminator "." (hex 2e)
btitle OFF 为下一条 SELECT 语句的前几个字符
cmdsep OFF
colsep " "
compatibility version NATIVE
concat "." (hex 2e)
copycommit 0
COPYTYPECHECK 为 ON
define "&" (hex 26)
describe DEPTH 1 LINENUM OFF INDENT ON
echo OFF
editfile "afiedt.buf"
embedded OFF
escape OFF
escchar OFF
exitcommit ON
用于 6 或更多行的 FEEDBACK ON
flagger OFF
flush ON
heading ON
headsep "|" (hex 7c)
instance "local"
linesize 80
lno 17
loboffset 1
logsource ""
long 80
longchunksize 80
markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sa
ns-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-seri
f; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-s
erif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0
px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; backgroun
d:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-s
erif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; ma
rgin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;-
} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; backgroun
d-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,s
ans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt;
 vertical-align:top;}</style><title>SQL*Plus Report</title>" BODY "" TABLE "bord
er='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON P
REFORMAT OFF
newpage 1
null ""
numformat ""
numwidth 10
pagesize 14
PAUSE 为 OFF
pno 0
recsep WRAP
recsepchar " " (hex 20)
release 1102000100
repfooter OFF  为 NULL
repheader OFF  为 NULL
securedcol is OFF
serveroutput OFF
shiftinout INVISIBLE
showmode OFF
spool OFF
sqlblanklines OFF
sqlcase MIXED
sqlcode 1756
sqlcontinue "> "
sqlnumber ON
sqlpluscompatibility 11.2.0
sqlprefix "#" (hex 23)
sqlprompt "SQL> "
sqlterminator ";" (hex 3b)
suffix "sql"
tab ON
termout ON
timing OFF
trimout ON
trimspool OFF
ttitle OFF 为下一条 SELECT 语句的前几个字符
underline "-" (hex 2d)
USER 为 "TRFF_APP"
verify ON
wrap : 将换至下一行
errorlogging is OFF
posted @ 2015-05-25 17:44  码不能停  阅读(423)  评论(0编辑  收藏  举报