24 August 2009

ORA-00214: controlfile inconsistent

One of my database crashed with this error, and here is how I fixed it.

ORA-00214: controlfile inconsistent

Error I received
ORA-00214: controlfile 'C:\ORACLE\ORADATA\ORCLDB\CONTROL01.CTL' version 593
inconsistent with file 'C:\ORACLE\ORADATA\ORCLDB\CONTROL03.CTL' version 587

SQL> shutdown immediate;

SQL> create pfile from spfile;

SQL> shutdown immediate;

Open the pfile, locate "*.control_files", It will look similar to like below

*.control_files='C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDB\CONTROL01.CTL','C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDB\CONTROL02.CTL','C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDB\CONTROL03.CTL'

Since one of the 3 control file is inconsistent, I removed the second and third and saved the file.

*.control_files='C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDB\CONTROL01.CTL'

SQL> startup pfile=C:\oracle\ora92\database\INITorcldb.ORA
ORA-00214: controlfile 'C:\ORACLE\ORADATA\ORCLDB\CONTROL01.CTL' version 593
inconsistent with file 'C:\ORACLE\ORADATA\ORCLDB\CONTROL02.CTL' version 589

Now remove first and third, try with control file 2

*.control_files='C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCLDB\CONTROL02.CTL'

SQL> startup pfile=C:\oracle\ora92\database\INITorcldb.ORA
Database mounted.
ORA-00322: log 1 of thread 1 is not current copy
ORA-00312: online log 1 thread 1: 'C:\ORACLE\ORADATA\ORCLDB\REDO01.LOG'


SQL> shutdown immediate;

Now create spfile from modified pfile, so it is used by default.

SQL> create spfile from pfile='C:\oracle\ora92\database\INITorcldb.ORA';

SQL> startup mount

SQL> recover database
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required


SQL> alter database open
ERROR at line 1:
ORA-00322: log 1 of thread 1 is not current copy
ORA-00312: online log 1 thread 1: 'C:\ORACLE\ORADATA\ORCLDB\REDO01.LOG'


SQL> recover database until cancel;
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'C:\ORACLE\ORADATA\ORCLDB\SYSTEM01.DBF'


SQL> ALTER DATABASE OPEN RESETLOGS;
ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'C:\ORACLE\ORADATA\ORCLDB\SYSTEM01.DBF'


SQL> shutdown immediate;

SQL> startup force
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

Specify the log file to use

SQL> Recover database using backup controlfile;
ORA-00279: change 3117356 generated at 04/08/2008 08:49:26 needed for thread 1
ORA-00289: suggestion : C:\ORACLE\ORA92\RDBMS\ARC00053.001
ORA-00280: change 3117356 for thread 1 is in sequence #53


Specify log: {=suggested | filename | AUTO | CANCEL}
C:\oracle\oradata\ORCLDB\REDO01.LOG
Log applied.
Media recovery complete.

SQL> alter database open resetlogs;

Database altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 370220868 bytes
Fixed Size 454468 bytes
Variable Size 343932928 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL>


17 August 2009

Blackberry: Battery too low for radio use

I am not sure what Blackberry engineers were thinking when they designed the phone.

It's really frustrating, and it is the most stupid thing to do. According to Blackberry, its a feature and not a design bug.

There are 2 options to force the battery on

1) You can dial 911 and disconnect the line, before the operator picks up. Though this works, I wont advice this, as you may offend 911 rules as this is clearly not an emergency

2) Install "ForceRadioOn" application. Its a freeware and available at http://www.blackberryapps.com/PlatformMain.asp?platform=5&sString=ForceRadioOn
or simply google for ForceRadioOn

After installing this application, just launch the application and click the button to turn the Radio On.

16 July 2009

Oracle: How to kill data pump jobs

When you import or export using data pump impdp or expdp tools, the import/export is done by a job. You have an option to provide a job name using JOB_NAME parameter too

Following sql will give you the list of data pump jobs

select * from dba_datapump_jobs

If you want to kill your impdp or expdp

1) Make sure that your impdp/expdp command prompt window is active
2) Press Control-C , It will pause the job. Done press another Control-C or close the command prompt. This will just close the window, but the job will still be running
3) Type Kill_Job
ex: Import>kill_job
Are you sure you wish to stop this job (y/n): y


If by mistake, you closed the window and your import/export job is still running,

1) Get the name of the job using
select * from dba_datapump_jobs
2) Open a new command prompt window. If you want to kill your import job type
impdp username/password@database attach=name_of_the_job
3) Once you are attached to job, Type Kill_Job
ex: Import>kill_job
Are you sure you wish to stop this job (y/n): y

And your job is killed, it will no longer show in dba_datapump_jobs

15 July 2009

Force 64bit IIS to run in 32 bit mode

When you want to run 32 bit web applications on a 64bit Windows box, you need to enable IIS to run in 32 bit mode.

By default IIS is set to run in 64 bit.

To check if 32 bit support is enabled, go to command prompt on the IIS box and type the following command

cscript C:\Inetpub\AdminScripts\adsutil.vbs get W3SVC/AppPools/Enable32bitAppOnWin64

Change the path of adsutil.vbs according to your setup

The script will output either True (1) or FALSE(0)

To enable 32 bit support, go to command promtp again and run the following

cscript c:\Inetpub\AdminScripts\adsutil.vbs set W3SVC/AppPools/Enable32bitAppOnWin64

Now that you enabled 32 bit support, you will no longer see ASP.NET tab on your Web application, properties on Internet service manager

To fix that, jus run aspnet_regiis, from command prompt


C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe /i