How to drop all tables in perticular schema??
Hi,
I am new in oracle.
I want to drop all tables in one perticular schema,
Please tell me solution.
PratHamesh
If your few of your tables have referential intigrity constraints and trying to drop master table whithout droping child table first, oracle will produce an error.
Better option would be to drop the entire schema and then create a new schema with the same name.
on sql plus.
set long size 20000
select dbms_metadata.get_ddl('USER','USERNAME') from dual;
--then save the above output to create the user later.
drop username cascade
use the above saved script to create the user again.
Jaffar
Similar Messages
-
How to drop a table in another schema.
Hi there, was looking to drop a table that is currently created under GL schema when consolidation process is done. These tables are kind of temporary and stay there if consolidation process doesn't complete successfully.
So, I'm try to execute a script that would drop the table but the particularity is that this drop isn'T executed by apps but with bolinf (custom user).
So, while trying to delete it with bolinf, I always get an error message that the table doesn't exists or so.
Here's the code
r_gl_int_ctrl.INTERFACE_TABLE_NAME is retreived from gl_interface_control table and from INTERFACE_TABLE_NAME column.
EXECUTE IMMEDIATE 'DROP TABLE GL.' || r_gl_int_ctrl.INTERFACE_TABLE_NAME;
and this generates the following error : ORA-00942: table or view does not exist
R12.0.6
RDBMS 10.2.0.3.0
Custom package under bolinf schema is trying to drop GL.GL_CONS_INTERFACE_38190 and it's not working. Nevertheless, if I install this package under apps, table get dropped.
Is there a way that I can drop a GL table like GL.GL_CONS_INTERFACE_38190 from BOLINF schema ? If so, what privileges/grant should user BOLINF have in order to drop this table from a GL Schema ?
Thank you.Hi;
You need to give drop grant to your user.Easy way is to give
GRANT DROP ANY TABLE TO USER; << but its mean it will give drop grant for all table.
Also see:
OERR: ORA 942 "table or view does not exist" [ID 18536.1]
Regard
Helios -
Droping all tables in a schema
how to drop all tables in a schema with out logging in that schema and having logged in as sys user?
Thanks in advance
Edited by: Prasanna.N on May 17, 2010 11:48 PMPrasanna.N wrote:
Hi,
i get this error
ERROR at line 5:
ORA-06550: line 5, column 9:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe
when giving
begin
for t in (select table_name from dba_tables where owner = 'SCOTT')
loop
execute immediate 'drop table SCOTT.' || t.table_name || 'purge';
end loop;
/I just wrote for loop, of course you have to write inside begin..end block:
begin
for t in (select table_name from dba_tables where owner = 'SCOTT')
loop
execute immediate 'drop table SCOTT.' || t.table_name || ' purge';
end loop;
end;
/ -
How to delete all rows in all tables of a schema in Oracle?
Hi all,
I want to delete all records of all tables of a schema and I think there should be some statement for this but I don't know how?
may you help?
Edited by: user8105261 on Nov 25, 2009 11:06 PMuser8105261 wrote:
Hi all,
I want to delete all records of all tables of a schema and I think there should be some statement for this but I don't know how?
may you help?
Edited by: user8105261 on Nov 25, 2009 11:06 PMA typical way to reset a schema (e.g. to recreate a schema on the test database) is totally different.
1) Drop the user
2) recreate the user including table scripts from
2a) your version control system
2b) from a export dumpfile using the "nodata" option while importing -
How can we copy table from one schema to other schema
Hi,
I have create one table in one schema and i want to copy it to other schema.How we can copy table from one schema to other schemaHi,
You can try something like this :-
SQL> CONNECT SYS/SYS123@SERVER AS SYSDBA
Connected.
SQL> CREATE USER TEST_1 IDENTIFIED BY TEST_1;
User created.
SQL> CREATE USER TEST_2 IDENTIFIED BY TEST_2;
User created.
SQL> GRANT CONNECT,RESOURCE,DBA TO TEST_1;
Grant succeeded.
SQL> GRANT CONNECT,RESOURCE,DBA TO TEST_2;
Grant succeeded.
SQL> CONNECT TEST_1/TEST_1@SERVER
Connected.
SQL> CREATE TABLE TEST_COPY ( TEST_COL NUMBER );
Table created.
SQL> INSERT INTO TEST_COPY VALUES ( 1 );
1 row created.
SQL> INSERT INTO TEST_COPY VALUES ( 2 );
1 row created.
SQL> COMMIT;
Commit complete.
SQL> GRANT ALL ON TEST_COPY TO TEST_2;
Grant succeeded.
SQL> CONNECT TEST_2/TEST_2@SERVER
Connected.
SQL> CREATE TABLE TEST_COPY AS SELECT * FROM TEST_1.TEST_COPY;
Table created.
SQL> SELECT * FROM TEST_COPY;
TEST_COL
1
2Regards,
Sandeep -
Need to grant DML privileges to all tables in few schemas
Hi,
I need to grant DML privileges to all tables in few schemas to a role. How can I achieve that?
I thought it's below syntax but it doesn't work. Please advice.
grant ALL ON ALL TABLES IN SCHEMA <Schema_name> TO <role_name>;Thanks,
GangadharGR wrote:
Hi,
I need to grant DML privileges to all tables in few schemas to a role. How can I achieve that?
I thought it's below syntax but it doesn't work. Please advice.
grant ALL ON ALL TABLES IN SCHEMA <Schema_name> TO <role_name>;
There is no single command to grant privileges at that level. There are either ANY privileges or privileges on an object.
You can write a bit of code to generate and execute what you want, but you would have to rerun it if any new tables were created. -
All columns of all table in one schema
Hi
All,
Oralce 10.2.0.3
I want to count all columns in all the table in one particular schema.
How can I do that?
which view i should use to count all cloumns of all tables in particular schema?
Thanksvishal patel wrote:
we needed for our data conversion project..I don't know how you'll use the number of columns in all a schema for data conversion. Some columns are duplicated (e.g. PK/FK), should they really count for two ?
A data conversion means you should actually know what are the columns used for, not how many they are.
one more question that count include hidden columns
what is hidden column used for ? I can not see those columns in actual table.See here an example :
Re: Difference btwn user_tab_cols & user_tab_columns
Nicolas. -
Can we export DATA from all tables in a schema?
Hi,
I have a question; Can we export all the DATA from all the tables present in the schema to any source (eigther CSV, TXT, DAt, etc..)?
Or
Can I have a PL/SQL procedure to display DATA from all Tables in a schema?
With Best Regards,
- NaveedHi,
This is pretty much what you need.
DECLARE
V_COUNT NUMBER;
v_sql varchar2(1000);
IN_OWNER_NAME VARCHAR2(100) := 'AP' ; -- SCHEMA NAME
TYPE T_COL_NAME is table of varchar2(1000) index by binary_integer;
v_col_tbl t_col_name;
BEGIN
FOR i in
(SELECT object_name
FROM dba_objects
WHERE owner = IN_OWNER_NAME
AND object_type ='TABLE'
and rownum < 2)
LOOP
v_sql := 'SELECT COUNT(*) FROM ' || i.object_name ;
EXECUTE IMMEDIATE v_sql INTO V_COUNT;
if v_count > 0 then
v_sql := 'SELECT * FROM ' || i.object_name ;
select column_name
bulk collect
into v_col_tbl
from DBA_TAB_COLUMNS
WHERE TABLE_NAME = I.OBJECT_NAME
AND OWNER = IN_OWNER_NAME;
-- start selecting the column and exporting using the column names selected.
end if;
if v_col_tbl.count > 0 then
for i in v_col_tbl.first .. v_col_tbl.last
loop
DBMS_OUTPUT.PUT_lINE(v_col_tbl(i));
end loop;
end if;
DBMS_OUTPUT.PUT_lINE( i.object_name || '-' || v_count);
END LOOP;
END;
- Ronel -
How to display all tables residing in my database
i'm using 10g express edition.
i'm developing a .net application using oracle
i want display table infomation in a datagrid
for that i need to select tables fromthe database using the interface given by them
in that i found server name field.....what it actually means?
also how to create a new database in 10g and how to display all tables residing in the database?
pls help me
thanking u
chaitanyauser11359516 wrote:
i want display table infomation in a datagrid
select owner||'.'||table_name owner_table_name
from all_tables
user11359516 wrote:in that i found server name field.....what it actually means?i'm not sute what you mean by server name field? if you refer to table column name see this code below:
select owner||'.'||table_name||'.'||column_name table_column_name,
decode(data_type,'VARCHAR',data_type||'('||to_char(data_length)||')',
'VARCHAR2',data_type||'('||to_char(data_length)||')',
'NUMBER',decode(data_scale,0,data_type||'('||to_char(data_precision)||')',
null,data_type,
data_type||'('||to_char(data_precision)||','||to_char(data_scale)||')'),
data_type) type,
nullable
from all_tab_cols
order by table_name, column_id -
How to drop multiple tables in SQL Workshop
Hi,
I'd like to drop multiple tables in one time but
SQL command processor returnes error message: ORA-00933.
Could you please tell me how to drop multiple tables in
one time?
My trial was follows
Drop table "table1", "table2"
Result
ORA-00933: SQL command not properly ended
Regards,
Hideki SakamotoHideki,
SQL syntax permits you to specify only one table in a DROP TABLE command.
The SQL Command Processor permits you to run one statement or PL/SQL block per submission.
So there are at least two ways you can do this. You could either upload or create a SQL script in SQL Workshop which contains your multiple statements:
drop table "table1"
drop table "table2"
or you could execute a single anonymous PL/SQL block in the SQL Command Processor, as in:
begin
execute immediate 'drop table "table1"';
execute immediate 'drop table "table2"';
end;
Joel -
How to view all table of a database
How to view all table of a database created on a oracle 9.2/10g database management system.
How to view available tables of oracle dbms which comes by default with package.
Thank you so much in advance!
With Regards,
NiksYou posted the same question twice.
How to view all table of a database -
How to drop all scheduled jobs
Hi,
in 8i, how to drop all oracle scheduled jobs ?
Many thanks before.SELECT job FROM user_jobs;
exec dbms_job.remove(23);
To remove all jobs, you can write a pl/sql block to loop through all jobs and remove them.
http://www.psoug.org/reference/dbms_job.html
Aalap Sharma :) -
Grant select on all table of a schema to role
Hi , is it possible to grant select on all table on a schema to a role?
To grant SELECT on all tables of the current schema to particular role or user:
SELECT 'GRANT SELECT ON '||TABLE_NAME||' TO READ_ONLY_ROLE;' COMMAND
FROM (
SELECT TABLE_NAME
FROM ALL_TABLES
WHERE OWNER = (SELECT USER FROM DUAL)
Then copy and execute the result commands, eg:
GRANT SELECT ON DEPT TO READ_ONLY_ROLE;
GRANT SELECT ON EMP TO READ_ONLY_ROLE;
GRANT SELECT ON DEMO_USERS TO READ_ONLY_ROLE;
GRANT SELECT ON DEMO_CUSTOMERS TO READ_ONLY_ROLE;
GRANT SELECT ON DEMO_ORDERS TO READ_ONLY_ROLE; -
Program (PL/SQL) for count the registers of all tables in a schema
Hi...
I create a little program , for count the registers of all tables in the schema...
If you need , send me your email...
Atte
HectorHi,
You can create a script by yourself by executing the script mentioned below:
Connect as sys or system....
SQL> spool test.sql
SQL> select 'select count(*) from '||owner||'.'||table_name||';' from dba_tables;
SQL> spool off;
Hope this helps.
Regards,
-Praveen.
http://myracle.wordpress.com -
What privilege is needed to browse all tables in a schema
I used SQLPlus to login to DB. When I clicked "table" in the left side window, no tables is shown. What privilege is needed to browse all tables in a schema?
Thanks.SQL*Plus is a command-line interface. There is no side window to click on. Perhaps you're talking about SQL Programmer? Or are you talking about some other tool?
What user are you logging in as? What user owns the objects? Do you just want to see that the tables exist? Or do you want to be able to see the data as well?
Justin
Maybe you are looking for
-
Itunes only showing my first Podcast episode
I added my podcast feed and after approval only one episode showed up. I have now done two more episodes over the last two weeks and they don't appear in Itunes. Anyone know why? Thanks in advance!
-
Reassigning AX's "Main/Default" Computer
Hi, I have a Keyspan remote and I sent them this enquiry: I have one of your 17B IR remotes and love it very much. It all worked well via my Airport Express and the latest iTunes on my Powerbook G4 until the day I decided to see if it would also work
-
St. loc. for Acct Assignment category K
Hi Team, We have come across strange scenario while creating PO for Acct assignment categoty "K". As we know, when we are using "K" means procuring material for Cost centre (free text mtrl). For this type NO st. Loc is required as material will be di
-
icloud Backup Failed There was a problem enabling iCloud Backup
-
Name search with and with out case sensitive including * also.
there is an urgent reuirement for name search . i am having 6 fields all are related to name like name prefix ,firstname, lastname etc. now i want select query so that i can search the person name with case ,with out case sensitive and ' * ' also. an