Kamran Agayev's Oracle Blog

Oracle Certified Master

RMAN Video Tutorial Series – Convert database from Windows to Linux using RMAN

Posted by Kamran Agayev A. on August 20th, 2010

In this video tutorial I show the convertion of the database from Windows to Linux using CONVERT DATABASE command in RMAN. Enjoy it

To download the .mp4 version of this file, use the following link

http://www.kamranagayev.com/Video_Tutorials/RMAN_Convert_Database.mp4

Posted in RMAN Backup and Recovery, Video Tutorials | 44 Comments »

Oracle Flashback Data Archive (Total Recall)

Posted by Kamran Agayev A. on July 21st, 2010

Starting from Oracle 11g version, it’s possible to keep every transaction made to the table and keep it as long as you want. Before 11g, in order to get before image of any row, either we were getting it from archived redo log files (if they are kept) using Log Miner, or were writing a trigger to save the data in another log table. But now, using Flashback Data Archive feature, we don’t need to use Log Miner or trigger to track changes made to the table. The new background process, FBDA (Flashback Data Archive) tracks all changes made to the table and stores it in a file in a compressed and partitioned format. However, you can’t use this feature with clustered, temporary, nested, remote or external tables and LONG or nested columns

It tracks all transactional changes made to specific tables for the specific time interval. To use Flashback Data Archive feature the user needs to have the FLASHBACK ARCHIVE ADMINISTER system privilege. Moreover, the FLASHBACK ARCHIVE object privilege should be granted to the user to enable historical data tracking. In the following scenario we show you the configuration and usage of this feature in detailed examples

–          Create a new user and grant him the required privileges:

[sourcecode]

SQL> create user usr identified by usr;

User created.

SQL> grant connect, resource, flashback archive administer to usr;

Grant succeeded.

SQL>  [/sourcecode]

–          Create a new separate tablespace for data archive

[sourcecode]

SQL> CREATE TABLESPACE tbs_arch DATAFILE ‘c:\flashback_archive.dbf’ size 10m;

Tablespace created.

SQL> [/sourcecode]

–          Create flashback archive on this tablespace using CREATE FLASHBACK ARCHIVE command as follows:

[sourcecode] SQL> create flashback archive fl_archive

  2  tablespace tbs_arch retention 1 year;

Flashback archive created.

SQL> [/sourcecode]

With above command we’ve created a Flashback Archive named FL_ARCHIVE which resides in the tablespace TBS_ARCH and holds information for 1 year. It means that we can use any Flashback Query which contains 1 year historical information regarding the table that assigned to this flashback archive

–          Now, create a table, insert one row and assign it to this flashback archive:

[sourcecode] SQL> create table tbl_fl_archive (id number, name varchar2(20));

Table created.

SQL> insert into tbl_fl_archive values(1,’Flashback Archive’);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from tbl_fl_archive;

        ID NAME

———- ——————–

         1 Flashback Archive

SQL> alter table tbl_fl_archive flashback archive fl_archive;

Table altered.

SQL> [/sourcecode]

The historical change on the table TBL_FL_ARCHIVE is now will be written to the flashback archive named FL_ARCHIVE.

–          To test it, delete all rows and use Flashback Query on that table. Remember, it will not look for the UNDO data, it will look to the flashback archive file for the changes

[sourcecode] SQL> select to_char(sysdate,’ddmmyyyy hh24:mi:ss’) ddate from dual;

DDATE

—————–

13022010 12:46:49

SQL> delete from tbl_fl_archive;

1 row deleted.

SQL> commit;

Commit complete.

SQL> select * from tbl_fl_archive;

no rows selected

SQL> select * from tbl_fl_archive as of timestamp to_timestamp(‘13022010 12:46:49′,’ddmmyyyy hh24:mi:ss’);

        ID NAME

———- ——————–

         1 Flashback Archive

SQL>  [/sourcecode]

In order to show and proof that it doesn’t look to the UNDO tablespace for the historical information on the rows for the specific time, create new undo tablespace and make it default by dropping the old one. Then use Flashback Versions on that table:

[sourcecode] SQL> conn / as sysdba

Connected.

SQL> show parameter undo_tablespace;

NAME                                 TYPE        VALUE

——————— ———–    ———   ————

undo_tablespace                      string      UNDOTBS1

SQL> select a.name from v$datafile a, v$tablespace b where a.ts#=b.ts# and b.name=’UNDOTBS1′;

NAME

————————————————

C:\APP\ADMINISTRATOR\ORADATA\DB2\UNDOTBS01.DBF

SQL> create undo tablespace undotbs2 datafile ‘C:\APP\ADMINISTRATOR\ORADATA\DB2\UNDOTBS02.dbf’ size 10m;

Tablespace created.

SQL> alter system set undo_tablespace=’UNDOTBS2′;

System altered.

SQL> startup force

ORACLE instance started.

Total System Global Area  431038464 bytes

Fixed Size                  1333676 bytes

Variable Size             251659860 bytes

Database Buffers          171966464 bytes

Redo Buffers                6078464 bytes

Database mounted.

Database opened.

SQL> show parameter undo_tablespace;

NAME                                 TYPE        VALUE

—————————              ———– ————

undo_tablespace                      string      UNDOTBS2 [/sourcecode]

As you see, we’re currently using the different UNDO tablespace that hasn’t any information about before images of data blocks of the TBL_FL_ARCHIVE. Now, let’s use Flashback Query against to that table:

[sourcecode] SQL> conn us1/us1

Connected.

SQL> select * from tbl_fl_archive as of timestamp to_timestamp(‘13022010 12:45:30′,’ddmmyyyy hh24:mi:ss’);

        ID NAME

———- ——————–

         1 Flashback Archive

SQL>  [/sourcecode]

This query gets the data from Flashback Data Archive

Modify the Flashback Data Archive

 

Use ALTER FLASHBACK ARCHIVE command to change the retention time, purge data or add or remove the tablespace. For this you need to have FLASHBACK ARCHIVE ADMINISTER privilege granted.  

–          To change the retention time, use:

[sourcecode] SQL> alter flashback archive fl_archive modify retention 6 month;

Flashback archive altered.

SQL> [/sourcecode]

–          To change tablespace quota of the tablespace that is used by a flashback data archive, use:

[sourcecode] SQL> alter flashback archive fl_archive add tablespace tbs_arch quota 50m;

Flashback archive altered.

SQL> [/sourcecode]

–          To add another tablespace for flashback data archive, use:

[sourcecode] SQL> create tablespace tbs_arch2 datafile ‘c:\flashback_archive2.dbf’ size 10m;

Tablespace created.

SQL> alter flashback archive fl_archive add tablespace tbs_arch2 quota 10m;

Flashback archive altered.

SQL> [/sourcecode]

–          To remove the tablespace from use by flashback data archive, use:

[sourcecode] SQL> alter flashback archive fl_archive remove tablespace tbs_arch2;

Flashback archive altered.

SQL> [/sourcecode]

–          To purge the data that’s in Flashback Data Archive, use PURGE BEFORE SCN (TIMESTAMP) or PURGE ALL as follows:

[sourcecode] SQL> ALTER FLASHBACK ARCHIVE fl_archive PURGE ALL;

Flashback archive altered.

SQL> ALTER FLASHBACK ARCHIVE fl_archive purge before timestamp to_timestamp(‘13022010 12:49:30′,’ddmmyyyy hh24:mi:ss’);

Flashback archive altered.

SQL> ALTER FLASHBACK ARCHIVE fl_archive purge before scn 988827;

Flashback archive altered.

SQL> [/sourcecode]

Dropping Flashback Data Archive

 

To drop flashback data archive use:

[sourcecode] SQL> drop flashback archive fl_archive;

Flashback archive dropped.

SQL> [/sourcecode]

Using default Flashback Data Archive for the system

 

As default, Oracle doesn’t use any flashback data archive. To set default flashback data archive, use the following command by connecting as SYS user:

[sourcecode] SQL> conn / as sysdba

Connected.

SQL> alter flashback archive fl_arc set default;

Flashback archive altered.

SQL> [/sourcecode]

By setting default flashback data archive, you will not need to specify it manually on each table you want to keep changes

To disable flashback archive for a table, use:

 

[sourcecode] SQL> alter table tbl_fl_archive no flashback archive;

Table altered.

SQL> [/sourcecode]

Query Flashback Data Archive

 

There’re mainly three views that are used to query the information regarding Flashback Data Archive.

The first view is DBA_FLASHBACK_ARCHIVE which gives information about Flashback Data Archive files

[sourcecode] SQL> select * from dba_flashback_archive;

FLASHBACK_ARCHIVE_NAME FLASHBACK_ARCHIVE# RETENTION_IN_DAYS CREATE_TIME

LAST_PURGE_TIME     

—————      ————–             ————  ———-

FL_ARCH                       2                 365           13-FEB-10

08.05.14.000000000 PM                    13-FEB-10 08.05.14.000000000 PM  [/sourcecode]

The second view is DBA_FLASHBACK_ARCHIVE_TS which gives information about tablespace that contains flashback data archives:

[sourcecode] SQL> select * from dba_flashback_archive_ts;

FLASHBACK_ARCHIVE_NAME       FLASHBACK_ARCHIVE#  TABLESPACE_NAME QUOTA_IN_MB

——————     —————–   ————-    ———-

FL_ARCH                        2                TBS_ARCH        FL_ARC [/sourcecode]

The third view is FLASHBACK_ARCHIVE_TABLES which displays the information of the tables that uses Flashback Data Archive:

[sourcecode] SQL> select * from dba_flashback_archive_tables;

TABLE_NAME    OWNER_NAME    FLASHBACK_ARCHIVE_NAME   ARCHIVE_TABLE_NAME

———-    ———-    ———————-   ——————

TBL_FL_ARCHIVE  US1        FL_ARC               SYS_FBA_HIST_69845 [/sourcecode]

As it was told above, Flashback Data Archie technology stores data in Compressed and Partitioned format. It should be checked easily. Get the name of the main table that’s used to store the data and query USER_TAB_PARTITIONS view as follows:

[sourcecode] SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME                     TABLESPACE_NAME

—————————— ——————————

SYS_FBA_HIST_69845

SYS_FBA_TCRV_69845             TBS_ARCH

SYS_FBA_DDL_COLMAP_69845       TBS_ARCH

TBL_FL_ARCHIVE                 USERS

SQL> select table_name, partition_name, compression, compress_for from user_tab_partitions where table_name=’SYS_FBA_HIST_69845′;

TABLE_NAME                     PARTITION_NAME                 COMPRESS

—————-           ————–                 ———

SYS_FBA_HIST_69845             HIGH_PART                      ENABLED 

SQL> [/sourcecode]

Posted in RMAN Backup and Recovery | 15 Comments »

RMAN Video Tutorial Series – Creating Duplicate and Standby database using RMAN

Posted by Kamran Agayev A. on June 25th, 2010

In this video tutorial I show creation of duplicate and standby database using RMAN. Enjoy it

 

To download the .mp4 version of this file, use the following link

http://www.kamranagayev.com/Video_Tutorials/Duplicate_and_Standby_database_with_RMAN.mp4

Posted in RMAN Backup and Recovery | 36 Comments »

Exclusive Interview with Uwe Hesse

Posted by Kamran Agayev A. on June 15th, 2010

 Uwe Hesse is an Oracle Certified Master (Database Administration 10g) and also Oracle Certified Professional (Database Administration versions 9i, 10g and 11g). In 2009, he got elected to the Oracle Leadership Circle, an internal award for the best Oracle Instructors from around the globe

Could u please provide answer to the following questions as follows:

  • Brief information about yourself and your family

I’m living in the west of Germany (near the Dutch boarder) together with my wife Mitra and our little daughter Donya. I was born in Bremerhaven, Mitra immigrated from Iran, where she was born in the north, near Azerbaidjan.

  • Your education

After my High School Diploma (“Abitur”), I had an education as Management Assistant in Informatics (“Datenverarbeitungskaufmann”).  Several years of work in the IT-Business followed, since 2000 employed at Oracle Corporation. Got a Masters Degree (MSc) in Management (Master Thesis in the Business Informatics area) from the Distance University (“FernUniversität”) in Hagen. Still studying there for my second Masters Degree (MA) in Education & Media

 

  • Your experience with Oracle. When you started first? Has it been interest of your side or just a coincidence?

I met my first Oracle Database (version 7.3.4) back in 1998, when I got employed at an Unilever daughter as mainly Developer (“Organisationsprogrammierer”) with the additional task to maintain the couple of Oracle Databases in place there. So it was rather incidentally.

  • What was the motive behind to prefer Oracle? Who you have been influenced by?

As I said, it was incidentally. If you don’t count dBase & Clipper, my first serious database was Oracle – if it would have been DB2, I would now be an IBM instructor, probably :-)

 

  • What would your preference of profession if not Oracle?

That is meanwhile a little hard to imagine, but probably I would be a teacher in some other area, because this something that I really love to do.

  • What motivates you in your job?

I really enjoy teaching, especially if I can tell by feedback and observation, that my students do indeed benefit from it! It is much rewarding when I get in contact with a new audience and spot a familiar face from an earlier course – and the guy liked that former course.

 

  • Do you give lectures on Oracle?

Yes, obviously. It’s what I do for a living.

  • Have you authored any book in Oracle?

Yes, my Master Thesis about Oracle Database High Availability. It is going to be published soon, but only available in German language.

 

  • Do you manage with your time as to read books on Oracle? What is the name of the book that you read recently?

I do not read that many books anymore about Oracle to be honest. A very good one that I can recommend is the Oracle Data Guard 11g Handbook by Larry Carpenter et al.

  

  • What do you think on OTN forums?

A very useful place to go and spend some time if you are interested in Oracle Technologie. I am a regular visitor.

  • Do you refer to the documentation? And how often does it happen?

All the time! It is very good and a must read for anyone, responsible for Oracle Technology.

  

  • What is the biggest mistake you have ever made during your DBA career?

I make no mistakes, of course. At least, I cannot remember :-)

 

  • What was your greatest achivement as an Oracle DBA?

That is the OCM degree – still proud of it.

  • What is you priority to manage the challenges you face?

My priority is always to deliver high quality courses, and I try to manage that with thoroughly preparation in technical & didactical respect.

  

  • How would you describe the essence of your success? According to your definition of success, how successful have you been so far?

I am successful if students benefit from my courses. Fortunately, we always get a feedback after the course – and I can tell you that my overall average score is well above 90 %. Based on these ratings & manager decision, we have an internal award at Oracle University: The “Leadership Circle” is granted to the best instructors in a worldwide quarterly election. In 2009, I was elected to it. This year, I got promoted to Senior Principal Instructor. That is the corporate international career level 5. It goes: IC1 (Junior instructor), IC2 (Staff Instructor), IC3 (Senior Instructor), IC4 (Prinicpal Instructor), then IC5. No higher level available, so I was as successful as I could possibly be :-) My next target should be Vice President now (kidding).

 

  • What are your best skills which make you differ from others?

I think I have kind of a talent to explain things in a clear & understandable manner and to spot the point of a technical matter. Many have great technical insight (OK, much more haven’t even), but few can explain what they know about complex technological things to others. Students don’t care much that you are an expert (even OCM) if they don’t understand what you are trying to tell them.

  • What’s your major weakness?

A tendency to perfectionism. If you ask my wife: Spending too much time with Oracle :-)

  • Have you ever lost your spirit? If so, what has been the reason and how have you overcome it?

Fortunately not. Still very happy with my life & job!

  • What is the next success you would like to attain and your efforts to this end?

Next achievement will hopefully be my MA degree. If everything runs smoothly, I may even go for a PhD

 

  • How do you balance your daily life with your career?

I try to spend as much time with my family as I can. That is sometimes difficult, because I am often abroad for a week, teaching.

 

  • Please describe your one day summary of activities?

Course day: Teaching the whole day. Else: Preparing the whole day for the next course, studying (new) Oracle Technology.

 

  • How many hours do you work and sleep in a day?

A usual work day starts at about 8 AM and ends at about 6 PM. I need about 7 hours of sleep a day.

  • Where and how do you spend your daily, weekly and annual holidays?

That is very different. But we do visit Mitra’s family in Iran about once in 2 years regularly.

  • Do you think about Oracle during vacations?

Yes, I do, but only occasionally. Checking my emails from time to time, i.e.

  

  • Do you have time or motivation to go in for any sports? If yes, which kind of sport do you go in for?

I try to go to the gym regularly. Played some tennis and badminton, but I can’t find the time for it recently. I was a great chess addicted, when I was young :-)

  

  • What’s your favorite meal and non-alcoholic drink?

Pizza! Does beer count as non-alcoholic?

  • What foreign languages do you know?

English (good enough to teach courses with), French (did not use it since I left High School), Farsi (just a couple of words)

  • What’s your average typing speed?

Too slow!

  • Have you ever get involved in politics?

No. I am a regular voter, though.

  • What are your hobbies? 

I’d love to find some time to play tennis again. When I retire, I will continue to play chess.

 

  • How do you spend your free time?

Strolling around with family, playing with Donya, visiting other family members

  • What’s your biggest ambition?

Think I am not so ambitious…

  • What would be your advice to the beginners in Oracle?

Go and visit an Oracle Database Administration Workshop from Oracle University at first to get a good foundation. Then practice a lot and try to keep in touch with new developments – which is by no means easy, because we develop new things at a high speed!

  • Would you like your children to follow in your footsteps or take a different path in life?

Donya will find her own way in life. I doubt that she will also become an Oracle Instructor – maybe she will become a doctor like her mother. But who knows?

  • Do you have any followers of you?

I do hope that the things a try to teach have an impact to some degree – but I would not be so immodest to call that “following”.

  

  • What is your vision on the future of Oracle?

I think the Corporation is still going strong and I don’t see why this should change in the near future.

 

Posted in Administration | 7 Comments »

Getting "ORA-01031: insufficient privileges" error with being granted a DBA role

Posted by Kamran Agayev A. on June 11th, 2010

Sometimes, you can get ORA-01031: insufficient privileges error while querying a table even if you have been granted a DBA role. Look at the following demonstration

Create a user USR1 with CONNECT and RESOURCE roles

[sourcecode]
SQL> create user usr1 identified by usr1;
User created.

SQL> grant connect, resource to usr1;
Grant succeeded.
[/sourcecode]

Create a table with USR1 user

[sourcecode]
SQL> conn usr1/usr1
Connected.

SQL> create table tbl_usr1 (id number);
Table created.
[/sourcecode]

Create the second user with DBA role

[sourcecode]
SQL> conn / as sysdba
Connected.

SQL> grant dba to usr2 identified by usr2;
Grant succeeded.
[/sourcecode]

Connect with the second user and try to truncate the table. You’ll success, because you’ve DBA role!

[sourcecode]
SQL> conn usr2/usr2
Connected.

SQL> truncate table usr1.tbl_usr1;
Table truncated.
[/sourcecode]

Now create a procedure and try to truncate the same table from procedure using dynamic sql

[sourcecode]
SQL> create or replace procedure my_proc
2 is
3 begin
4 execute immediate ‘truncate table usr1.tbl_usr1’;
5 end;
6 /

Procedure created.

SQL> execute my_proc;
BEGIN my_proc; END;

*
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "USR2.MY_PROC", line 4
ORA-06512: at line 1
[/sourcecode]

Upps.. We got an error. Although we have a DBA role granted, we need to explitily grant SELECT privilege to the user to access the table inside a procedure:

[sourcecode]
SQL> show user
USER is "USR2"
SQL> select * from usr1.tbl_usr1;

no rows selected

SQL> conn usr1/usr1
Connected.
SQL> grant select on tbl_usr1 to usr2;

Grant succeeded.

SQL> conn usr2/usr2
Connected.
[/sourcecode]

Let’s try to truncate the table again:

[sourcecode]
SQL> execute my_proc;
BEGIN my_proc; END;

*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "USR2.MY_PROC", line 4
ORA-06512: at line 1
[/sourcecode]

Now we got a different error. Although we have DBA role, we cannot truncate the table from procedure. For this, we need to explitily grant DROP ANY TABLE privilege to the user:

[sourcecode]
SQL> conn / as sysdba
Connected.

SQL> grant drop any table to usr2;
Grant succeeded.

SQL> conn usr2/usr2
Connected.

SQL> execute my_proc;
PL/SQL procedure successfully completed.

SQL>
[/sourcecode]

As you see, we’ve succeeded. It means that to be able to perform operations in a procedure, we need to be granted those privileges directl

Posted in Administration | 1 Comment »

I'm an Oracle ACE :)

Posted by Kamran Agayev A. on June 7th, 2010

 

  Last month (on May 3, 2010) I got a call from one of my best friend, reviewer of my RMAN book and a man who nominated me for the ACE award – Syed Sabdar Hussain – that I was awarded an Oracle ACE title. I can proudly announce that I’m the first and the only Oracle ACE in my country, Azerbaijan :)

You can view my ACE profile from the following address:

http://apex.oracle.com/pls/otn/f?p=19297:4:2391572447992081::NO:4:P4_ID:2080

Posted in Administration | 15 Comments »

Exclusive Interview with Syed Sabdar Hussain

Posted by Kamran Agayev A. on May 31st, 2010

  Sabdar Syed is an Oracle ACE, Oracle Certified Professional (8i, 9i & 10g), Oracle Certified Expert (10g RAC), and Oracle 11i E-Business Certified Professional with over 8 years of experience in Oracle Database and Oracle Applications Administration with strong Unix/Linux administration skills. He’s currently working as an Oracle Database Administrator for a first bank, Saudi Hollandi Bank, in Kingdom of Saudi Arabia, (Riyadh). He has extensive experience with Oracle Database 11g, 10g, 9i, & 8i , Oracle 10g RAC, and Oracle E-Business Suite 11i, Specializing in Installing, Configuring, Administering, Cloning, Patching, Upgrading and Migrating, and troubleshooting of Oracle Database 11g, 10g, 9i, & 8i , Oracle 10g RAC, and Oracle E-Business Suite 11i on different UNIX and Linux OS including Solaris, HP-Unix, IBM AIX and Red Hat. Good exposure in implementing backup & recovery strategies and implementing high-availability solutions (Real Application Clusters (RAC), Data Guard (Standby)).He has written and published a couple of articles on Oracle Metalink Customer Knowledge Exchange.

He owns his blog ( http://sabdarsyed.blogspot.com ) where he discusses the issues that he faced and resolved, and also the topics he tested or implemented. 

Could u please provide answer to the following questions as follows:

  • Brief information about yourself and your family

 I am Syed Sabdar Hussain, an Indian national currently working for Saudi Hollandi Bank, K.S.A.  I have 3 brothers and a sister and I am married person and have one son. My wife is Rozina and my son is Rayyan (2 years old).

  • Your education

I have done my graduation in Bachelor of Computer Sciences i.e B.Sc (Computers)

 

  • Your experience with Oracle. When you started first? Has it been interest of your side or just a coincidence?

 I started using and practicing Oracle SQL & PL/SQL from my graduation in the year 1999-2000. When I completed my graduation, I got trained in Oracle 8i DBA Administration in the year 2001. Then, I started working as Oracle DBA since 2002.

  • What was the motive behind to prefer Oracle? Who you have been influenced by?

My elder brother, Mr. Syed Jaffar Hussain, who was already interviewed in your blog, is my motivator and mentor. He preferred me to choose my career in Oracle Technologies, and also he taught me many core techniques in Oracle DBA. I always follow his footsteps. He is not only a motivator to me but also he is a motivator for many other DBAs too.

 

  • What would your preference of profession if not Oracle?

If not an Oracle DBA, then I would have been a programmer or developer

  • What motivates you in your job?

My ability to work hard and deliver results, and reorganization and appreciation at the work motivates me.  My past experience motivates me to become DBA from Junior to Senior Level.

 

  • Do you give lectures on Oracle?

 No, but I do give internal technical presentations in the company and do train Junior DBAs. I’m sure that I will be prepared for open lectures on Oracle in near future when the opportunity comes.

  • Have you authored any book in Oracle?

 I’m currently reviewing the book “Oracle Backup & Recovery: Expert secrets for using RMAN and Data Pump” for Rampant Techpress. And, I helped my elder brother by reviewing the chapters and testing the scenarios he prepared for his upcoming book “Oracle 11g R1 / R2 Real Application Clusters Handbook”. And looking forward to review other Oracle books and write a book on my own in Oracle Technologies in near future.

  

  • Do you manage with your time as to read books on Oracle? What is the name of the book that you read recently?

 Whenever possible I do read Online Oracle Documentations, Oracle ILT (Instructor Led Training) materials, and Oracle Books. Following are the few books which I’m currently referring:

“Oracle Database 10g Performance Tuning Tips & Techniques”

“Oracle Automatic Storage Management: Under-the-Hood & Practical Deployment Guide”

“Pro Oracle Database 10g RAC on Linux: Installation, Administration, and Performance”

“Oracle Data Guard 11g Handbook”

  • What do you think on OTN forums?

OTN Forum is a great and wonderful technical forum and one and only place for every DBA to join and get the answers for their questions and clear their doubts from the top experts in Oracle. I’m also a member of OTN and myself asked many questions and answered to the other DBA questions in OTN forums. I would strongly recommend every novice and junior DBAs to keep follow the OTN forums to gain the great real knowledge shared by the experts.

  • Do you refer to the documentation? And how often does it happen?

Of course and I regularly refer the Oracle Documentations, my first and foremost source would be Oracle Documentation to get the concepts clear, and definitely documentation is a key for every Oracle Professional. I would prefer to read ILT materials as well, as these ILT chapters and concepts are refined and prepared from the vast Oracle Decimations.

  • What is the biggest mistake you have ever made during your DBA career?

As long as I remember, I have never done such mistake in my DBA career which causes bigger problem.  Sometimes, I do commit silly mistakes which can be negligible; well after all we are human beings :) 

 

  • What was your greatest achievement as an Oracle DBA?

 Implanted Oracle 10g R2 RAC on Two Nodes, Upgraded and migrated critical banking database (2TB) from 9i to 10g, Converted single-instance to RAC Database using RCONFIG in with nominal downtime, Converted large Data Warehouse Databases from non-ASM to  ASM, Performed Cross Platform Database Migration, Implemented Physical Standby Database, etc.

  • What is your priority to manage the challenges you face?

 First understanding the issue or challenge, and prepare myself to resolve the issue with all the possibilities I know, or discussing with the team members or contacting with Oracle Support  to get their ideas to approach the solution, i.e. no question of giving up the challenges to face.

 

  • How would you describe the essence of your success? According to your definition of success, how successful have you been so far?

Confidence, dedication and hard work are few essences of my success; these helped me a lot to be in this position today.

 

  • What are your best skills which make you differ from others?

Sharing the knowledge and help others in resolving the problems

 

  • What’s your major weakness?

Being transparent and being calm sometimes

 

  • Have you ever lost your spirit? If so, what has been the reason and how have you overcome it?

Have no such known. But sometimes discourage and criticism make us feel loosing spirit. But no issue, after all we are humans, we need to think positive and need to know what we are, and get going. Never feel happy when someone appreciate your work and never feel bad or loose your spirit when someone discourage or criticize. So, believe in always of what you do.

 

  • What is the next success you would like to attain and your efforts to this end?

My next goal or success is to become an Oracle Certified Master; I’m gearing up for it, and will appear for this exam by the end of this year or the beginning of the next year. But, I have to undergo two Oracle Training courses to eligible for writing this exam.

 

  • How do you balance your daily life with your career?

Not so easy to balance the personal life with professional life. All the time I’m on demand and should available for weekend activities in the bank. Due to this, sometimes, I don’t find enough time to spend with family, but I will surely fulfill the promises right after my busy schedules.

 

  • Please describe your one day summary of activities?

Wake up by 7 am and get ready, take breakfast and go to the office by 8 am, 1 hr for lunch in the after noon, return to home by 6 pm from the office, rest of the time spent at home by playing with my son, watching TV news channels for sometime, working on laptop and using internet for sometime, having dinner with family members together, and usually will go to bed by 12 in the night. It’s like machinery life throughout the week.

 

  • How many hours do you work and sleep in a day?

I work for 9-10 hours and sleep for 6 hours a day.

  • Where and how do you spend your daily, weekly and annual holidays?

During weekends with friends and colleagues, and definitely annual holidays with parents back in India.

  • Do you think about Oracle during vacations?

No

  • Do you have time or motivation to go in for any sports? If yes, which kind of sport do you go in for?

 Now a days NO, but I used to play cricket during my college days.

  • What’s your favorite meal and non-alcoholic drink?

 Chicken and Mutton biriyani (rice with spice) prepared in Hyderabadi style with Pepsi or Coke

  • What foreign languages do you know?

 A little bit of Arabic language, and Indian languages – Telugu & Hindi and little bit of Kannada.

  • What’s your average typing speed?

 Not too fast and not too slow, just average :)

  • Have you ever get involved in politics?

 Never but like to read and know about politics.

  • What are your hobbies? 

 Watching comedy movies, reading news papers, playing video games etc

 

  • How do you spend your free time?

Watching movies, TV and sparing sometime with friends and chit chat with them

  • What’s your biggest ambition?

 My ambition is to acquire the most elite position and to attain senior level in Oracle field. And, of course, to join and extend my support to my elder brother in his future establishing company

  • What would be your advice to the beginners in Oracle?

 I would suggest and advice the beginners in Oracle to join OTN Forums and other Oracle Forums, do practice all the DBA scenarios on different OS including Unix/Linux, prepare for Oracle Certifications, make a habit of referring Oracle Documentations/books/blogs., etc.

  • Would you like your children to follow in your footsteps or take a different path in life?

 I will wish them to choose their own path which would definitely better for them.

  • Do you have any followers of you?

 Yes, my followers are from my family, friends, and my blog viewers.

  • What is your vision on the future of Oracle?

 Oracle has already come up with consolidate, compress and control in the latest version 11g R2 in the market.  But still I would like to see Oracle is to be more integrated technology and complete solution for all the worlds business needs. i.e. All-in-One/one place for everything.

  • Could you please take a photo in your office near to your desktop?

 

Posted in Expert Interviews | 7 Comments »

RMAN Data Recovery Advisor in Oracle 11g – scenario based explanation

Posted by Kamran Agayev A. on May 21st, 2010

One of the great new features of RMAN in Oracle 11g is the new tool named Data Recovery Advisor. This tool automates the diagnose of the data failure and corruption, advises the recovery steps and performs automatic recovery of the database failure.  This tool could be used from GUI as well as from CLI.

In the following scenario we’ll use Data Recovery Advisor to recover the lost data

–          We have three tablespaces (USERS, USERS02, USERS03)

–          We create two tables on two tablespaces (tbl_test01 on USERS and tbl_test02 on USERS02)

–          We corrupt the datafiles of USERS and USERS02 tablespace and delete the USERS03 datafile

–          Using LIST FAILURE command we see list three data failure (two data block corruption and one missing datafile)

–          We get advice for all these problems and manually restore the third datafile and recover it

–          We use REPAIR FAILURE command to make RMAN automatically repair the data block corruption

Let’s start performing the above scenario

–          Create two new tablespaces (USERS02, USER03) and create two tables on USERS and USERS02 tablespaces.

[sourcecode] SQL> create tablespace users02 datafile ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS02.DBF’ size 1m;

Tablespace created.

SQL> create tablespace users03 datafile ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS03.DBF’ size 1m;

Tablespace created.

SQL> create table tbl_test01 (name varchar2(10)) tablespace users;

Table created.

SQL> create table tbl_test02 (name varchar2(10)) tablespace users02;

Table created.

SQL> insert into tbl_test01 values(‘my_test01’);

1 row created.

SQL> insert into tbl_test02 values(‘my_test02’);

1 row created.

SQL> commit;

Commit complete.

SQL>

[/sourcecode]

–          Take backup of the database

[sourcecode] RMAN> backup database plus archivelog; [/sourcecode]

–          Corrupt the datafiles using techniques that are described in the Performing Block Media Recovery with RMAN video tutorial. Then flush the buffer cache and query the table. You’ll get “ORA-01578: ORACLE data block corrupted” error. Query the V$DATABASE_BLOCK_CORRUPTION view. You can get an empty result, however after a while Oracle automatically detects and updates the view. Then shutdown the database, delete the datafile that belongs to the USERS03 tablespace, mount the database and use ALTER DATABASE DATAFILE ‘path_of_the_users03.dbf’ OFFLINE; command to make it offline and start the database:

[sourcecode]

SQL> alter system flush buffer_cache;

System altered.

SQL> select * from tbl_test01;

select * from tbl_test01

              *

ERROR at line 1:

ORA-01578: ORACLE data block corrupted (file # 4, block # 72)

ORA-01110: data file 4: ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS01.DBF’

SQL> alter system flush buffer_cache;

System altered.

SQL> select * from tbl_test02;

select * from tbl_test02

              *

ERROR at line 1:

ORA-01578: ORACLE data block corrupted (file # 5, block # 16)

ORA-01110: data file 5: ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS02.DBF’

SQL> select * from v$database_block_corruption;

no rows selected

[/sourcecode]

Wait a while and run the command again:

[sourcecode]

SQL> select * from v$database_block_corruption;

     FILE#     BLOCK#     BLOCKS CORRUPTION_CHANGE# CORRUPTIO

———- ———- ———- —————— ———

         4         72          1                  0 CHECKSUM

         5         16          1                  0 CHECKSUM

SQL> shut abort

SQL> startup mount;

SQL> alter database datafile ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS03.DBF’ offline;

Database altered.

SQL> alter database open;

Database altered.

SQL>

[/sourcecode]

–          Now use LIST FAILURE command to let RMAN gather the data failures you have:

[sourcecode] C:\>rman target /

RMAN> list failure;

using target database control file instead of recovery catalog

List of Database Failures

=========================

Failure ID Priority Status    Time Detected Summary

———- ——– ——— ————- ——-

328        HIGH     OPEN      20-MAY-10     One or more non-system datafiles are  missing

308        HIGH     OPEN      20-MAY-10     Datafile 5: ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS02.DBF’ contains one or more corrupt blocks

122        HIGH     OPEN      20-MAY-10     Datafile 4: ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS01.DBF’ contains one or more corrupt blocks

You can get detailed information on any listed failure:

RMAN> list failure 328 detail;

List of Database Failures

=========================

Failure ID Priority Status    Time Detected Summary

———- ——– ——— ————- ——-

328        HIGH     OPEN      20-MAY-10     One or more non-system datafiles are

 missing

  Impact: See impact for individual child failures

  List of child failures for parent failure ID 328

  Failure ID Priority Status    Time Detected Summary

  ———- ——– ——— ————- ——-

  331        HIGH     OPEN      20-MAY-10     Datafile 6: ‘C:\APP\ADMINISTRATOR\ORADATA\TT\USERS03.DBF’ is missing

    Impact: Some objects in tablespace USERS03 might be unavailable

–          Now use ADVISE FAILURE command to get necessary advises and ready scripts to perform a recovery

RMAN> advise failure all;

List of Database Failures

=========================

Failure ID Priority Status    Time Detected Summary

———- ——– ——— ————- ——-

328        HIGH     OPEN      20-MAY-10     One or more non-system datafiles ar

 missing

308        HIGH     OPEN      20-MAY-10     Datafile 5: ‘C:\APP\ADMINISTRATOR\O

ADATA\TT\USERS02.DBF’ contains one or more corrupt blocks

122        HIGH     OPEN      20-MAY-10     Datafile 4: ‘C:\APP\ADMINISTRATOR\O

ADATA\TT\USERS01.DBF’ contains one or more corrupt blocks

analyzing automatic repair options; this may take some time

using channel ORA_DISK_1

analyzing automatic repair options complete

Mandatory Manual Actions

========================

no manual actions available

Optional Manual Actions

=======================

1. If file C:\APP\ADMINISTRATOR\ORADATA\TT\USERS03.DBF was unintentionally renaed or moved, restore it

Automated Repair Options

========================

Option Repair Description

—— ——————

1      Restore and recover datafile 6; Perform block media recovery of block 16 in file 5; Perform block media recovery of block 72 in file 4

  Strategy: The repair includes complete media recovery with no data loss

  Repair script: c:\app\administrator\diag\rdbms\tt\tt\hm\reco_3231280737.hm

RMAN>

[/sourcecode]

So we have a detailed information on what we have and how we can perform a recovery. We need to restore and recover the datafile 6 and perform block media recovery on datafile 4 and 5. RMAN created a script which could be run to perform the whole recovery. Here’s the source of the script:

[sourcecode]

   # restore and recover datafile

   sql ‘alter database datafile 6 offline’;

   restore datafile 6;

   recover datafile 6;

   sql ‘alter database datafile 6 online’;

   # block media recovery

   recover datafile 5 block 16

   datafile 4 block 72;

[/sourcecode]

Let’s perform the first action manually. So run the following commands in RMAN

[sourcecode] RMAN>    sql ‘alter database datafile 6 offline’;

RMAN>    restore datafile 6;

RMAN>    recover datafile 6;

RMAN>    sql ‘alter database datafile 6 online’;

Now use ADVISE FAILURE command again.  It will diagnose the failures and update the result:

RMAN> advise failure all;

List of Database Failures

=========================

Failure ID Priority Status    Time Detected Summary

———- ——– ——— ————- ——-

308        HIGH     OPEN      20-MAY-10     Datafile 5: ‘C:\APP\ADMINISTRATOR\OR

ADATA\TT\USERS02.DBF’ contains one or more corrupt blocks

122        HIGH     OPEN      20-MAY-10     Datafile 4: ‘C:\APP\ADMINISTRATOR\OR

ADATA\TT\USERS01.DBF’ contains one or more corrupt blocks

analyzing automatic repair options; this may take some time

using channel ORA_DISK_1

analyzing automatic repair options complete

Mandatory Manual Actions

========================

no manual actions available

Optional Manual Actions

=======================

no manual actions available

Automated Repair Options

========================

Option Repair Description

—— ——————

1      Perform block media recovery of block 16 in file 5; Perform block media recovery of block 72 in file 4

  Strategy: The repair includes complete media recovery with no data loss

  Repair script: c:\app\administrator\diag\rdbms\tt\tt\hm\reco_1778061078.hm

[/sourcecode]

–          Now let’s preview the repair plan of RMAN and repair all data. For this, use REPAIR FAILURE PREVIEW command and REPAIR FAILURE as follows:

[sourcecode]

RMAN> repair failure preview;

Strategy: The repair includes complete media recovery with no data loss

Repair script: c:\app\administrator\diag\rdbms\tt\tt\hm\reco_1778061078.hm

contents of repair script:

   # block media recovery

   recover datafile 5 block 16

   datafile 4 block 72;

RMAN> repair failure;

Strategy: The repair includes complete media recovery with no data loss

Repair script: c:\app\administrator\diag\rdbms\tt\tt\hm\reco_1778061078.hm

contents of repair script:

   # block media recovery

   recover datafile 5 block 16

   datafile 4 block 72;

Do you really want to execute the above repair (enter YES or NO)? YES

executing repair script

Starting recover at 20-MAY-10

using channel ORA_DISK_1

channel ORA_DISK_1: restoring block(s)

channel ORA_DISK_1: specifying block(s) to restore from backup set

restoring blocks of datafile 00005

restoring blocks of datafile 00004

<…output trimmed ….>

<…output trimmed ….>

starting media recovery

media recovery complete, elapsed time: 00:00:07

Finished recover at 20-MAY-10

repair failure complete

RMAN>

[/sourcecode]

–          Now query the tables:

[sourcecode]

SQL> select * from tbl_test01;

NAME

———-

my_test01

SQL> select * from tbl_test02;

NAME

———-

my_test02

SQL>

[/sourcecode]

Posted in Administration, RMAN Backup and Recovery | 7 Comments »

Video Tutorial – Installing OEL and Oracle 10gR2

Posted by Kamran Agayev A. on April 25th, 2010

In this video tutorial I demonstrate the installation of OEL (Oracle Enterprise Linux) and Oracle Database 10gR2 on the virtual machine

 

To download the .mp4 format of the video tutorial, use the following link:

http://www.kamranagayev.com/Video_Tutorials/OEL_installation.mp4

Posted in Video Tutorials | 38 Comments »

Starting review the book "Oracle Database 11g – Underground Advice for Database Administrators" for Packt Publishing

Posted by Kamran Agayev A. on April 24th, 2010

Today I’ve got an e-mail from Packt Publishing asking me to review the book “Oracle Database 11g – Underground Advice for Database Administrators” for April Sims

It’s an honour for me to review the mentioned book. The book consists of eight chapters and near 350 pages. I hope I will finish the review for the next month and will post my opinions for each chapter of the book

Posted in Administration | 2 Comments »