要想打开或者关闭一个pdb,需要具有sysdba,sysoper,sysbackup,sysdg这些权限中的一种?
从现在的测试情况看,是这样的,赋予一个用户sysbackup或者sysdg权限,都可以关闭和启动pdb
To change the open mode of the PDB from mounted to opened or from opened to
mounted, the current user must have SYSDBA, SYSOPER, SYSBACKUP, or SYSDG
administrative privilege. The privilege must be either commonly granted or locally
granted in the PDB. The user must exercise the privilege using AS
sys_privilege_name at connect time.
• For all other operations performed using the ALTER PLUGGABLE DATABASE
statement, the current user must have the ALTER DATABASE system privilege, and the privilege must be either commonly granted or locally granted in the PDB.
• To close a PDB, the PDB must be open.
sysbackup权限能够close和open pdb
sysdg权限能够close和open pdb
一个用户如果没有sysdba sysoper sysbackup sysdg这些权限,是不能连接一个没有open的也就是处于 mount状态的pdb的
但是对于一个多instance的pdb,如果pdb在某个或者某些instance上open了,那么一个没有这些权限的用户是可以连接上这些open的instance中的一个,然后可以用 alter pluggable database open read write 去将这个pdb在剩余的没有open的instance上open
02:59:59 SQL> USERNAME SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM
-------------------- ----- ----- ----- ----- ----- -----
SYS TRUE TRUE FALSE FALSE FALSE FALSE
PDBADMIN FALSE FALSE FALSE TRUE FALSE FALSE
06:27:21 SQL> connect pdbadmin/comp1@comp1pdb21047 as sysbackup
Connected.
06:27:43 SQL> alter pluggable database close immediate instances=all;
Pluggable database altered.
Elapsed: 00:00:03.55
06:28:03 SQL> alter pluggable database open read write instances=all;
Pluggable database altered.
Elapsed: 00:00:04.42
06:30:16 SQL> select username,sysdba,sysoper,sysasm,sysbackup,sysdg,syskm from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM
-------------------- ----- ----- ----- ----- ----- -----
SYS TRUE TRUE FALSE FALSE FALSE FALSE
PDBADMIN FALSE FALSE FALSE FALSE TRUE FALSE
Elapsed: 00:00:00.06
06:30:59 SQL> connect pdbadmin/comp1@comp1pdb21047 as sysdg
Connected.
06:31:41 SQL> alter pluggable database close immediate instances=all;
Pluggable database altered.
Elapsed: 00:00:02.92
06:31:57 SQL> alter pluggable database open read write instances=all;
Pluggable database altered.
Elapsed: 00:00:03.98