Archecker Examples

Example 1

Restores the table customer in database stores7 to the same table. If table exists, rows are appended. If table does not exist, it is created. The logs will be applied during the logical restore.

database stores7; 

-- SOURCE and TARGET Table

create table customer (
  customer_num serial not null ,
  fname char(15),
  lname char(15),
  company char(20),
  address1 char(20),
  address2 char(20),
  city char(15),
  state char(2),
  zipcode char(5),
  phone char(18)
) in rootdbs ;
insert into customer
  select * from customer;
 
restore to current;

Example 2

Restores the table customer in database stores7 to the table customer2 in database stores7. No logical recovery will be done.

database stores7;

-- SOURCE Table
create table customer (
customer_num serial not null ,
  …
  phone char(18)
) in rootdbs ;

-- TARGET Table
create table customer2 (
  customer_num serial not null ,
  …
  phone char(18)
) in rootdbs ;

insert into customer2
  select * from customer;

restore to current with no log ;

Example 3

Restores the tables customer and orders in database stores7 to the same tables.

database stores7;

-- SOURCE Table
create table customer (
  customer_num serial,
  …
  phone char(18)
) in rootdbs ;

-- Second SOURCE Table
create table orders(
  order_num serial,  
  …
  paid_date date
) in rootdbs ;

insert into orders select * from orders;
insert into customer select * from customer;

restore to current with no log ;

Example 4

Restores the table customer in database stores7 to the tables customer_california and customer_nj in database stores7.

database stores7;

-- SOURCE Table
create table customer (
  customer_num serial,
  …
  phone char(18)
 ) in rootdbs ;

-- CA TARGET Table
create table customer_california(
  customer_num serial,
  …
  phone char(18)
) in rootdbs ;

-- NJ TARGET Table
create table customer_nj (
  customer_num serial,
  …
  phone char(18)
) in rootdbs ;

insert into customer_california
  select * from customer
    where state = "CA";
insert into customer_newjersey
  select * from customer
    where state = "NJ";

restore to current with no log

Example 5

Restores the nonfragmented table customer in database stores7 to the fragmented table customer_frag in database stores7.

database stores7;

-- SOURCE Table
create table customer (
  customer_num serial,
  …
  phone char(18),
) in rootdbs ;

-- TARGET Table
create table customer_frag (
  customer_num serial,
  …
  phone char(18)
) fragment by expression
PARTITION cust_ca state = "CA" in fy1,
PARTITION cust_nj state = "NJ" in fy1,
PARTITION cust_rem REMAINDER in fy1;

insert into customer_frag
  select * from customer;

Example 6

Restores the table customer in database stores7 to the external table customer_file, which is actually a file called customer.unl. This file will be an ASCII file delimited with the pipe symbol (“|”).

database stores7;

-- SOURCE Table
create table customer (
  customer_num serial,
  …
  phone char(18)
) in rootdbs ;

-- TARGET Table
create external table customer_frag (
  customer_num serial,
  …
  phone char(18)
) using ( "customer.unl", DELIMITED );

insert into customer_file
  select * from customer;

restore to current with no log ;

Example 7

Restores the table customer in database stores7 to the same table in database stores7. The logical logs will be applied during a logical restore stopping at the specified time.

database stores7;  

-- SOURCE and TARGET Table
create table customer (
  customer_num serial not null ,
  …
  phone char(18)
) in rootdbs ;

insert into customer
  select * from customer;

restore to '2006-05-08 02:00:00';

Personal Tools