1.oracle

作者: _少年不知愁 | 来源:发表于2019-12-18 09:45 被阅读0次

    oracle安装可以参考:https://www.jianshu.com/p/b4200e721bfd
    centos下载:http://mirrors.163.com/centos/
    oracle下载:https://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html

    #查看service_name 
     show parameter service_names;
    
    1.修改用户密码
    sqlplus / as sysdba
    查看所有用户信息
    SQL> select username,password from dba_users;
    修改密码
    SQL> alter user system identified by 123456;
    
    2.新增用户
    SQL> create user test identified by 123456;
    否被会报错: [ORA-01045: user lacks CREATE SESSION privilege; logon denied(10.2.0.5)
    SQL> grant create session to test;
    
    #给用户赋予权限,及表空间权限
    grant create any table to test;
    ALTER USER test quota unlimited on users;
    
    3.error:ORA-01034: ORACLE not available Process ID: 0 Session ID: 0 Serial number: 0

    (1)方法1

     ps -ef | grep smon | awk '{print $2}'|xargs kill -9
    sqlplus / as sysdba
    startup
    然后再:
    select 1 from dual;
    发现 ok
    

    (2)方法2

    查看:
    echo $ORACLE_SID
    lsnrctl status
    查看这两个ORACLE_SID是否一致
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-SEP-2018 15:06:10
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date                13-SEP-2018 14:55:18
    Uptime                    0 days 0 hr. 10 min. 52 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /data/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /data/app/oracle/diag/tnslsnr/centos/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos)(PORT=1521)))
    Services Summary...
    Service "orcl11g.us.oracle.com" has 1 instance(s).
      Instance "orcl11g", status READY, has 1 handler(s) for this service...
    Service "orcl11gXDB.us.oracle.com" has 1 instance(s).
      Instance "orcl11g", status READY, has 1 handler(s) for this service...
    The command completed successfully
    
    发现不一致:
      Instance "orcl11g", status READY, has 1 handler(s) for this service...
    echo $ORACLE_SID 
    输出:orcl
    
    则去
    vi /data/app/oracle/product/11.2.0/db_1/bin/dbstart
    查看:
    # Starts a Database Instance
    startinst() {
      # Called programs use same database ID
      export ORACLE_SID
    发现 ORACLE_SID直接export 并未初始化
    则在export加一句 ORACLE_SID = orcl(视情况而定)
    
    然后reboot 之后发现:
    select 1 from dual;
    ok
    

    相关文章

      网友评论

          本文标题:1.oracle

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