Rowid in BIGFILEs
Hi experts ,
when i execute this command :=== select dbms_rowid.rowid_relative_fno('AAAM7eAAAAAAAAUAAD','bigfile') from dual;
I get 1024 result.... because this is a bigfile tablespaces rowid.. how should i use the rowid_create function with relative_fno set to 1024.. i just want to know the relative file number
Olive
Even though it not visible, it is a virtual field that you can reference:
:block_name.rowid
Regards
Similar Messages
-
Maximum number of blocks for a bigfile datafile?
Hello,
In 10g, when using bigfile tablespaces, the maximum size of a datafile can be between 8TB to 128TB depending on the block size (2K to 32K). The formula given to calculate the max size of a bigfile datafile is:
Maximum datafile size = db_block_size * maximum number of blocks
So my question is how do you calculate the max number of blocks? Oracle documentation states that the max number of blocks is 4,294,967,296 (4 billion) 2^32. But where do they get this number from? I read, on a different site (not Oracle), that it is the addressing scheme used in ROWID that changed permitting the possibility of addressing 4 billion blocks instead of 4 million:
This is due to a new addressing scheme Oracle uses internally. Oracle ROWID, addressing a database object stored in a traditional SMALLFILE tablespace, divides the 12 bytes thusly: 3 bytes for the Relative File#, 6 bytes for the Block# and 3 bytes for the object. The same rowid addressing an object stored in a new BIGFILE tablespace uses the 9 bytes to store the Block# within the unique file, as there is no reason to use the 3 bytes for the Relative File# since there is only one file in that tablespace. Thus the new addressing scheme permits up to 4Gblocks (4,294,967,296) in a single data file and the maximum file size can reach 8 TB for a blocksize of 2K and 128 TB for a blocksize of 32K.
But, even with this explanation, 4 billion still makes no sense because using 9 bytes equates to 2^72 addressable blocks, not 2^32. Am I missing something?
Thanks,
MarkThanks for the answer.
I'm almost tempted to accept the explanation that the 4,294,967,296 addressable blocks is a 32bit platform limitation... Do you or anyone know of any official Oracle documentation explaining where they get this magic number from? -
What is the major change of using ROWID from 9i to 10g?
For tables in a default "smallfile" tablespace the rowid format has not changed. The rowid format does change for tables stored in the new "bigfile" tablespace.
A bigfile tablespace has only one file and the relative file number is always the same (1024 on most platforms).
The dbms_utility procedures DATA_BLOCK_ADDRESS_FILE and DATA_BLOCK_ADDRESS_BLOCK should not be used with bigfiles.
The dbms_rowid package has been modified and several of its routines accept "bigfile" as a parameter. But you have to identify the input rowid is for a bigfile to get back correct results.
HTH -- Mark D Powell -- -
Which one faster- With Rowid or PK
Hi,
Recently came across the concepts of IOT(Index organised table). It was mentioned that
You must specify a primary key for an index-organized table, because the primary key uniquely identifies a row. Use the primary key instead of the Rowid for directly
accessing index-organized rows. "
This surprised me as till date I was assuming that the fastest way to access the data from a table is by Rowid. Isn't this contadicting then?
Can the experts clarify more on these conceps related to IOT.
Rgds,
Aashishwhat is the diff betn a Normal table with PK on some column and IOT with almost
the same structure?The difference is whatever is implied by that "almost".
Look, the purpose of index organized tables is to do away with a nugatory object when a table and and its primary key index - have basically the same structure. The classic example is the code lookup table, where the difference between the table's columns (code, code_descr) and its primary key (code) is a single column (code_descr). Nearly access of that table is going to be an indexed read on code to get the description. That usage makes it a good candidate for being an IOT.
Mere creation of PK on a column would give the same result.No. An index organized table is similar to creating an index on (code, code_descr) but without the need to maintain two sets of data. Furthermore the IOT allows us to include non-primary key columns without compromising our relational integrity.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Get ROWIDs from Interactive Report
Hi,
I'm using an interactive report but I'd like to use the rows returned in a process so is it possible to get the rowsids that have been selected and make up the filtered report
Thanks AndyA little trial and error using Andy ATD's suggestions gave me the following query, which I can use to recreate the selected ROWIDs:
SELECT /*c.interactive_report_id, report_id, application_user, report_name, */
CONDITION_COLUMN_NAME as col_name, CONDITION_OPERATOR as col_operator,
CONDITION_EXPRESSION as exp1, CONDITION_EXPRESSION2 as exp2,
CONDITION_ENABLED AS enabled,
LAST_UPDATED_ON as date_mod
FROM APEX_APPLICATION_PAGE_IR_COND C
WHERE c.application_id = :APP_ID
AND c.page_id = :APP_PAGE_ID
AND c.condition_type = 'Filter'
AND application_user = :APP_USER
AND condition_enabled = 'Yes'
and report_name is null -- Just show current working report
AND trunc(last_updated_on) = trunc(sysdate)
ORDER BY last_updated_on desc, report_id;
This gives results like:
COL_NAME COL_OPERATOR EXP1 EXP2 ENABLED DATE_MOD
ASK_AMOUNT_CURRENT between 2500 10000 Yes 03-DEC-08
PREF_CLASS_YEAR = 1968 - Yes 03-DEC-08
- Stew -
Does the 'default where clause' query select the ROWID by default ?
Hi ,
The query in default where property of a data block is as follows:
global.prim_lang = :global.user_lang
and upper(group_name) like upper('%' || :B_apply_inclusions.TI_group_desc || '%')
UNION ALL
select g.rowid, g.group_no
from table1 t,
table 2 g
where :global.prim_lang != :global.user_lang
and upper(g.group_name) = t.key(+)
and :global.user_lang = t.lang(+)
and upper(nvl(t.translated_value, g.group_name)) like upper('%' || :B_apply_inclusions.TI_group_desc || '%')
The g.rowid was added in the UNIONALL portion of the query because the first part of the query was bringing rowid as well.
We are in 10.1.2.3.0 forms version.
However for a user in forms verion 10.1.2.0.2, the query is giving an error " Unable to perform query " - due to mismatch in the number of columns selected in the query union.
because for this user, rowid is not selected as part of default where clause query( 1st part of the query before the unionalll).
If g.rowid is removed from the 2nd part of the query , it errors out in 10.1.2.3.0 forms version.
Could you kindly clarify when this rowid will also be selected by the default where clause of a block and why this issue is occuring?Is this issue related to forms version or any other property of the block? Is it is version based, is there a patch available to deal with the same?
Thanks in Advance.You normally change the default_where block property just when you want to chnage the filter conditions for what is selected from a given block data source.
Querries with union or minus will confuse forms as to the rowid and will no longer be albe to perform the default insert/update/delete, not knowing the rowid and the table to perform the dml on.
A from clause query will be the best way to change dynamically the tables you select from and also the where. But, by using that, if you wish to insert/update/delete, you will have to use on-insert/update/delete triggers where the processing will have to rely on some primary key columns and not on rowid.
Or, instead of a from-clause, you may use a view, but that will definitely be less flexible than a from clause query. -
ORA-12032: cannot use rowid column
Hi,
on 8.1.7 I have the following error :
ORA-12032: cannot use rowid column from materialized view log on "string"."string"
The solution is :
Action: A complete refresh is required before the next fast refresh. Add ROWID columns to the materialized view log, if required.
How can I do a complete refresh before the next fast refresh or Add ROWID columns ? How to know if Add ROWID columns is required ?
Thank you.
PS :
my script is :
START WITH TO_DATE('06-jul-2010 17:57:48','dd-mon-yyyy hh24:mi:ss')
NEXT SYSDATE+1/24user522961 wrote:
Hi,
on 8.1.7 I have the following error :
ORA-12032: cannot use rowid column from materialized view log on "string"."string"
The solution is :
Action: A complete refresh is required before the next fast refresh. Add ROWID columns to the materialized view log, if required.
How can I do a complete refresh before the next fast refresh or Add ROWID columns ? How to know if Add ROWID columns is required ?
Thank you.run above
EXECUTE DBMS_MVIEW.REFRESH('MV_NAME','C'); -
Hi,
I have two tables
CUSTOMERS
===========
Name Null Type
======================
CUST_UID NOT NULL NUMBER(4)
CUST_NAME VARCHAR2(50)
ITEM_PRICES
===========
Name Null Type
======================
IP_UID NOT NULL NUMBER(4)
IP_ITEM_DESC VARCHAR2(50
IP_COST_PRICE NUMBER(6,2)
IP_SELL_PRICE NUMBER(6,2)
I have a view IPS_VW which is the cartician product of CUSTOMERS and ITEM_PRICES, and an instead of trigger for UPDATE on this view which either inserts or updates data in the following third table
ITEM_PRICES_SPECIAL
===========
Name Null Type
======================
IPS_UID NOT NULL NUMBER(4)
CUST_UID NUMBER(4)
IP_UID NUMBER(4)
IPS_SELL_PRICE NUMBER(6,2)
The following is my view
SELECT 'A'||ROWNUM AS "IPSVW_UID",
0 AS "IPSVW_IPS_UID",
"CUSTOMERS"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES"."IP_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "CUSTOMERS" "CUSTOMERS",
"ITEM_PRICES" "ITEM_PRICES"
WHERE NOT EXISTS
(SELECT 1
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL"
WHERE "ITEM_PRICES_SPECIAL"."IP_UID" ="ITEM_PRICES"."IP_UID"
AND "ITEM_PRICES_SPECIAL"."CUST_UID" ="CUSTOMERS"."CUST_UID"
UNION
SELECT 'B' ||ROWNUM AS "IPSVW_UID",
"ITEM_PRICES_SPECIAL"."IPS_UID" AS "IPSVW_IPS_UID",
"ITEM_PRICES_SPECIAL"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES_SPECIAL"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES_SPECIAL"."IPS_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL";
And this is the instead of trigger
CREATE OR REPLACE TRIGGER "TRG_IPSVW_UPDATE" INSTEAD OF
UPDATE ON IPS_VW REFERENCING NEW AS N FOR EACH ROW
BEGIN
IF :N.IPSVW_IPS_UID = 0 THEN
INSERT INTO ITEM_PRICES_SPECIAL
( CUST_UID, IP_UID,IPS_SELL_PRICE )
VALUES
( :N.IPSVW_CUST_UID,:N.IPSVW_IP_UID, :N.IPSVW_IPS_SELL_PRICE );
ELSE
UPDATE ITEM_PRICES_SPECIAL
SET IPS_SELL_PRICE = :N.IPSVW_IPS_SELL_PRICE
WHERE IPS_UID = :N.IPSVW_IPS_UID;
END IF;
END;
Everything works fine in SQLPLUS, if i update a rate in this view, a record is either inserted or updated in the third table.
But when i try to create a tabular form based on this view, i get the error
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
Could someone help me please?
Thanks,
AllenI think The tabular form needs to be able to identify some primary key and using a rownum concatenation cannot provide that.
Cheers
Kofi -
Hi All,
I have a expert mode VO. Its not a EO based VO. I need the row id in the VO query. But it throws me an ora-01445 error. I need the rowid because I need to pass it as a parameter to a procedure. How can i get this done. Any help is greatly appreciated.
Thanks,
Sreeram.HI,
This is my sql query in the VO I am trying to develop:
SELECT * from (SELECT aid.rowid,
aid. ACCOUNTING_DATE,
aid. DISTRIBUTION_LINE_NUMBER,
aid. INVOICE_ID,
aid. ACCRUAL_POSTED_FLAG,
aid. ASSETS_ADDITION_FLAG,
aid. ASSETS_TRACKING_FLAG,
aid. CASH_POSTED_FLAG,
aid. DIST_CODE_COMBINATION_ID,
aid. LAST_UPDATED_BY,
aid. LAST_UPDATE_DATE,
aid. LINE_TYPE_LOOKUP_CODE,
aid. PERIOD_NAME,
aid. SET_OF_BOOKS_ID,
aid. INVOICE_DISTRIBUTION_ID,
aid. AMOUNT,
g.code_combination_id,
g.segment1,
g.segment2,
g.segment3,
g.segment4,
g.segment5,
g.segment6,
ppa.segment1 as Project,
pt.task_number as TASK,
aid.expenditure_type,
aid.expenditure_item_date,
hao.name as name
FROM AP.AP_INVOICE_DISTRIBUTIONS_ALL aid,
GL.GL_CODE_COMBINATIONS g,PA.pa_projects_all ppa, PA.pa_tasks pt, apps.hr_all_organization_units_tl hao
WHERE aid. invoice_id = 19498
AND LINE_TYPE_LOOKUP_CODE in ('ITEM')
AND aid. DIST_CODE_COMBINATION_ID =g.code_combination_id
AND aid.project_id = ppa.project_id(+)
AND aid.task_id = pt.task_id (+)
AND aid.expenditure_organization_id = hao.organization_id (+)) QRSLT where 1=2
But it gives me this error:
SQL QUERY ERROR MESSAGE:ORA-01445 Cannot select rowid from, or sample a join view with out a key-preserved table.
Btw..this is a custom application.
Any pointers on this..
Thanks,
Sreeram.
Edited by: SreeramKosaraju on Jun 29, 2009 9:58 AM -
How to get the ROWID in a Trigger?
On Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit when I try below script I always get the same Rowid as "AAAAAAAAAAAAAAAAAA". Is this normal?
Thank you.
create table testrowid (a number );
create or replace trigger testrowidbins
before insert on testrowid for each row
begin
dbms_output.put_line( 'Rowid:= ' || :new.rowid );
end;
set serveroutput on
insert into testrowid values( 1 );
insert into testrowid values( 2 );
insert into testrowid values( 3 );
rollback ;
insert into testrowid values( 1 );
insert into testrowid values( 2 );
insert into testrowid values( 3 );
commit ;
insert into testrowid values( 1 );
insert into testrowid values( 2 );
insert into testrowid values( 3 );
rollback ;Well, it was more of a rhetorical question.
Rowid is the physical location of a row in a table. During the execution of a BEFORE trigger, the row has not yet been placed in the table hence the 'AAAAA' rowid.
During your AFTER trigger, the row exists in the table and therefore has a normal rowid. -
Using RowID to get the first instance of a value in a table
I have a table of the structure
SECURITY(
COMPANY_ID NUMBER,
SECURITY_ID NUMBER,
CUSIP
One company can have many CUSIPs asociated with it and I want to find the best way to find any valid CUSIP for the company_id using PL/SQL.
Here is my approach, I would like any other suggestions or comments.
SELECT
rowid INTO v_row_id
FROM
SECURITY
where COMPANY_ID=v_company_id
and rownum<2
SELECT
CUSIP INTO v_cusip
FROM
SECURITY
where rowid=v_row_idHello
If you don't specify an order you will let oracle decide what the "first" row is. It may be the first row that was inserted, it could be the last, or it could be any other row for that company. If the execution plan for the query changes (or a number of other things) the first row returned could change. This may of course not matter to you at all but it's worth pointing out I think:
create table dt_test_SECURITY(
COMPANY_ID NUMBER,
SECURITY_ID NUMBER,
CUSIP varchar2(20)
--generate some test data
SQL> insert into dt_test_security select mod(rownum,200)+1,mod(rownum,10)+1,to_char(rownum) from dba_objects where rownum <2001;
2000 rows created.
SQL>
SQL> SELECT
2 CUSIP
3 FROM
4 dt_test_SECURITY
5 where
6 COMPANY_ID=1;
CUSIP
2000
200
400
600
800
1000
1200
1400
1600
1800
10 rows selected.
SQL> SELECT
2 CUSIP
3 FROM
4 dt_test_SECURITY
5 where
6 COMPANY_ID=1
7 and
8 rownum<2;
CUSIP
2000
create index dt_test_security_idx2 on dt_test_security(company_id,cusip);
exec dbms_stats.gather_table_stats(ownname=>user,tabname=>'DT_TEST_SECURITY',method_opt=>'FOR TABLE FOR ALL INDEXES FOR ALL INDEXED COLUMNS');
SQL> SELECT
2 CUSIP
3 FROM
4 dt_test_SECURITY
5 where
6 COMPANY_ID=1;
CUSIP
1000
1200
1400
1600
1800
200
2000
400
600
800
SQL> SELECT
2 CUSIP
3 FROM
4 dt_test_SECURITY
5 where
6 COMPANY_ID=1
7 and
8 rownum<2;
CUSIP
1000If you use MAX(cusip), you will get the highest cusip against the company which is much more specific. Is that what you want? How are you intend to determin which is the first row, or doesn't it matter?
HTH
David -
What's the impact of rowid materialized view in oracle 10g
Hello to all ;
Oracle official docs saying
ROWID materialized views should be used only for materialized views based on master tables from an Oracle7 database, and should not be used from Oracle8 or higher.
For 10g or higher versions can we consider rowid materizlized view ?
product 10.2.0.4 and 11g r2 on Redhat 5.1No
should not be used from Oracle8 or higher10g is higher -
Using ROWID in the WHERE clause of a SELECT statement
hi all,
my team is trying to select a value from a table using the rowid as the selection criterion
e.g. select column_name from table_name where rowid > 'AAA112BBBCCC12A'
this query does not appear to return accurate results e.g. it return rows instead of two. my questions are:
1. is this a legitimate approach?
2. should we convert the row id to varchar2? if so how should this be done?
thanks!SQL> select rowid,ename
2 from emp;
ROWID ENAME
AAAs8KAA+AAAVXCAAA KING
AAAs8KAA+AAAVXCAAB BLAKE
AAAs8KAA+AAAVXCAAC CLARK
AAAs8KAA+AAAVXCAAD JONES
AAAs8KAA+AAAVXCAAE SCOTT
AAAs8KAA+AAAVXCAAF FORD
AAAs8KAA+AAAVXCAAG SMITH
AAAs8KAA+AAAVXCAAH ALLEN
AAAs8KAA+AAAVXCAAI WARD
AAAs8KAA+AAAVXCAAJ MARTIN
AAAs8KAA+AAAVXCAAK TURNER
AAAs8KAA+AAAVXCAAL ADAMS
AAAs8KAA+AAAVXCAAM JAMES
AAAs8KAA+AAAVXCAAN MILLER
AAAs8KAA+AAAVXCAAO erwer
15 rows selected.
SQL> select ename from emp where rowid = 'AAAs8KAA+AAAVXCAAH';
ENAME
ALLEN
SQL> select ename from emp where rowid > 'AAAs8KAA+AAAVXCAAH';
ENAME
WARD
MARTIN
TURNER
ADAMS
JAMES
MILLER
erwer
7 rows selected.1) using rowid to access a record is the quickest way so it is legitimate
however using > has no real purpose as you point out you cannot get any meaningful results returned.
2) No real need to convert however beware storing values in tables as Oracle does not guarantee to preserve the format in different versions so upgrading from 9i to 10g would invalidate your data. -
What causes "ORA-01445: cannot select ROWID from" error
While executing a SELECT query i got this error:
ORA-01445: cannot select ROWID from, or sample, a join view without a
key-preserved table
Below mentioned is the join condition part of the query. The line which the error has occured is italicized
from checkout_hdtl ch
inner join pmt_htl ph on ph.post_ln_a = ch.post_ln_code
inner join pin_dls pd on pd.post_ln_a = ph.post_ln_code
inner join carton_dtl cd on cd.carton_nbr = ch.carton_nbr
and cd.lseq_nbr = pd.lseq_nbr
inner join invoice_module im on cd.invevt_code = im.inv_code
inner join item_dock_master del on nm.invent_code = iwm.inv_code
left outer join inv_curr_comm_code mnb on ium.invent_code = im.inv_code
and icc.cntry = ph.shipto_cntry
left outer join vw_ver_master vw on vw.del_rec = ch.del_rec
left outer join cmd code_entry on code_pi.cntry =
cd.code_entry where ch.shpmt_nbr = '3'
What do i do?I would rather use Notepad than store my data in SQL server. It just so happens that our product is released for SQL Server as well. Hence i did the testing.
>Is there a limit to the number of joins that can be performed in Oracle?
Wrong question as it does not have anything to do with the number of views.. it has everything to do with the ability to correctly identify the unique row. Re-read the error message details posted by Blu - it explains the error.As you can see from my post, i created a table using the(CTAS) SELECT query from the View vw_ver_master's definition. So the view's result set is now stored in a table and now there are only tables involved in these JOINS.
The query will succeed if i comment out ANY one of these JOINS in this statement. This is so weird.
I -
Invalid rowid error while running the snapshot agent in transactional replication
Hi All,
I am getting an Invalid rowid error while replicating an large tables i.e around 30 millions rows from oracle(publisher) to sql server(Subscriber) while running the snapshot agent in transactional replication.
Its taking around 18 hours and its then its throwing this error.
Is there any faster way that i can replicate the initial snapshot this large table as 18 hours is very high on time.
Kindly suggest.i am always got quick and accurate response always..hope the same in this case also.
Thanks,Hi,
Could you please create a replication with some small tables for a test?
You can disable the firewall on both sides and rerun snapshot. Enable verbose logging to level 4 for snapshot agent and check the results if it fails.
http://support.microsoft.com/kb/312292
Here is a document says for the error: ORA-10632: Invalid rowid Cause: Segment Highwatermark was overwritten due to shrink and space reused Action: Reissue this command.
I also suggest you contact the Oracle support team for further help.
Thanks.
Tracy Cai
TechNet Community Support
Maybe you are looking for
-
The autofill/password function is allowing library card account nuumbers to display for every previous user on our library computers and probably other computers on campus. Since the box asking "do you want to save" does not appear, we aren't able to
-
Groups not working in apple mail
Hi, Since the update to 19.9.1 mail groups began working again, but now they've stopped. It used to be I could enter the first few letters in the address field and either a person's or group's name would show up to be selected. Not groups don't sho
-
When and Why do we need to build a CUSTOM CUBE
Hello Experts, Could some please explain with a scenerio .. "When and Why do we need to build a CUSTOM CUBE" Thanks in advance Bhalout
-
Prevent elevation message for some programs at windows startup
Hi I'm using Windows 8.1 in a 2012 R2 Domain. When my main computer starts, 3 Programs require elevation to run. When I logon my adminstrator account I know the password but for my non administrator user, it's an issue. Is it possible to setup startu
-
(iTunes 10.4.1) Ever since i updated my itunes my music isnt playing right it sounds weird