Linux 環境數據庫安裝、啓動、鏈接常見錯誤

===============================================================================
Error Code:ORA-01031: insufficient privileges
===============================================================================
$ sqlplus sys/oracle@ora11g as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 12 19:08:41 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
ERROR:
ORA-01031: insufficient privileges
Enter user-name: linux

解決方法: sql

 一、以oracle用戶登陸服務器,並經過sqlplus以管理員身份登陸
 sqlplus / as sysdba
 
 二、檢查系統參數remote_login_passwordfile的value值是否爲EXCLUSIVE
 show parameter password;
 
 三、查詢具備sysdba權限的用戶
 select * from v$pwfile_users;
 
 四、若是第3步查詢的結果爲空給用戶賦DBA權限
 grant sysdba to sys;
 
 五、若是步驟4返回ORA-01994錯誤,創建password文件
  orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password='賦DBA權限用戶的密碼' entries=DBA權限的用戶數
 
 六、從新以SY
要點說明:
 Oracle權限認證的基本順序是這樣的,先由SQLNET.AUTHENTICATION_SERVICES的設置值來決定是使用OS認證仍是口令文件認證,若是使用口令文件認證的話,就要看還有後面的兩個條件:若是 remote_login_passwordfile 參數設置爲非NONE並且口令文件存在的話就能正常使用口令文件認證,不然將會失敗。 數據庫

 系統默認  SQLNET.AUTHENTICATION_SERVICES = 默認不設 服務器

 SQLNET.AUTHENTICATION_SERVICES = ALL 支持OS認證和口令文件認證。
 SQLNET.AUTHENTICATION_SERVICES = NTS 僅用於 WIN NT 系統。
 SQLNET.AUTHENTICATION_SERVICES = NONE 指定oracle只使用口令文件 (WIN 和 LINUX)。
 SQLNET.AUTHENTICATION_SERVICES   不設   LINUX 默認支持 OS認證和口令文件認證。
 WIN 系統只支持口令文件認證。 oracle

 系統默認  REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE spa

 REMOTE_LOGIN_PASSWORDFILE = NONE 不使用口令文件
 REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE 使用口令文件,但只有一個數據庫實例能夠使用
 REMOTE_LOGIN_PASSWORDFILE = SHARED 多個數據庫實例共用一個口令文件,這種設置下不能增長其餘數據庫用戶做爲特殊權限用戶到口令文件中的。 ci

 ORAPWD FILE=< FILENAME > PASSWORD=< PASSWORD >  ENTRIES=< MAX_USERS > rem

 參數解析:
 FILENAME:密碼文件名文件命規則「orapw」+<實例名>;
 PASSWORD:設置INTERNAL/SYS賬號的口令;
 MAX_USERS:密碼文件中能夠存放的用戶數,對應於許能夠SYSDBA/SYSOPER權限登陸數據庫的用戶數。由於在日後的維護中,若用戶數超出了此限制,則須要重建密碼文件 get

 


===============================================================================
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
===============================================================================
Error Code:ORA-32001: write to SPFILE requested but no SPFILE is in use
===============================================================================
SQL> alter system set cluster_database=false scope=spfile; string

若是有如下報錯,說明數據庫不是用spfile來啓動的
alter system set cluster_database=false scope=spfile
*
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE is in use
能夠經過如下語句來確認是不是用spfile來啓動的,爲空表示用pfile啓動
SQL> show parameter spfile;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string

使用如下語句來修改oracle來使用spfile啓動
SQL> create spfile from pfile;
File created.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
SQL> alter system set cluster_database=false scope=spfile;

System altered.
===============================================================================
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
===============================================================================
Error Code:ORA-01078: failure in processing system parameters
     LRM-00109: could not open parameter file '/opt/oracle/products/10.1.0.3/db_1/dbs/initjason.ora'
===============================================================================
錯誤信息:
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/products/10.1.0.3/db_1/dbs/initjason.ora'


解決辦法:
cp $ORACLE_BASE/admin/$ORACLE_SID/pfile/init.ora.85201021251 /opt/oracle/products/10.1.0.3/db_1/dbs/initjason.ora

> sqlplus /nolog

SQL*Plus: Release 10.1.0.3.0 - Production on Thu Jun 8 13:16:00 2006

Copyright (c) 1982, 2004, Oracle.  All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                   778212 bytes
Variable Size              57679900 bytes
Database Buffers          109051904 bytes
Redo Buffers                 262144 bytes
Database mounted.
Database opened.
SQL>           

問題解決!

注:Oracle在啓動過程當中,須要讀取參數文件(pfile/spfile)來建立實例.Oracle在啓動過程當中,尋找參數文件的順序爲:spfile<sid>.ora,spfile.ora,init<sid>.ora.
===============================================================================
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
===============================================================================
Error Code:ora-01031 :insufficient privileges
===============================================================================
1.多是防火牆沒有關閉

檢查防火狀態:
linux:~ # chkconfig -list|grep -i fire
SuSEfirewall2_final       0:off 1:off 2:off 3:off 4:off 5:off 6:off
SuSEfirewall2_init        0:off 1:off 2:off 3:off 4:off 5:on   6:off
SuSEfirewall2_setup       0:off 1:off 2:off 3:off 4:off 5:off 6:off
開啓防火牆:
linux:~ # chkconfig --level 5 SuSEfirewall2_init on
linux:~ # chkconfig -list|grep -i fire
SuSEfirewall2_final       0:off 1:off 2:off 3:off 4:off 5:off 6:off
SuSEfirewall2_init        0:off 1:off 2:off 3:off 4:off 5:on   6:off
SuSEfirewall2_setup       0:off 1:off 2:off 3:off 4:off 5:off 6:off
關閉防火牆:
linux:~ # chkconfig --level 5 SuSEfirewall2_init off
linux:~ # chkconfig -list|grep -i fire
SuSEfirewall2_final       0:off 1:off 2:off 3:off 4:off 5:off 6:off
SuSEfirewall2_init        0:off 1:off 2:off 3:off 4:off 5:off 6:off
SuSEfirewall2_setup       0:off 1:off 2:off 3:off 4:off 5:off 6:off
===============================================================================
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
===============================================================================
Error Code:ORA-01119: error in creating database file '/home/oracle/oradata/test01/testTMP.dbf'
      ORA-27040: file create error, unable to create file
   Linux-x86_64 Error: 2: No such file or directory

===============================================================================
-- 建立臨時表空間
 CREATE TEMPORARY TABLESPACE VoiceInsight_Temp
 TEMPFILE '/home/oracle/oradata/test01/testTMP.dbf'
 SIZE 32M
 AUTOEXTEND ON
 NEXT 32M MAXSIZE 500M
 EXTENT MANAGEMENT LOCAL;

 

ORA-01119: error in creating database file

'/home/oracle/oradata/test01/testTMP.dbf'
 ORA-27040: file create error, unable to create file
 Linux-x86_64 Error: 2: No such file or directory

解決方法:

在sqlplus中調用Unix命令須要在命令前加個感嘆號。如SQL> !ps -aef | grep ora11gr2

SQL> !mkdir -p /home/oracle/oradata/test01   SQL> CREATE TEMPORARY TABLESPACE VoiceInsight_Temp TEMPFILE '/home/oracle/oradata/test01/testTMP.dbf' SIZE 32MAUTOEXTEND ON NEXT 32M MAXSIZE 500M EXTENT MANAGEMENT LOCAL; Tablespace created. ===============================================================================

相關文章
相關標籤/搜索