Posts Tagged ‘DBA Oracle’

ORA-00376 file 2 cannot be read at this time ORA-01548 UNDO Needs Recovery

February 27th, 2018, posted in Oracle Queries
Share

ORA-00376: file 2 cannot be read at this time ,

ORA-01548 UNDO “Needs Recovery”:

Error:

Wed May 21 07:52:20 2014
Errors in file c:\oracle\product\10.2.0\admin\ \bdump\ _cjq0_3412.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: ‘C:\ORACLE\ORADATA\ \DATA\ \UNDOTBS01.DBF’

Wed May 21 07:52:20 2014
Errors in file c:\oracle\product\10.2.0\admin\ \bdump\ _cjq0_3412.trc:
ORA-00604: error occurred at recursive SQL level 1
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: ‘C:\ORACLE\ORADATA\ \DATA\ \UNDOTBS01.DBF’

SQL> select file_name from dba_data_files where tablespace_name=’UNDOTBS1′;

FILE_NAME
 --------------------------------------------------------------------------------
 C:\ORACLE\ORADATA\ \DATA\ \UNDOTBS01.DBF
 C:\ORACLE\ORADATA\ \DATA\ \UNDOTBS02.DBF

SQL>

SQL> drop tablespace UNDOTBS1 including contents and datafiles;
 drop tablespace UNDOTBS1 including contents and datafiles
 *
 ERROR at line 1:
 ORA-01548: active rollback segment '_SYSSMU1$' found, terminate dropping tablespace

SQL>

Solution:

From the below SQL it shows that UNDOTBS1 contains a few corrupt undo segments

SQL> select segment_name,status,tablespace_name from  dba_rollback_segs where status not in (‘ONLINE’,’OFFLINE’);

SEGMENT_NAME                   STATUS           TABLESPACE_NAME
 ------------------------------ ---------------- ------------------------------
 _SYSSMU1$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU2$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU3$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU4$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU5$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU6$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU7$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU8$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU9$                      NEEDS RECOVERY   UNDOTBS1
 _SYSSMU10$                     NEEDS RECOVERY   UNDOTBS1

10 rows selected.

SQL>

ORA-00376 file 2 cannot be read at this time,ORA-01548 UNDO Needs Recovery,UNDO Needs Recovery,Needs Recovery,ORA-01548,ORA-00376,cannot be read at this time,Oracle dba,oracle apps,oracle database,oracle dba database,oracle need recovery,oracle recovery,database recovery,ORA 01548,ORA 00376,Ora error,apps dba,core dba,oracle dba,dba oracl,Oracle tablespace

 

 

 

 

 

To get past this problem:

  1. create a pfile from the current spfile,
  2. change UNDO_MANAGEMENT  to ‘MANUAL’ and UNDO_TABLESPACE to ‘SYSTEM’ in the pfile
  3. add the _corrupt_rollback_segments init parameter to the pfile    “_corrupted_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,_SYSSMU4$,_SYSSMU5$,_SYSSMU6$,_SYSSMU7$,_SYSSMU8$,_SYSSMU9$,_SYSSMU10$)”
  4. startup the database using “startup pfile=’<location/name of pfile>’ “;
  5. drop corrupt UNDOTBS1 uncluding contents and datafiles
  6. create a new UNDO tablespace
  7. shutdown database again, and startup using the existing spfile (not pfile)

 

SQL> create pfile from spfile;

File created.

SQL>

*.undo_management=’AUTO’
*.undo_tablespace=’UNDOTBS2′
_corrupted_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,_SYSSMU4$,_SYSSMU5$,_SYSSMU6$,_SYSSMU7$,_SYSSMU8$,_SYSSMU9$,_SYSSMU10$)

 

 

SQL> startup pfile=’C:\oracle\product\10.2.0\db_1\database\INITwicustest.ora’;

ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size                  2065408 bytes
Variable Size             788532224 bytes
Database Buffers          452984832 bytes
Redo Buffers               14708736 bytes
Database mounted.
Database opened.
SQL> drop tablespace UNDOTBS1 including contents and datafiles;

Tablespace dropped.

SQL> create UNDO tablespace UNDOTBS1 datafile ‘C:\ORACLE\ORADATA\ \DATA\ \UNDOTBS01.DBF’ size 250M;

Tablespace created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\Users\Wicus>sqlplus sys as sysdba

 

SQL*Plus: Release 10.2.0.4.0 - Production on Wed May 21 07:56:13 2014

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Enter password:
 Connected to an idle instance.
SQL> startup
 ORACLE instance started.

Total System Global Area 1258291200 bytes
 Fixed Size                  2065408 bytes
 Variable Size             788532224 bytes
 Database Buffers          452984832 bytes
 Redo Buffers               14708736 bytes
 Database mounted.
 Database opened.
 SQL>

 

Share

Disable Auditing In A 11G Database

November 18th, 2017, posted in Oracle Queries
Share

In a RAC Database :

 

SQL> ALTER SYSTEM SET audit_trail=NONE SCOPE=spfile sid='*';
System altered.
SQL>

Note : Restart the database to have the change take affect, or do a rolling restart, one instance at a time.




In a Single Instance Database :

 

SQL> ALTER SYSTEM SET audit_trail=NONE SCOPE=spfile ;
System altered.
SQL>

Note : Restart the database to have the change take affect.

Share

How To Upload Excel/Text File Data Into Oracle Table Using TOAD

February 27th, 2017, posted in Oracle, Windows
Share

n this we will explain how to put Excel or text file data into an Oracle table. You can do this easily in SQL Server with a Copy (Ctrl+C) of the data from Excel then open the target table into edit mode and Paste (Ctrl+V). Done.

But this will not work in Oracle.

In an Oracle database you can do it using the import command. I will show you each and every step with snapshots.

Step 1 : Open TOAD.

Step 2 : Write the following query to create a test table:

  1. Create table TESTTABLE
  2. (
  3. NAME varchar2(20),
  4. Address varchar2(100),
  5. RollNo integer
  6. )

Step 3 : Now my table is ready. It’s time to create the data in an Excel file.

Step 4 : Go to Database -> Import -> Table Data.

Step 5 : Select the table you want to import the Excel data to.

Step 6 : Click on show data. Now execute the data button to enable the use. Click on that.

Step 7 : After clicking on Execute Wizard the following screen will open:

Next ->

Step 8 : Now, browse to your Excel file – > Next ->

Next ->

Step 9 : Choose the sheet and click on AutoMap. The AutoMap button will automatically bind your Excel sheet column data with the Oracle table column.

Next ->

Next ->

Here your Excel data has been bound with the table columns. Next ->

Step 10 : Click on Execute to finish the process. It may ask for sheet selection. Click on Okay with the desired sheet.

Here is your uploaded data:

Step 11 : Commit the Task by clicking on the commit button.

Using the preceding procedure you can easily import Excel data. You can also import text flat files data. All steps are nearly the same. The only change is the following step. In this import I need to choose the separator for the flat file. Apart from any separators you can use fixed width. In the attached example I used a comma separator.

I think the procedure is very clear with snapshots. If you have found any mistake in concept, please do comment.

Your comments will make me perfect in the future.

Thanks for reading.

 

Share