Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

8

积分

1

好友

20

主题
1#
发表于 2014-3-13 10:56:44 | 查看: 4844| 回复: 8
本帖最后由 bj-jn 于 2014-3-13 11:05 编辑

版本:10.2.0.5.0(64bit)
操作步骤:
1.查看会话角色
SQL> select * from session_roles;

ROLE
------------------------------
DBA
SELECT_CATALOG_ROLE
HS_ADMIN_ROLE
EXECUTE_CATALOG_ROLE
DELETE_CATALOG_ROLE
EXP_FULL_DATABASE
IMP_FULL_DATABASE
GATHER_SYSTEM_STATISTICS
SCHEDULER_ADMIN
WM_ADMIN_ROLE
JAVA_ADMIN
JAVA_DEPLOY
XDBADMIN
XDBWEBSERVICES
PLUSTRACE
OLAP_DBA

2.查看会话权限
SQL> select * from session_privs where privilege like '%VIEW%';

PRIVILEGE
----------------------------------------
CREATE VIEW
CREATE ANY VIEW
DROP ANY VIEW
CREATE MATERIALIZED VIEW
CREATE ANY MATERIALIZED VIEW
ALTER ANY MATERIALIZED VIEW
DROP ANY MATERIALIZED VIEW
UNDER ANY VIEW
MERGE ANY VIEW

3.查询数据字典
SQL> select count(*) cnt from dba_data_files;

  COUNT(*)
----------
        24

4.创建基于数据字典的视图
SQL> create view v as select count(*) cnt from dba_data_files;
create view v as select count(*) cnt from dba_data_files
                                      *
ERROR at line 1:
ORA-01031: insufficient privileges

在该用户下创建基于普通表的视图没问题,只要创建基于数据字典或者动态性能视图的视图时都会报ORA-01031错误,请各位帮忙看看,谢谢!
2#
发表于 2014-3-13 11:32:02
做一个1031 的errorstack我看下

回复 只看该作者 道具 举报

3#
发表于 2014-3-13 14:35:30
Maclean Liu(刘相兵 发表于 2014-3-13 11:32
做一个1031 的errorstack我看下

刘大好,上传附件为level 10的errorstack

orcl_ora_8399.rar

843.45 KB, 下载次数: 895

回复 只看该作者 道具 举报

4#
发表于 2014-3-13 20:23:04
ksedmp: internal or fatal error
ORA-01031: insufficient privileges
Current SQL statement for this session:
create view v as select count(*) cnt from dba_data_files
----- Call Stack Trace -----
calling              call     entry                argument values in hex      
location             type     point                (? means dubious value)     

ksfchk kzpchkbu kzpchkbu 报错

回复 只看该作者 道具 举报

5#
发表于 2014-3-13 20:25:08
kzpchkbu   Kernel Zecurity layer Privileges CHecK privileges on an object

回复 只看该作者 道具 举报

6#
发表于 2014-3-13 20:28:41
SQL> grant dba to maclean;

Grant succeeded.

SQL> conn maclean/oracle
Connected.

INSTANCE_NAME
----------------
ASMDB1

SQL> create view v1 as select count(*) cnt from all_users;

View created.

SQL> create view v2 as select count(*) cnt from dba_users;
create view v2 as select count(*) cnt from dba_users
                                           *
ERROR at line 1:
ORA-01031: insufficient privileges


SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production





test case 2:

SQL> select * from v$VERSION;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production

SQL> grant dba to maclean;

Grant succeeded.

SQL> conn maclean/oracle
Connected.
SQL> create view v1 as select count(*) cnt from all_users;

View created.

SQL> create view v2 as select count(*) cnt from dba_users;
create view v2 as select count(*) cnt from dba_users
                                           *
ERROR at line 1:
ORA-01031: insufficient privileges

回复 只看该作者 道具 举报

7#
发表于 2014-3-13 20:31:18
这个现象是正常的

  1* select object_name,object_type,owner from dba_objects where object_name='DBA_USERS'
SQL> /

OBJECT_NAME                    OBJECT_TYPE         OWNER
------------------------------ ------------------- ------------------------------
DBA_USERS                      VIEW                SYS
DBA_USERS                      SYNONYM             PUBLIC


dba用户没有办法在属于SYS的视图上建另一层视图


SQL> conn / as sysdba
Connected.
SQL> create view sys_view1 select 1 "abc" from dual;
create view sys_view1 select 1 "abc" from dual
                      *
ERROR at line 1:
ORA-00905: missing keyword


SQL> create view sys_view1 as select 1 "abc" from dual;

View created.

SQL> conn maclean/oracle
Connected.
SQL> select * from sys.sys_view1;

       abc
----------
         1

SQL> create view dba_view1 as select * From sys.sys_view1;
create view dba_view1 as select * From sys.sys_view1
                                           *
ERROR at line 1:
ORA-01031: insufficient privileges

回复 只看该作者 道具 举报

8#
发表于 2014-3-14 09:05:21
Maclean Liu(刘相兵 发表于 2014-3-13 20:31
这个现象是正常的

  1* select object_name,object_type,owner from dba_objects where object_name='DBA_ ...

感谢刘大,看来这是正常现象那我就部纠结了!

回复 只看该作者 道具 举报

9#
发表于 2014-4-30 23:53:48
这个要显示给权限的。

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-21 03:32 , Processed in 0.059251 second(s), 23 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569