安装oracle玩玩(3)-unlock user,分配plustrace角色权限
上一篇 /
下一篇 2008-05-03 00:20:53
/ 个人分类:oracle 实践
让普通的开发人员也跟查看实行计划,
开锁 hr 用户Linux 命令是什么呢?
ALTER USERANONYMOUS/*用户名*/
ACCOUNT UNLOCK;转 http://q.yesky.com/group/review-7442427.html
忘记oracle sys用户后更新密码并unlock1.sqlplus '/as sysdba'
2.alter user xxx identified by yyy;
( 这里的xxx可以是system、sysman等等。)
这样执行完毕后,如果你采用sqlplus sysman/yyy的话,会提示
ERROR:
ORA-28000: the account is locked
所以你不如直接采用下面的操作来执行:
3.alter user xxx identified by yyy account unlock;
以hr用户进入sqlplus
SQL> set autot on
SP2-0618: セッション識別子が見つかりません。PLUSTRACEロールが有効かを確認してください。
SP2-0611: STATISTICSレポートを使用可能にするときにエラーが発生しました。
SQL>
转 http://hi.baidu.com/archieyao/blog/item/33badeeff1190715fdfa3ce6.html
2、解决方法:
A.以SYS用户登录:
oracle>sqlplus '/ as sysdba';
B.运行utlxplan.sql(rdbms/admin下)脚本创建PLAN_TABLE;
SQL>@ D:oracleora81RDBMSADMINutlxplan.sql
C.通过执行plustrce.sql(ORACLE_HOME/sqlplus/admin/plustrce.sql)脚本创建plustrace角色,这将V$视图上的选择权限授予该角色,也将plustrace角色授予DBA角色,脚本部份内容如下:
drop role plustrace;
create role plustrace;
grant select on v_$sesstat to plustrace;
grant select on v_$statname to plustrace;
grant select on v_$session to plustrace;
grant plustrace to dba with admin option;
D.将plustrace角色授予当前用户(无DBA角色的用户)。
现在只需完成后两项,注意文件路径不是在rdbms下,
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
に接続されました。
SQL> set autot on
SP2-0618: セッション識別子が見つかりません。PLUSTRACEロールが有効かを確認してください。
SP2-0611: STATISTICSレポートを使用可能にするときにエラーが発生しました。
SQL> connect / as sysdba;
接続されました。
SQL> @C:\oracle\product\10.2.0\client_1\sqlplus\admin\plustrace.sql
SP2-0310: ファイル"C:\oracle\product\10.2.0\client_1\sqlplus\admin\plustrace.sql"をオープンできませ・
SQL> C:\oracle\product\10.2.0\client_1\sqlplus\admin\plustrce.sql
SP2-0024: 変更するものがありません。
SQL> @C:\oracle\product\10.2.0\client_1\sqlplus\admin\plustrce.sql
SQL>
SQL> drop role plustrace;
drop role plustrace
*
行1でエラーが発生しました。:
ORA-01919: ロール'PLUSTRACE'は存在しません
SQL> create role plustrace;
ロールが作成されました。
SQL>
SQL> grant select on v_$sesstat to plustrace;
権限付与が成功しました。
SQL> grant select on v_$statname to plustrace;
権限付与が成功しました。
SQL> grant select on v_$mystat to plustrace;
権限付与が成功しました。
SQL> grant plustrace to dba with admin option;
権限付与が成功しました。
SQL>
SQL> set echo off
SQL> grant plustrace to hr
2 ;
権限付与が成功しました。
SQL> unconnect
SP2-0042: 不明なコマンドです("unconnect")。行の残りは無視されました。
SQL> disconnect
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining optionsとの接続が切断されました。
SQL> show user
ユーザーは""です。
SQL> connect hr/oracle
接続されました。
SQL> set autot on
SQL> select * from plan_table;
レコードが選択されませんでした。
実行計画
----------------------------------------------------------
Plan hash value: 103984305
--------------------------------------------------------------------------------
-
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
|
--------------------------------------------------------------------------------
-
| 0 | SELECT STATEMENT | | 1 | 11081 | 2 (0)| 00:00:01
|
| 1 | TABLE ACCESS FULL| PLAN_TABLE$ | 1 | 11081 | 2 (0)| 00:00:01
|
--------------------------------------------------------------------------------
-
Note
-----
- dynamic sampling used for this statement
統計
----------------------------------------------------------
1 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
2511 bytes sent via SQL*Net to client
521 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed
SQL>
由此更加能够理解关于不同用户之间的权限关系,授权技巧,先创建角色,再将该角色授予管理员,with admin option,再由管理员授予其他人员
导入论坛
引用链接
收藏
分享给好友
推荐到圈子
管理
举报
TAG: