Creating SYNONYM for all tables who don't have one at once!
Hello to all,
I'm trying to create synonyms for every table who's missing one at the moment. I'm trying this code:
declare
cursor cur_objects is
select obj.object_name , obj.owner
from all_objects obj
where owner = '&&SCHEMA_OWNER'
AND NOT EXISTS (SELECT *
FROM all_synonyms syn
WHERE obj.object_name = syn.table_name)
AND obj.object_type = 'TABLE'
AND obj.object_name LIKE 'CI_%';
begin
for rec_objects in cur_objects loop
begin
dbms_output.put_line(rec_objects.object_name);
execute immediate('create public synonym ' || rec_objects.object_name || ' for '
|| rec_objects.owner ||'.'||rec_objects.object_name )
exception when others then
null;
end;
end loop;
end;
I'm getting this error:
ORA-06550: line 10, column 37:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
begin function package pragma procedure subtype type use
<een ID>
<een scheidingsteken-ID tussen dubbele aanhalingstekens> form
current cursor
I'm still pretty new at PL/SQL and can't get it to work. Does anyone got any tips ?
Thnx already
Ok now I got this error:
RA-06550: line 17, column 1:
PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem return
returning <een exponent (**)> <> or != or ~= >= <= <> and or
like LIKE2_ LIKE4_ LIKEC_ between into overlaps using ||
multiset bulk year DAY_ member SUBMULTISET_
The symbol ";" was substituted for "EXCEPTION" to continue.
Similar Messages
-
Find all tables who don't have at least one DATE column
DB version:10gR2
Using user_tab_cols view, How can i find the tables who don't have at least one DATE(user_tab_cols.data_Type='DATE') column?SELECT table_name
FROM user_tables
WHERE table_name NOT IN ( SELECT DISTINCT
table_name
FROM user_tab_cols
WHERE DATA_TYPE = 'DATE'
);Regards
Arun -
Script to create synonyms for the tables of Oracle Applications
Team,
For Oracle Applications 11i on W2K, where might I find a script to create synonyms for all of the application tables? I would think there would be a standard script somewhere in one of the directories created during the install or on the CDs.
Thanks,
LutherJohn, it is ssome sort of a bleed, but in this case it's not the part that 'might be cut off' that matters; it's the part that still needs to be on the page. Yes, I meant it to be (virtually) not-noticeable for the casual reader. Of course you can make it part of the page design, that ought to ease up matters.
The amount pages shift horizontally because of binding is called "creep", and this depends on the type of binding and the thickness of the paper. You cannot adjust for creep unless you know exactly how much this is and how your book is going to be printed and bound.
Airkite:
But the book that you printed worked out alright? Was it done with a different method?
This was a simple outlined text, not an image. Through the inaccuracies of printing and binding combined, there were no straight edges *anywhere* but fortunately the lines were thick enough to let you mentally connect them
This was done (I'm sure) with the method you proposed.
There is an alternative way, but it's way more expensive (on the other hand, the result is impressive): after the entire process of printing, binding, and cutting, books are put in a clamp one at a time and fed through a silk screen printer, fore edge on top, and printed with whatever you like.
I know of the existance of this technique but I haven't seen a book done like this in years and have no clue at all of the costs involved (writing that down in one sentence makes me realize those two might be connected). -
Creating synonys for all table
i want to create synonyms for all atbles.the synonyn name and table name are same.instead creating one by one synonym i wnat to create all synonyms at a time.
1)select 'CREATE PUBLIC SYNONYM'||' '||'test'||' '||'for' ||' '||'test' from dual
2)select OBJECT_NAME from user_objects where OBJECT_TYPE ='TABLE'
in the first query if we replace with test with 2nd query then we can get the script for that.
i replaced that biut its not working how to do itHere is a generic grant script. If you review it, you will see how it works and can adapt it to your varying needs.
BEGIN
FOR x IN ( SELECT owner,
object_name,
DECODE(object_type, 'TABLE' , 'select, insert, update, delete',
'SEQUENCE', 'select',
'VIEW', 'select',
'execute') AS privs,
DECODE (owner, 'SCHEMA_1', 'USER_1',
'SCHEMA_2', 'ROLE_A'
) AS app_user
FROM dba_objects
WHERE object_type IN ('TABLE', 'PACKAGE', 'PROCEDURE',
'FUNCTION', 'SEQUENCE', 'VIEW')
AND owner IN ('SCHEMA_1', 'SCHEMA_2' ))
LOOP
BEGIN
EXECUTE IMMEDIATE 'grant ' || x.privs || ' on ' || x.owner ||
'.' || x.object_name || ' to ' || x.app_user ;
EXECUTE IMMEDIATE 'create or replace synonym '|| x.app_user||'.'||x.object_name||
' for ' ||x.owner||'.'||x.object_name ;
EXCEPTION
WHEN others THEN
dbms_output.put_line('Bad owner = '||x.owner||'; Bad app_user='||x.app_user||
'; Bad object_name='||x.object_name);
END;
END LOOP;
END;
/ -
I don't have a credit card to enter in too App Store . I never had to have one befor to buy aps befor so why start it now it's so stupid for people who don't have one or don't want to put there private details on here
How to Get Apps From the App Store Without a Credit Card
http://ipadhelp.com/ipad-help/how-to-get-free-apps-from-the-app-store-without-a- credit-card/
Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
http://support.apple.com/kb/ht2534
Why can’t I select None when I edit my payment information?
http://support.apple.com/kb/ts5366
If None is not available - On your computer launch iTunes and click “iTunes Store” in the left navigation pane. Click the “down arrow” next to your name at the top right side of the page and click “Account.” Enter your username and password and click “View Account” to log into your account information. Next to your Payment Type, click “Edit.” Select the “None” button and click “Done.” Confirm that your card has been removed by returning to the Apple account information screen. Under Payment Type, it should say that there is no credit card on file.
iTunes Store: Changing your payment information
http://support.apple.com/kb/HT1918
iTunes Store Accepted Forms of Payment
http://support.apple.com/kb/HT5552
Cheers, Tom -
Creating sequences for all tables in the database at a time
Hi ,
I need to create sequences for all the tables in my database.
i can create individually ,using toad and sqlplus.
Can any one give me a code for creating the sequences dynamically at a time for all the tables.
it is urgent ..
Regards.I need to create sequences for majority of the tables that are having ID column
which is sequences."The majority" is not the same as all. So you probably want to drive your generation script off the ALL_TAB_COLUMNS view...
where column_name = 'ID'You need to think about this carefully. You might want different CACHE sizes or different INCREMENT BY clauses for certain tables. You might even (whisper it) want a sequence to be shared by more than one table.
Code generation is a useful technique, but it is a rare application where one case fits all.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Asks for security code with a gift card setup? What code,anyway was thrown away by the person gifting, HELP!
The security code should be on your card, quite often on the back of it on the signature strip, though it's sometimes on the front of the card : http://support.apple.com/kb/HT3541
Does your card not have one on it ? -
Asking for passcode and I don't have one?
I have an iPod touch.
I turned it on 5 minutes ago and it asked for a passcode but it didn't show the numbers, it showed a keyboard. I don't use password or passcodes and everything that I would put, the iPod isn't accepting. No one has touched my iPod except me and I've turned it on and off twice. What should i do?plug it into the computer
click sync
now click restore
now set up with the backup -
Setup for bb Torch is asking for a password, I don't have one
I need to reset an existing email and setup is now asking me to login with a user name and password, this has not been the case in the past on my phone. I do not have a password enabled on my phone.
It will give a forgotten password option and asks for a username. No matter what email address I give it tells me the password was sucessfully sent to my blackberry, but it does not apear in any of my email addresses.
Why is this happening and better yet how to I solve it?/
I have shut off the phone; taken out the sim card and battery and started back up and that doesn't change it either.
Help!I got tired of waiting for you and your response is still not the answer. I called ATT they transferred me to blackberry who transferring me back to blackberry techinical support at ATT, left me on hold for a very long time and disconnected me. Finally got in touch with ATT techinical support and they SOLVED the issue!!!!
What must have occured is that in the updating of the software over time for BB is that they require a password for the phone, since I never established a password for my phone the only way for me to fix the issue was for them to establish a password for me.
For other frustrated blackberry users when needing to change settings on exisiting email and you run into a required password, call your carrier and their technichal support can get you up and running with a password. -
PsCC asking for serial number. Don't have one.
I ppayed 980yen/manth in Japan. But Photshop CC requesut enter Sirial No. I don't knomy sirial No.
Why not ? Can't use PsCC.
Where is my payment?Sign in or activation errors
Mylenium -
Public Synonyms for Nested Tables - Insertion Problem
Hi,
we are facing a problem during implementation. Our DB set up
is , we will be having two schema named OWNR and COPY.
In the schema, OWNR we have to create all the tables,
types,procedures, packages and obj.....This schema will have
both DDL and DML privileges.
In the schema, COPY we are not supposed to create any tables,
objects. We have to create public synonyms for all the tables,
types, procedures... in OWNR and grant ALL privilege to the
schema COPY.The schema, COPY will have only DML privileges.
The problem is we have some nested tables in our application.
When I try to insert into the synonym which is created for the
nested table, it is not allowing me to insert..The whole
implementation is stucked..Please help.The scripts are given
below.......
We have a type name SITA_ADDRESS_TY which is used by the nested
table SITA_ADDRESSES_NT.Script used for creating the Type,Nested
table,Table, Public Synonym and granting all privilege to these
types and tables are
CREATE OR REPLACE TYPE SITA_ADDRESS_TY AS OBJECT (
SITA_ADDRESS VARCHAR2(10),
REMARKS VARCHAR2(100)) ;
PROMPT SITA_ADDRESSS_NT...
CREATE OR REPLACE TYPE SITA_ADDRESSES_NT AS TABLE OF
SITA_ADDRESS_TY ;
Using this nested table we have created the table,
UMS_SITA_ADDRESS
CREATE TABLE UMS_SITA_ADDRESS (
COMPANY_CODE VARCHAR2 (6) NOT NULL,
AIRLINE_CODE VARCHAR2 (6) NOT NULL,
DESTINATION VARCHAR2 (6) NOT NULL,
SITA_ADDRESS SITA_ADDRESSES_NT)
TABLESPACE EKUMDAT
PCTFREE 5
PCTUSED 40
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 64K
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 505
FREELISTS 1 FREELIST GROUPS 1 )
NOCACHE
NESTED TABLE SITA_ADDRESS STORE AS UMSNT_SITA_ADDRESS ;
PROMPT SYNONYM SITA_ADDRESS_TY...
CREATE PUBLIC SYNONYM SITA_ADDRESS_TY FOR SITA_ADDRESS_TY
PROMPT SYNONYM SITA_ADDRESSES_NT...
CREATE PUBLIC SYNONYM SITA_ADDRESSES_NT FOR SITA_ADDRESSES_NT
PROMPT UMS_SITA_ADDRESS...
CREATE PUBLIC SYNONYM UMS_SITA_ADDRESS FOR UMS_SITA_ADDRESS
Granting Privileges
PROMPT SITA_ADDRESS_TY...
GRANT EXECUTE ON SITA_ADDRESS_TY TO COPY
PROMPT SITA_ADDRESSS_NT...
GRANT EXECUTE ON SITA_ADDRESSES_NT TO COPY
PROMPT UMS_SITA_ADDRESS...
GRANT ALL ON UMS_SITA_ADDRESS TO COPY
When I connect to copy and desc UMS_SITA_ADDRESS, the structure
is
SQL> desc ums_sita_address
Name Null? Type
COMPANY_CODE NOT NULL VARCHAR2(6)
AIRLINE_CODE NOT NULL VARCHAR2(6)
DESTINATION NOT NULL VARCHAR2(6)
SITA_ADDRESS
OWNR.SITA_ADDRESSES_NT
Why is it so??. Even though I have a synonym for
SITA_ADDRESSES_NT, it is not referencing the synonym but instead
refer the OWNR.SITA_ADDRESSES_NT
Because of this when I try to insert into ums_sita_address(in
schema COPY), it is giving the following error,
SQL> insert into ums_sita_address values
('EK','EK','DXB',SITA_ADDRESSES_NT());
insert into ums_sita_address values
('EK','EK','DXB',SITA_ADDRESSES_NT())
ERROR at line 1:
ORA-00932: inconsistent datatypes
But when the same connect to OWNR and try to insert with the
same stmt, it is inserting...
Our middle tier can connect only to COPY schema alone..Is there
anything to be done in the DBA side to achieve this??.
Please help from your valuabe experience...Or can you ask your
collegues if they have got a soln to this probs..Our
implementation team is stucked with this...
Thanks
PriyaHi
I am not sure but maybe you need to use this command:
SQL> insert into ums_sita_address values
('EK','EK','DXB',SITA_ADDRESSES_TY());
SITA_ADDRESSES_TY() instead SITA_ADDRESSES_NT
Regards -
Public Synonyms for Nested Tables - Insertion Problem - Please Help!!!!!
Hi,
we are facing a problem during implementation. Our DB set up
is , we will be having two schema named OWNR and COPY.
In the schema, OWNR we have to create all the tables,
types,procedures, packages and obj.....This schema will have
both DDL and DML privileges.
In the schema, COPY we are not supposed to create any tables,
objects. We have to create public synonyms for all the tables,
types, procedures... in OWNR and grant ALL privilege to the
schema COPY.The schema, COPY will have only DML privileges.
The problem is we have some nested tables in our application.
When I try to insert into the synonym which is created for the
nested table, it is not allowing me to insert..The whole
implementation is stucked..Please help.The scripts are given
below.......
We have a type name SITA_ADDRESS_TY which is used by the nested
table SITA_ADDRESSES_NT.Script used for creating the Type,Nested
table,Table, Public Synonym and granting all privilege to these
types and tables are
CREATE OR REPLACE TYPE SITA_ADDRESS_TY AS OBJECT (
SITA_ADDRESS VARCHAR2(10),
REMARKS VARCHAR2(100)) ;
PROMPT SITA_ADDRESSS_NT...
CREATE OR REPLACE TYPE SITA_ADDRESSES_NT AS TABLE OF
SITA_ADDRESS_TY ;
Using this nested table we have created the table,
UMS_SITA_ADDRESS
CREATE TABLE UMS_SITA_ADDRESS (
COMPANY_CODE VARCHAR2 (6) NOT NULL,
AIRLINE_CODE VARCHAR2 (6) NOT NULL,
DESTINATION VARCHAR2 (6) NOT NULL,
SITA_ADDRESS SITA_ADDRESSES_NT)
TABLESPACE EKUMDAT
PCTFREE 5
PCTUSED 40
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 64K
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 505
FREELISTS 1 FREELIST GROUPS 1 )
NOCACHE
NESTED TABLE SITA_ADDRESS STORE AS UMSNT_SITA_ADDRESS ;
PROMPT SYNONYM SITA_ADDRESS_TY...
CREATE PUBLIC SYNONYM SITA_ADDRESS_TY FOR SITA_ADDRESS_TY
PROMPT SYNONYM SITA_ADDRESSES_NT...
CREATE PUBLIC SYNONYM SITA_ADDRESSES_NT FOR SITA_ADDRESSES_NT
PROMPT UMS_SITA_ADDRESS...
CREATE PUBLIC SYNONYM UMS_SITA_ADDRESS FOR UMS_SITA_ADDRESS
Granting Privileges
PROMPT SITA_ADDRESS_TY...
GRANT EXECUTE ON SITA_ADDRESS_TY TO COPY
PROMPT SITA_ADDRESSS_NT...
GRANT EXECUTE ON SITA_ADDRESSES_NT TO COPY
PROMPT UMS_SITA_ADDRESS...
GRANT ALL ON UMS_SITA_ADDRESS TO COPY
When I connect to copy and desc UMS_SITA_ADDRESS, the structure
is
SQL> desc ums_sita_address
Name Null? Type
COMPANY_CODE NOT NULL VARCHAR2(6)
AIRLINE_CODE NOT NULL VARCHAR2(6)
DESTINATION NOT NULL VARCHAR2(6)
SITA_ADDRESS
OWNR.SITA_ADDRESSES_NT
Why is it so??. Even though I have a synonym for
SITA_ADDRESSES_NT, it is not referencing the synonym but instead
refer the OWNR.SITA_ADDRESSES_NT
Because of this when I try to insert into ums_sita_address(in
schema COPY), it is giving the following error,
SQL> insert into ums_sita_address values
('EK','EK','DXB',SITA_ADDRESSES_NT());
insert into ums_sita_address values
('EK','EK','DXB',SITA_ADDRESSES_NT())
ERROR at line 1:
ORA-00932: inconsistent datatypes
But when the same connect to OWNR and try to insert with the
same stmt, it is inserting...
Our middle tier can connect only to COPY schema alone..Is there
anything to be done in the DBA side to achieve this??.
Please help from your valuabe experience...Or can you ask your
collegues if they have got a soln to this probs..We are stucked
with this...
Thanks
PriyaHi
I am not sure but maybe you need to use this command:
SQL> insert into ums_sita_address values
('EK','EK','DXB',SITA_ADDRESSES_TY());
SITA_ADDRESSES_TY() instead SITA_ADDRESSES_NT
Regards -
When do I really need to create indexes for a table?
Once I was talking to a dba in a conference.
He told me that not always I have to create indexes for a single table, it depends of its size.
He said that Oracle read registers in blocks, and for a small table Oracle can read it fully, in a single operation, so in those cases I don't need indexes and statistcs.
So I would like to know how to calculate it.
When do I really need to create indexes for a table?
If someone know any documment that explain that, or have some tips, I'd aprecciate.
Thanks.
P.S.: The version that I'm using is Oracle 9.2.0.4.0.Hi Vin
You mentioned so many mistakes here, I don't know where to begin ...
vprabhu_2000 wrote:
There are different kinds of Index. B-tree Index is by default. Bit map index, function based index,index organized table.
B-tree index if the table is large This is incorrect. Small tables, even those consisting of rows within just one block, can benefit from an index. There is no table size too small in which an index might not be benefical. William Robertson in his post references links to my blog where I discuss this.
and if you want to retrieve 10 % or less of data then B-tree index is good. This is all wrong as well. A FTS on a (say) million row table could very well be more efficient when retrieving (say) just 1% of data. An index could very well be more efficient when retrieving 100% of data. There's nothing special about 10% and there is no such magic number ...
>
Bit Map Index - On low cardinality columns like Sex for eg which could have values Male,Female create a bit map index. Completely and utterly wrong. A bitmap index might be the perfect type of index, better than a B-Tree, even if there are (say) 100,000 distinct values in the table. That a bitmap index is only suitable for low cardinality columns is just not true. And what if it's an OLTP application, with lot's of concurrent DML on the underlining table, do you really think a bitmap index would be a good idea ?
>
You can also create an Index organized table if there are less rows to be stored so data is stored only once in index and not in table. Not sure what you mean here but an IOT can potentially be useful if you have very large numbers of rows in the table. The number of rows has nothing to do with whether an IOT is suitable or not.
>
Hope this info helps. Considering most of it is wrong, I'm not sure it really helps at all :(
Cheers
Richard Foote
http://richardfoote.wordpress.com/ -
How can I deploy EFS using Group Policy and Active Directory with a goal to automatically encrypt computers for ALL users who login? (NOT an option for me to use BitLocker)
I was asked to deploy EFS to encrypt the user my documents folder and profile on all of the users laptops. The laptops are in common areas (board meeting rooms, etc) and security of files is a must.
I successfully created a recovery certificate in AD. I created an OU and setup an EFS policy and users can now login and select to encrypt their own files. The issue is that management would like to have automaticy Encrypt ALL users my documents AUTOMATICALLY
when a user login.
Can this be done?
Please helpHi,
Any update?
Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.
Best Regards,
Andy Qi
TechNet Subscriber Support
If you are
TechNet Subscription user and have any feedback on our support quality, please send your feedback
here.
Andy Qi
TechNet Community Support -
How do I run sp_spaceused for all tables in a database?
Hi,
I am struggling to understand how to run the sp_spaceused sproc for all tables in a database.
I know how to use it for one table but how would I replicate it automatically for each table in a given database?
Regards,
Ian.I just managed to alter the code of VidyaSagar and have pulled out all the information including Schema name. Below is what it looks like:
set
nocount
on
select
'Database Name: ',
db_name
if
exists(select
name from tempdb..sysobjects
where name='##tmp'
drop
table ##tmp
create
table ##tmp(TABLE_SCHEMA
nvarchar(256),TABLE_NAME
nvarchar(256),
num_rows int,
reserved_KB varchar(15),data_KB
varchar(15),index_KB
varchar(15),unsed_KB
varchar(15
go
declare
@tbl_schema nvarchar(256
declare
@tbl_name nvarchar(256
declare
@schema_tbl_name nvarchar(256
declare
tblname CURSOR
for
select
TABLE_SCHEMA
TABLE_NAME
from
INFORMATION_SCHEMA.TABLES
where TABLE_TYPE='BASE
TABLE'
open
tblname
Fetch
next
from tblname
INTO @tbl_schema,@tbl_name
WHILE
@@FETCH_STATUS
= 0
BEGIN
set @schema_tbl_name=@tbl_schema+'.'+@tbl_name
insert
into ##tmp(TABLE_NAME
, num_rows
, reserved_KB
,data_KB
,index_KB
,unsed_KB
exec
sp_spaceused
@schema_tbl_name
update ##tmp
set TABLE_SCHEMA
=@tbl_schema
where TABLE_SCHEMA
is
NULL
and TABLE_NAME=@tbl_name
FETCH
NEXT
FROM tblname
INTO @tbl_schema,@tbl_name
END
CLOSE
tblname
deallocate
tblname
go
select
from
##tmp
drop
table ##tmp
Warm Regards, Ajay
Maybe you are looking for
-
Error message while activating a function
Hello guys I have just written a simple function and am trying to activate it. When I click on check button it says 'no syntax error'. However, when I click on activate button, I get the following error. Any feedback on this will be greatly appreciat
-
okay...2 days ago the iPhone 4 vibrated for a good 45 min. did a hard reboot on the phone, stopped vibrating, locked on call screen, can't answer or recieve calls. Talked to a tech support last night. Was told to do a restore, saved all of what we co
-
SAP Production system - SDK Dev New licence key components
I like to request a new license key for SAP B1 production system. What should be the components along with SDK Development that i should select in the license key request information? Is it mandatory to have at least one professional user license in
-
JEditorPane's paint method problem (urgent)
Hi all, I have JEditorPane that displays HTML formatted text. My task requirement is to display a compay logo as static backgdound in this jeditorPane (The logo must be displayed always in the center nevermind the text scrolling)... So I overrided JE
-
RE: BI functional and Technical Specification
Hi, Can anybody share BI Functional and Technical Specification for SAP R/3 data extraction for modules FI/CO, SD, MM, WM/MM. Thanks.