2015年5月6日 星期三

Oracle Flashback Technology

這次不小心把資料庫異動錯,幸好使用此feature將資料就回來,所以將此feature介紹如下

http://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_flashback.htm#BJFDJCJD
這次用到其中

Flashback Query

以下有講如何config,如何使用
http://oracle-base.com/articles/9i/flashback-query.php

需要有

Automatic Undo Management

才能使用Flashback Query
以下講如何 config Automatic Undo Management
http://oracle-base.com/articles/9i/automatic-undo-management.php

 其中使用SQL:
SELECT oea01,oeaud02 FROM oea_file
  AS OF TIMESTAMP
   TO_TIMESTAMP('2015-05-07 12:00:00', 'YYYY-MM-DD HH:MI:SS')
 where oea01 like 'ASO7-1504%';
叫出當時未異動前的資料

2015年5月4日 星期一

How to send HTTP GET or POST request in Perl

http://xmodulo.com/how-to-send-http-get-or-post-request-in-perl.html

To install LWP on Ubuntu or Debian:
$ sudo apt-get install libwww-perl

To install LWP on CentOS, Fedora or RHEL:
$ sudo yum install perl-libwww-perl.noarch

HTTP GET Perl example

use LWP::UserAgent;

my $ua = LWP::UserAgent->new;

my $server_endpoint = "http://192.168.1.1:8000/service";

# set custom HTTP request header fields
my $req = HTTP::Request->new(GET => $server_endpoint);
$req->header('content-type' => 'application/json');
$req->header('x-auth-token' => 'kfksj48sdfj4jd9d');

my $resp = $ua->request($req);
if ($resp->is_success) {
    my $message = $resp->decoded_content;
    print "Received reply: $message\n";
}
else {
    print "HTTP GET error code: ", $resp->code, "\n";
    print "HTTP GET error message: ", $resp->message, "\n";
} 
 

HTTP POST Perl example

use LWP::UserAgent;

my $ua = LWP::UserAgent->new;

my $url = "http://192.168.1.1:8000/service";


my $resp = $ua->post( $url, { 'term' => $md5 } );


if ($resp->is_success) {
    my $message = $resp->decoded_content;
    print "Received reply: $message\n";
}
else {
    print "HTTP POST error code: ", $resp->code, "\n";
    print "HTTP POST error message: ", $resp->message, "\n";
}