A Oracle DBA's BLOG

Welcome to my ORACLE DBA blog. You will be Amazing!!!

Wednesday, October 2, 2013

Buffer Busy Wait

Buffer Busy Wait 
 This article presents Buffer Busy Wait 
Buffer busy waits could indicate contention in redo, rollback or data blocks. In this action all we need to check the v$waitstat view.
That Buffer busy wait condition happens when:
The block is being read into buffer by another session, And Another session has the  buffer block locked in a mode that is in compatible with the waiting session’s request

The action and resolving this problem


P1: File#  (The waiting data block of datafile numbers. We can see at DBA_DATA_FILES view and  FILE_ID )
P2: Block# (At DBA_EXTEND view block_id)
P3: Class#

So now find the buffer waiting session

SELECT tablespace_name, file_name
    FROM dba_data_files
   WHERE file_id = &v$session.p1;

If you may not see P1 at dba_data_files Then check the Temp files. May e the size of action is big thats why it under temp file

SELECT tablespace_name, file_name
    FROM dba_temp_files f, v$parameter p
   WHERE p.name='db_files'
     AND f.file_id+p.value = &v$session.p1;

Or we can check by Segments

SELECT  owner , segment_name , segment_type
    FROM  dba_extents
   WHERE  file_id = &v$session.p1
     AND  &v$session.p2 BETWEEN block_id AND block_id + blocks -1


Also we can see the block by following select
SELECT *
  FROM v$waitstat
 WHERE COUNT > 0 order by 2 desc;
                   
              So, by following command we can figure out that event.   
SELECT 'Segment Header' class,
       a.segment_type,
       a.segment_name,
       a.partition_name
  FROM dba_segments a, v$session_wait b
 WHERE a.header_file = b.p1
   AND a.header_block = b.p2
   AND b.event = 'buffer busy waits'
UNION ALL
SELECT 'Freelist Groups' class,
       a.segment_type,
       a.segment_name,
       a.partition_name
  FROM dba_segments a, v$session_wait b
 WHERE b.p2 BETWEEN a.header_block + 1
                AND (a.header_block + a.freelist_groups)
   AND a.header_file = b.p1
   AND a.freelist_groups > 1
   AND b.event = 'buffer busy waits'
UNION ALL
SELECT a.segment_type || ' block' class,
       a.segment_type,
       a.segment_name,
       a.partition_name
  FROM dba_extents a, v$session_wait b
 WHERE b.p2 BETWEEN a.block_id AND a.block_id + a.blocks - 1
   AND a.file_id = b.p1
   AND b.event = 'buffer busy waits'
   AND NOT EXISTS
          (SELECT 1
             FROM dba_segments

            WHERE header_file = b.p1 AND header_block = b.p2);

Thursday, August 8, 2013

Oracle Flashback Data Archive

Oracle Flashback Data Archive 
At this Article I would like to share new feature of Oracle 11g version Flashback Data Archive/ Total Recall
Today I tested this to keep transaction, I think at oracle 10g version we used to Log Miner or Developed Trigger to keep the datas. After I used FBDA I saw incredibly to made datas in the compressed file.
My user have to have  FLASHBACK ARCHIVE ADMINISTER privilege.
So, let me start
Frist I give a privilege to my user
SQL> grant flashback archive administer to veysi;
Grant succeeded.
Created a tablespace for testing Flasback data archive
SQL> CREATE TABLESPACE tblspce_arch DATAFILE ‘/u01/app/oradata/orcl/flshbck_arch.dbf’ size 10m;
Tablespace created.
Lets tested it by creating table and using transactions
SQL> create table vey_flsh_arch (id number, name varchar2(15));
Table created.
SQL> insert into vey_flsh_arch values(1,’Veysi’);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from vey_flsh_arch;
        ID NAME
———- ——————–
         1 Veysi
