Wednesday, September 9, 2009

Troubeshoot Oracle standby DB

8.3.1.2.2 Recovering From Errors
To correct the problems described in Section 8.3.1.2.1, perform the following steps:
1. Create the raw slice on the standby database and assign permissions to the Oracle
user.
2. Query the V$DATAFILE view. For example:
    SELECT NAME FROM V$DATAFILE;
NAME
-------------------------------------------------------------------------------
-
/u01/MILLER/MTS/system01.dbf
/u01/MILLER/MTS/undotbs01.dbf
Managing Primary Database Events That Affect the Standby Database
Managing a Physical Standby Database 8-9
/u01/MILLER/MTS/sysaux01.dbf
/u01/MILLER/MTS/users01.dbf
/u01/MILLER/MTS/mts.dbf
/dev/raw/raw100
/u01/app/oracle/product/10.1.0/dbs/UNNAMED00007
SQL - ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=MANUAL;
SQL - ALTER DATABASE CREATE DATAFILE
           '/u01/app/oracle/product/10.1.0/dbs/UNNAMED00007'
           AS
           '/dev/raw/raw101';

3. In the standby alert log you should see information similar to the following:
    Fri Apr 8 10:09:30 2005
    alter database create datafile
    '/dev/raw/raw101' as '/dev/raw/raw101'
    Fri Apr 8 10:09:30 2005
    Completed: alter database create datafile
    '/dev/raw/raw101' a
4. On the standby database, set STANDBY_FILE_MANAGEMENT to AUTO and restart
    Redo Apply:
    SQL - ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
    SQL - RECOVER MANAGED STANDBY DATABASE DISCONNECT;
    At this point Redo Apply uses the new raw device datafile and recovery continues.

om tyo - area wajib comment :)

Sunday, September 6, 2009

Learn Effective pl/sql

Saya coba untuk mengulas mengenai penulisan pl/sql yang effective
berdasarkan referensi yang ada, dan saya tuangkan dalam contoh-contoh pl/sql
dan untuk skripting ini di tulis dengan menggunakan schema SH

declare
cursor c_prod is
select prod_id,
prod_name,
prod_desc,
prod_subcategory
from products
where prod_category_desc = 'Electronics';
rec_prod c_prod%rowtype;
begin
open c_prod;
loop
fetch c_prod into rec_prod;
exit when c_prod%notfound;
dbms_output.put_line('description product '||rec_prod.prod_desc);
end loop;
close c_prod;
end;

declare
v_prod_name products.prod_name%type;
begin
select prod_name
into v_prod_name
from products
where prod_category_desc = 'Electronics'
and prod_id = 300;
if sql%notfound then
dbms_output.put_line('the data not found');
else
dbms_output.put_line('the name of product -> '||v_prod_name);
end if;
exception when no_data_found then
dbms_output.put_line('no data found');
end;