Tuesday, November 24, 2009

set oracle date format

for lazy people like me don't want to use to_date() function.
we can preset the dateformat for the session.

alter session set NLS_DATE_FORMAT='';

Monday, November 23, 2009

dblink link

1) make sure you have create database link privileges.
login as dba and "grant create database link to $user;

2).
create database link
$dblinkname connect to $schemaname identified by $schemapassword using '$oracle_sid';
$dblinkname is the identifier for this dblink.
$schemaname is the schema you want to connect
$schemapassword is the normal password for the $schemaname.
$oracle_sid is the connection string. eg host/sid

to test.

select * from dual@$dblinkname;

Friday, November 20, 2009

use rman to delete archive log

if you are getting

Enter password: ********
ERROR:
ORA-00257: archiver error. Connect internal only, until freed.

this error message when you login to your Oracle

you can use rman to delete some log.

oracle $ rman target /
rman> delete noprompt archivelog until time 'sysdate - 2' ;
rman> crosscheck backupset;

This will delete the archive log older than 2 days.