Text value Search in all tables of a schema
Hi,
I have a schema and a lot of tables.
Now i want to search a given value in all tables and all columns.
Actully for e.g I have a value 'http://192.168.1.15:8080://....'
which is to be replaced by 'http://10.15.1.16:8080://.....'
I need information of all table name and all their respective columns having this value.
Is their any tool, or sql script which can scan.
I am using 10g
Thanks
Message was edited by:
[email protected]
Hi,
it's quite easy to write a plsql-prog using dynamic sql (if tthe value you've just to
search varchar cols). I've never heard about a tool for search and replace within a whole schema.
Torsten
Similar Messages
-
Keyword Search on all tables of a Schema
Hi,
My application incorporates a keyword search facility i.e. it should search all tables for that particular keyword and return matched strings. This should be implemented by dynamic queries from a procedure.
Can anyone suggest me an efficient algorithm for the same?
Thanks in advanceA query like the one you wish to build may have nasty side effects in Oracle. I can post a quick suggestion... but I'm aware that it may pollute the SGA somewhat and thus cause some performance issues for the system. Consider it a starting point, ok?
PROMPT create result table
CREATE GLOBAL TEMPORARY TABLE keyword_search_result_gt
(tname varchar2(30)
,cname varchar2(30)
,text varchar2(4000)
) ON COMMIT PRESERVE ROWS
PROMPT create search procedure
CREATE OR REPLACE PROCEDURE wild_keyword_search( p_keyword IN VARCHAR2 )
IS
CURSOR c1 IS
SELECT /*+cache */
table_name
,column_name
FROM
user_tab_columns
WHERE
data_type = 'VARCHAR2'
ORDER BY 1;
BEGIN
FOR x IN c1 LOOP
EXECUTE IMMEDIATE 'INSERT INTO keyword_search_result_gt SELECT '''||x.TABLE_NAME||''', '''||x.COLUMN_NAME||''', '||x.COLUMN_NAME||' FROM '||x.TABLE_NAME||' WHERE '||x.COLUMN_NAME||' LIKE '''||'%'||p_keyword||'%'||'''';
END LOOP;
END;
PROMPT cleanup
DELETE keyword_search_result_gt
PROMPT run a test searching for keyword 'TEXTABC'
exec wild_keyword_search ('TEXTABC')
PROMPT query output
SELECT * FROM keyword_search_result_gt
/<br>
<br>
It this an ok answer? Or do you consider it crap to be swapped with a scalable solution? -
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 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 -
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;
/ -
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. -
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; -
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. -
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 -
Searching for a values in all tables in a schema
Hi All,
Is there any way/logic to find a value in unknown
fileds of unknown tables in a schema.
Just out of curiosity, I am posting this question.
Thanks in advance.
Regards,
SriniI already answered to a similar post last week.
Have a look at this site :
how do I find in a ViewTable what table has a specific column?
-- Shailender Mehta -- -
SQL TO search for a text from one of the table in a scheme(user)
Hi folks
Is there any way to serch for a text from a table in a schema(user) where we dont know from which table that text belongs to .
If yes please post me ..
ThanksTry this
SQL> var val varchar2(5)
SQL> exec :val := 'as'
PL/SQL procedure successfully completed.
SQL> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"
Regards
Singh -
Monitor all tables of a schema
Hi All,
I would like to monitor all the tables under a schema, hoping to have an alert (in email) if there is decrease in rows of any table owned by the schema (delete rows).
My db version is 11.1.0.6
Please share your suggestions on how it can be done, also if possible with some good examples
Thanks,
Sathishuser13158979 wrote:
can i monitor all the tables owned by the schema using above method? FGA requires object_name need to be monitored, in this case how can we use it?
eg:
DBMS_FGA.ADD_POLICY (object_schema => 'scott', object_name=>'emp', policy_name
=> 'mypolicy1', audit_condition => 'sal < 100', audit_column =>'comm, credit_
card, expirn_date', handler_schema => NULL, handler_module => NULL, enable =>
TRUE, statement_types=> 'INSERT, UPDATE');You can do ;
SQL> conn sys as sysdba
Connected.
SQL> SHOW PARAMETER AUDIT
NAME TYPE VALUE
audit_file_dest string /home/oracle/app/oracle/admin/
ORAWISS/adump
audit_sys_operations boolean FALSE
audit_syslog_level string
audit_trail string DB
SQL> AUDIT ALL BY ORAWISS BY ACCESS;
Audit succeeded.
SQL> AUDIT EXECUTE PROCEDURE BY ORAWISS BY ACCESS;
Audit succeeded.
SQL> AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY ORAWISS BY ACCESS;
Audit succeeded.
SQL> conn orawiss
Enter password:
Connected.
SQL> insert into orawiss.test_audit values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> delete from orawiss.test_audit;
1 row deleted.
SQL> commit;
Commit complete.
SQL> conn sys as sysdba
Connected.
COLUMN username FORMAT A10
COLUMN owner FORMAT A10
COLUMN obj_name FORMAT A10
COLUMN extended_timestamp FORMAT A35
SQL>
SELECT username,
extended_timestamp,
owner,
obj_name,
action_name
FROM dba_audit_trail
WHERE owner = 'ORAWISS'
ORDER BY timestamp;
USERNAME EXTENDED_TIMESTAMP OWNER OBJ_NAME ACTION_NAME
ORAWISS 08-AUG-11 09.59.48.837419 PM +02:00 ORAWISS TEST_AUDIT INSERT
ORAWISS 08-AUG-11 09.59.59.645848 PM +02:00 ORAWISS TEST_AUDIT DELETE
SQL> -
How can count no of rows in all tables in one schema
hi all
i want to cound no of rows in my schema ( all tables)
eg. i have 36 tables
i want to know no of rows in every tables in only one query through sql or plsql
how can i do..
regards
mohammadi
Message was edited by:
Mohdidubai52hi
thanx for ur reply
but i got error....
SQL> ED
Wrote file afiedt.buf
1 DECLARE
2 v_rowNo NUMBER := 0;
3 v_sum NUMBER := 0;
4 v_tableName VARCHAR2(100);
5 CURSOR c1 IS
6 SELECT table_name
7 FROM user_tables;
8 BEGIN
9 FOR counter IN c1 LOOP
10 DBMS_OUTPUT.PUT_LINE(counter.table_name);
11 EXECUTE IMMEDIATE 'SELECT COUNT(1) FROM ' || counter.table_name INTO v_ro
wNo;
12 v_sum := v_sum + v_rowNo;
13 END LOOP;
14 DBMS_OUTPUT.PUT_LINE('Number of rows: ' || v_sum);
15* END;
16 /
DECLARE
ERROR at line 1:
ORA-00933: SQL command not properly ended
ORA-06512: at line 11
again
thanx
regards
Mohammadi -
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.
PratHameshIf 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
Maybe you are looking for
-
Satellite P870 - simple image backup & restore software required
Does anyone know of simple disk imaging software to back up and restore C: drive including the OS and every file. I used to use BartPE which had the shell of Windows XP on the CD and booted from the CD and allowed an image to be made or restored. It
-
PLEASE HELP! X2-01 CALL PROBLEM!
There's nothing wrong when I make an outgoing call, it seems normal. But when someone does an incoming call to me, I can hear them, I can clearly hear their back ground without me answering their call. Though, when I tried saying 'Hello' to the calle
-
Making your Flash teaching content as effective as possible
Hi All, I just added a new blog post with some thoughts about how creators of flash tutorials, articles, videos, etc. could make their content more usable and discoverable for Flash learners. http://blogs.adobe.com/jayarmstrong/ I'm hoping to start a
-
How to handle SYS_REFCURSOR?
I created table in oracle 11g like below, CREATE TABEL family( EMP_ID VARCHAR(255), EMP_PASSWD VARCHAR(255), EMP_NAME VARCHAR(255), PRIMARY KEY(EMP_ID) ) And I inserted a few data. commit command was successful. I made a stored procedure to call data
-
Seeing Friends wish list so I can buy their wishes as gift.
Hi all; I know how to add items to my wish list and reaching them when I need . Do you know if there is any way I can see my friends wish lists so I can buy them as present ? or Is there any way I can let them to see mine so they can make gifts