oracle oracle连接SQLplus

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/990061/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:55:16  来源:igfitidea点击:

Connect SQLplus in oracle

oraclesqlplus

提问by Sopolin

I want to connect user sys in sqlplus of oracle but after I connect, I type like this:

我想在oracle的sqlplus中连接用户sys但连接后,我输入如下:

sqlplus sys as sysdba
password:123456
Error:
  ORA-01030:insufficient privilege

  warning:You are no longer to connect oracle.
Error:
  ORA-01030:insufficient privilege

  warning:You are no longer to connect oracle.

Does anyone help me to solve my problem?

有没有人帮我解决我的问题?

采纳答案by DCookie

Is your operating system user account that you are logged in as a member of the ORA_DBA group (windows) or the DBA group (*nix)?

您作为 ORA_DBA 组 (windows) 或 DBA 组 (*nix) 的成员登录的操作系统用户帐户是?

If the answer is yes, then the next thing to check is for the existence of the ORACLE_HOME\database\orapwORCL.ora file, which contains the passwords for all of the users defined as sysdba users. If it does not exist, you need to shutdown the database and execute the orapwd utility:

如果答案是肯定的,那么接下来要检查 ORACLE_HOME\database\orapwORCL.ora 文件是否存在,该文件包含所有定义为 sysdba 用户的用户的密码。如果它不存在,您需要关闭数据库并执行 orapwd 实用程序:

  • cd ORACLE_HOME\database
  • orapwd file=orapwORCL.ora password=123456 entries=10
  • cd ORACLE_HOME\数据库
  • orapwd 文件=orapwORCL.ora 密码=123456 个条目=10

This defines the sys password as 123456. You should then be able to start up the database and connect sys/123456 as sysdba

这将 sys 密码定义为 123456。然后您应该能够启动数据库并以 sysdba 身份连接 sys/123456

The password file must exist for password=based authentication on sysdba logins. The reason for this is the fact that sysdba connections must be allowed when the database is not up and the database cannot authenticate you.

密码文件必须存在于 sysdba 登录时基于密码的身份验证。这样做的原因是,当数据库未启动且数据库无法对您进行身份验证时,必须允许 sysdba 连接。

回答by Steve Broberg

Your example looks a little garbled; to connect to sqlplus via the command line, with a user sysand password 123456:

你的例子看起来有点乱;通过命令行连接到 sqlplus,使用用户名sys和密码123456

sqlplus sys/123456 as sysdba

or

或者

sqlplus "sys/123456 as sysdba"

prior to Oracle 10. If you are already inside sqlplus (as I assume from the fact that your example starts with a SQL>), you use the connect command:

在 Oracle 10 之前。如果您已经在 sqlplus 中(因为我假设您的示例以 SQL> 开头),则使用 connect 命令:

SQL> connect sys/123456 as sysdba

In all cases, if you haven't set the environment variable ORACLE_SID, you need to specify that after the password, like this:

在所有情况下,如果您还没有设置环境变量ORACLE_SID,则需要在密码后指定,如下所示:

sqlplus sys/123456@<mydbname> as sysdba

where <mydbname>is either of the form <hostname>/<sid>, if you're using Oracle 10 or later, or a valid entry from your tnsnames.orafile (located in $ORACLE_HOME/network/admin) for all versions.

如果您使用的是 Oracle 10 或更高版本,则其中<mydbname>是形式<hostname>/<sid>,或者是您的tnsnames.ora文件(位于$ORACLE_HOME/network/admin)中适用于所有版本的有效条目。