Privilege for flashback query
I am using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi.
Documentation says"
◦For Flashback Query and Flashback Version Query, grant _FLASHBACK_ and SELECT privileges on specific objects to be accessed during queries or grant the FLASHBACK ANY TABLE privilege to allow queries on all tables. "
However, I do not see flashback privilege, but I am still able to use flashback query if the table is in same schema.
All the following select yeields - no rows found.
select * from user_tab_privs where privilege like '%FLASHBACK%'
select * from USER_SYS_PRIVS where privilege like '%FLASHBACK%'
select * from role_tab_privs where privilege like '%FLASHBACK%'
select * from role_sys_privs where privilege like '%FLASHBACK%'
What privilege do we need to use flashback query? +Why I am able to use flashback query ( select * from <tablename> as of SCN ...) without the privilege?
+Note: Flashback_on in V$database table is NO
Edited by: spur230 on Mar 11, 2011 1:39 PM
Ganesh Srivatsav wrote:
Do your research using this
select * from dict where table_name like '%PRIV%'G.Went through all of them but did not find how schema owner has flashback privilege.
Similar Messages
-
Check package/procedure level privileges for a user
hi gurus,
how to check the package/procedure level privileges for a user? like dba_tab_privs for tables.
for eg: grant execute on dbms_scheduler to user1.
now, i need to verify that user1 has execute privilege on dbms_scheduler or not.
what's the view for this?
thanks in advance,
charlesSQL> select privilege, count(*) from dba_tab_privs group by privilege order by 1;
PRIVILEGE COUNT(*)
ALTER 19
DEBUG 256
DELETE 131
DEQUEUE 3
EXECUTE 19315
FLASHBACK 52
INDEX 14
INSERT 137
MERGE VIEW 36
ON COMMIT REFRESH 52
QUERY REWRITE 52
PRIVILEGE COUNT(*)
READ 7
REFERENCES 54
SELECT 3752
UNDER 3
UPDATE 111
WRITE 5
17 rows selected.DBA_TAB_PRIVS is for more than just tables. -
Initial load of small target tables via flashback query?
A simple question.
Scenario: I’m currently building a near real time warehouse, streaming some basic facts and dimension tables between two databases. I’m considering building a simple package to "reset" or reinitialize the dimensions an all-round fix for variety of problem scenarios (since they are really small, like 15 000 rows each). The first time I loaded the target tables I utilized data pump with good success, however since streams transforms data on the way a complete reload is somewhat more complex.
Considered solution: Ill just write a nice flashback query via db-link fetching data from a specific (recent) SCN and then I reinitialize the table on that SCN in streams...
Is this a good idea? Or is there something obvious like a green and yellow elephant in the gift shop that I overlooked? Why I’m at all worried is because in the manuals this solution is not mention among the supported ways to do the initial load of a target table and I’m thinking there is a reason for this?I have a series of streams with some tranformations feeding rather small dimensional tables, I want to make this solution easy to manage even when operations encounter difficult replication issues, so Im developing a PL/SQL package that will:
1) Stop all streams
2) Clear all errors
3) Truncate target tables
4) Reload them including transformation (using a SELECT AS OF "ANY RECENT SCN" from target to source over dblink)
5) Using this random recent SCN I will re-instantiate the tables
6) Start all streams
As you see datapump even if it works is rather difficult to utilize when you tranform data from A to B, using AS OF I not only get a constant snapshot from the source, I also get the exact SCN for it.
What do you think? Can I safely use SELECT AS OF SCN instead of datapump with SCN and still get a consisten sollution?
For the bigger FACT tables im thinking about using the same SELECT AS OF SCN but there with particular recent paritions as targets only and thus not having to reload the whole table.
Anyways this package would ensure operations that they can recover from any kind of disaster or incomplete recovery on both source and target databases, and just re-instantiate the warehouse within minutes. -
Flashback query vs. flashback versions query
I have noticed that I can do a regular flashback query as far back as I have UNDO data available for the query, as long as long as the table definition has not changed. Flashback versions query, however, is limited to the UNDO retention parameter.
So, for example, if my UNDO_RETENTION parameter is set to the default 900 seconds, I can only go back 15 minutes in time, even if the regular flashback query shows data in the table from 1 hour ago.
Why does Oracle hold to the the retention parameter for versions query, but let you go back farther for the regular query?Flashback query shows 7th Nov value and the next query shows 8th nov value..
thanks,
baskar.l -
Task Privileges for Existing Users - Looking for a global update solution
After some reading I understand that if you set the task privileges for the PUBLIC user in the Privileges section of Discoverer Administrator (10g), any new user created in the system will pick up the privileges you have assigned to the PUBLIC user.
I currently have 4000+ users who have access to Discoverer Plus and the ability to create/edit queries. I want to limit who can access Discoverer Plus functionality to approximately 150 users.
I have changed my PUBLIC user to NOT have privileges but this will only affect new users. Is there any way to restrict 4000+ users without having to go through each user individually and set the privileges.
I am looking for a global update solution. I am wondering if this can be done through the back-end.Hi Mezzobella
If you change the rights for the public user then other users, who have not been manually adjusted in any way, will automatically pick up the public rights. Therefore, if you have a lot of users that are not changing this means that at some point in their life you will have clicked OK or Apply on the screen with a user displayed. This now assigns the rights to that user as opposed to inheriting them from the public user.
What you are describing is the perfect reason why you should not administer Discoverer using user accounts but to use roles or responsibilities instead.
In your case you are now somewhat stuck. The programatic way to revoke these rights is to drop rows from the EUL5_ACCESS_PRIVS table but this could take longer than doing inside Discoverer. Basically, when a user has been granted privileges one row per privilege is inserted into this table. The column AP_EU_ID contains the ID of the user. The column GP_APP_ID is the one that tells you what privilege a user has. Here is a list of the privileges:
1000 Desktop / Plus Privilege (U)
1001 Create / Edit Query (U)
1002 Item Drill (U)
1003 Drill Out (U)
1004 Grant Workbook (aka Sharing) (U)
1005 Collect Query Statistics (U)
1006 Admin Privilege (A)
1007 Set Privilege (A)
1008 Create / Edit Business Area (A)
1009 Format Business Area (A)
1010 Create / Edit Summaries (A)
1011 Not used as far as can be determined
1012 Schedule (U)
1013 User is never required to schedule workbooks (U)
1014 Save workbooks to database (U)
1015 Managed scheduled workbooks (A)
1016 This is an apps mode EUL
1017 This is the user's assigned language
1018 User is allowed to change password
1019 to 1023 Not used as far as can be determined
1024 Create Link (U)
Note: A = Admin privilege, U = User privilege
Theoretically you could manually delete rows from this table and that will revoke the rights. In reality, Oracle do not like it when inexperienced users manually the EUL as you could corrupt it. Therefore, any manual updates must be done with utmost caution after making sure you back up or have a copy of the table you will be updating - just in case.
Try running this query to see the content:
SELECT DECODE( AP_EU_ID, 104198, 'Viewer', 103697, 'Plus', 'Other' ) "Who" , AP_ID, AP_TYPE, AP_EU_ID, AP_PRIV_LEVEL, GP_APP_ID, GBA_BA_ID, GD_DOC_ID, AP_ELEMENT_STATE
FROM EUL5_ACCESS_PRIVS
Best wishes
Michael -
Flashback query to view table transactions
I am on 11g DB and have a requirement to view a set of tables transactional events that occurred every 5-10 minutes. The events for each table must be viewed in the order they occurred. From there a may need to write that information to another table. I was looking to use the flashback quey feature (as I see it is enabled on my DB) to do this. What is the best way to do this with flashback query and are there any performance considerations to consider querying the flashback tables on a regular interval?
Thanks
Edited by: bobmagan on Feb 6, 2013 4:43 AMHi,
refer ,
http://www.oracle-developer.net/display.php?id=320
Simply , you can use below query to get records as of desired TS from any table of the database, However oldest timestamp that you can query depends on your UNDO retention
SELECT count(1) FROM <table_name> AS OF TIMESTAMP to_timestamp('13-MAY-11 19:00:00','DD-MON-YY HH24:MI:SS');Thanks,
Ajay More
http://www.moreajays.com -
Flashback query on the v$transaction
hi All,
if i know the SCN just before the transaction commit, after the transaction is commit, I can use flashback query on the v$transaction to get the info about the transaction, such as undo segment number, used undo block.
Here comes the testcase, i use dbms_lock.sleep(6) because the smon_scn_time is updated every 6 seconds(Note ID: 281510.1)
the problem is that the flashback query on the v$transaction doest not work, no rows return at the last line.
any advice?
sys@SID10G> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for MacOS X Server: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
sys@SID10G> drop table t purge;
Table dropped.
sys@SID10G>
sys@SID10G> create table t as select * from all_objects where rownum <= 1000;
Table created.
sys@SID10G>
sys@SID10G> exec dbms_lock.sleep(6);
PL/SQL procedure successfully completed.
sys@SID10G>
sys@SID10G> update t set object_name = lower(object_name);
1000 rows updated.
sys@SID10G>
sys@SID10G> --save the current scn for later flashback query
sys@SID10G> col scn new_value _scn
sys@SID10G>
sys@SID10G> select dbms_flashback.get_system_change_number scn from dual;
SCN
6397848
sys@SID10G>
sys@SID10G> select xidusn, xidslot, xidsqn, used_ublk from v$transaction;
XIDUSN XIDSLOT XIDSQN USED_UBLK
8 12 4725 8
sys@SID10G>
sys@SID10G> select dbms_flashback.get_system_change_number scn from dual;
SCN
6397848
sys@SID10G>
sys@SID10G> commit;
Commit complete.
sys@SID10G>
sys@SID10G> exec dbms_lock.sleep(6);
PL/SQL procedure successfully completed.
sys@SID10G> select xidusn, xidslot, xidsqn, used_ublk from v$transaction as of scn &_scn;
old 1: select xidusn, xidslot, xidsqn, used_ublk from v$transaction as of scn &_scn
new 1: select xidusn, xidslot, xidsqn, used_ublk from v$transaction as of scn 6397848
no rows selectedEdited by: Sidney Chen on Aug 7, 2011 3:33 PMPlease see,
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_flashback.htm#g1703502
You cannot retrieve past data from a dynamic performance (V$) view. A query on such a view always returns current data.Aman.... -
Flashback query to get back a old table with data.
Hi,
By mistake i drop one table 20 days before so is it possible to get that table back using flashback query.
if yes , can you give me some idea for that query.
thanks for your support...Hi,
Flashback is a 10g new Feature. The only solution in your case will be recover the table from a backup. If you have an exp backup just import the table back to the DB, if you have a RMAN backup you can perform an incomplete recovery (point-in-time recovery) to the time just
before the drop in an auxiliary DB and exp/imp back the table to your DB.
Cheers,
Francisco Munoz Alvarez
http://www.oraclenz.com -
Gurus,
I'm receiving an ora-01555 error when attempting to run a flashback query. How can I get this resolve as I need to recover records that were deleted!
SQL> show parameter undo
NAME TYPE
VALUE
undo_management string
AUTO
undo_retention integer
604800
undo_tablespace string
UNDOTBS1
Undo Tablespace is 6GB!
select count(*) from bld as of timestamp (sysdate-5);
ORA-01555: snapshot too old: rollback segment number 19 with name "_SYSSMU19_1281712960$" too small
01555. 00000 - "snapshot too old: rollback segment number %s with name \"%s\" too small"
*Cause: rollback records needed by a reader for consistent read are
overwritten by other writers
*Action: If in Automatic Undo Management mode, increase undo_retention
setting. Otherwise, use larger rollback segments
All help is greatly appreciated.Based on what you have posted you are toast. The data you are trying to read is no longer in the undo tablespace and therefore is unavailable to you.
Why you might ask? I suspect you would find great value in reading the most current issue of Oracle magazine: Especially Tom Kyte's article where he specifically addresses this issue.
SQL> select 604800/86400 from dual;
604800/86400
7Your undo retention exceeds 5 days ... thus all you have accomplished is to waste disk space. -
Flashback query gives an error
We're on version 10.1.0.4, having upgraded from 10.1.0.3, and Flashback Query stopped working:
SQL> create table test_flashback (d date);
Table created.
SQL> begin
2 for i in 1 .. 10
3 loop
4 insert into test_flashback values (sysdate);
5 commit;
6 dbms_lock.sleep(60);
7 end loop;
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> select * from test_flashback;
D
12-FEB-09
12-FEB-09
12-FEB-09
12-FEB-09
12-FEB-09
12-FEB-09
12-FEB-09
12-FEB-09
12-FEB-09
12-FEB-09
10 rows selected.
SQL> alter table test_flashback enable row movement;
Table altered.
SQL> select * from test_flashback AS OF TIMESTAMP
2 TO_TIMESTAMP('2009-02-12 08:29:00', 'YYYY-MM-DD HH:MI:SS');
select * from test_flashback AS OF TIMESTAMP
ERROR at line 1:
ORA-00600: internal error code, arguments: [kdsgrp1], [], [], [], [], [], [], []I looked through METALINK, & while this particular error isn't listed, it does mention that there was a reported problem with using Flashback and "AS OF TIMESTAMP". The solution was to use Flashback with an SCN.
So, my question is, how do you know which SCN is associated with that particular time frame? When someone says, I dropped a record about an hour ago, could you get it back for me ... how do I get the SCN for "about an hour ago"?
Thanks,
ChuckOracle maintains a mapping of SCNs to timestamps with a granularity of a few seconds (the exact number depends on the Oracle release-- I believe in 10.2 it's +/- 3 seconds) automatically, and uses this map to find the closest SCN to the timestamp you specify. That map should be maintained (again automatically) far longer than your 25 hour window.
If you need something that goes back months or years, it may make sense to save that data off into your own table.
Justin -
Minimum privileges for creating table
I wanted to know of the minimum set of privileges for creating a table in Oracle 11g database. First I created a schema and granted the create table privilege to the schema. When I tried to create a table in the schema, it was giving a message of like privileges required on the tablespace. Granting the resource privilege grants the unlimited quota on all the tablespaces including SYSTEM and SYSAUX tablespace which may not be an ideal scenario. So, my query is that what are the minimum set of privileges for creating a table in Oracle 11g database.
I hope, my question is clear.
Please revert with the reply to my query.
RegardsHi,
If you are going to use the read only :
SQL> create user anar identified by anar;
User created.
SQL> grant create session, select any table, select any dictionary to anar;
Grant succeeded.
SQL> conn anar/anar
Connected.
SQL> create table test(id number);
create table test(id number)
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> desc test.test
Name Null? Type
ID NUMBER
SQL> insert into test.test values (1);
insert into test.test values (1)
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> update test.test set id = 15;
update test.t set id = 15
ERROR at line 1:
ORA-01031: insufficient privileges
Thank you -
FLASHBACK QUERY - Range based - Doubt - Help needed -URGENT
Hi,
I want to user the flashback query facility to capture the history of versions for a day (i.e) i want to get the data versions from morning 10 a.m to 6.pm.
How to get the versions by using the time range for a day.
I used the query as
select a.eno,
b.eno,
a.ename,
b.ename
from emp a, emp as of timestamp
to_timestamp('08-NOV-2006 06:32:21.999999 AM','DD-MON-RRRR HH:MI:SS.ff6 AM') b
where a.eno=b.eno
The above query will fetch only one versions for the specified timestamp.
How could i implement the range based search through flashback query.
Please suggest any methods to implement the same.
Thanks in advance.You'll want to read the documentation about Oracle Flashback Version Query.<br><br>
Regards,
Rob. -
So, this is a very powerfull tool, but useless if you have a 3-tire application and using a persistent connection feature.
So in most cases you'll have only one Oracle user used to connect. It would be great if the flashback_transaction_query view can be extended with a CLIENT_INFO or CLIENT_IDENTIFIER fields from the session. Hope, this is not too hard to code... This information is VERY usefull in case you have invistigation of who, why and what for had changed some information.But want to check if the same concepts works incase of 'TRUNCATE' commandWhy not to check then ?
SQL> select * from t;
TID I
1 A
1 B
1 D
2 A
2 C
2 C
2 B
3 A
3 C
4 A
4 B
4 C
5 A
6 A
7 A
15 rows selected.
SQL> select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from dual;
GET_SYSTEM_CHANGE_NUMBER
5228349
SQL> truncate table t;
Table truncated.
SQL> select * from t as of scn 5228349;
select * from t as of scn 5228349
ERROR at line 1:
ORA-01466: unable to read data - table definition has changedMoreover, the answer is described in the documentation:
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/consist.htm#sthref2174
Flashback Query does not work through DDL operations that modify columns, or drop or truncate tables
Rgds. -
Why Am I able to view flashback query longer than undo_retention?
Hi
this is what I did
SQL> select sysdate from dual;
SYSDATE
2008-11-23 16:55:39
--to find out the lower transaction end
SQL> exec :v_lower_timestamp:='2008-11-23 15:55:39';
--adjust the timestamp to a lower value than will overshot the undo_retention
SQL> update emp set sal=sal*2 where empno=:v_empno;
1 row updated.
SQL> commit;
Commit complete.
SQL> select sysdate from dual;
SYSDATE
2008-11-23 16:59:14
SQL> exec :v_upper_timestamp:='2008-11-23 16:59:14';
SQL> SELECT * FROM emp AS OF TIMESTAMP TO_TIMESTAMP(:v_lower_timestamp, :v_date_ format) WHERE empno=:v_empno;
EMPNO ENAME JOB MGR HIREDATE SAL
COMM DEPTNO
7934 MILLER CLERK 7782 1982-01-23 00:00:00 650
10
SQL> SELECT * FROM emp AS OF TIMESTAMP TO_TIMESTAMP(:v_upper_timestamp, :v_date_ format) WHERE empno=:v_empno;
EMPNO ENAME JOB MGR HIREDATE SAL
COMM DEPTNO
7934 MILLER CLERK 7782 1982-01-23 00:00:00 1300
10
but when I try to do that for flashback transaction query
SQL> SELECT versions_startscn, versions_endscn, versions_xid, versions_operation ,
ename, sal
FROM emp
VERSIONS BETWEEN TIMESTAMP
TO_TIMESTAMP(:v_lower_timestamp, :v_date_format)
AND TO_TIMESTAMP(:v_upper_timestamp, :v_date_format)
WHERE empno=:v_empno;
2 3 4 5 6 7 FROM emp
ERROR at line 3:
ORA-30052: invalid lower limit snapshot expression
--but the moment I raise the lower timestamp limit
SQL> exec :v_lower_timestamp:='2008-11-23 16:55:39';
VERSIONS_STARTSCN VERSIONS_ENDSCN VERSIONS_XID V ENAME SAL
619162 0300250051010000 U MILLER 1300
619162 MILLER 650
flashback transaction works, this is understandable.
but my question is why flashback query does allow the snapshot to be capture even longer than the undo_retention specified by but not flashback version query?
thanks a lot!Select 10 files and open the files, then select and open the next 10 files.
-
help needed for writing query
i have the following tables(with data) as mentioned below
FK*-foregin key (SUBJECTS)
FK**-foregin key (COMBINATION)
1)SUBJECTS(table name)
SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
2 02 Computer Science
3 03 Physics
4 04 Chemistry
5 05 Mathematics
7 07 Commerce
8 08 Computer Applications
9 09 Biology
2)COMBINATION
COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
383 S1 9 4 2 3
384 S2 4 2 5 3
---------I actually designed the ABOVE table also like this
3) a)COMBINATION
COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
383 S1
384 S2
b)COMBINATION_DET
COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
1 383 9
2 383 4
3 383 2
4 383 3
5 384 4
6 384 2
7 384 5
8 384 3
Business rule: a combination consists of a maximum of 4 subjects (must contain)
and the user is less relevant to a COMB_NAME(name of combinations) but user need
the subjects contained in combinations
i need the following output
COMB_ID COMB_NAME SUBJECT1 SUBJECT2 SUBJECT3 SUBJECT4
383 S1 Biology Chemistry Computer Science Physics
384 S2 Chemistry Computer Science Mathematics Physics
or even this is enough(what i actually needed)
COMB_ID subjects
383 Biology,Chemistry,Computer Science,Physics
384 Chemistry,Computer Science,Mathematics,Physics
you can use any of the COMBINATION table(either (2) or (3))
and i want to know
1)which design is good in this case
(i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
good method to link with same table but if 4 subjects only(and must) comes
detail table is not neccessary )
now i am achieving the result by program-coding in C# after getting the rows from oracle
i am using oracle 9i (also ODP.NET)
i want to know how can i get the result in the stored procedure itsef.
2)how it could be designed in any other way.
any help/suggestion is welcome
thanks for your time --PradeeshWell I forgot the table-alias, here now with:
SELECT C.COMB_ID
, C.COMB_NAME
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
FROM COMBINATION C;
As you need exactly 4 subjects, the columns-solution is just fine I would say.
Maybe you are looking for
-
The application doesn't want to open! I'm able to get the welcome screen, but when I click either "new project" or "open project," I get nothing. I'm able to open "organize," however. There's one clue as to what the trouble is.... I downloaded the mo
-
Displaying pdf report in pop page by command button.
Hi I am jdev 10.1.3.3 .I am displaying an pdf report on click of command button like this. FacesContext.getCurrentInstance().getExternalContext().redirect("http://www.acme.com/someCustomPath/myFantasticReport.pdf"); But problem is this.It is displayi
-
I Pad calendar will not keep list longer than 1 year. help!
How do you get the List function of Icandar to kepp the list for more than 1 year?
-
How do I change my number online ?
I'm having a lot of trouble trying to change my number I can't find it can you please help me
-
I can't stop or clear data from a database
This is the error I'm getting: Error: 1013018 Cannot unload database [Fin] while user [moore] is performing database operation. Wait for the user to complete the operation, or ask the user to abort it. Log out all users and then unload the database.