SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
今天新建数据库使用hr用户练习的时候,set autotrace on时出现以下错误
是因为没有PLUSTRACE权限
涉及到@ORACLE_HOME/sqlplus/admin/plustrce.sql文件
内容如下
--DESCRIPTION--CreatesarolewithaccesstoDynamicPerformanceTables--fortheSQL*PlusSETAUTOTRACE...STATISTICScommand.--Afterthisscripthasbeenrun,eachuserrequiringaccessto--theAUTOTRACEfeatureshouldbegrantedthePLUSTRACEroleby--theDBA.----USAGE--sqlplus"sys/knl_test7assysdba"@plustrce----Catalog.sqlmusthavebeenrunbeforethisfileisrun.--ThisfilemustberunwhileconnectedtoaDBAschema.setechoondroproleplustrace;createroleplustrace;grantselectonv_$sesstattoplustrace;grantselectonv_$statnametoplustrace;grantselectonv_$mystattoplustrace;grantplustracetodbawithadminoption;setechooff
1. 查找数据库中是否有该角色
SQL>select*fromdba_roleswhererole='PLUSTRACE';norowsselected
2.建立角色 (使用sys用户)
SQL>@?/sqlplus/admin/plustrce.sqlSQL>SQL>droproleplustrace;droproleplustrace*ERRORatline1:ORA-01919:role'PLUSTRACE'doesnotexistSQL>createroleplustrace;Rolecreated.SQL>SQL>grantselectonv_$sesstattoplustrace;Grantsucceeded.SQL>grantselectonv_$statnametoplustrace;Grantsucceeded.SQL>grantselectonv_$mystattoplustrace;Grantsucceeded.SQL>grantplustracetodbawithadminoption;Grantsucceeded.SQL>SQL>setechooff
3.查询数据库
SQL>select*fromdba_roleswhererole='PLUSTRACE';ROLEPASSWORDAUTHENTICAT-------------------------------------------------PLUSTRACENONONE
4.授予操作用户改权限
SQL>grantplustracetohr;Grantsucceeded.
5.使用hr用户测试是否成功
SQL>connhr/hrConnected.SQL>SQL>setautotraceon
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。