温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

解决Linux 下oracle12报错 Connected

发布时间:2020-07-24 03:21:14 来源:网络 阅读:507 作者:卉慧 栏目:关系型数据库

绿底为输入,白底为输出,黄底为输出中的错误提示。

问题描述:

[root@oracle ~]# su - oracle
Last login: Tue Sep 17 23:40:50 CST 2019 on pts/0

[oracle@oracle ~]$sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Mon Sep 2 01:09:18 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

SQL> conn sys /as sysdba
Enter password:
Connected to an idle instance.

解决办法:

 1、进入到sqlplus启动实例

[root@oracle ~]# su - oracle                --1.确认切换到oracle用户
Last login: Tue Sep 17 23:40:50 CST 2019 on pts/0

[oracle@oracle ~]$ lsnrctl start                     --2.打开监听

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 02-SEP-2019 01:19:38

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                02-SEP-2019 01:19:40
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

[oracle@oracle ~]$ sqlplus /nolog                    --登录sqlplus

SQL*Plus: Release 12.2.0.1.0 Production on Mon Sep 2 01:23:29 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/12.2.0/dbhome_1/dbs/initoradb.ora'

原来打不开initoradb.ora,于是进入/u01/app/oracle/product/12.2.0/dbhome_1/dbs/目录

[root@oracle ~]# cd /u01/app/oracle/product/12.2.0/dbhome_1/dbs/

[root@oracle dbs]# ls
hc_orcl.dat  init.ora  lkORCL  orapworcl  spfileorcl.ora

原来是没有initoradb.ora文件。

解决此问题的方法就是到/u01/app/oracle/admin/orcl/pfile/目录下,将init.ora.818201912514复制到dbs目录下:

[root@oracle app]# cd /u01/app/oracle/admin/orcl/pfile/
[root@oracle pfile]# ls
init.ora.818201912514
[root@oracle pfile]# cp init.ora.818201912514 /u01/app/oracle/product/12.2.0/dbhome_1/dbs/initoradb.ora

cp的目标文件用oracle用户打开可能为空,用chmod命令授权:chmod -R 777 /目标文件

[root@oracle dbs]# chmod -R 777 /u01/app/oracle/product/12.2.0/dbhome_1/dbs/initoradb.ora

然后再次用sqlplus连接数据库,

[oracle@oracle ~]$ sqlplus /nolog
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup                    --启动oracle数据库
ORACLE instance started.

Total System Global Area 3741319168 bytes
Fixed Size      8627344 bytes
Variable Size    872418160 bytes
Database Buffers  2852126720 bytes
Redo Buffers      8146944 bytes
Database mounted.
Database opened.

数据库启动后,连接数据库
SQL> conn /as sysdba
Connected. 

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI