1. 程式人生 > >oracle: 淺談orapwd命令,及解決遠端登入ORA-01031: insufficient privileges問題

oracle: 淺談orapwd命令,及解決遠端登入ORA-01031: insufficient privileges問題

1、先看下命令說明:orapwd

Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>

  where
    file - name of password file (required),
    password - password for SYS will be prompted if not specified at command line,
    entries - maximum number of distinct DBA (optional),
    force - whether to overwrite existing file (optional),
    ignorecase - passwords are case-insensitive (optional),
    nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
    
  There must be no spaces around the equal-to (=) character.


2、再看下使用範例:

orapwd file=orapwmercury password=lzx123 entries=10

範例說明:

  • file:變數orapwmercury為'orapw$ORACLE_SID'格式,如sid為test則命令檔案為orapwtest,這點必須按格式來,並且該檔案要放置在$ORACLE_HOME/dbs/目錄下。
  • password:變數lzx123為設定給sys使用者的密碼
  • entries:10表明可以有10個sysdba許可權使用者,不可超過10個,目前已經定義了sys一個。

注:改動生效需要重啟資料庫。

3、應用說明:

orapwd命令是用來建立口令檔案的,所以需要明白什麼時候需要這個口令檔案,執行下列命令檢視

[[email protected] ~]$ sqlplus / as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on Sat Sep 17 11:21:52 2011

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show parameter remote_login_passwordfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile            string      EXCLUSIVE
SQL> 

保證資料庫open情況下,執行命令show parameter remote_login_passwordfile;檢視值是不是EXCLUSIVE。這裡的值是pfile中定義的,可以檢視你的initSID.ora檔案。對該欄位的描述是:

***********************************************FROM ORACLE11G DOCS******************************************

REMOTE_LOGIN_PASSWORDFILE specifies whether Oracle checks for a password file.

Values:

  • shared

    One or more databases can use the password file. The password file can containSYS as well as non-SYS users.

  • exclusive

    The password file can be used by only one database. The password file can containSYS as well as non-SYS users.

  • none

    Oracle ignores any password file. Therefore, privileged users must be authenticated by the operating system.

Notes:

  • When REMOTE_LOGIN_PASSWORDFILE is set to either exclusive orshared, but the password file does not exist, then the behavior is the same as settingREMOTE_LOGIN_PASSWORDFILE tonone.

  • If you change REMOTE_LOGIN_PASSWORDFILE to exclusive orshared fromnone, then ensure that the password file is in sync with the dictionary passwords. SeeOracle Database Administrator's Guide for more information.

*******************************************************************************************************************

從描述中可以知道如果值是none的話,表明口令檔案模式不起作用,必須用作業系統級的sysdba許可權使用者登入,如系統使用者oracle。而沒有指定值得話等同於none。因此如果要使用口令檔案必須是exclusive或是shared模式,並且用orapwd命令建立,值得一提的是該口令檔案指儲存具有sysdba等超級許可權的使用者。

