Thursday, May 17, 2012

Enable/Disable Flashback in Oracle 11g

Before enable the flashback we need to take our database in archive log mode. To enable the archive log click here 
  After enabling the archive logs now we need to set 3 paramaters for flashback are
 1 db_recovery_file_dest 
2 db_recovery_file_dest_size
3 db_flashback_retention_target 
  
>>This parameter "db_recovery_file_dest" is used to set the destination where we  want to store 
the location of flashback logs.  The location of flashback logs may or maybe be same as the location
 of archive logs, here i gave different location from archive logs. 
>>The parmeter "db_recovery_file_dest_size" is used to define the size that can be used by 
flashback directory/folder provided with above parameter. This size can be calculated on the basis 
of transactions happened in our database and if archive logs, only when the destination of archive logs 
& flashback logs are same.
>>The parameter "db_flashback_retention_target " is used to provide time limit upto which 
flashback logs should be in the memory of database, So that database can be flashed up back
 with in time limit. Time is provided in minutes, so we set retention time 1440 which is about a day.
 
 >>Set flashback database parameters

alter system set db_recovery_file_dest='E:\app\navneet\FRA' scope=spfile; 
alter system set db_recovery_file_dest_size=20G scope=spfile;
alter system set db_flashback_retention_target=1440 
 
 >> Turn flashback on for the database 
shutdown immediate; 
startup mount;
alter database flashback on;
alter database open;

>>Now check if flashback is enabled 
select flashback_on from v$database; 
 FLASHBACK_ON
------------------
YES
 
 Now Flashback is ENABLED. 
 
>>To disable flashback 
alter system set db_recovery_file_dest=" scope= both sid='*';


 
Some related queries are as follow 
>> To check the flashback logs 
select * from v$flashback_database_log;

>>To check the estimated flashback size
SELECT ROUND(ESTIMATED_FLASHBACK_SIZE/1024/1024/1024) FROM V$FLASHBACK_DATABASE_LOG; 
  
>>To create a guaranteed restore point
create restore point RESTORE_POINT guarantee flashback database;
select NAME, SCN, TIME from V$RESTORE_POINT;

