Pages
Categories
Apex Audit Book review Bugs Character sets Database links Dataguard Email General musings Grid control Installs Linux Materialized views Old Oracle forms Oracle User Group Performance tuning PL/SQL RAC Rman Scripts Security Sharepoint Space Spfile SQL*Net SQL Developer SQL server Stats Uncategorized VMWare Windows WordpressCategories
- Apex (1)
- Audit (1)
- Book review (2)
- Bugs (6)
- Character sets (6)
- Database links (2)
- Dataguard (1)
- Email (3)
- General musings (6)
- Grid control (2)
- Installs (11)
- Linux (18)
- Materialized views (3)
- Old (1)
- Oracle forms (4)
- Oracle User Group (1)
- Performance tuning (18)
- PL/SQL (4)
- RAC (7)
- Rman (11)
- Scripts (33)
- Security (3)
- Sharepoint (1)
- Space (6)
- Spfile (2)
- SQL Developer (1)
- SQL server (7)
- SQL*Net (4)
- Stats (4)
- Uncategorized (17)
- VMWare (1)
- Windows (7)
- Wordpress (3)
Archives
- June 2013
- May 2013
- March 2013
- February 2013
- January 2013
- November 2012
- October 2012
- July 2012
- June 2012
- April 2012
- March 2012
- February 2012
- December 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- April 2009
- March 2009
- November 2008
- January 2008
- November 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
Recent Comments
- balram on Oracle Developer Suite 10g 9.0.4.0.1 windows software download media
- tory burch tote sale on Data block corruption cleared with alter system flush buffer_cache
- Bearer of Pain on Oracle Developer Suite 10g 9.0.4.0.1 windows software download media
- Andrew Fraser on Make indexes unusable before big insert
- Jon Adams on Make indexes unusable before big insert
Category Archives: Scripts
Convert java dates to oracle sql dates (esp. odm_publicobject createdate)
Java dates are recorded in milliseconds after 01-Jan-1970 00:00:00 GMT. To convert these to oracle dates, use sql like: SELECT TO_DATE(’01-JAN-1970 00:00:00′,’DD-MON-YYYY HH24:MI:SS’) + createdate/(1000*60*60*24) createdate , creator FROM odm_publicobject WHERE TO_DATE(’01-JAN-1970 00:00:00′,’DD-MON-YYYY HH24:MI:SS’) + createdate/(1000*60*60*24) > sysdate – 30 … Continue reading
Posted in Scripts
Leave a comment
Oracle regexp_replace remove non alpha ASCII
Replace everything that isn’t a standard ASCII alpha character with a space: SELECT REGEXP_REPLACE ( ‘xxXX € Ááé 123 %; test text æ¸¬è© ¦ “xmxmx” number²’ , ‘[^a-zA-Z]‘ , ‘ ‘ ) FROM DUAL h/t Kok Yan Lo and jadarnel27 … Continue reading
Posted in Scripts
Leave a comment
Global search and replace with sed and find
sed -e ‘s/old1/new1/g s/old2/new2/g s/old3/new3/g’ –i $(find / -name ‘*.php’ -o -name ‘*.include’ -o -name ‘*.inc’ -o -name ‘*.class’ -o -name ‘ht.access’) ‘locate’ would be an alternative to ‘find’.
Database Password Changes from users web page
This is a Pl/sql wrapper around “alter user” to allow front end interfaces (Servicedesk, Javascript or PHP web pages, etc.) to safely change passwords. CREATE OR REPLACE PROCEDURE sys.php_reset_passwords /*************************** || Name : sys.php_reset_passwords || Author : Andrew Fraser || … Continue reading
Posted in Scripts, Security
Leave a comment
List all crons and database links with scripts
I’m currently listing all interfaces – database links and cron jobs – into excel, and used these two scripts to automate the process. Shell script to list all crons (note that this assumes crons in /etc/cron.d run as root): for … Continue reading
Posted in Database links, Scripts
Leave a comment
unlock orcladmin password in shell script
Shell script to check if orcladmin account is locked, and unlock it if required # Check to see if orcladmin account is locked, and unlock it if it is. if [ “`ldapbind -p <myport> -D cn=orcladmin -w <myorcladminpassword>`” = “bind … Continue reading
Posted in Oracle forms, Scripts, Security
Leave a comment
Split space delimited string with regexp SQL
Split up a delimited string with: select regexp_substr(‘Hello world !’ ,’[^ ]+’, 1, 1) , regexp_substr(‘Hello world !’ ,’[^ ]+’, 1, 2) , regexp_substr(‘Hello world !’ ,’[^ ]+’, 1, 3) from dual ; Output: REGEX REGEX R —– —– – … Continue reading
Posted in Scripts
Leave a comment
sed change entire line
Here I use sed to replace the entire 2nd line in a lot of files with a new 2nd line. The shell script: for fle in `ls *.msg` do # copy file first so as can keep permissions and ownership … Continue reading
Posted in Linux, Scripts
Leave a comment
Remove dba_2pc_pending records
Old entries in dba_2pc_pending can be removed by ‘rollback force’ or if that fails, with a purge: set pages 9999 spool go.tmp select ‘rollback force ”’||local_tran_id||”’ ;’ from dba_2pc_pending ; select ‘exec dbms_transaction.purge_lost_db_entry(”’||local_tran_id||”’ )’ , ‘commit;’ from dba_2pc_pending ; spool … Continue reading
Posted in Scripts
Leave a comment
Find delete old files
# Delete files older than 15 minutes find /ORA_DISK/redoarch/ -name ‘arch_*.dbf’ -mmin +15 -delete #Delete files older than 2 days 50 8 * * * find /ORA_DISK/redoarch/ -name ‘arch_*.dbf’ -mtime +2 -delete Old versions of unix find do not have … Continue reading
Posted in Linux, Rman, Scripts
Leave a comment