zoukankan      html  css  js  c++  java
  • SQLPLUS常用命令

    远程的时候,恰好plsql developer不能使用,只能使用命令行操作数据库,平时用的不多,费劲,所有查查资料,以后备用

    ===========================================================================================

    shutdown   关闭数据库(dba用户执行)

    startup    启动数据库(dba用户执行)
    sqlplus username/password  如: sqlplus scott/tiger
    sqlplus username/password@net_service_name 如: sqlplus scott/tiger@orcl
    sqlplus username/password as sysdba 如:sqlplus sys/admin as sysdba
    sqlplus username/password@//host:port/sid 
    exit       退出sql*plus 
    quit             用法同exit
    ctrl+c           强制中断会话
    conn mzh/mzh 切换用户
    disconnect        提交更改并从数据库中断开,但不退出sqlplus
    edit 对当前的输入进行编辑
    / 重新运行上一次运行的sql语句
    show all 查看所有68个系统变量值 
    show user 显示当前连接用户 
    set sqlprompt "sql> " --设置默认提示符,默认值就是"sql> " 
    set heading off --禁止输出列标题,默认值为on 
    set linesize 1000 --设置屏幕显示行宽,默认100 
    查询用户有哪些表空间 select object_name, object_type from user_objects;
    desc(describe) 表名    显示表的结构 
    show error 显示错误 
    在sqlplus中执行操作系统命令,使用host命令(使用"!"(linux),使用"$"(windows))
    host cls($ cls) 清空屏幕
    set linesize n        设置一行最多显示多少字符
    col column_name              显示列格式
    clear columns                将所有列的显示属性设为缺省值
    col column_name format a50   设置column_name为50个字符宽
    column column_name clear         --清楚已设置列属性
    set colsep {  | text}  on 设置列间的分隔符
    set heading {on | off} 设置是否显示列头
    set linesize {80 | n}设置sqlplus输出一行显示的列数
    set long {80 | n}  设置long, clob, nclob和xmltype 类型数据的显示字节数
    set newpage {1 | n | none}  设置每页前显示多少行
    ===========================================================================================
  • 相关阅读:
    旅行锦囊
    生活智慧
    育儿锦囊
    新婚置办
    软件开发心得
    64位sql server2005安装
    Struts学习心得
    Spring学习心得
    Oracle补习班第十天
    Python----文件操作
  • 原文地址:https://www.cnblogs.com/llhl/p/9648720.html
Copyright © 2011-2022 走看看