Apps DBA Concepts

Just another WordPress.com weblog

Archive for June, 2008

Enabling flashback on Oracle

Posted by vasselva on June 6, 2008

Flashback query is not enabled by default and must be turned on in following sequence. We will set retention to 10 hours (600 minutes), set recovery size up to 2 GB in file “/recovery/flashback”:

shutdown immediate;
startup mount;
alter database archivelog;
alter system set DB_FLASHBACK_RETENTION_TARGET=600;
alter system set DB_RECOVERY_FILE_DEST_SIZE=2G;
alter system set DB_RECOVERY_FILE_DEST=’/recovery/flashback’;
alter database flashback on;
alter database open;

Posted in Database | Leave a Comment »

Deleting Windows Services using perl

Posted by vasselva on June 2, 2008

Use it at your own risk

serviceDel.pl

print “Deleting Windows Services perl….\n”;
my $cmd =”sc query \”<SERVICE NAME>\” | grep RUNNING | cut -c33-“;
my $ret =`$cmd`;
chomp($ret);
$ret =~ s/^\s+//;
$ret =~ s/\s+$//;

if(“$ret” eq “RUNNING”){
my $cmd = “sc stop \”<SERVICE NAME>\””;
my $rt=system($cmd);
print “Stop service returned $rt…\n”;
}

while(true){
sleep(5);
my $cmd =”sc query \”<SERVICE NAME>\” | grep STOPPED | cut -c33-“;
my $c = `$cmd`;
chomp($c);
$c =~ s/^\s+//;
$c =~ s/\s+$//;
if ( “$c” eq “STOPPED”){print “SERVICE STOPPED \n”;last;}
print “SERVICE iS RUNNING \n”;
}

my $cmd = “sc delete \”<SERVICE NAME>\””;
my $rt  =  system($cmd);
print “Delete Service returned $rt…\n”;

Posted in Scripts | Leave a Comment »