Oracle相关

作者: zilanhu | 来源:发表于2017-07-10 10:25 被阅读0次

    Google一般比百度靠谱,英文资料一般比中文资料丰富、准确。所以还是建议遇到问题直接Google,不要在百度浏览大量的重复文章浪费时间。


    Oracle相关资料


    Oracle相关语法及函数

    • Win10 用户:ora-01031: insufficient privileges,权限不足问题
      如果尝试网上的办法都不可行的话,可以尝试以下办法:
      将电脑从微软账号切换为本地账户。再次尝试即可。
    • Oracle Dual
    //几种有意思的用法
    SELECT 7*9 FROM DUAL
    63
    

    DUAL is a table automatically created by Oracle Database along with the data dictionary. DUAL is in the schema of the user SYS but is accessible by the name DUAL to all users. It has one column, DUMMY, defined to be VARCHAR2(1), and contains one row with a value X. Selecting from the DUAL table is useful for computing a constant expression with the SELECT statement. Because DUAL has only one row, the constant is returned only once.
    Alternatively, you can select a constant, pseudocolumn, or expression from any table, but the value will be returned as many times as there are rows in the table. Please refer to "SQL Functions" for many examples of selecting a constant value from DUAL.

    • Connect By、Start With、Level
    • LPAD
      要注意这个例子中字符串的截取方式,大部分文章中都简单用单字母或者重复符号进行填充,太简单,完全不具有代表性。
    SELECT LPAD('Page 1',15,'*.') "LPAD example" FROM DUAL;
    LPAD example
    *.*.*.*.*Page 1
    

    Oracle遇到的相关问题

    用户无法drop

    今天在现场遇到一个问题,导致数据库崩溃,需要恢复数据库。在删除用户时使用命令:

    DROP USER XX CASCADE;
    

    一直提示无法删除当前用户,使用

    SELECT USERNAME,SID,SERIAL#,STATUS FROM V$SESSION;
    

    发现XX用户一旦被删除会重新连接,暂时不知道是什么原因。
    后来发现,可以先锁定用户

    ALTER USER XX ACCOUNT LOCK;
    ALTER SYSTEM KILL SESSION'SID,SERIAL#';
    DROP USER XX CASCADE;
    

    相关文章

      网友评论

        本文标题:Oracle相关

        本文链接:https://www.haomeiwen.com/subject/lsryhxtx.html