>>To flashback the database to specific time
flashback database to timestamp to_timestamp('dd/mm/yy HH24:MI:SS', 'DD/MM/YYYY
HH24:MI:SS');

>>To drop a restore point
select NAME, SCN, TIME from V$RESTORE_POINT; 
 drop restore point RESTORE_POINT;
 
 
The V$RECOVERY_FILE_DEST and V$FLASH_RECOVERY_AREA_USAGE views can help 
to find out the current location, disk quota, space in use, space reclaimable by deleting files,
total number of files, the percentage of the total disk quota used by different types of files.
 
 
 
Your suggestions and queries are always warm welcomed.  

Saturday, April 28, 2012

ORA-00064: object is too large to allocate on this O/S (1,9080000)




Today i got an error ORA-00064 in Oracle 10g Express Edition on Windows platform.

When the Oracle starts then it read the Initialization file and allocates the memory of all parameters say for session , process and all . And if anyone don't have sufficient resource to allocate them then this issue persists.

According to my environment one of my friend increased the sessions to 5000, when Oracle is restarted, it throws error.

Following steps are performed to resolve this issue.






Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\navneet>sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Apr 27 13:15:32 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter user-name: /as sysdba
Connected to an idle instance.

SQL> startup
ORA-00064: object is too large to allocate on this O/S (1,9080000)

SQL> create pfile='c:\pfile.ora' from spfile;
File created.

Then i edited the pfile.ora and reduced the session to 100 from 5000.


SQL> startup pfile='c:\pfile.ora';
ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size                  1288820 bytes
Variable Size             180356492 bytes
Database Buffers          415236096 bytes
Redo Buffers                2904064 bytes
Database mounted.
Database opened.


Now our pfile.ora is perfect, no need anymore edition.  We are going to create spfile from this pfile.



SQL> create spfile from pfile='c:\pfile.ora';
File created.

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


SQL> startup
ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size                       1288820 bytes
Variable Size             180356492 bytes
Database Buffers          415236096 bytes
Redo Buffers                2904064 bytes
Database mounted.
Database opened.






Your suggestions and queries are always warm welcomed.

Friday, March 30, 2012

Checking operating system version: must be 5.0, 5.1, 5.2 or 6.0 . Actual 6.1 Failed

Today i got error while installing oracle on Windows server 2008 R2
When i clicked on "setup.exe" file, it throws an error as below:





Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be 5.0, 5.1, 5.2 or 6.0 . Actual 6.1

Failed <<<<

Exiting Oracle Universal Installer, log for this session can be found at C:\Prog
ram Files\Oracle\Inventory\logs\installActions2012-03-30_09-25-48AM.log

Please press Enter to exit...





After too much research i came to know that I need to modify the "oraparam.ini" file which
is placed with Oracle setup files.


I modify the Oraparam.ini file located here
"database\install\oraparam.ini"


Just add those words which are bold as below in the oraparam.ini file.

[Certified Versions]
# You can customise error message shown for failure, provide value for
CERTIFIED_VERSION_FAILURE_MESSAGE
Windows = 5.0,5.1,5.2,6.0,6.1



[Windows-6.1-required]
# Minimum display colours for OUI to run
MIN_DISPLAY_COLORS = 256
# Minimum CPU speed required for OUI
# CPU = 300



Save the oraparam.ini file & then run setup again. Now all goes fine & got the oracle installed.



Your suggestions and queries are always warm welcomed.

Thursday, March 29, 2012

Enabling Archivelog Mode in Oracle 11g

To set archive log, always login through SYSDBA


Now, lets check the current log mode either in "Archivelog" or "Noarchivelog":

C:\Documents and Settings\navneet>sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 27 11:19:53 2012

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Enter user-name: /as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2296
Current log sequence 2299


OR


SQL> select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

We have checked that our Database is in "NOARCHIVE LOG". Below query will set the location where to save the archive logs.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=E:\ARCHIVE_LOG' SCOPE=SPFILE;

System altered.


SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT
ORACLE instance started.

Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 385876432 bytes
Database Buffers 142606336 bytes
Redo Buffers 5804032 bytes
Database mounted.

The below query will make database into archivelog.
SQL> ALTER DATABASE ARCHIVELOG;

Database altered.



SQL> ALTER DATABASE OPEN;

Database altered.


SQL> SELECT LOG_MODE FROM V$DATABASE;

LOG_MODE
------------
ARCHIVELOG


OR


SQL> ARCHIVE LOG LIST
Database log mode Archive Mode
Automatic archival Enabled
Archive destination E:\ARCHIVE_LOG
Oldest online log sequence 2296
Next log sequence to archive 2299
Current log sequence 2299


SQL> alter system switch logfile;



Now database is in Archivelog mode, We have verified by checking archivelogs in directory.


E:\>dir
Volume in drive E has no label.
Volume Serial Number is AA1B-C0B9

Directory of E:\

12/09/2011 09:15 AM app
03/27/2012 11:43 AM 13,952,512 ARCHIVE_LOG2ARC0000002299_0769427405.0001
03/27/2012 11:46 AM 1,536 ARCHIVE_LOG2ARC0000002300_0769427405.0001
03/28/2012 05:39 AM 50,630,144 ARCHIVE_LOG2ARC0000002301_0769427405.0001
03/29/2012 05:38 AM 40,771,072 ARCHIVE_LOG2ARC0000002302_0769427405.0001
03/29/2012 06:30 PM 40,671,232 ARCHIVE_LOG2ARC0000002303_0769427405.0001
02/17/2009 11:33 AM 23,516,968 SkypeSetupFull.exe
6 File(s) 169,543,464 bytes
1 Dir(s) 38,746,923,008 bytes free



Your suggestions and queries are always warm welcomed.

Friday, March 9, 2012

Error ORA-28056: Writing audit records to Windows Event Log failed

I got a PC which ran out from disk space & Oracle was not working. The error was ORA-28056.
I need to delete all the event log & then reconnect it again. Here you can see what happened & it get resolved.



C:\Documents and Settings\navneet>sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 7 15:44:02 2012

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Enter user-name: /as sysdba
Connected to an idle instance.

SQL> startup
ORA-28056: Writing audit records to Windows Event Log failed
OSD-157797404: Message 157797404 not found; product=RDBMS; facility=SOSD

O/S-Error: (OS 1502) The event log file is full.

SQL> exit
Disconnected


Solution of the Problem :  This was because the Event Viewer log is full and could not log anymore events.
The solution is to clear the event log .To solve this issue follow any of the following steps.

1) When a log is full, it stops recording new events. Clearing the log is one way to free the log and start recording new events. To do so
Go to Control Panel --> Administrative Tools --> Event Viewer --> Clear All Events.


