Can't query 'job_queue_processes in Oracle DB 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production - oracle

I want to query the value of job_queue_processes:
select value from v$parameter where name='job_queue_processes';
But I can't, I get a
`ORA-00942: table or view does not exist`
Querying user jobs is fine, as well:
select * from user_jobs
Querying version is fine, as well:
select * from v$version where rownum<2;
SYS.dba_jobs_running & SYS.dba_jobs are not working either (ORA-00942: table or view does not exist)
select * from SYS.dba_jobs_running;
select * from SYS.dba_jobs;

SYS#research 15-APR-15> grant select on v_$parameter to sample;
Grant succeeded.
SAMPLE#research 15-APR-15> select value from v$parameter where name='job_queue_processes';
VALUE
---------------------------------------------------------------------------------------------
1000

Related

Equivalent SQL_NO_CACHE command in Oracle

I use SQL_NO_CACHE in MySQL for run query select without cache.
like this
select SQL_NO_CACHE id from mytable
Now I want to run an equivalent query in oracle.
I search in google but not found any things for run select without cache in oracle.
Query results are normally not cached in Oracle, only the requested table or index blocks. In Oracle 12 a result cache was introduced, that seems to be similar to the MySQL feature:
SELECT /*+ NO_RESULT_CACHE */ id
FROM mytable;
SELECT /*+ RESULT_CACHE */ id
FROM mytable;
More details are in Oracle's Performance Guide.

ORA-01435: user does not exist when accessing V$Locked_Object in Oracle

