Pages

Tuesday, February 17, 2015

Changing Database link password without recreating



 It is possible to change a database link password without dropping and recreating a database link.

The ALTER DATABASE LINK statement can be used and you do not need to specify the target TNS Service name either.


ALTER DATABASE LINK DB_LINK_NAME connect to USER_NAME identified by  NEW_PASSWORD;















main url: https://jhdba.wordpress.com/2015/02/13/changing-a-database-link-password/

Wednesday, August 28, 2013

execute shell script USING DBMS_SCHEDULER

--- create shell scrip as below

[oracle@server1 ~]$ cat vmstat.sh

#!/bin/bash
/usr/bin/vmstat >> /home/oracle/x.txt


---create job , set arguments and enable

begin
 dbms_scheduler.create_job
(
job_name => 'My_job',
job_type => 'EXECUTABLE',
job_action => '/bin/bash',

  start_date =>sysdate ,
number_of_arguments => 1,
repeat_interval => 'FREQ=secondly; INTERVAL=5',
enabled => false,
comments => 'shell script test'
);

dbms_scheduler.set_job_argument_value(job_name=>'My_job', argument_position=>1, argument_value=>'/home/oracle/vmstat.sh');
dbms_scheduler.enable(name=>'My_job');
end;

--- DD VIEW


select * from dba_scheduler_job_run_details x where x.job_name='MY_JOB';

Wednesday, July 3, 2013

Extract DB Time from Awr

Here’s a handy little script for showing when the database has been most busy. 
thanks to kerry http://kerryosborne.oracle-guy.com


select * from (
select begin_snap, end_snap, timestamp begin_timestamp, inst, a/1000000/60 DBtime from
(
select
 e.snap_id end_snap,
 lag(e.snap_id) over (order by e.snap_id) begin_snap,
 lag(s.end_interval_time) over (order by e.snap_id) timestamp,
 s.instance_number inst,
 e.value,
 nvl(value-lag(value) over (order by e.snap_id),0) a
from dba_hist_sys_time_model e, DBA_HIST_SNAPSHOT s
where s.snap_id = e.snap_id
 and e.instance_number = s.instance_number
 and to_char(e.instance_number) like nvl('&instance_number',to_char(e.instance_number))
 and stat_name             = 'DB time'
)
where  begin_snap between nvl('&begin_snap_id',0) and nvl('&end_snap_id',99999999)
and begin_snap=end_snap-1
order by dbtime desc
)
where rownum < 31