A Oracle DBA's BLOG

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

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