2) We can also free a log and start recording new events by overwriting old events. To overwrite events,
Go to Control Panel --> Administrative Tools --> Event Viewer --> on the left side Application/System/Security (as available) Right click --> Properties --> click Overwrite events as needed . 
This ensures that all new events are written to the log, even when the log is full.


3) We can also start logging new events by increasing the maximum log size. To increase the log size,
 Go to Control Panel --> Administrative Tools --> Event Viewer --> on the left side Application/System/Security (as available) Right click --> Properties --> Increase the Maximum log size by typing a bigger value.



After that open the CMD,
write "sqlplus /nolog" and press enter.
Now, write "connect as sysdba", enter the user name, for example, "sys" and the password.
After connect, write "startup".


C:\Documents and Settings\navneet>sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 7 15:52:12 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.

Enter user-name: /as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select status from v$instance;

STATUS
------------
STARTED


SQL> alter database mount;

Database altered.


SQL> select status from v$instance;

STATUS
------------
MOUNTED


SQL> alter database open;

Database altered.


SQL> select status from v$instance;

STATUS
------------
OPEN


Njoy!!!!!




Your suggestions and queries are always warm welcomed.



Wednesday, February 29, 2012

Oracle XE 10g compatibility issue window 2008

Today I was installing Oracle XE 10g on windows 2008.
The installation was successful without any error or any warning. But after clicking on FINISH, the apex page was not found.

I checked the services of oracle & seen that all services are STOP.
I started all the services of oracle.
For servies, Goto Windows+R> Type "services.msc"> right click on service name & click START.

Even then i was not able to see apex webpage,
then i tried to test it manually & enter into sqlplus.
After logging in " /as sysdba" i got an error

Enter user-name: /as sysdba
Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file 'C:\oraclexe\app\oracle\product\10.2.0\serv
er\dbs/spfileXE.ora'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.


I also noticed that BIN folder is empty & no CTRL file, no LOG file, no DBF's in oradata folder.
It did not created database too.
Then i re-install it after removing it completely, re-installation is successful again. Even after successful re-installing there is no files in BIN folder & again no CTRL file, no LOG file, no DBF's in oradata folder, Also database has not been created again.
After too much struggle i came to know that there is compatibility issue of Oracle XE with windows server 2008 and some of the rights issue too.

This is the tip to make it work.
1. Go to the installer OracleXEUniv.exe
2. Right click --> Select Properties --> Compatibility --> click on Run this program in Compatibility Mode for: --> Windows 2003 Sp1
3. Run this OracleXEUniv.exe file as administrator.

After running this OracleXEUniv.exe you will notice that setup is taking more time to install that means its creating database too.
Remember to double check that everything works fine. This solution works for me.


Extra Tips:
Here are some common issues which can make barrier to install XE.

1) XE dump must be on local machine, not on network path.
2) XE must be installed by a local machine administrator, not a domain administrator.
3) XE requires several ports (1521, 8080) .
4) Firewalls and antivirus are known to crash the install.
5) Often point 3) will block the installation of the database.

Note that XE does not use any form of HTTP listener - the database listener does the basic work and passes HTTP requests into the database. So no Apache or IIS requires with XE





Your suggestions and queries are always warm welcomed.