Query to rename a Schema name
I have the permission of DBA.
I want the query to rename a Schema name from abc to xyz
Please help me
Thanks,
Do a user-level export of user X
create new user A
import system/manager fromuser=X touser=A
drop user X
Similar Messages
-
Hi,
Is it possible in oracle to rename a Schema?
or
Is it possible in any other SQL language like t-sql,mysql etc?
Thanks
AravindhI think No,
What you can do is export the schema to a different user name(your desired username)
It all works on export and import.
Thanks,
Ganesh. -
Renaming a schema name and full priveleges
Hi,
1) it possible to rename a particular schema in oracle 9i.For example the existing schema name is xyz,i want it to be renamed to abc.I dont want to do it using exp/imp.Any help will be appreciated
2)Secondly is it possible to give full rights on one schema to another schema by giving single command or any alternative.
For example
Schema A should full rights on Schema B objects (i.e insert,delete,execute,create etc)
regards
VijayHi,
1) it possible to rename a particular schema in oracle 9i.For example the existing schema name is xyz,i want it to be renamed to abc.I dont want to do it using exp/imp.Any help will be appreciatedYou can't rename a schema so i think only better available way is export import
2)Secondly is it possible to give full rights on one schema to another schema by giving single command or any alternative.Yes you can create a script using following commands on sqlplus
set lines 200
spool c:\grants.sql
select 'grant '||privilege|| ' to NEW_USER;' from dba_sys_privs where grantee='ACTUEL_USER_WITH_RIGHTS'
UNION
select 'grant '||granted_role|| ' toNEW_USER;' from dba_role_privs where grantee='ACTUEL_USER_WITH_RIGHTS'
UNION
select 'grant '||privilege|| ' on '||owner||'.'||table_name||' to NEW_USER;' from dba_tab_privs where grantee='ACTUEL_USER_WITH_RIGHTS';
spool off;
@c:\grants.sqlSalman -
Is they any method to rename database schema name apart from taking export and import uitlities.
Eg:- Alter user rename xx to yy;No and it bugs the hell out of me! Like you say
you'll either have to use the fromuser - touser
syntax in import or the remap_schema option in
datapump. Another annoyance are the inflexibility of
oracle privileges. I want a simple command to say
grant insert on all tables in a particular schema
without having to list them out using object
privileges or using the ANY syntax meaning that a
user can insert into any schemas table.But this is what roles are for. You create the role and grant the role to the user.
With a bit of pl/sql it would be quite straightforward to create a role which had all the tables in a schema. -
hi there,
who knows how to cheat a little and add schema name dynamically in report query?
curently trying PLSQL function body returning SQL
...from ' || '&P1_SCHEMA.' ||'.IM_INVOICES_V
where...
any bright thoughts?
crazy SimonHi,
You could try something like this...
CREATE OR REPLACE FORCE VIEW IM_INVOICES_V_VW AS
SELECT 'SCHEMA_1'.the_schema,
IM_INVOICES_V.*
FROM schema1.IM_INVOICES_V
UNION ALL
SELECT 'SCHEMA_2'.the_schema,
IM_INVOICES_V.*
FROM schema2.IM_INVOICES_V;
and then...
SELECT *
FROM IM_INVOICES_V_VW
WHERE the_schema = :P1_SCHEMA
AND ...Cheers
Ben -
Schema name added to SQL query after SQL Command
Post Author: rickeb1
CA Forum: Data Connectivity and SQL
Hello,
I am using Crystal Reports XI. I have created a Crystal report in the usual manner using a set of tables from a given database schema. When I look at the SQL query that Crystal generates, there are no data schema qualifiers anywhere.
Then I added an SQL Command object that I use as an additional table. Now when I look at the generated SQL query, the data schema name is added to the beginning of the original query as well as to the new SQL Comand code. It also creates an EXTERNAL JOIN which uses this hard-coded schema name (not exactly sure what an "external join" is).
This hard-coding of the schema name is causing a problem when we try to migrate the report to a different environment. Is there some way to avoid having Crystal generate a query with the schema name imbedded in the query, or is there a way to remove it after it is generated?
Thanks!Post Author: rickeb1
CA Forum: Data Connectivity and SQL
Actually, our problem may be related to this:
http://boardreader.com/t/Crystal_XI_249231/The_Show_SQL_Query_SQL_command_changes_89667.html
Any help greatly (and desparately) apapreciated! -
How to parameterize the schema name in APEX
Hi,
How to parameterize the schema name in APEX , in order to access different tables from the respective schema.
For example:-
select NAME display_value, CODE return_value
from paramSchema.DESC_LIST WHERE SELECTION_FLG = 'Y'
order by 1
in the above code, paramSchema will be replaced with the actual schema name duing runtime. I tried doing so by some hidden fields on page, but it didn't worked out.
I took the schema name from the respective server as per the IPof the server.
stored in a hidden field named as schema.
And replaced the same in place of schema name. But no luck.
select NAME display_value, CODE return_value
from :schema.DESC_LIST WHERE SELECTION_FLG = 'Y'
order by 1
Please help me in shorting it out.
Thanks,
AnuradhaHi
In order to do that, you would need to use dynamic SQL by changing the report type to PL/SQL Function Body Returning SQL Query and have code along the lines of
DECLARE
l_sql VARCHAR2(32767);
BEGIN
l_sql := 'select NAME display_value, CODE return_value
from '||:schema||'.DESC_LIST WHERE SELECTION_FLG = 'Y'
order by 1';
RETURN l_sql;
END;However, by doing this, you lose alot of flexibility. The other options would be...
To have seperate report regions that are conditional on the value of the variable.
To use a WITH clause at the tope of the query like...
WITH src_data AS
(SELECT * FROM schema1.my_table
WHERE :schema = 'schema1'
UNION ALL
SELECT * FROM schema2.my_table
WHERE :schema = 'schema2')
SELECT *
FROM src_dataOther than that you could look at using synonyms and doing something similar.
Hope this helps.
Cheers
Ben -
To get rid of Schema name in output using DBMS_METADATA
Hi all,
Would someone be able to tell me how to get rid of the schema name output given by the below select stmt.
Query
Select Dbms_metadata.Get_ddl('FUNCTION','ACCOUNT_CODE')
from dual;
Result
CREATE OR REPLACE FUNCTION "GOINGLIVE"."ACCOUNT_CODE" (PTransCode VarChar2,.............
I checked for the documentation, but could manage to eliminate only storage clauses, tablespace etc. but not teh schema name.
Please provide your advise on this.
Thanks
- SandeepWhich version are you on?
In 10g, you can use DBMS_METADATA.SET_REMAP_PARAM to get rid of schema name:
SQL> create table md_test(x int, y varchar2(10));
Table created.
SQL> declare
2 l_ctx number;
3 l_ctxt number;
4 l_ddl sys.ku$_ddls;
5 begin
6 l_ctx := dbms_metadata.open('TABLE');
7 dbms_metadata.set_filter(l_ctx, 'NAME', 'MD_TEST');
8 l_ctxt := dbms_metadata.add_transform(l_ctx, 'MODIFY');
9 dbms_metadata.set_remap_param(l_ctxt, 'REMAP_SCHEMA', user, null);
10 l_ctxt := dbms_metadata.add_transform(l_ctx, 'DDL');
11 dbms_metadata.set_transform_param(l_ctxt, 'SEGMENT_ATTRIBUTES', false);
12 l_ddl := dbms_metadata.fetch_ddl(l_ctx);
13 dbms_output.put_line(l_ddl(1).ddltext);
14 dbms_metadata.close(l_ctx);
15 end;
16 /
CREATE TABLE "MD_TEST"
( "X" NUMBER(*,0),
"Y" VARCHAR2(10)
PL/SQL procedure successfully completed.In 9i, you have to resort to some manual tricks (with REPLACE, probably):
SQL> create table md_test(x int, y varchar2(10));
Table created.
SQL> declare
2 l_ctx number;
3 l_ctxt number;
4 l_ddl sys.ku$_ddls;
5 begin
6 l_ctx := dbms_metadata.open('TABLE');
7 dbms_metadata.set_filter(l_ctx, 'NAME', 'MD_TEST');
8 l_ctxt := dbms_metadata.add_transform(l_ctx, 'DDL');
9 dbms_metadata.set_transform_param(l_ctxt, 'SEGMENT_ATTRIBUTES', false);
10 l_ddl := dbms_metadata.fetch_ddl(l_ctx);
11 dbms_output.put_line(
12 replace(l_ddl(1).ddltext, '"' || user || '".'));
13 dbms_metadata.close(l_ctx);
14 end;
15 /
CREATE TABLE "MD_TEST"
( "X" NUMBER(*,0),
"Y" VARCHAR2(10)
PL/SQL procedure successfully completed.
SQL> select * from v$version where rownum = 1;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.6.0 - ProductionHope this helps,
Andrew. -
Need to know schema name and table name associated with a column-URGENT
Hi folks,
I need to know the schema name and the table name associated with a column. Though jdbc has the api to getTableName and getSchemaName, some database vendor like oracle does return empty upon call of mentioned methods. I found that oracle driver does not support that
Can any one give me the solution? It is urgent. Or do you suggest any third pary jdbc driver which can provide those?
Thanks
AngelinaAngelina,
Your question has been discussed several times previously in this forum. Search this forum's archives for "getTableName". Oracle JDBC driver does not implement this (because "it is not feasible" -- according to Oracle).
First of all, I would suggest that you could probably change your application's logic so that you would not need this functionality (but I guess that is not feasible either, right :-)
Alternatively, you could try querying the Oracle database data dictionary.
Good Luck,
Avi. -
How to rename voting disk name in oracle clusterware 11gr2
Hi:
I need change the name of voting disk at os level, original name is /dev/rhdisk20, I need rename to /dev/asmocr_vote1 (unix AIX), the voting disk is locate in ASM diskgroup +OCR.
Initial voting disk was: /dev/rhdisk20 in diskgroup +OCR
#(root) /oracle/GRID/11203/bin->./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
1. ONLINE a2e6bb7e57044fcabf0d97f40357da18 (/dev/rhdisk20) [OCR]
I createt a new alias disk name:
#mknod /dev/asmocr_vote01 c 18 10
# /dev->ls -lrt|grep "18, 10"
brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:57 rhdisk20 --> Old name
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:59 asmocr_vote01 ---> alias to old name, the new name.
After change votingn disk unix name, the cluster doesn't start, voting disk is not found by CRSSD.
-STEPS to start clusterware after changing the OS voting disk name are:
1- stop al nodes:
#crsctl stop crs -f (every node)
Work only in one node (node1, +ASM1 instance):
2- Change asm_diskstring in init+ASM1.ora:
asm_diskstring = /dev/asm*
3- change disk unix permiss:
# /dev->ls -lrt|grep "18, 10"
brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
crw-rw---- 1 root system 18, 10 Sep 6 16:59 asmocr_vote01
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 17:37 rhdisk20
#(root) /dev->chown oracle:asmadmin asmocr_vote01
#(root) /dev->chown root:system rhdisk20
#(root) /dev->ls -lrt|grep "18, 10"
brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:59 asmocr_vote01 --> new name only have oracle:oinstall
crw-rw---- 1 root system 18, 10 Sep 6 17:37 rhdisk20
4-start node in exclusive mode:
# (root) /oracle/GRID/11203/bin->./crsctl start crs -excl
CRS-4123: Oracle High Availability Services has been started.
CRS-2672: Attempting to start 'ora.mdnsd' on 'orarac3intg'
CRS-2676: Start of 'ora.mdnsd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'orarac3intg'
CRS-2676: Start of 'ora.gpnpd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'orarac3intg'
CRS-2672: Attempting to start 'ora.gipcd' on 'orarac3intg'
CRS-2676: Start of 'ora.cssdmonitor' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.gipcd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'orarac3intg'
CRS-2672: Attempting to start 'ora.diskmon' on 'orarac3intg'
CRS-2676: Start of 'ora.diskmon' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.cssd' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.ctssd' on 'orarac3intg'
CRS-2672: Attempting to start 'ora.drivers.acfs' on 'orarac3intg'
CRS-2679: Attempting to clean 'ora.cluster_interconnect.haip' on 'orarac3intg'
CRS-2681: Clean of 'ora.cluster_interconnect.haip' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'orarac3intg'
CRS-2676: Start of 'ora.ctssd' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.drivers.acfs' on 'orarac3intg' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'orarac3intg'
CRS-2676: Start of 'ora.asm' on 'orarac3intg' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'orarac3intg'
CRS-2676: Start of 'ora.crsd' on 'orarac3intg' succeeded
5-check votedisk:
# (root) /oracle/GRID/11203/bin->./crsctl query css votedisk
Located 0 voting disk(s).
--> NO VOTING DISK found
6- mount diskgroup of voting disk (+OCR in this case) in +ASM1 instance:
SQL> ALTER DISKGROUP OCR mount;
7-add votedisk belongs diskgroup +OCR:
# (root) /oracle/GRID/11203/bin->./crsctl replace votedisk +OCR
Successful addition of voting disk 86d8b12b1c294f5ebfa66f7f482f41ec.
Successfully replaced voting disk group with +OCR.
CRS-4266: Voting file(s) successfully replaced
#(root) /oracle/GRID/11203/bin->./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
1. ONLINE 86d8b12b1c294f5ebfa66f7f482f41ec (/dev/asmocr_vote01) [OCR]
Located 1 voting disk(s).
8-stop node:
#(root) /oracle/GRID/11203/bin->./crsctl stop crs –f
8-start node:
#(root) /oracle/GRID/11203/bin->./crsctl start crs
10- check:
# (root) /oracle/GRID/11203/bin->./crsctl query css votedisk
## STATE File Universal Id File Name Disk group
1. ONLINE 86d8b12b1c294f5ebfa66f7f482f41ec (/dev/asmocr_vote01) [OCR]
Vicente.
HP.
Edited by: 957649 on 07-sep-2012 13:11There is no facilty to rename a column name in Oracle 8i. This is possible from Oracle 9.2 version onwards.
For you task one example given below.
Example:-
Already existed table is ITEMS
columns in ITEMS are ITID, ITEMNAME.
But instead of ITID I want ITEMID.
Solution:-
step 1 :- create table items_dup
as select itid itemid, itemname from items;
step 2 :- drop table items;
step 3 :- rename items_dup to items;
Result:-
ITEMS table contains columns ITEMID, ITEMNAME -
How to check the host name or rename the host name in Enterprise Manager
Hello,
How do i check the host name or rename the host name in Enterprise Manager for Oracle 11g?
Regards,
Ming Manthere is a shell script called chgip or something
like that is there . I used it for IAS. I beleive the
same is there for database too
Rajesh AlexIf there is, I have not been able to find it.
Off the top of my head, changing the host name involves at least the following (others feel free to add on):
For listener and connectivity
- listener.ora
- tnsnames.ora (on all clients as well)
- potentially ldap.ora (on all clients as well)
- init.ora parameter LOCAL_LISTENER
For admin using Enterprise Manager (starting 10g)
- the contents of the sysman schema
- the directory name of the OEM agent directory
- the directory name of the OEM OC4J config directory
- various config files in the OEM OC4J config directory
Oracle provides the emca to handle this last set.
In addition, the following refer to hosts that are [probably] not local
- init parameter REMOTE_LISTENER (usually just points to a tnsnames.ora entry naming remote hosts)
- init parm SMTP_OUT_SERVER
Again, adding to the list might be interesting. -
Default schema names in multi-tier landscape
Hi folks,
We have an interesting problem due to having different named default schemas in each of our 3 hana systems. For example lets say these are our default schemas in our development, staging, and production HANA systems;
DEV_SCHEMA
QA_SCHEMA
PROD_SCHEMA
Each of these replicating data from their corresponding SAP source systems.
Now, we have a view that is developed on DEV hana box and uses DEV_SCHEMA. When this view content is imported to QA or PROD we handle easily with schema mapping. All is well and good although we are not really a fan of this different naming and us developers did not choose this naming (self defense plea here for us brilliant developers whom never make such mistakes... PS: HI LARS! - Go Germany!)
Now we are setting up a connection from BW into HANA using system connection and inside this is a parameter called 'db user'. Although it's called db user it's actually looking for a SCHEMA name. If BW DEV is querying from HANA DEV this schema name would be DEV_SCHEMA. However if BW_QA is querying from HANA_QA then the name would need to be QA_SCHEMA but in our BW landscape we are locked in QA and PROD and normally can not and/or do not want to edit objects in non-native systems. Ideally what we need is our default schemas in HANA to have the same exact name throughout the HANA landscape.
All this said, I can see that it would be great to re-name our entire HANA landscape however that would be a HUGE monumental undertaking as all systems would need to be re-replicated again (at least I think).
Just curious if anybody else has named their schemas differently on each tier? What are most people doing? Naming the default schemas the same consistently or are you using schema mapping?
Thanks,
-PatrickHi Luke,
I am new to the project and there seems to be no original version. At some point a bunch of the destination field names were changed on the admin console and errors resulted from it both due to mismatched joins and the use of two word field names. I have documentation of the names for the set of tables in the function area but am having trouble with how everything matches up in the bottom half.. I'll keep working on it
Z -
SQL QUERY to create new schema in Oracle 10g Express
Can anyone provide the SQL query to create a new schema in Oracle 10g Express edition.
Can anyone provide a SQl query to create a
schema/user named 'test' with username as 'system'
and password as 'manager'system user is created during database creation, it's internal Oracle admin user that shouldn't be used as schema holder.
In Oracle database, Oracle user is schema holder there's no seperate schema name to be defined other than username. -
Bug: numeric schema names not managed correctly
If a schema name consists of numbers, the generated SQL will always fail.
In this case, it should put double-quotes around the schema name.
For example, dragging a table over to the query pane will generate a select statement,
but since it does not enclose the schema name in double-quotes, the error
"invalid table name" will be received when trying to run that query.
I am using version 1.2.1 Build MAIN-32.13.
Thank you.Well, checking the documentation (we are on 10gR2), I do note the following:
"Nonquoted identifiers must begin with an alphabetic character...".
So you are right. Alas, this was not something with which I was involved.
Given that however, it would be a very user-friendly tweak to the product
to make it more usable - remember, this is a circumstance in which the SQL
generated by the tool is wrong, which does look bad as it is an Oracle product. -
I want to use a dynamic schema name in the from clause but its not working.
DECLARE
vblQueryName VARCHAR2(20);
vblSchemaName VARCHAR2(20);
BEGIN
SELECT CurrentSchemaName INTO vblSchemaName FROM HR_989_SCHEMA;
vblQueryName:='060_525_020';
INSERT /*+ APPEND(HP_ELIGIBILITIES,4) */ INTO HP_ELIGIBILITIES
LVL1ID,
LVL1Desc,
LVL2ID,
LVL2Desc,
LVL3ID,
LVL3Desc,
LVL4ID,
LVL4Desc
SELECT /*+ PARALLEL(a,4) */
LVL1ID,
LVL1Desc,
LVL2ID,
LVL2Desc,
LVL3ID,
LVL3Desc,
LVL4ID,
LVL4Desc
FROM
bold vblSchemaName.HP_ELIGIBILITIES a
WHERE
UPPER(LVL2ID) = 'XX' ;
COMMIT;
DBMS_OUTPUT.PUT_LINE( 'Query Executed: ' || vblqueryName);
INSERT INTO HP_QUERYEXECLOG(QueryName) VALUES(vblQueryName);
EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
END;
I want to create a rules table so that the schema name in front of the table name in the from clause can be controlled by a separate table that is maintained but its not working . Help and your valuable inputs needed for this issueI want to use a dynamic schema name in the from clauseyou can alternatively set the current schema as e.g. in:
declare
vblqueryname varchar2 (20);
vblschemaname varchar2 (20);
begin
select currentschemaname into vblschemaname from hr_989_schema;
vblqueryname := '060_525_020';
execute immediate 'alter session set current_schema=' || vblschemaname;
insert /*+ APPEND(HP_ELIGIBILITIES,4) */
into hp_eligibilities (lvl1id,
lvl1desc,
lvl2id,
lvl2desc,
lvl3id,
lvl3desc,
lvl4id,
lvl4desc
select /*+ PARALLEL(a,4) */
lvl1id,
lvl1desc,
lvl2id,
lvl2desc,
lvl3id,
lvl3desc,
lvl4id,
lvl4desc
from hp_eligibilities a
where upper (lvl2id) = 'XX';
commit;
dbms_output.put_line ('Query Executed: ' || vblqueryname);
insert into hp_queryexeclog (queryname)
values (vblqueryname);
exception
when no_data_found
then
null;
end;
Maybe you are looking for
-
I-Trigue 3000 2.1 speakers
Hi, I have seen the on the Creative Worldwide site and noticed that they are a new product and do not yet have a price. I am from the U.K and was wondering if there is anyone out there who knows when/if they will be available in the U.K and how much
-
Java error : NullPointerException while system copy
Hi All, system: windowsNT 2003 with SQL 2005 error while heterogeneous backup of system (CRM system ABAP + Java) SAPinit_dev.log SEVERE: Error during export of EP_ATTR_HEADERS Sep 29, 2010 7:22:32 PM com.sap.inst.jload.Jload logStackTrace SEVERE: jav
-
Can i trap the URL of the browser??help!!!!
Hi, I want to trap the URL of the browser in my java application.Is it possible to do that?? In other words, can i manipulate the browser (like 'IE browser' available as an activex component for vb users.) in java for some urgent requirement? (Or) Is
-
Hi Experts We recently upgraded to PPM 5.0 on Netweaver Business Client The problem i face is with Project and Portfolio Administration. I have an existing Initiative template but I cannot create a new Initiative template. If i try to create an Initi
-
Where can I find Garage 11 v6.0.4 to install on my 2014 mac book pro .