注:假如你不能用sys加上口令登入,那就用系統使用者oracle,使用sqlplus / as sysdba;登入到資料庫(如不能登入,這裡有個sqlnet.ora檔案請查閱http://blog.csdn.net/lzx_bupt/article/details/6781332)。

4、常見問題

(1)嘗試使用sysdba許可權使用者遠端登入的時候提示,尤其是pl/sql使用 "sys/密碼 as sysdba"登入時

ORA-01031: insufficient privileges

對該問題首要考慮就是1:口令檔案的缺失,造成沒有找到口令、2:REMOTE_LOGIN_PASSWORDFILE值沒有指定或是指定了none。

(2)select * from v$pwfile_users; 結果為 no rows select如

SQL> show user;
USER is "SYS"
SQL> select * from v$pwfile_users;

no rows selected

也說明口令檔案不存在或是不起作用,需要按上述調整好,重啟資料庫,登入,然後檢驗:

SQL> startup open; 
ORACLE instance started.

Total System Global Area  801701888 bytes
Fixed Size                  2217632 bytes
Variable Size             469764448 bytes
Database Buffers          322961408 bytes
Redo Buffers                6758400 bytes
Database mounted.
Database opened.
SQL> show parameter remote_login_passwordfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile            string      EXCLUSIVE
SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS                            TRUE  TRUE  FALSE

SQL> grant sysdba to cat;

Grant succeeded.

SQL> select * from v$pwfile_users;

USERNAME                       SYSDB SYSOP SYSAS
------------------------------ ----- ----- -----
SYS                            TRUE  TRUE  FALSE
CAT                            TRUE  FALSE FALSE

可說明,口令檔案工作了!

注:本人截止到20110916仍在使用oracle,關於本話題如再有疑問請留言。

相關推薦

oracle: orapwd命令解決遠端登入ORA-01031: insufficient privileges問題

1、先看下命令說明:orapwd Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>

sudo命令用其他身份來執行命令限制root遠端登入詳解

一,命令sudo 命令語法 sudo(選項)(引數) 命令描述 sudo命令用來以其他身份來執行命令,預設的身份為root。 使用者使用sudo時,必須先輸入密碼,之後有5分鐘的有效期限,超過期限則必須重新輸入密碼。 命令選項 -b:

Oracle安裝後命令行中執行sqlplus / as sysdba出現錯誤ora-01031:insufficient privileges

Win10安裝Oracle後命令行中執行sqlplus / as sysdba出現錯誤ora-01031:insufficient privileges的解決方法 情景描述 剛剛在Win10

Oracle 11g連線sysdba出現ERROR: ORA-01031: insufficient privileges

      今天剛安裝好Oracle 11g,連線資料庫時出現了ERROR: ORA-01031: insufficient privileges       找到自己Oracle的安裝路徑,Oracle\product\11.2.0\dbhome_1\NETWORK\

[Oracle] sqlplus / as sysdba ora-01031 insufficient privileges

一. 問題描述 今天在新機子(WINDOWS)上搭建Oracle環境,完了之後通過SQL*PLUS本地登入時報錯: ora-01031 insufficient privileges   ——-許可權不足 二. 解決過程 錯誤排除 1. 當時首先想到的是oracl

在Linux環境下設定 ora-01031:insufficient privileges解決方法總結

今天需要使用sys使用者處理問題,但是報錯上面ora-01031:insufficient privileges。 在網上有很多方法,這個是自己經過測試的方法步驟。 1:首先檢查檔案sqlnet.ora檔案是否設定正確(檔案地址就是你oracle安裝的目錄)# sqlnet

conn / as sysdba 出現ORA-01031: insufficient privileges解決方案

一、檢查sqlnet.ora(WINDOWS下位於%ORACLE_HOME%NETWORKADMIN目錄)是否包含這句:SQLNET.AUTHENTICATION_SERVICES=(NTS),沒有的話加上  sqlnet.ora所在目錄(以Oracle 11g為例):

conn / as sysdba 出現ORA-01031: insufficient privileges 解決辦法

sysdba不能遠端登入這個也是一個很常見的問題了。  碰到這樣的問題我們該如何解決呢? 我們用sysdba登入的時候,用來管理我們的資料庫例項,特別是有時候,伺服器不再本臺機器,這個就更是有必要了。  當我們用sqlplus "/ as sysdba"  是可以登入

sys使用者遠端登入ora-01031錯誤的解決

現象: ORA-01031 無效許可權解決辦法:檢視引數,判斷遠端登入密碼檔案的狀態:SQL> show parameter passwordNAME                                 TYPE        VALUE----------

standby主從不同步主庫報錯:ORA-01031: insufficient privileges

今天發現物理standby的從庫不能同步主庫的資料了,主庫報錯:ORA-01031: insufficient privileges ORA-01031: insufficient privileges PING[ARC2]: Heartbeat failed to co

Oracle資料庫啟動時提示沒有許可權 ora-01031:insufficient privileges

情況說明 環境:Linux 操作語句: [Oracle@ora11r2 ~]$ sqlplus /nolog SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jun 10 18:22:16 2010 Copyri

ora-01031:insufficient privileges解決方法總結

主要是 sqlnet.ora 檔案和 remote_login_passwordfile 引數影響。 一直以來,我記住的一個知識點就是:SQLNET.AUTHENTICATION_SERVICES=(NTS)是使用OS認證的必須條件之一。 今天一個偶然的機會,才知道這個結論是不完全準確的。 在本文的測試中,

oracle:sys、system 無法登入問題:ORA-01031: insufficient privileges

請輸入使用者名稱:  sys/sys as sysdbaERROR:ORA-01031: insufficient privileges 請輸入使用者名稱:  system/system as sysoperERROR:ORA-01031: insufficient pri

使用SYS使用者遠端登陸報許可權不足的解決ORA-01031: insufficient privileges

1.監聽及tnsnames.ora正常,普通使用者使用服務名可以登陸資料庫。 [[email protected] admin]$ cat tnsnames.ora mypl =   (DESCRIPTION =     (ADDRESS = (PROTOCOL

ora-01031:insufficient privileges解決方法總結 .

sqlplus "/ as sysdba" 連不上,報ora-01031:insufficient privileges解決方法 注意多個數據庫例項時候,set ORACLE_SID='', 1、檢查sqlnet.ora(WINDOWS下位於%ORACLE_HOME%N

B樹B+樹B*樹分析MySQL的索引

樹的基本概念 根:樹的頂端結點 兄弟:具有同一個雙親(Parent)的孩子(Child)之間互稱為兄弟(Sibling)。 祖先:結點的祖先(Ancestor)是從根(Root)到該結點所經分支(Branch)上的所有結點。 葉子(終端結點):沒有孩子的結點(也就是度為0的結點)稱為

嵌入式工程師入門嵌入式工程師進階學嵌入式這些你需要知道

你是 找到 一個人 不知道 裏來 方法 高級編程 嵌入式系統 實用 想要從事嵌入式開發,但又不知道怎麽入門的,可以看下,下面我結合自身實際來談一談。 前提基礎:簡單的電路、模電、數電知識,C語言 一、從51單片機入手 如果有一些前提的基礎知識,要上手51單片機不算難。首先,

awk命令

log 次數 循環 alfred 數值 字符串 int 所有 進行 簡介 awk是一個強大的文本分析工具,相對於grep、sed命令,awk在其對數據分析並生成報告時,顯得尤為強大。簡單來說awk就是把文件逐行的讀入,然後將每行切片,再對切開的部分進行處理。 awk有3個不

ionic start 創建ionic項目報錯解決過程

解決 錯誤 版本 分享 sta all nbsp events ins 問題描述: 前一次創建利用命令行創建ionic項目一次性成功,第二次沒有運行: $ npm install -g ionic cordova 直接運行: ionic start ionicDemo

文件解析上傳漏洞

文件上傳漏洞 文件解析漏洞 中國菜刀 在web滲透中,我最期待兩種漏洞,一種是任意命令執行漏洞,如struct2漏洞等;另一種是文件上傳漏洞,因為這兩種漏洞都是獲取服務器權限最快最直接的方法。而對於任意命令執行漏洞,如果是通過內網映射出來的,那麽可能還需要使用不同的手段進行木馬文件上傳,從而獲取