I am trying to run below query from SOME_USER
SELECT * FROM V$Locked_Object; -- Public Synonym
also tried
SELECT * FROM "SYS"."V_$LOCKED_OBJECT";
and getting.
ORA-01435: user does not exist
01435. 00000 - "user does not exist"
*Cause:
*Action:
I have given these grants from SYS to SOME_USER
grant select on "SYS"."V_$LOCKED_OBJECT" to SOME_USER; still getting the same error.
I noticed that I am able to access other public synonyms in SOME_USER like V$LOCK_ACTIVITY, v$lock_type etc. getting this error when trying V$Locked_Object and V$LOCK only. Please suggest maybe I am missing some basics.
Oracle Version - Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
I'd suggest you to check against metadata.
First, check whether the object exists in the DB at all (I'm sure it exists, but still for double checking).
I hope you have access to dba_% objects
select * from dba_objects where object_name like 'V%LOCKED%OBJ%';
Then, check if you have the permissions to access that object
select * from all_objects where object_name like 'V%LOCKED%OBJ%';
If the object exists in the dba_ table and can not be found in all_ it means you don't have the permissions for that. Execute the following for double checking
select *
from user_tab_privs
where table_name like 'V%LOCKED%OBJ%';
You'll get probably nothing here as you can't find the object, so the next thing I'd check is the role name that has access to that particular object
select *
from role_tab_privs
where table_name like 'V%LOCKED%OBJ%';
Then, check if you have that role assigned to your user
select * from session_roles
I hope this will help
use
select * from "SYS"."V$locked_objects"

How to get select rights of information_schema.schemata in grrenplum

I created a new user in greenplum db and just want to give select rights of information_schema.schemata table. After running below query I am just able to select the information_schema.schemata table with out eror however no data appears.
GRANT SELECT ON information_schema.schemata TO <username>;
GRANT SELECT ON information_schema.schemata TO <username>;
SELECT * FROM information_schema.schemata ;
I am expecting the data should be shown to me from new user however I am getting below message with no data.
Total query runtime: 291 msec
0 rows retrieved.
I had no problems running this on version 5.x of GP but got the same results as you on GP 4.3.32.1 (the latest 4.3 release).
Looking at the definition of the information_schema.schemata view
\d+ information_schema.schemata
shows that is joins two tables, pg_namespace and pg_authid, from the pg_catalog schema.
In 4.3.x, a regular user doesn't have access to pg_authid.
So, as gpadmin, run:
psql -d <userdb> -c 'grant select on pg_catalog.pg_authid to <user>'
Then your query should work.

get All sql history in oracle 10g

How to get all select and insert statement from the beginning in the oracle? I tried,
select * from v$sqlarea;
but it's giving only today results, but i need all select and insert statement from the beginning where oracle installed or before particular month.
Thanks in advance.
For recent SQL:
select * from v$sql
For history:
select * from dba_hist_sqltext

Oracle - creating table WITHOUT parallel option

for some reason when I'm trying to CTAS (create table as select) on a large table (40million~ records ) I see in the v$session 18 active sessions with my sql statement.
when i'm trying to hint the optimizer to use less CPUs
create table table_name parallel (degree 2) as
select * from large_table;
I see 6 active sessions.
with degree 3 I see 8 active sessions.
I tryed degree default but it created 18 sessions as well.
previously in the code , before executing the CREATE TABLE statement I changed few attributes in my session :
alter session set workarea_size_policy = manual;
alter session set hash_area_size = 1048576000;
I want to create the table in 1 session , how to I do it ?
Thanks !
Use the
NO_PARALLEL hint
in the select clause of the CTAS statement.
See also Note on Parallel Hints
create table t as
select /*+ NO_PARALLEL */ *
from large_table;
Investigation & testing:
SQL*Plus version and Oracle Database version:
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Sep 21 11:56:58 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
I used two different sqlplus processes to connect to the same database via different service names. One running copy of sqlplus will be used to perform the CTAS. The other copy of sqlplus will be used to to query the number of sessions.
The query to get session count and results prior to anything else:
SQL> select service_name, count(*)
2 from v$session
3 where username = 'ME'
4 group by service_name
5 order by service_name;
SERVICE_NAME COUNT(*)
---------------------------------------------------------------- ----------
aaaaaa2 1
aaaaaa3 1
Creating large_table:
SQL> create table LAO as select * from all_objects;
Table created.
SQL> exec dbms_stats.gather_table_stats(user, 'LAO');
PL/SQL procedure successfully completed.
SQL> create table large_table parallel 4 as
2 select N.N, LAO.*
3 from LAO
4 cross join (select level as N from dual connect by level <= 400) N
5 /
Table created.
SQL> select to_char(count(*), 'fm999,999,999')
2 from large_table;
TO_CHAR(COUN
------------
42,695,200
Since large_table was created with parallel 4, a simple CTAS defaults to 4 worker processes, CTAS:
create table t as
select * from large_table;
Sessions:
SERVICE_NAME COUNT(*)
---------------------------------------------------------------- ----------
aaaaaa2 5
aaaaaa3 1
Now, the noparallel table option. (Creating a table that by default won't have parallel plans for DML, but the parallelism of large_table causes the CTAS to run in parallel.)
drop table t;
create table t noparallel as
select * from large_table;
Sessions (SYS$BACKGROUND showed up towards the end of the last query, then just stuck around. I believe it dies if not needed in a certain amount of time.):
SERVICE_NAME COUNT(*)
---------------------------------------------------------------- ----------
SYS$BACKGROUND 1
aaaaaa2 5
aaaaaa3 1
The NO_PARALLEL hint in the select clause does work:
drop table t;
create table t as
select /*+ NO_PARALLEL */ * from large_table;
Sessions:
SERVICE_NAME COUNT(*)
---------------------------------------------------------------- ----------
SYS$BACKGROUND 1
aaaaaa2 1
aaaaaa3 1
One last CTAS, where a table is created that will use multiple processes by default, but will not during the CTAS:
drop table t;
create table t parallel 4 as
select /*+ NO_PARALLEL */ * from large_table;
Sessions:
SERVICE_NAME COUNT(*)
---------------------------------------------------------------- ----------
SYS$BACKGROUND 1
aaaaaa2 1
aaaaaa3 1

Resources