Oracle

以 sysoper 身份關閉時出現“權限不足”

  • August 11, 2019

我無法使用授予 sysoper 的普通使用者關閉數據庫。

這與我不知道的 PDB 之間顯然存在差異(並且文件也沒有澄清),因為如果我為 PDB 使用者執行相同的操作,系統操作員可以毫無問題地關閉/啟動 PDB。我看過的其他例子也表明應該沒有錯。我錯過了什麼?

確切的錯誤資訊是:

ORA-01031: insufficient privileges

感謝您的任何見解。

作為 sysoper 的權限不足

這取決於您如何授予SYSOPER特權。要關閉數據庫實例,使用者應該擁有SYSOPER所有容器的權限。

下面展示該場景。

我有普通使用者通話C##_TEST

[oracle@ora12c dbs]$ sqlplus sys@oracdb as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 2 08:47:05 2016

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

Enter password: 

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options


SQL> select common from dba_users where username='C##_TEST';

COM
---
YES

我只授予SYSOPER使用者ORACDB(CDB)。

SQL> grant sysoper to c##_test container=current;

Grant succeeded.

然後我使用 C##_TEST 使用者連接到容器數據庫SYSOPER並嘗試關閉數據庫並收到ORA-01031錯誤。

[oracle@ora12c dbs]$ sqlplus c##_test/test@oracdb as sysoper

SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 2 08:49:05 2016

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> shut immediate;
ORA-01031: insufficient privileges
SQL> 

現在我再次SYSOPER通過選項授予特權container=all。而這個時候使用者可以關閉數據庫。

[oracle@ora12c dbs]$ sqlplus sys@oracdb as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 2 08:49:36 2016

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

Enter password: 

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> grant sysoper to c##_test container=all;

Grant succeeded.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

[oracle@ora12c dbs]$ sqlplus c##_test/test@oracdb as sysoper

SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 2 08:50:06 2016

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

引用自:https://dba.stackexchange.com/questions/156964