Creating view on v$waitstat in my schema

Hi,
How can I create a view on v$.. objects in my schema?
I have dba priveleges.
SQL> create view my_waitstat as select class,count from v$waitstat;
create view my_waitstat as select class,count from v$waitstat
ERROR at line 1:
ORA-01031: insufficient privileges
SQL>

I understatnd :-) that you very wise man
I ask a question because I need to resolve my problem quickly
How about this one?
SQL> connect / as sysdba;
Connected.
SQL> grant select on x$kcbwait to dbmon;
grant select on x$kcbwait to dbmon
ERROR at line 1:
ORA-02030: can only select from fixed tables/views
SQL> grant select on v$waitstat to dbmon;
grant select on v$waitstat to dbmon
ERROR at line 1:
ORA-02030: can only select from fixed tables/views

Similar Messages

  • Trouble Creating View on External Table in Diff Schema

    I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    returns the error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I created a directory:
    CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
    Granted privs:
    grant read,write on directory ER_ADMIN_DIR to public;
    Created the external table EXT1 in a different schema WH1:
    CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('FILE1.TXT')
    REJECT LIMIT UNLIMITED;
    I can query from the table successfully connected as SYS:
    SQL> select count(*) from wh1.ext1;
    1008
    1 row selected.
    However when I try to create a view on that table connected as SYS:
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    I get the following error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
    Is there a known bug on creating views on external tables remotely?
    Thanks for any help!
    Tina

    I have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
    scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
      2  /
    User created.
    scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
      2  /
    Grant succeeded.
    scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE wh1.ext1
      2    (table_name  VARCHAR2(100),
      3       column_name VARCHAR2(100))
      4  ORGANIZATION EXTERNAL
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY er_admin_dir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          FIELDS TERMINATED BY ','
    10          MISSING FIELD VALUES ARE NULL)
    11       LOCATION ('file1.txt'))
    12  REJECT LIMIT UNLIMITED
    13  /
    Table created.
    scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
      2  /
    CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    scott@ORA92> CONNECT wh1/wh1
    Connected.
    scott@ORA92> @ LOGIN
    scott@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]2
    wh1@ORA92> GRANT SELECT ON ext1 TO scott
      2  /
    Grant succeeded.
    wh1@ORA92> CONNECT scott/tiger
    Connected.
    wh1@ORA92> @ LOGIN
    wh1@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]A92
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
      2  /
    Session altered.
    scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
      2  /
    View created.
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
      2  /
    Session altered.
    scott@ORA92> SELECT * FROM wh1.ext1view
      2  /
    TABLE_NAME
    ---------------------------------------------------------COLUMN_NAME
    ---------------------------------------------------------tab1
    col1
    tab2
    col2
    scott@ORA92>

  • Is it possible to grant users to create views only?

    We are using SQL Server 2008 R2.
    Some advanced users have been working on the database to retrieve data from tables and alter existing views for years. Now we would like to give them permissions to create their own views.
    It is not supposed to give them too much rights such as creating tables. Is it possible to do that, such as creating new schema for that purpose. Thanks.

    You left out an important step that we failed to mention: you muist change the order of the schema. This is required, or else ownership chaining will void all security checks.
    In script below, you get a permission error trying to create the first view, but comment out the ALTER AUTHORIZATION statement and it will not.
    Using a loginless user and EXECUTE USER is an execellent way to test a permission setup on database level.
    CREATE DATABASE yngve
    go
    USE yngve
    go
    CREATE SCHEMA torsten
    go
    CREATE USER ulrik WITHOUT LOGIN WITH DEFAULT_SCHEMA = torsten
    GRANT SELECT ON SCHEMA::torsten TO ulrik
    GRANT ALTER ON SCHEMA::torsten TO ulrik
    GRANT CREATE VIEW TO ulrik
    ALTER AUTHORIZATION ON SCHEMA::torsten TO ulrik
    go
    CREATE TABLE dbo.alfa(a int NOT NULL)
    INSERT dbo.alfa(a) VALUES (88)
    go
    EXECUTE AS USER = 'ulrik'
    go
    CREATE VIEW torsten.albin AS SELECT a FROM dbo.alfa
    go
    SELECT * FROM torsten.albin
    go
    CREATE VIEW torsten.alfons AS SELECT getdate() AS today
    go
    SELECT * FROM torsten.alfons
    go
    REVERT
    go
    USE tempdb
    go
    DROP DATABASE yngve
    Erland Sommarskog, SQL Server MVP, [email protected]
    Thanks. I have tried to create a login less account.
    CREATE USER [testuser] without login WITH DEFAULT_SCHEMA=[SchemaTest]
    GOGRANT SELECT ON SCHEMA :: SchemaTest TO  [testuser]
    GO
    GRANT ALTER ON SCHEMA :: SchemaTest TO  [testuser]
    GOGRANT CREATE VIEW TO  [testuser]
    GO
    ALTER AUTHORIZATION ON SCHEMA :: SchemaTest TO [testuser]
    GO
    Without "ALTER AUTHORIZATION" statment, user can create SchemaTest.v_MyView and select all data.
    With "ALTER AUTHORIZATION" statment, user can still be able to create SchemaTest.v_MyView, but unable to select retrieve data from the view. The error is as below.
    The SELECT permission was denied on the object 'MyTable', database 'ViewTest', schema 'dbo'.
    Maybe I still miss something. But at least user cannot retrieve protected data.

  • Creating views in a new schema to access certain rows of tables in source schema

    Hi,
    Oracle 10.2.0.4
    We are trying to mask certain data from some users. My suggestion is that we create a new schema view_schema on the same instance where we have source tables say in source_schema.
    We then create views in view_schema as below
    CREATE VIEW AS SELECT * FROM source_schema.table where COLUMN_n = 'XYZ';
    we then grant SELECT on these views to a role and assign new users that role to be able to see the viewed data.
    So the questions below.
    We can create views to look at data in another schema WITHOUT giving SELECT permissions directluy on source_schema.tanle?
    This will work and there is no need to create synonyms etc
    WE can manage users and views much easilier
    Does this make sense and would that be better than selecting views with say table_name_view in source schema for this purpose and even creating synonyms for these views with the same tanle names in sourece_schema?
    Thanks

    905989 wrote:
    Hi,
    Oracle 10.2.0.4
    We are trying to mask certain data from some users. My suggestion is that we create a new schema view_schema on the same instance where we have source tables say in source_schema.
    We then create views in view_schema as below
    CREATE VIEW AS SELECT * FROM source_schema.table where COLUMN_n = 'XYZ';
    we then grant SELECT on these views to a role and assign new users that role to be able to see the viewed data.
    So the questions below.
    We can create views to look at data in another schema WITHOUT giving SELECT permissions directluy on source_schema.tanle?
    This will work and there is no need to create synonyms etc
    WE can manage users and views much easilier
    Does this make sense and would that be better than selecting views with say table_name_view in source schema for this purpose and even creating synonyms for these views with the same tanle names in sourece_schema?
    Thanks
    1. You can create the view in another schema (first granting privileges to the view schema) without granting privileges from the source schema
    2. You probably want to create public synonyms for the view(s).  You can refer to the view as schema.view but this is cumbersome
    3. I am not sure about management being easier but added complexity should not be too bad.  Write documentation describing how everything works and the object involved.
    Another, more complicated but more powerful possibility is to use row level security also known as virtual private database - if you have the license.  You create a profile for a table and a procedure to generate WHERE clauses to filter any query against the table and columns defined in the profile.  Again, you need the license to do this.

  • Create materialized view throws insufficient privileges in single schema

    I'm trying to create a complex materialized view in my own schema, using only tables from my own schema:
    CREATE MATERIALIZED VIEW MYSCHEMA.MYMVIEW AS
        SELECT
            A.ONE_THING,
            B.ANOTHER_THING,
            C.A_THIRD_THING
        FROM MYSCHEMA.TABLEA A
        JOIN MYSCHEMA.TABLEB B
            ON A.COL1 = B.COL1
        JOIN MYSCHEMA.TABLEC C
            ON A.COL2 = C.COL2The line JOIN MYSCHEMA.TABLEB B throws an ORA-01031: insufficient privileges error, highlighting TABLEB.
    I understand that grants need to be explicit on tables when creating objects across schemas, but this code is operating within my own schema only; i created and own all the tables in this schema.
    What's going on?
    Thanks!

    Perhaps it is the tool that i am using that highlights the wrong item, because as it turns out, i don't have the CREATE MATERIALIZED VIEW permission after all (the permission was mistakenly granted to a different user instead of to me).
    SELECT * FROM SESSION_PRIVS;returns CREATE VIEW, but does not return CREATE MATERIALIZED VIEW.
    Sorry to have wasted your time.

  • Create view and alter Session gets 0RA-01031

    I can't create a view after using ALTER SESSION set current_schema without using an explicit schema. I get ORA-01031. Is this a known bug? Here are the details:
    1. Log on as SYSTEM
    2. ALTER SESSION set current_schema=FRED;
    3. CREATE VIEW vFoo as select * from Foo;     -- ORA-01031: insufficient privileges
    4. CREATE VIEW FRED.vFoo as select * from Foo;     -- this works!
    I've read where some privileges need to be granted directly. In fact, if Fred grants select privilege on Foo to SYSTEM, the statement in #3 above works. However, something doesn't seem right because why does #4 succeed without the GRANT?
    In case you're wondering why I don't just use #4 above, which does work, it's because I've got a script that will be run by customers to create tables, views, etc. in an arbitrary schema and the schema is associated with a user with limited permissions. Hence, the use of the ALTER SESSION.

    See, You looged as SYSTEM (Scheme = SYSTEM)
    Now you alter your session to another schema FRED.
    Now if you want to access SCHEMA of FRED, You need to connect first.
    SQL > connect user/password@host
    Then
    SQL > CREATE VIEW vFoo as select * from Foo;
    View created.

  • Create View from Database Links - Question

    Question
    I'm missing something simple.
    I'm trying to create a view, from a Database Link.
    CREATE VIEW view_name
    AS SELECT a.*
    FROM schema.tablename@dblink a;
    When I run this in the SQL Commands window.
    I get this error message.
    ORA-00933: SQL command not properly ended
    What am I missing? Any help is appreciated...

    <i>CREATE VIEW vw_name
    AS SELECT a.*
    FROM [email protected] a;
    </i>
    <br>
    1) User (schema) which is creating view must have proper db_link to source database. For that try this for testing purpose:
    select 1 from [email protected]<br>
    If this fail then db_link is not ok! This step is absolute must to go any further step to!!!
    <br>
    2) when db_link is set, then your view should be named as:
    CREATE VIEW vw_name
    AS SELECT *
    FROM <b>schema_name</b>.[email protected];<br>
    please pay attention to "schema_name", because from remote side every table is in some schema so it really need declaration of owner schema.
    <br>
    Hope this helps...

  • Error Creating View on External Table

    I create my oracle directory connected as SYS as SYSDBA and grant read,write to public:
    CREATE OR REPLACE DIRECTORY ER_ADMIN_DIR AS 'C:\win32app\ingr\ER\ER_Init\scripts';
    grant read,write on directory ER_ADMIN_DIR to public;
    I creat my external table from SYS to reside in another schema called DRTEST:
    CREATE TABLE DRTEST.SPEC_REQUIRED (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('atts_in_red.tx')
    REJECT LIMIT UNLIMITED ;
    I can select from the table and all is good at this point.
    However, I get an error when I try to create a view (in DRTEST from SYS) based on the external table.
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED;
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    (note I'm still connected as SYS as SYSDBA here)
    I can create the view if I connect to DRTEST and run the exact same create view statement there. Is there something in Oracle that prevents me from doing this from the SYS account? I usually think of SYS as having the "Power of God to do all things".
    I have to create the external table and view on several schema's and I don't want the user to have to connect to each schema separately.
    Tina

    Tina,
    I think you are facing bug 2948123 (CREATE VIEW ON EXTERNAL TABLE ORA-6564). The workaround is to connect (in your case) as user DRTEST and then perform the CREATE VIEW statement (you tested this already). Or (according to the bug description) create the view under the SYS schema itself.

  • What can i do for creating view on a public synonym?

    Hi people,
    I have create a public synonym for other users object as,
    SQL> create public synonym pdep for scott.dept;
    Synonym created.
    then i tend to create a view on this public syn as,
    SQL> create view vpdep as select * from pdep;
    create view vpdep as select * from pdep
    ERROR at line 1:
    ORA-01031: insufficient privileges
    I have privilege to create view.also i can create view on a public synonym of my own objects.for ex,
    SQL> create public synonym cdep for dept;
    Synonym created.
    SQL> create view vcdep as select * from cdep;
    View created.
    what could be the reason behind this?is there any privilege required for me.pls suggest me.
    Regards
    VIDS

    Hi vidusnat!
    This is from Oracle's onlinedocumentation:
    >
    Privileges Required to Create Views
    To create a view, you must meet the following requirements:
    You must have been granted one of the following system privileges, either explicitly or through a role:
    o The CREATE VIEW system privilege (to create a view in your schema)
    o The CREATE ANY VIEW system privilege (to create a view in another user's schema)
    You must have been explicitly granted one of the following privileges:
    o The SELECT, INSERT, UPDATE, or DELETE object privileges on all base objects underlying the view
    o The SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, or DELETE ANY TABLE system privileges
    In addition, in order to grant other users access to your view, you must have received object privileges to the base objects with the GRANT OPTION clause or appropriate system privileges with the ADMIN OPTION clause. If you have not, then grantees cannot access your view.
    >
    I hope that this will bring a little light into darkness!
    Yours sincerely
    Florian W.

  • Create view throwing an error

    Hello guys, I am trying to create a view from the result set of a sql query. The sql when run independently works fine, but when I try to create a view on it it throws an error saying that the table does not exist. below is the create view I am using.
    create view ops$oracle.pci_view as SELECT
         (select name from v$database@dwdev) database_name,
          (select host_name from v$instance) host_name,
          (select version from v$instance) dbversion,
           o.owner,
           o.object_name table_name,
           o.CREATED table_created,
           o.last_ddl_time table_last_ddl_time,
           t.tablespace_name,
           t.last_analyzed,
           t.partitioned,
           t.num_rows,
           T.COMPRESSION,
           t.compress_for,
           t.read_only,
           tb.status tablespace_status,
           tb.encrypted tablespace_encrypted,
           tb.compress_for tablespace_compress,
           tb.contents,
           TC.COLUMN_NAME,
           tc.data_type,
           TC.DATA_LENGTH,
           tc.data_precision,
           tc.data_scale,
           tc.nullable,
           tc.column_id,
           tc.num_distinct,
           tc.avg_col_len,
           tc.density,
           tc.num_nulls,
           tc.low_value,
           tc.high_value,
           tc.last_analyzed col_last_analyzed,
           ec.encryption_alg,
           ec.salt,
           ec.integrity_alg,
           (SELECT tcm.comments
              FROM dba_tab_comments tcm
             WHERE tcm.owner = T.OWNER AND tcm.table_name = t.table_name)
              table_comments,
           (SELECT ccm.comments column_comments
              FROM dba_col_comments ccm
             WHERE     ccm.owner = TC.OWNER
                   AND ccm.table_name = tc.table_name
                   AND ccm.column_name = tc.column_name)
              column_comments
      FROM dba_objects o,
           dba_tables T,
           dba_tablespaces tb,
              dba_tab_columns tc  
            LEFT JOIN
              dba_encrypted_columns ec      ***********************************************
           ON     ec.owner = TC.OWNER
              AND ec.table_name = tc.table_name
              AND ec.column_name = tc.column_name
    WHERE o.owner NOT IN
              ('APPQOSSYS',
               'DBSNMP',
               'EXFSYS',
               'GGAPP',
               'OPS$ORACLE',
               'ORACLE_OCM',
               'OUTLN',
               'SYS',
               'SYSTEM',
               'WMSYS',
               'XDB')
           AND o.object_type = 'TABLE'
           AND NOT EXISTS
                      (SELECT 1
                         FROM dba_mviews mv
                        WHERE mv.owner = o.owner
                              AND mv.container_name = o.object_name)
           AND t.owner = o.owner
           AND t.table_name = o.object_name
           AND tb.tablespace_name = t.tablespace_name
           AND tc.owner = o.owner
           AND tc.table_name = o.object_name
           AND tc.owner = t.owner
           AND tc.table_name = t.table_name
           AND tc.data_length > 15
           AND tc.data_type NOT LIKE ('TIMESTAMP%')
           AND (tc.data_precision IS NULL OR tc.data_precision > 15);(The line containing the string of astrixes, that is the table that the error says does not exist)
    can someone help me where I am going wrong.
    Thanks

    969224 wrote:
    what if I create the view in SYS for few minutes until i can complete the task i was assigned and after that drop the view I created in SYS schema, would that have any effect on the database?Uh, yeah .. SYS isn't any better an option than SYSTEM.
    Those schemas are "off limits" to us ... ignore them .. pretend they do not exist. (seriously ..)
    Sounds like you need a new schema to store your application objects.

  • VIew of Package body in another schema in EA 3.0

    I would like the ability in SQL Developer to view the package body of another schema with the CREATE ANY PRIVILGE.
    For instance, in TOAD you can grant access to DBA_SOURCE or SELECT_CATALOG_ROLE and then be able to view another schema's package body.
    This is long overdue without having to log into that schema or granting CREATE ANY PRIVILEDGE to user.
    This one is really needed

    "CREATE ANY PRIVILEGE" is irrelevant to the ability of viewing the source owned by other users.
    Please provide exact script for creating a user, which is able to see the code, say in HR schema, via the query
    select * from all_source
    where owner = 'HR'
    and yet missing the nodes in the OtherUsers->Packages->PKG_A->PKG_A Body in the navigator.

  • How to create view with schemabinding on cross datbases(partitioned views)

    Hello Everyone,
    Please help me to sort this issue. I know it is not possible bind the scheman in below example. But is there any solution to solve this issue.
    I've tables like below
    create database D1--First database
    create table dbo.t1(
    id int
    create database D2--Second database
    create table dbo.t2(
    id int
    i want to create a view with the schema binding option on this
    create database D3
    use d3
    create view vw_v1
    with schemabinding
    as
    select id from d1.dbo.t1
    union all
    select id from d2.dbo.t2
    I'm getting this below error
    Msg 4512, Level 16, State 3, Procedure vw_v1, Line 7
    Cannot schema bind view 'vw_v1' because name 'd1.dbo.t12' is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.
    Many thanks
    A-ZSQL

    CREATE VIEW
    SCHEMABINDING
    Binds the view to the schema of the underlying table or tables. When SCHEMABINDING is specified, the base table or tables cannot be modified in a way that would affect the view definition. The view definition itself must first be modified or dropped to remove
    dependencies on the table that is to be modified.
    > When you use SCHEMABINDING,
    the select_statement must include the two-part names (schema.object)
    of tables, views, or user-defined functions that are referenced.
    >
    All referenced objects must be in the same database.
    José Diz     Belo Horizonte, MG - Brasil

  • Create user with select privilege only one schema

    can someone tell me how i can create user with select priviliges only one schema.
    i don't want the user to have any select privileges with other schema.
    can someone advise me.
    Thansk

    In general, you would do something like
    CREATE ROLE abc_read_only;
    FOR x IN (SELECT * FROM dba_tables WHERE owner='ABC')
    LOOP
      EXECUTE IMMEDIATE 'GRANT SELECT ON abc.' || x.table_name || ' TO abc_read_only';
    END LOOP;
    CREATE USER your_user ...;
    GRANT abc_read_only TO your_userYou create a role, grant the role SELECT access to all the tables in the ABC schema (you can extend this to grant access to views, functions, etc depending on the requirements), and then grant that role to your user.
    Justin

  • Create view problem

    dear all,
    i am using 816 dB on sun platform.
    a schema is exported from a US7ASCII dB and imported to a UTF8 dB. the data, index, constraints etc are imported successfully. however, error msg prompted when creating view,
    ORA-03113: end-of-file on communication channel
    there is no problem when importing the same dump file to a US7ASCII dB.
    any idea?

    This might help you. I had a similar situation when migrating from Ora7 to Ora8.1.6.
    Imported Ora7 dump into Ora8 DB. When trying to insert into some to the tables which had constraints and trggers, received ORA-03113. This is a known bug in 8.1.5 and 8.1.6. Oracle support bug no: 1078551. You got to upgrade to 8.1.7.

  • How can I create View

    Hi,
    I need to create an view of another schema. How can I do so? And the same view need to placed in diffrent schema. How can I perform this.

    [email protected] wrote:
    Hi,
    I need to create an view of another schema. How can I do so? What do you mean? I think you want create view in schema A using other schema(B) objects? If yes then you can do:
    create view v_b as
    select * from b.x,b.y
    where /*conditions*/;
    And the same view need to placed in diffrent schema. How can I perform this.there is no that term(matter).But you can create public synonym for this view then all users can use this view:
    sqlplus A/pass;
    create public view v_b for v_b;

Maybe you are looking for