Create A flashback archive on this tablespace and give for your retention time.
SQL> create flashback archive FLSHBACK_ARCH tablespace tblspce_arch retention 5 year;
Flashback archive created.
Now we can use the flashback query through 5 years.
So register flashback archive on apllication
SQL> begin
     dbms_flashback_archive.register_application
     (application_name=>'veyAp',
     flashback_archive_name=>' FLSHBACK_ARCH);
     end;
     /  
 
PL/SQL procedure successfully completed.
Now Add our table on it
SQL> begin
     dbms_flashback_archive.add_table_to_application
     (application_name=>'veyAp',
     table_name=>'vey_flsh_arch',
     schema_name=>'VEYSI');
     end;
     /  
 
PL/SQL procedure successfully completed.
Or use the following command.
SQL> alter table vey_flsh_arch flashback archive FLSHBACK_ARCH;
Table altered.

So, let look at our table
SQL> select table_name,status from user_flashback_archive_tables;
 
no rows selected

Upps! No rows, it means we have to enabled our table on flashback archive tables.
SQL> select table_name,status from user_flashback_archive_tables;
SQL> exec dbms_flashback_archive.enable_application(application_name=>'veyAp')
 
PL/SQL procedure successfully completed.
 
SQL> select table_name,status from user_flashback_archive_tables;
 
TABLE_NAME STATUS
---------- ----------
VEY_FLSH_ARCH         ENABLED





Also we can lock down our table no one can change any transactions
SQL> exec dbms_flashback_archive.lock_down_application(application_name=>'veyAp')
 
PL/SQL procedure successfully completed.
 
SQL> delete from vey_flsh_arch;
delete from vey_flsh_arch
            *
ERROR at line 1:
ORA-55622: DML, ALTER and CREATE UNIQUE INDEX operations are not allowed on table "QUAID"."T1"

Unlock by using following command
SQL> exec dbms_flashback_archive.unlock_application(application_name=>'veyAp')
 
PL/SQL procedure successfully completed.

SQL>
Now it will be on the Flashback archive and every transaction we can use it on it.
SQL> set time on;
SQL> insert into vey_flsh_arch values (2,’Gunay’)
1 row inserted.
SQL>delete from vey_flsh_arch;
2 row deleted.
SQL> commit;
Commit complete.
SQL> select * from vey_flsh_arch;
no rows selected
SQL> select * from tbl_fl_archive as of timestamp to_timestamp(’08082013 15:08:30′,’ddmmyyyy hh24:mi:ss’);
        ID NAME
———- ——————–

         1 Veysi

Wednesday, August 7, 2013

ORA-01078: failure in processing system parameters

Today, I got a issue during my experience
 ORA-01078: Failure in processing system parameters,
 LRM-00109: could not open parameter file '/app/oracle/product/11.2.0/db_1/dbs/init.ora
 Its first time I'm on this issue
 So, i realized that Failure caused during processing of INIT.ORA parameters during system startup.

My action was like the following and it had fixed, May be we can see easy/different way on the internet,However let me fix it :) 

[oracle@localhost ]$ sqlplus as sysdba 

SQL>startup 


ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/app/oracle/product/11.2.0/db_1/dbs/init.ora' 

SQL> exit

Disconnected
Open database nomount mode by pfile
SQL> startup nomount pfile=/app/oracle/admin/orcl/pfile/init.ora
ORACLE instance started.

Create pfile again
SQL> create spfile from pfile
2 ;
create spfile from pfile
*
ERROR at line 1:
ORA-01078: failure in processing systemparameters
LRM-00109: could not open parameter file
'/app/oracle/product/11.2.0/db_1/dbs/init.ora'


 Create like that
SQL> create spfile from pfile='/app/oracle/admin/orcl/pfile/init.ora';

File created.

NOW create pfile 
SQL> create pfile from spfile;

File created.

SQL> exit
I got init.ora
 [oracle@localhost pfile]$ ls
init.ora
 [oracle@localhost pfile]$sqlplus


Enter user-name: sys as sysdba
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and RealApplication Testing options

I thought i resolved my issue but after this select 
SQL> select name from v$database;
select name from v$database
*
ERROR at line 1:
ORA-01507: database not mounted


Close database
SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.

Open it should work i guess :)
SQL> startup
ORACLE instance started.

Total System Global Area 224760096 bytes
Fixed Size 1235143 bytes
Variable Size 218627450 bytes
Database Buffers 87557892 bytes
Redo Buffers 5427622 bytes
Database mounted.
Database opened.

Finnaly

SQL> select name from v$database;

NAME
---------
orcl




Saturday, July 20, 2013

RMAN Commands List Oracle 11g

RMAN Commands List (Oracle 11g)


This article presents more useful  commands list Of RMAN Oracle 11g.
During my experience i used all of these commands for many reasons and i decided to share with you.

SHOW Commands :

1.shows all the current configuration settings

RMAN>show all;

2.shows the current retention policy.

RMAN> show retention policy;

3.shows the default device type configured for backups.

RMAN>show default device type;

4.shows the number of backup copies available in the target database.

RMAN> show datafile backup copies;

Configuration..


1.To how many days the backup copies need to be retained. 

RMAN>CONFIGURE RETENTION POLICY TO REDUNDANCY2;

2.Retention policy to the default value of 1 day

RMAN> CONFIGURE RETENTION POLICY CLEAR;

