RE: Difference in SYS user and A user with dba previleges.

I think most of the cases this works I have seen couple of cases where
either you have to connect directly to schema owner or connect as
sysdba. 
 
Version: 10.2.0.2
 
a) Note:309809.1, ORA-1031 : CREATE DATABASE LINK Fails
 
b) My case( Not sure why it happens, may be someone has answer), create
MATERIALIZED VIEW fails with ORA-01031 
 
SQL> conn dbasuper/dbasuper
Connected.
SQL> alter session set current_schema=APP;
 
Session altered.

SQL> CREATE MATERIALIZED VIEW APP.mymview
REFRESH COMPLETE
START WITH SYSDATE NEXT TRUNC(SYSDATE+1)+.99
WITH PRIMARY KEY
AS
select a.*
from app.mytab a
where owner not in ('SYS','SYSTEM')
/
  2    3    4    5    6    7    8    9  from app.mytab a
         *
ERROR at line 7:
ORA-01031: insufficient privileges

 
 
-- *******  Complete test case below *******************
 
drop user app cascade;
create user app identified by app;
grant create session, connect to app;
 

drop user dbasuper cascade;
create user dbasuper identified  by dbasuper;
grant dba to dbasuper;
 
grant CREATE MATERIALIZED VIEW to app,dbasuper;
grant CREATE ANY MATERIALIZED VIEW to app,dbasuper;
grant CREATE SNAPSHOT to app,dbasuper;
grant CREATE ANY SNAPSHOT to app,dbasuper;
grant QUERY REWRITE to app,dbasuper;
grant GLOBAL QUERY REWRITE to app,dbasuper;
grant UNLIMITED TABLESPACE to app,dbasuper;
 
conn dbasuper/dbasuper
 
alter session set current_schema=APP;
 
drop table APP.MYTAB;
create table APP.mytab as select rownum rid,a.* from all_objects a where
rownum < 11;
alter table app.mytab add constraint mytab$pk primary key(rid);
 
CREATE MATERIALIZED VIEW APP.mymview
REFRESH COMPLETE
START WITH SYSDATE NEXT TRUNC(SYSDATE+1)+.99
WITH PRIMARY KEY
AS
select a.*
from app.mytab a
where owner not in ('SYS','SYSTEM')
/
 
ERROR at line 7:
ORA-01031: insufficient privileges

 
-- Where as when I connect to sysdba account or as directly as app user
it MVIEW gets created with no issues. 
 
conn app/app
drop MATERIALIZED VIEW APP.mymview;
CREATE MATERIALIZED VIEW APP.mymview
REFRESH COMPLETE
START WITH SYSDATE NEXT TRUNC(SYSDATE+1)+.99
WITH PRIMARY KEY
AS
select a.*
from app.mytab a
where owner not in ('SYS','SYSTEM')
/
 
conn /as sysdba
 
drop MATERIALIZED VIEW APP.mymview;
 
CREATE MATERIALIZED VIEW APP.mymview
REFRESH COMPLETE
START WITH SYSDATE NEXT TRUNC(SYSDATE+1)+.99
WITH PRIMARY KEY
AS
select a.*
from app.mytab a
where owner not in ('SYS','SYSTEM')
/

________________________________

From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Mandal, Ashoke
Sent: Monday, October 09, 2006 10:14 AM
To: niall.litchfield@xxxxxxxxx; sjaffarhussain@xxxxxxxxx
Cc: Oracle-L@Freelists. Org (E-mail)
Subject: RE: Difference in SYS user and A user with dba previleges.


We were also asked by security audit team to use individual userid with
DBA privilege for database administration so that you know who has done
the changes in the database. But my feeling is that you can't track any
changes without any auditing on. 
 
Thanks,
Ashoke

________________________________

From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Niall Litchfield
Sent: Monday, October 09, 2006 9:21 AM
To: sjaffarhussain@xxxxxxxxx
Cc: Oracle-L@Freelists. Org (E-mail)
Subject: Re: Difference in SYS user and A user with dba previleges.


I'd agree with your security people that you
 
a) change default passwords and
b) don't use sys for admin tasks. 
 
I'm not sure that I'd be convinced by the argument that system shouldn't
be used, but that an identically privileged account should be setup
instead. 

 
On 10/9/06, Syed Jaffar Hussain <sjaffarhussain@xxxxxxxxx> wrote: 

        Hi List,
        
        I am working in an organization where security people asked us
not
        keep the sys and system user passwords, rather create an dba 
        authenticated user with dba prvileges.
        I know that the user with just dba privileges, can't shutdown
and
        startup the database.
        However, I believe, on server, we can use 'connect / as sysdba'
and do
        startup and shutdown. 
        Is there anything significant difference between the sys user
and a
        user with dba premission? I mean, dba administration point view.
        
        Thanks for your time.
        
        --
        Best Regards,
        Syed Jaffar Hussain
        8i,9i & 10g OCP DBA
        
        I blog at :http://jaffardba.blogspot.com/
        
        
http://www.oracle.com/technology/community/oracle_ace/ace1.html#hussain 
        
------------------------------------------------------------------------
----------
        "Winners don't do different things. They do things differently."
        --
        http://www.freelists.org/webpage/oracle-l
        
        
        




-- 
Niall Litchfield
Oracle DBA
http://www.orawin.info 

Other related posts: