DECLARE
BEGIN
--Bye Tables!
FOR i IN (SELECT ut.table_name
FROM USER_TABLES ut) LOOP
EXECUTE IMMEDIATE 'drop table '|| i.table_name ||' CASCADE CONSTRAINTS ';
END LOOP;
END;
Saturday, June 13, 2015
Oracle - PL/SQL - Delete all table
Oracle - PL/SQL - Delete all sequence
DECLARE
BEGIN
--Bye Sequences!
FOR i IN (SELECT us.sequence_name
FROM USER_SEQUENCES us) LOOP
EXECUTE IMMEDIATE 'drop sequence '|| i.sequence_name ||'';
END LOOP;
END;
Wednesday, February 25, 2015
Sun Solaris : Check Memory like Unix Top command
Here you go :
prstat -Z
Sun solaris : Ping not found
Ping tool usually found under /usr/sbin/ping
You can use directly by do this :
You can edit your ~/.profile and put in the path.
Exit and login back the terminal ssh. and try "ping 10.10.10.11".
You can use directly by do this :
/usr/sbin/ping 10.10.10.11
You can edit your ~/.profile and put in the path.
PATH=$PATH:/usr/sbin
export PATH
Exit and login back the terminal ssh. and try "ping 10.10.10.11".
Oracle : Check last analyzed after gather statistic of schema
select table_name, last_analyzedIt show all table that has been analyzed with last analyzed date..
from user_tables
order by last_analyzed desc nulls last;
Sunday, September 28, 2014
Oracle : find duplicate row and total duplicate
select column_name, count(column_name)
from table
group by column_name
having count (column_name) > 1;
Monday, September 1, 2014
Oracle : display all date in month
Here some example for show all date in current/before/after month or specific month
Above is current month
select to_char( add_months(trunc(sysdate,'MM'),-1) + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(add_months(trunc(sysdate,'MM'),-1)) - add_months(trunc(sysdate,'MM'),-1) + 1;Above is before current month
select to_char( add_months(trunc(sysdate,'MM'),1) + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(add_months(trunc(sysdate,'MM'),1)) - add_months(trunc(sysdate,'MM'),1) + 1;Above is after current month
select to_char( trunc(sysdate,'MM') + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(trunc(sysdate,'MM')) - trunc(sysdate,'MM') + 1;
Above is current month
select to_char( trunc(to_date('20140101','YYYYMMDD'),'MM') + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(trunc(to_date('20140101','YYYYMMDD'),'MM')) - trunc(to_date('20140101','YYYYMMDD'),'MM') + 1;Above is specific month but you must enter date.
Subscribe to:
Posts (Atom)