2.修改打开的数据库进行限制模式
alter system enable restricted session;
看监听服务的状态:
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 01-DEC-2019 09:50:50
Uptime 0 days 5 hr. 16 min. 35 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.sztech.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=dbserver.sztech.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/emrep/xdb_wallet))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=dbserver.sztech.com)(PORT=5501))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "cdb1" has 1 instance(s).
Instance "cdb1", status RESTRICTED, has 1 handler(s) for this service...
Service "cdb1XDB" has 1 instance(s).
Instance "cdb1", status RESTRICTED, has 1 handler(s) for this service...
Service "emrep" has 1 instance(s).
Instance "emrep", status READY, has 1 handler(s) for this service...
Service "emrepXDB" has 1 instance(s).
Instance "emrep", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status RESTRICTED, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status RESTRICTED, has 1 handler(s) for this service...
Service "pdb1_1" has 1 instance(s).
Instance "cdb1", status RESTRICTED, has 1 handler(s) for this service...
Service "pdb2" has 1 instance(s).
Instance "cdb1", status RESTRICTED, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
作者: 郑全 时间: 2020-1-15 18:51
1.查看实例处于限制模式 :
SQL> select instance_name,status,logins from v$instance;
INSTANCE_NAME STATUS LOGINS
-------------------------------- ------------------------ --------------------
orcl OPEN RESTRICTED
3.授予 限制会话权限
SQL> conn / as sysdba
已连接。
SQL> grant restricted session to sztech;
授权成功。
--再次登录,就可以了。
SQL> conn sztech/sztech
已连接。
SQL>
注意:再数据库变为限制会话模式之前登录的用户,不受影响。
4.取消限制模式:
SQL> alter system disable restricted session;
系统已更改。
5.验证,目前已经取消限制模式,普通用户可以登录
SQL> select instance_name,status,logins from v$instance;
INSTANCE_NAME STATUS LOGINS
-------------------------------- ------------------------ --------------------
orcl OPEN ALLOWED
SQL>