Professional Documents
Culture Documents
go to $ORACLE_HOME/OPatch
In cmd, run command: opatch lsinventory detail
SQL>startup
or
check the status of listener if not started then start the listener as
$lsnrctl
lsnrctl> stop
lsnrctl>start
lsnrctl>exit
$export ORACLE_SID=noida
$sqlplus sys/password@noida as sysdba
SQL> startup
Case 3 : Make sure while connecting, that the ORACLE_SID and ORACLE_HOME is correctly set .
There should not be trailing trash in ORACLE_HOME path . So, set ORACLE_SID before connecting as
:
Linux :
$export ORACLE_SID=noida
$sqlplus sys/xxxx@noida as sysdba
SQL> startup
Window :
C:\> set ORACLE_SID=noida
C:\> sqlplus sys/xxxx@noida as sysdba
C:\> startup
Case 4 : Sometimes in case of window , if event log is full , then we get this error . So delete the
event logs and try to connect again .
2.) Enable the Error Logging : Whenever we enable the error loging the default table
SPERRORLOG is created . Enable by using the below command
SQL> set errorlogging on
SQL> show errorlogging
errorlogging is ON TABLE SCOTT.SPERRORLOG
As, we see that the default table "SPERRORLOG" is created in scott schemas, since the current user is
scott . Hence, sperrorlog table is created current user .
Creating a User Defined Error Log Table :
We can create one or more error log tables to use other than the default . Before specifying a user
defined error log table , let's have look on default errorlog
SQL> desc
Name
---------------USERNAME
TIMESTAMP
SCRIPT
IDENTIFIER
MESSAGE
STATEMENT
Null?
--------
sperrorlog
Type
-------------------VARCHAR2(256)
TIMESTAMP(6)
VARCHAR2(1024)
VARCHAR2(256)
CLOB
CLOB
For each error, the error logging feature logs the following bits of information. To use a user defined
log table, we must have permission to access the table, and we must issue the SET ERRORLOGGING
command with the TABLE schema.tablename option to identify the error log table and the schema if
applicable. Here is syntax to create user-defined table..
SQL> set errorlogging on table [schema].[table]
for example :
SQL> set errorlogging on table hr.Error_log_table
Demo to create user-defined table :
Step 1 : Create the table : If we want create the error logging user-defined table and if table
doesnot exist then get the below error as
SQL> set errorlogging on table hr.Error_log_table
SP2-1507: Errorlogging table, role or privilege is missing or not accessible
create the table as
SQL> create table Hr.Error_log_table ( username varchar(256), timestamp TIMESTAMP, script
varchar(1024), identifier varchar(256), message CLOB, statement CLOB) ;
Table created.
Step 2 : Create user-defined error logging table
SQL> show errorlogging
errorlogging is OFF
SQL> set errorlogging on table hr.Error_log_table
SQL> show errorlogging
errorlogging is ON TABLE hr.Error_log_table
Step 3 : Generate some errors
SQL> selet * from employees ;
SP2-0734: unknown command beginning "selet * fr..." - rest of line ignored.
SQL> select * from employe ;
select * from employe
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> set linesze 2000
SP2-0158: unknown SET option "linesze"
Step 4 : Check the error logging from the user-defined errorlog
SQL> select * from hr.Error_log_table ;
SQL> commit ;
Without commit, other sessions wont see this information. Here i have commit it and taken the output
from other session for the sake of proper formatting purpose.
We can truncate to clear all existing rows in the error log table and begins recording errors from the
current session. as
SQL> set errorlogging on truncate
SQL> select * from Error_log_table ;
No rows selected
We can also set an unique identifier to make it easier to identify the logging record.We can use it to
identify errors from a particular session or from a particular version of a query.
SQL> set errorlogging on identifier 'MARK'
SQL > select * from employ ;
select * from employ
*
ERROR at line 1:
ORA-00942: table or view does not exist
Now check the identifier :
SQL> select * from hr.Error_log_table ;
ORA-01078 is generally occuring when a corrupt spfile file is being used or the parameter file
(spfile/pfile) may be missing from the default or specified location . The spfile is present in the
default location $ORACLE_HOME/dbs for Unix and %ORACLE_HOME%\database for window .We
may get ORA-01078 when starting the database as
C:\>set ORACLE_SID=noida
C:\>sqlplus sys/xxxx as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 8 14:14:54 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078 : failure in processing system parameters
LRM-00109 : couldnot open parameter file 'C:\APP\NEERAJS\PRODUCT\11.2.0\DBHOME_1\DATAB
ASE\INITNOIDA.ORA'
SQL> exit
Disconnected
There is no way the spfile can be repaired or modified manually . The only solution is to either restore
the spfile from the rman backup or recreate a new pfile and then create spfile . If a SPFILE backup
exists , restore it to the original location . The SPFILE backup could be a copy of the spfile or from a
RMAN backup. Restore the spfile from backup as
C:\>rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Feb 8 14:16:38 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup force nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'C:\APP\NEERAJS\PRODUCT\11.2.0\DBHOME_1\DATABASE\INITNOIDA.ORA'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
159019008 bytes
1373264 bytes
75500464 bytes
75497472 bytes
6647808 bytes
20120208-01
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 08-FEB-12
RMAN> shutdown
Oracle instance shut down
RMAN> startup
connected to target database (not started)
Oracle instance started
database mounted
database opened
Total System Global Area
535662592bytes
Fixed Size
1375792
bytes
Variable Size
331350480 bytes
Database Buffers
197132288 bytes
Redo Buffers
5804032
bytes
RMAN> exit
Recovery Manager complete.
C:\>set ORACLE_SID=noida
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 8 14:38:11 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
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 name , open_mode from v$database ;
NAME
OPEN_MODE
--------- -------------------NOIDA
READ WRITE
If no spfile backup exists,we can use an existing pfile and startup the database , but this pfile may or
may not contain all the non default parameter because the spfile is updated dynamically . So it is
better to obtain the list of all the non-default parameter list in the alert log file and then create the
pfile . Once the pfile is created we can create the spfile from pfile . Below is some contained of the my
alert log file .
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options.
Using parameter settings in server-side spfile
C:\APP\NEERAJS\PRODUCT\11.2.0\DBHOME_1\DATABASE\SPFILENOIDA.ORA
System parameters with non-default values:
---------->> copy from here <<-------------------processes
= 150
memory_target
= 816M
control_files
= "C:\APP\NEERAJS\ORADATA\NOIDA\CONTROL01.CTL"
control_files
= "C:\APP\NEERAJS\FLASH_RECOVERY_AREA\NOIDA\CONTROL02.CTL"
db_block_size
= 8192
compatible
= "11.2.0.0.0"
log_archive_dest_1
= "LOCATION=D:\archive\ VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=noida"
log_archive_dest_2
= "SERVICE=delhi LGWR SYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=delhi"
log_archive_dest_state_2 = "defer"
fal_client
= "NOIDA"
fal_server
= "DELHI"
log_archive_format
= "ARCH_%r_%t_%s_%D_%T"
db_recovery_file_dest = "C:\app\Neerajs\flash_recovery_area"
db_recovery_file_dest_size= 3852M
standby_file_management = "AUTO"
undo_tablespace
= "UNDOTBS1"
remote_login_passwordfile= "EXCLUSIVE"
db_domain
= ""
dispatchers
= "(PROTOCOL=TCP) (SERVICE=noidaXDB)"
local_listener
= ""
audit_file_dest
= "C:\APP\NEERAJS\ADMIN\NOIDA\ADUMP"
audit_trail
= "DB"
db_name
= "noida"
open_cursors
= 300
diagnostic_dest
= "C:\APP\NEERAJS"
----------------->>
Upto Here << --------------Wed Feb 02/08/2012 14:38:35
PMON started with pid=2, OS id=1456
Wed Feb 02/08/2012 14:38:35
VKTM started with pid=3, OS id=1484 at elevated priority
VKTM running at (10)millisec precision with DBRM quantum (100)ms
Wed Feb 07 17:01:27 2012
GEN0 started with pid=4, OS id=1056
Wed Feb 02/08/2012 14:32:35
DIAG started with pid=5, OS id=3524
Wed Feb 02/08/2012 14:32:35
DBRM started with pid=6, OS id=228
Create the pfile the above parameter and save it(say C:\initnoida.ora') and startup the database as
C:\>set ORACLE_SID=noida
C:\>sqlplus sys/xxxx as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile='C:\initnoida.ora' ;
SQL> startup
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size
1375792 bytes
Variable Size
331350480 bytes
Database Buffers
197132288 bytes
Redo Buffers
5804032 bytes
Database mounted.
Database opened.
SQL> select name,open_mode from v$database;
NAME
OPEN_MODE
------------------------NOIDA
READ WRITE
We can also get the parameters from the corrupted spfile using utilities like strings available on Unix.
Similar utilities can be found for Windows as well.
$ strings spfile<SID>.ora
init<SID>.ora