设为首页 加入收藏

TOP

oraclesqlplus常用命令
2014-11-24 02:01:02 来源: 作者: 【 】 浏览:1
Tags:oraclesqlplus 常用 命令

以为内容选自Oracle官方文档,只讲command-line:

规范:<变量名> , {举例} , a | b 枚举可选值,(XX)描述

----------------------------------------------------------------------------------------------------

1、glogin.sql常用脚本(配置sqlplus command line):

-- To change the SQL*Plus prompt to display the current user,
-- connection identifier and current time.
-- First set the database date format to show the time.
ALTER SESSION SET nls_date_format = 'YYYY-MM-DD HH:MI:SS';
-- SET the SQLPROMPT to include the _USER, _CONNECT_IDENTIFIER
-- and _DATE variables.
SET SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER> "
-- To set the number of lines to display in a report page to 24.
SET PAGESIZE 24
-- To set the number of characters to display on each report line to 78.
SET LINESIZE 78
-- To set the number format used in a report to $99,999.
SET NUMFORMAT $99,999

2、常用命令:

--sqlplus xxx@xxx 登陆sqlplus

--exit 退出

--CTRL+C 强制中断会话

--help index 调出sqlplus帮助索引界面

{

\

}

-- | help 查看指定命令说明

--@ <scriptname> 运行指定脚本

--@@ <scriptname> 同@,区别在于默认文件所在位置不同(上层)

--/ 执行最近脚本

--accept 接受用户输入存储到变量中

{

}

--append 向当前文件追加文本行

{

}

--column 改变列格式

{

COLUMN SALARY FORMAT $99,999
}

--connect | conn 会话中切换连接命令,如conn hr/hr@orcl

--copy

--describle/desc 描述表、视图的列以及函数、程序的说明。

--host sql会话模式利用host命令调用cmd命令

--show 显示变量货参数值

--SET 命令集:

--SET PAGESIZE 60 设置一页显示行数

--

--store and start 存储set 变量值和恢复set 变量值

{

SCOTT@orcl> store set c:\plusenv.sql  --存储当前session set 变量值
已创建 file c:\plusenv.sql
SCOTT@orcl> show pagesize
pagesize 24
SCOTT@orcl> set pagesize 60
SCOTT@orcl> show pagesize
pagesize 60
SCOTT@orcl> start c:\plusenv.sql     --恢复set 变量值
SCOTT@orcl> show pagesize
pagesize 24
SCOTT@orcl> host del /f c:\plusenv.sql

}

--

To be continue...

---------------------------

Dylan Presents.

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇oracle导入导出工具exp/imp 下一篇OracleDatabase12c十二大新特性

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: