Tuesday, May 26, 2009

DataGuard - Step by Step

1. Intro

Oracle9i Data Guard provides an extensive set of data protection and disaster recovery features to help you to survive disasters, human errors, and corruptions that can incapacitate a database. Based on business requirements, these features can be advantageously combined with other Oracle9i high-availability and disaster recovery features for enhanced levels of high availability and disaster protection.

Oracle9i Data Guard is the management, monitoring, and automation software that works with a production database and one or more standby databases to protect your data against failures, errors, and corruptions that might otherwise destroy your database. It protects critical data by automating the creation, management, and monitoring of the databases and other components in a Data Guard configuration. It automates the otherwise manual process of maintaining a transactional consistent copy of an Oracle production database, called a standby database, that can be used if the production database is taken offline for routine maintenance or becomes damaged.

In a Data Guard configuration, a production database is referred to as a primary database. Using a backup copy of the primary database, you can create from one to nine physical and logical standby databases and incorporate them in a Data Guard configuration. Primary and standby databases can be running on a single node or in a Real Application Clusters environment. Every standby database is associated with only one primary database. However, a single primary database can support multiple physical standby databases, logical standby databases, or a mix of both in the same configuration:

Physical standby databases A physical standby database is physically identical to the primary database, with on-disk database structures that are identical to the primary database on a block-for-block basis. The physical standby database is updated by performing recovery. It can either be recovering data or open for read-only reporting.

Logical standby databases A logical standby database is logically identical to the primary database. The logical standby database is updated using SQL statements. The tables in a logical standby database can be used simultaneously for recovery and for other tasks such as reporting, summations, and queries.

2. Implementation:

2.1 Checking Force Logging:

This check need to be done on both databases i.e. (SID01 & SID02)

SQL> select force_logging from v$database;

If the result of above command shows “NO” then we need run following command.

2.2. Enable Force Logging:

SQL> alter database force logging;

2.3 Checking Archive log mode:

Both databases have to be in Archive Mode. If they are NOT we have to enable Archive mode.

Checking Archive Mode:

SQL> archive log list

Database log mode Archive Mode

Automatic archival Enable

Archive destination /opt/oracle/archive/SID01

Oldest online log sequence 2386

Current log sequence 2388

If you get “Database log mode NO ARCHIVE MODE” it means you have to do following steps to convert it in ARCHIVE MODE.

If your database is already in ARCHIVE MODE skip the following step.

Enabling Archive Mode:

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1=’LOCATION=’SCOPE=BOTH;

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1=ENABLE SCOPE=BOTH;

SQL> ALTER SYSTEM SET LOG_ARCHIVE_FORMAT =’’ SCOPE= SPFILE;

SQL> ALTER SYSTEM SET LOG_ARCHIVE_START= TRUE SCOPE=SPFILE;

SQL> ALTER SYSTEM SET DG_BROKER_START= TRUE SCOPE=BOTH;

SQL> SHUTDOWN IMMEDIATE;

SQL> STARTUP MOUNT;

SQL> ALTER DATABASE ARCHIVELOG;

SQL> ALTER DATABASE OPEN;

SQL> ARCHIVE LOG LIST;



2.4 Creating RMAN base backup:

SID01:

{

allocate channel canal01 type disk ;

allocate channel canal02 type disk ;

sql 'alter database backup controlfile to trace';

sql 'alter system archive log current';

backup filesperset 4 format “/backup/rman/dumps/SID01/SID01_db_%U.bkp" ( database );

backup format “/backup/rman/dumps/SID01/SID01_stdby_%U.cf" current controlfile for standby keep forever nologs;

backup format "/backup/rman/dumps/SID01/SID01_arch_%U.bkp" archivelog all;

release channel canal01;

release channel canal02

}

SID02:

{

allocate channel canal01 type disk ;

allocate channel canal02 type disk ;

sql 'alter database backup controlfile to trace';

sql 'alter system archive log current';

backup filesperset 4 format “/backup/rman/dumps/SID02/SID02_db_%U.bkp" ( database );

backup format “/backup/rman/dumps/SID02/SID02_stdby_%U.cf" current controlfile for standby keep forever nologs;

backup format "/backup/rman/dumps/SID02/SID02_arch_%U.bkp" archivelog all;

release channel canal01;

release channel canal02

}

2.5 Coping RMAN Backup to DR:

SID01:

SID01:/backup/rman/dumps/SID01 >scp * oracle@10.2.24.52:/backup/rman/dumps/SID01

SID02:

SID02:/backup/rman/dumps/SID02 >scp * oracle@10.2.24.52:/backup/rman/dumps/SID02

2.6 Coping Archive from primary to DR:

SID01:

SID01:/opt/oracle/archive/SID01 >scp *.arc oracle@10.2.24.52: /opt/oracle/archive/SID01

SID02:

SID02:/opt/oracle/archive/SID02 >scp *.arc oracle@10.2.24.52: /opt/oracle/archive/SID02


2.6 Checking tnsnames alias & listener:

You need to check tnsnames alias and listener status on both site from both direction.

SID01:

From Primay to DR:

$tnsping SID01dr

From DR to Primary:

$tnsping SID01prod

SID02:

From Primay to DR:

$tnsping SID02dr

From DR to Primary:

$tnsping SID02prod

2.7 Create pfile for standby on primary

You have to create pfile from spfile at primary database and later copy it to DR site.

SID01:

SQL> create pfile='/tmp/initSID01.ora.standby' from spfile;

SID02:

SQL> create pfile='/tmp/initSID02.ora.standby' from spfile;

2.8 Coping pfile from primary to standby – DR site

SID01:

scp /tmp/initSID01.ora.standby oracle@10.2.24.52:/opt/oracle/admin/SID01/pfile/

SID02:

scp /tmp/initSID02.ora.standby oracle@10.2.24.52:/opt/oracle/admin/SID02/pfile/

2.9 Edit standby parameter file

SID01:

$vi initSID01.ora.standby

output:

*.background_dump_dest='/opt/oracle/admin/SID01/bdump'

*.background_core_dest='/opt/oracle/admin/SID01/bdump'

*.background_user_dest='/opt/oracle/admin/SID01/bdump'

*.compatible='9.2.0.0.0'

*.control_files='/opt/oracle/oradata/SID01/control01.ctl',

'/opt/oracle/oradata/SID01/control02.ctl','/opt/oracle/oradata/SID01dr/control03.ctl'

*.core_dump_dest='/opt/oracle/admin/SID01/cdump'

*.db_block_size=8192

*.db_cache_size=50331648

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='SID01'

*.fast_start_mttr_target=300

*.hash_join_enabled=TRUE

*.instance_name='SID01'

*.java_pool_size=0

*.large_pool_size=33554432

*.log_archive_dest_1='LOCATION=/opt/oracle/archive/SID01'

*.log_archive_format='arch_SID01_%t_%s.arc'

*.log_archive_start=TRUE

*.open_cursors=300

*.pga_aggregate_target=50331648

*.processes=150

*.query_rewrite_enabled='FALSE'

*.remote_login_passwordfile='EXCLUSIVE'

*.shared_pool_size=268435456

*.sort_area_size=524288

*.star_transformation_enabled='FALSE'

*.timed_statistics=TRUE

*.undo_management='AUTO'

*.undo_retention=10800

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/opt/oracle/admin/SID01/udump'

*.dg_broker_start='TRUE'

*.standby_archive_dest='/backup/archive/SID01/standby'

*.standby_file_management='AUTO'

*.remote_archive_enable = 'TRUE'

SID02:

$vi initSID02.ora.standby

output:

*.background_dump_dest='/opt/oracle/admin/SID02/bdump'

*.background_core_dest='/opt/oracle/admin/SID02/bdump'

*.background_user_dest='/opt/oracle/admin/SID02/bdump'

*.compatible='9.2.0.0.0'

*.control_files='/opt/oracle/oradata/SID02/control01.ctl',

'/opt/oracle/oradata/SID02/control02.ctl','/opt/oracle/oradata/SID02/control03.ctl'

*.core_dump_dest='/opt/oracle/admin/SID02/cdump'

*.db_block_size=8192

*.db_cache_size=50331648

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='SID01'

*.fast_start_mttr_target=300

*.hash_join_enabled=TRUE

*.instance_name='SID01'

*.java_pool_size=0

*.large_pool_size=33554432

*.log_archive_dest_1='LOCATION=/opt/oracle/archive/SID02'

*.log_archive_format='arch_SID02_%t_%s.arc'

*.log_archive_start=TRUE

*.open_cursors=300

*.pga_aggregate_target=50331648

*.processes=150

*.query_rewrite_enabled='FALSE'

*.remote_login_passwordfile='EXCLUSIVE'

*.shared_pool_size=268435456

*.sort_area_size=524288

*.star_transformation_enabled='FALSE'

*.timed_statistics=TRUE

*.undo_management='AUTO'

*.undo_retention=10800

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/opt/oracle/admin/SID02/udump'

*.dg_broker_start='TRUE'

*.standby_archive_dest='/backup/archive/SID02/standby'

*.standby_file_management='AUTO'

*.remote_archive_enable = 'TRUE'

PS: In above text block the important parameters that needs to be changed are in biger fonts.

2.10 Copy initSID01.ora.standby to $ORACLE_HOME/dbs/:

SID01:

cp /opt/oracle/admin/pfile/initSID01.ora.standby $ORACLE_HOME/dbs/initSID02.ora

SID02:

cp /opt/oracle/admin/pfile/initSID02.ora.standby $ORACLE_HOME/dbs/initSID02.ora

2.11 Create executa_duplcate.sh:

SID01:

Vi executa_duplcate.sh

Output:

export ORACLE_SID=SID01

sqlplus /nolog @/opt/oracle/admin/SID01/standby/inicia_SID01_standby.sql

rman @/opt/oracle/admin/SID01/standby/executa_duplicate.rman

sqlplus /nolog @/opt/oracle/admin/SID01/standby/gera_stb_redolog.sql

SID02:

Vi executa_duplcate.sh

Output:

export ORACLE_SID=SID02

sqlplus /nolog @/opt/oracle/admin/SID02/standby/inicia_SID02_standby.sql

rman @/opt/oracle/admin/SID02/standby/executa_duplicate.rman

sqlplus /nolog @/opt/oracle/admin/SID02/standby/gera_stb_redolog.sql

PS: executa_duplcate.sh calls three sub scripts, that should be created in same directory as following:


2.11.1 create inicia_SID02_standby.sql

SID01:

Vi inicia_SID01_standby.sql

Output:

connect / as sysdba;

shutdown abort;

startup nomount pfile='/opt/oracle/admin/SID01/pfile/initSID01.ora.standby';

create spfile='/opt/oracle/admin/SID01/pfile/spfileSID01' from pfile='/opt/oracle/admin/SID01/pfile/initSID01.ora.standby';

shutdown immediate;

startup nomount;

exit;

SID02:

Vi inicia_SID02_standby.sql

Output:

connect / as sysdba;

shutdown abort;

startup nomount pfile='/opt/oracle/admin/SID02/pfile/initSID02.ora.standby';

create spfile='/opt/oracle/admin/SID02/pfile/spfileSID02' from pfile='/opt/oracle/admin/SID02/pfile/initSID02.ora.standby';

shutdown immediate;

startup nomount;

exit;

2.11.2 Create executa_duplicate.rman

SID01:

Vi executa_duplicate.rman

Output:

connect auxiliary / ;

connect target sys/******@SID01prod;

run

{

allocate auxiliary channel canal01 device type disk format '/backup/rman/dumps/SID01/SID01_db_%U.bkp';

allocate auxiliary channel canal02 device type disk format '/backup/rman/dumps/SID01/SID01_db_%U.bkp';

duplicate target database for standby nofilenamecheck dorecover;

release channel canal01;

release channel canal02;

}

exit;

SID02:

Vi executa_duplicate.rman

Output:

connect auxiliary / ;

connect target sys/******@SID02prod;

run

{

allocate auxiliary channel canal01 device type disk format '/backup/rman/dumps/SID02/SID02_db_%U.bkp';

allocate auxiliary channel canal02 device type disk format '/backup/rman/dumps/SID02/SID02_db_%U.bkp';

duplicate target database for standby nofilenamecheck dorecover;

release channel canal01;

release channel canal02;

}

exit;

2.11.3 create gera_stb_redolog.sql

SID01:

Vi gera_stb_redolog.sql

Output:

alter database add standby logfile group 4 ( '/opt/oracle/oradata/SID01/SID01_sblog04_a.dbf' ) size 100M;

alter database add standby logfile group 5 ( '/opt/oracle/oradata/SID01/SID01_sblog05_a.dbf' ) size 100M;

alter database add standby logfile group 6 ( '/opt/oracle/oradata/SID01/SID01_sblog06_a.dbf' ) size 100M;

alter database add standby logfile group 7 ( '/opt/oracle/oradata/SID01/SID01_sblog07_a.dbf' ) size 100M;

SID02:

Vi gera_stb_redolog.sql

Output:

alter database add standby logfile group 4 ( '/opt/oracle/oradata/SID02/SID02_sblog04_a.dbf' ) size 100M;

alter database add standby logfile group 5 ( '/opt/oracle/oradata/SID02/SID02_sblog05_a.dbf' ) size 100M;

alter database add standby logfile group 6 ( '/opt/oracle/oradata/SID02/SID02_sblog06_a.dbf' ) size 100M;

alter database add standby logfile group 7 ( '/opt/oracle/oradata/SID02/SID02_sblog07_a.dbf' ) size 100M;

2.12 run executa_duplcate.sh

SID01:

$./executa_duplcate.sh

SID02:

$./executa_duplcate.sh

2.13 Shutdown and Startup to mount:

SID01:

SQL> shutdown abort

SQL> startup nomount

SQL> alter database mount standby database;

SID02:

SQL> shutdown abort

SQL> startup nomount

SQL> alter database mount standby database;

2.14: Enable Archive Dest for standby at Primary:

At Primary:

SID01:

SQL> alter system set log_archive_dest_2='SERVICE=SID01dr arch' scope=both;

SQL> alter system set log_archive_dest_state_2=enable scope=both;

SID02:

SQL> alter system set log_archive_dest_2='SERVICE=SID02dr arch' scope=both;

SQL> alter system set log_archive_dest_state_2=enable scope=both;

2.15 Enable automatic recovery at standby:

SID01:

SQL> alter database recover managed standby database disconnect from session;

SID02:

SQL> alter database recover managed standby database disconnect from session;


2.16 Define FAL server & client at standby database

SID01:

SQL> alter system set fal_server='SID01prod' scope=both;

SQL> alter system set fal_client='SID01dr' scope=both;

SID02:

SQL> alter system set fal_server='SID02prod' scope=both;

SQL> alter system set fal_client='SID02dr' scope=both;

cheers

Tuesday, May 12, 2009

Dawood & Alam story

Whenever i get time, i have habit of recalling my past, as God has blessed me with strong memory, i can easily remind the events and people way in past. Few days ago i was thinking on people who get chance to excel but they d'nt realize opportunity. So i started thinking have ever i met such people...frankly i found many :) i guess it might be normal behavior of an ordinary man, they are ready to lose their chance.

you must be awaiting for subject story, yeah i have decided to blog these two people, as they have a great impact on my life and they were one of them (ready to lose their chance).

When i was in 3rd grade at school, it was the time when only a single teacher was responsible for teaching all subjects, our teacher "Sher Ali" was a comparatively rich man, he was doing job for fun, his main source of income was his transport business, so he never gave shit to enter our class and teach something. He was our class teacher since 1st grade so we reached 3rd grade without getting proper knowledge. we were same blank as we were before starting schooling...

Things were bad and even we were not interested in any sort of betterment because, it was a party time....but as nature keep things mangling he left our class and became an independent teacher, means a teacher who has nothing to teach in school, he might bribed Head Master to keep him away from classes...A day when we reached school found a new teacher sitting in our class, it was a shock for me...as i was n still i am lazy, i feared that the new teacher is going to give us some kinda ride...sad feelings...i was even not properly settle with this shock of seeing a new teacher in class, i went to my desk which was almost in mid of class room (just few desk before last row) i found two new faces sitting in mid of front row ! wawoo two new class fellows...so our story starts here.

My desk mate told me that the new teacher name is "Jahanzeb Khan" and these two new boys are Dawood n Alam, both are Jahanzeb's nephews. So everybody at class was waiting to get start with this new teacher...after a while our Head Master arrived and gave us a kinda introduction of Mr. Jahanzeb ---- "Mr. Jahanzeb is highly educated and experienced teacher, he is young and talented, i am hopeful that he will be a great source of knowledge for you!" and then we were left to Jahanzeb and GOD....Jahanzeb started very well, he gave us his list of rules...including break times, period schedule etc...when he finished he went out of class and said you are now free for 30min, you can go out, we will resume after 30min....everybody evacuated from class room including me...at that time i was dam shy, i did'nt mind to speak with new colleagues, preferred to get their introduction from other fellows :D though they were really noisy guys, specially Dawood ! he was really noisy... might be because his uncle was all in all at that room :s

Things became normal just as they could ever...nothing serious was happening...few days pass with this new teacher, a day in the morning he came and said, people, we will start Mathematics from today, and you have to give real intention to this subject it is very important etc,etc... anyhow, i was really a half meter into ground... because i never had been hard worker and i knew that this new subject i.e. mathematics with this new teacher, is the killer. so he started with simple mathematical exercises, amazingly i found it very easy to get...few weeks after he came and started saying from tomorrow we are going to start LCM, this is the most difficult exercises of your book and if you get LCM quickly you will become best in rest of exercises... so next day he started teaching us LCM everybody was watching him when he was writing on black board...things were normal just simple copy-paste stuff... suddenly he changed the rule and gave us a question to solve, the question was a bit different then the ones he was solving on board, so it was not easy task...he wrote question and went out of class room to bring his cup of tea, he took almost 2 or 3 minute, in this time i was the ONLY student who was able to solve the question, he came and asked anyone solved it yet ! i with a kinda scary voice YES SIR...BANG! everybody was steering me :s teacher was too amazed that a back bencher is able to solve this question...even his beloved nephews were struggling... he suddenly asked me to show my notebook, and he found it was 100% correct. He started interviewing me...what is your name?, where you live?, what your father do? do you have mathematics tuition etc...? there was nothing interesting for him, i was just another ordinary student...But he made a very strange decision, he announced that Nayyar is going to sit in front row with Dawood n Alam from now...Big Bang! everybody again steering me, i was almost about to die watching those eyes at me...but i had to shift from my camouflaged back bench to front row :s

I started sitting in between Dawood n Alam, it was really new experience for me...though i was more scared of being sitting in front...i found Dawood is a chatter while Alam was comparatively quiet...things were getting towards normal...we three started understanding each other, here are the examples...

like, when Mr. Jahanzeb was giving some assignment for class, they were pushing me to do it quickly so that they can copy-paste to their notebook and get time to play...even sometimes they were really bashing me "Nayyar, why are you taking so much time to solve these questions...they are not that hard, just do it, we need to go out, you are some kind of crap, we d'nt know why Mr. Jahanzeb moved you here..." and as soon as i was finishing assignment, they were making a carbon copy of that assignment...

During this time i found that Dawood hand writing is fucking highly quality, he started getting popularity school wide due to his fine hand writing, even a day our Head Master entered class room and called Dawood to write a letter for him...I got impressed.

I started searching why he is dam good in writing...and i found the secret, it was his Pen :D he had a special pen who's needle was cut in way that in URDU we call it "QALUM". i asked him several times where he got this pen, but he was reluctant to give answer, even sometimes he was making false statements... a day i broke my pen's needle, my mother gave me money to go and buy new needle for it from a guy in our colony, he had a shop in Peshawar court for Pen repairs, i went to his home it was 2 minutes walk from my home, when i asked the guy to fix my pen, he took me into his home, and there i found that he had a pen with same needle cut as Dawood, i asked him, could you please make my new pen needle with this cut, he said you have to pay extra, i agreed and DONE ! i got Dawood style pen.

So, you can imagine, in few weeks i got same quality hand writing as Dawood had and started getting popular too...though as i told you, i am too lazy person...and i never thought about becoming No. 1, i was happy to remain an ordinary guy in my class, but it is true that i never failed any subject and in my whole school life i was considered as talented but lazy guy.

Going back to Alam, i found just a normal student, though he was more obedient then Dawood... Mr. Jahanzeb told us that Alam has very good voice and he is awesome vocalist of Pashtoo NAATs... that became Alam's popularity reason and he was invited everywhere when there was a need to vocal NAAT...even he only knew one Pashtoo Naat & and i saw him vocaling same Naat 7 years :)

Mr. Jahanzeb tried a lot but both of them were unable to excel themselves ,I saw 100s of times Mr. Jahanzeb was trying to push them to some place and they were failing, like putting them into sports team, they failed, putting their names in proctorial board they failed, putting their name in scholarship exam they failed, even sometimes Mr. Jahanzeb was speaking with other teachers to give them good marks, still they were short of good positions, Dawood & Alam both had big amount to spend in school canteen..., even when they reached 10th grade (Matric) they were just one of those 3rd divisioners such as me :D

After almost 6 years...

A day i was entering to KMC's building (my very first proper job) where i was working as office assistant and in parallel was doing M.Sc in Computer Science... i heard someone is shouting Nayyar, Nayyar...Nayyaraaa...i quickly started searching who is calling, i found Dawood, he ran towards me...i found him in bad condition, he was not properly dressed up as we were use to see them in school, he asked me, Nayyar what are you doing... i gave my all info about job & study etc...he suddenly started weeping and said, yaar i am about to die, i lost my time, i did F.A (12th grade) in private, i d'nt have job, no capacity to do further study, i have been hired as security guard for a doctor's clinic near your office, i will look after his and clients cars....please do something for me, even Alam is working as gardener in air-force & has same condition as me !

Moral: As once Qazi Ahkam (my ever best teacher) said, if you play with your life, there will be a time when it will start playing with you...and than there will be no limits.

Friday, May 8, 2009

Email Reply

This is a funny pissing off email reply, i sent to this lady...she was continuously sending me her company's emails even after telling her that i am no more representing imsciences.edu.pk (my old job).

Dear Shahina Khan,

I am glade that you are Khan, because i am Khan too, do you know reason behind people write Khan after their names, No? Ok, when British colonized us they were use to give different awards such as Khan, Nawab, Sir.....etc

I was born to a Pashtoon family in Peshawar...Peshawar is the city were Daleep Kumar and Sharukh Khan families were also born, though i am not a film hero...even i never tried to give any sort of audition...even then Sharukh khan's cousin who lives in Peshawar have so many time proposed me...i am not proud !

Ok coming to the point, i have left imsciences and Pakistan too, so i am not representing them any more !

could you please send this email to info@imsciences.edu.pk ,they will certainly reply you...you know the reason, No? Ok, because you are a Lady, second you are Khan, third info@imsciences.edu.pk checking guy is a male who is also Tariq Khan !

cheers and keep yourself happy.

Thursday, April 2, 2009

ORA-01156 signalled during: alter database add standby logfile

Last night I was stuck with our standby RAC servers !

We have to rebuilt/duplicate all databases on standby RAC servers, in the step when i was adding standby logfile i received error "ORA-01156" it was too annoying, on top of that i was terribly tired with that RMAN backup crash for one of the database at Production Site, so you can imagine, i had to solve two problems at the same time on two different sites :-S

anyhow i found a very nice post on ORA-01156 as a matter of fact the post was so concise that i took 2 minutes to solve it !

look at the beauty of the post ! just few lines and problem explained with solution.

i ran just following lines in my case and solved it !

Why is this happening?

You cannot add standby redo log while the database is in managed recovery mode.

How do I fix it?

Exit managed recovery mode, add the logs, and then reinitiate managed recovery:

alter database recover managed standby database cancel;

alter database add standby logfile group () size ;

alter database recover managed standby database disconnect;



cheers

Thursday, March 5, 2009

A Joke.

this joke was sent by a friend...if you know all three characters of the joke you will love to read it :)

"Once Pervez Musharraf, Asif Zardari and Nawaz Sharif were travelling in an auto-rickshaw. They met with an accident and all three of them died.

An Angel was waiting for this moment at the doorstep of death. He asks MUSHARAF and Zardari to go to HEAVEN. But, for Nawaz Sharif, Angel had already decided that he should be sent to HELL. Nawaz Sharif is not at all happy with this decision. He asks Angel as to why this discrimination is being made. All the three of them had served the public. Similarly, all took bribes, all misused public positions, etc. Then why the differential treatment?

He felt that there should be a formal test or an objective evaluation before a decision is made; and should not be just based on opinion or pre-conceived notions. Angel agrees to this and asks all the three of them to appear for an English test.

MUSHARAF is asked to spell "PAKISTAN" and he does it correctly. Zardari is asked to spell "ENGLAND" and he too passes. It is Nawaz Sharif's turn and he is asked to spell "CZECHOSLOVAKIA ". Nawaz Sharif protests that he doesn't know English. He says this is not fair and that he was given a tough question and thus forced to fail with false intent.

Angel then agrees to conduct a written test in Urdu (to give another chance assuming that Nawaz Sharif should at least feel that Urdu would provide an equal platform for all three). MUSHARAF is asked to write "KUTTA BOLA BHOW BHOW". He writes it easily and passes.

Zardari is asked to write "BILLY BOLI MYAUN MYAUN". He too passes. Nawaz Sharif is asked to write "BANDAR BOLA GURRRRRR....." Tough one. He fails again. Nawaz Sharif is extremely unhappy. Having been a student of history (which the other two weren't),he now requested for all the 3 to be subjected to a test in history Angel says OK but this would be the last chance and that he would not take any more tests.

MUSHARAF is asked: "When did Pakistan get Independence?" He replied "1947" and passed. Zardari is asked "How many people died during the independence struggle?" He gets nervous. Angel asked him to choose from 3 options: 100,000 or 200,000 or 300,000. Zardari catches it and says 200,000 and passes.

It's Nawaz Sharif's turn now. Angel asks him to give the Name and Address of each of the 200,000 who died in the struggle. Nawaz Sharif accepts defeat and agrees to go to HELL.


Moral of the story: IF YOUR MANAGEMENT HAS DECIDED TO SCREW YOU, THERE IS NO ESCAPE"

cheers

Thursday, February 5, 2009

import a single table from full schema dumps

Yesterday i had a problem with production database, our cron based script made the import of wrong dumps of a table, so we were having problem with only this table.

We did't had any other solution to revert these changes, so we went to import this table from latest dumps, here is the script i use to do so:

imp system tables=TABLE_NAME \
fromuser=USER_NAME \
touser=USER_NAME \
file=/path-to-directory/dump-file-name.dmp \
log=/path-to-directory/log-file-name.log \
resumable=y \
commit=n \
resumable_timeout=3600 \
ignore=y \
constraints=n


cheers