Invalid Synonym in SQL Plus Vs Toad [message #615414] |
Tue, 03 June 2014 10:28 |
azeem87
Messages: 116 Registered: September 2005 Location: dallas
|
Senior Member |
|
|
Hi,
we have a job that drops and recreate few tables daily 3 am.
i have select Grant on that table with in this job,
as part of major release Grants/Synonyms where created on entire schema, All synonyms Valid.
I see through Toad that all the synonyms are valid, but somehow other person noticed this by this SQL
select owner, object_type, status object_status, count(*)
from dba_objects
where status <> 'VALID'
group by owner, object_type, status
OWNER OBJECT_TYPE OBJECT_STATUS COUNT(*)
------------------------------ ------------------- ------------- ----------
APPLICATIONUSR SYNONYM INVALID 9
At same time from Toad this doesn't show as invalid Synonym,
question is while we drop and recreate and then grant on the table to that user, the existing synonyms which was invalid when we drop becomes valid correct ?
Thanks
|
|
|
|
|
|
Re: Invalid Synonym in SQL Plus Vs Toad [message #615420 is a reply to message #615418] |
Tue, 03 June 2014 12:53 |
azeem87
Messages: 116 Registered: September 2005 Location: dallas
|
Senior Member |
|
|
code is something like this.
CREATE OR REPLACE PROCEDURE WEBSYSTEM.BKUP_TABLES
IS
V_Table_Present NUMBER
BEGIN
BEGIN
SELECT COUNT (*)
INTO V_Table_Present
FROM user_tables
WHERE table_name IN
('PYCOMMONTEMPLATE_BKUP',
....
....);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
V_Table_Present := 0;
END;
IF V_Table_Present > 0 then
EXECUTE IMMEDIATE 'drop table PYCOMMONTEMPLATE_BKUP';
...
...
end if;
EXECUTE IMMEDIATE
'create table PYCOMMONTEMPLATE_BKUP as select * from PAYMENTSCOMMONTEMPLATE';
....
EXECUTE IMMEDIATE
'Grant select on PYCOMMONTEMPLATE_BKUP to READ_ONLYROLE,APPLICATIONUSR';
....
....
END;
and i was reading this arcticle and took into consideration about space and performance while loading these tables daily..
there are 9 tables in total and will have around 10 mil rows in total for those 9 tables.
1) if you use a normal insert, it will use the free space below the high water mark (HWM) before using space above the HWM.
If you use a direct path load (sqlldr direct=y, insert /*+ APPEND */ as select), then we only load above the existing HWM and will not reuse the existing free space (but any subsequent normal inserts would - even after the direct path load)
Reference --> https://asktom.oracle.com/pls/apex/f?p=100:11:0%3A%3A%3A%3AP11_QUESTION_ID:492636200346818072
Thanks
|
|
|
|
Re: Invalid Synonym in SQL Plus Vs Toad [message #615422 is a reply to message #615420] |
Tue, 03 June 2014 13:20 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
azeem87 wrote on Tue, 03 June 2014 23:23
there are 9 tables in total and will have around 10 mil rows in total for those 9 tables.
Just 9 tables? 10 million rows in total? Not too many to be so much worried about. DB is about the size. 10, 100, 1000... million, billion, how much is the size of the data?
Quote:
1) if you use a normal insert, it will use the free space below the high water mark (HWM) before using space above the HWM.
That does not mean you need to DROP and CREATE tables each time. Truncate brings the HWM down to where it should be for a normal start. You have not read Tom's answer properly.
Quote:Reference --> https://asktom.oracle.com/pls/apex/f?p=100:11:0%3A%3A%3A%3AP11_QUESTION_ID:492636200346818072
And didn't you pay attention to this statement by Tom in his very first reply "
"TRUNCATE will reset the HWM of a table back to 'zero' and will truncate the associated indexes on the table as well."
Not a good idea to drop and create tables for your requirement. If they daily loading tables, then truncate it before the next insert happens.
[Updated on: Tue, 03 June 2014 13:26] Report message to a moderator
|
|
|