Monday 1 August 2016

Unable to Open database after database clone or Recover from backup

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: '/ora_sys/TFSU/system01_TFS.dbf'


SQL> RECOVER DATABASE UNTIL CANCEL;
ORA-00283: recovery session canceled due to errors
ORA-16433: The database must be opened in read/write mode.


SQL> ALTER DATABASE OPEN NORESETLOGS;
ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/ora_sys/TFSU/system01_TFS.dbf'


SQL>alter system set _ALLOW_RESETLOGS_CORRUPTION=true
***Hidden parameter _ALLOW_RESETLOGS_CORRUPTION=TRUE  which will allow us to 
open database even though it’s not properly recovered   ***

SQL> ALTER DATABASE OPEN  RESETLOGS;

Database altered.

ORA-01031: insufficient privileges on Windows sqlplus "/as sysdba"

Issue: 
C:\Windows\system32>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 1 20:43:55 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.

ERROR:
ORA-01031: insufficient privileges

Solution:
รจ Verified user to be part of ORA_DBA group, which is missing below
c:\Oracle>echo %username%
surajarajuj

C:\Windows\system32>NET LOCALGROUP ORA_DBA
Alias name     ORA_DBA
Comment        Oracle DBA Group
Members
----------------------------------------------------------
NT AUTHORITY\SYSTEM
The command completed successfully.

C:\Windows\system32>NET LOCALGROUP ORA_DBA  suraparajuj /add
The command completed successfully.

C:\Windows\system32>NET LOCALGROUP ORA_DBA
Alias name     ORA_DBA
Comment        Oracle DBA Group
Members
--------------------------------------------------------
NT AUTHORITY\SYSTEM
DBHOST\suraparajuj
The command completed successfully.


c:\Oracle>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 1 20:43:55 2016

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>