3.Optimization option to the default value.

RMAN>CONFIGURE BACKUP OPTIMIZATION CLEAR;

4.identical files are NOT backed up to the device specified.

RMAN>CONFIGURE BACKUP OPTIMIZATION ON;

BACKUP COMMAND

1.backs up the database (target).

RMAN> backup database;

2.backs up the target database and the current control file and archive log files.

RMAN> backup database include current controlfile plus archive log;

1.reports which backups can be deleted.

RMAN> report obsolete;
1.deletes all the backups that are older based on the retention policy setup.

RMAN> delete obsolete;

LIST COMMAND

  1. First of all we may LIST our Rman backup sets by following command. 
RMAN> list backup;

   2.If we want to list backup of individul database we use

RMAN> list backup of database;
 
  3.List only backup set proxy copies

RMAN> list backupset;
 
4.List image copies and archivelog

RMAN>list copy;

 5.lists out all the files that are in the backup that belong to the tablespace ‘system’.

RMAN> list backup of tablespace system;

6.If backup deleted/moved by OS we can use

RMAN>list expired backup;

7.to list by file or some specific(control) file

RMAN>list backup by file;
RMAN>list backup of control file;

8.We can list summary of copies, proxy and sets

RMAN>list backup summary;

9.To list incarnation backup

RMAN>list incarnation;

10.Also to list all database

RMAN>list backup of database;


Thursday, July 4, 2013

ODI11g: Creating and Connecting to ODI Work Repository

This Article present Creating ODI11G: Work repository, At previous post i mention Master Repository So lets Create Work Repository On it.

         Work Repository: Organization and project Repository. Keeping information about working on server or clients. Also Data project and models keeping here.

Step by step Creating Work Repository 

First create ODIW user and give password (for example: "veysi")

SQL> create user ODIW identified by veysi;

Grant dba privile to user

SQL> grant dba to ODIW;

NOTE:  Now remember ODIM user for Master, ETL for System And ODIW user for Work user.


Open the ODI

Log in with Master Repository

Click New(+) and write requisites informations.
Log in Name: Whatever you want
SUPERVISOR:Supervısor and password did you give
USER:Master User(ODIM)
Drive list: Oracle jdbc Drive 
Drive Name: oracle.jdbc.OracleDriver (Connect Oracle  Host JDBC)
URL: Would you like to connect Database jdbc:oracle:thin:@ 

You can Test Your Connection and Click Ok 


Click Ok

Now its ready for doing Any job. Click Work Repository


You will see the Master Repository connection information. Click Next

Write ID between 1-998 and write name(whatever you want)  Choose Work repository Development and Click Finish


ODI is creating your work

Click Yes

Choose created work click Ok

 It Now Ready you can test it and click ok



Now have a nice work :)


ODI11g: Creating and Connecting to ODI Master Repository


Today I'll preset ODI Creating Master Repository, During My practice at OraTech i used to ODI
So what does it mean Repository? Repository is data center of ODI that keep all of works. We need a Master repository and "n" Work Repository before we have started.

Master Repository: Keep information of installation and Sources, Targets,Security and version. On every project should be at less one Master repository or sometime more than one.
        ETL: E-LT(Extract-Load & Transform ) Data  transformation and integration . Etl takes  data's from source system to Data warehouse. 


Step by Step creating Master Repository

1. Create prerequisite users..
Create “ETL” user and password. (for example”veysi”)

SQL> create user ETL identified by veysi;

Give ETL user DBA privilege.

SQL> grant dba to ETL;

Create “ODIM” user and password. (for example:”veysi”)

SQL> create user ODIM identified by veysi;

Give ODIM user DBA privilege

SQL> grant dba to ODIM;

So,Lets start. first keep going on path and run ./odi.sh




Its Opening


Click File>New

Choose Master Repository Creation and click OK

Technology: Default Oracle  (Master Repositori host)

JDBC Driver: oracle.jdbc.OracleDriver (Oracle connect to Host JDBC)

JDBC URL: jdbc:oracle:thin:@ (Connection to Oracle  database  Host,post and Sid information)
Note: Host and  sid could known by using V$instance parameter.

USER: ODIM (Master Repository  user)

Password: veysi (ODIM user password)

DBA USER: ETL (system user)

Password: veysi (ETL password)


NOTE: ID should be different with others  Master Repository ID

Click Test Connection and test your connection
So, Mine was successfully :)

Give Supervisor Password and click next

Choose Internal Password Storage and Click finish

Master Repository is creating, wait for a while :)

So that was Successful
Now You can login and create Any work Repository for projects.

Next Post is Work Repository just keep following ;)